]> code.ossystems Code Review - openembedded-core.git/commitdiff
meta-selftest: add test of .gitignore in tarball
authorMartin Jansa <Martin.Jansa@gmail.com>
Fri, 29 May 2020 22:03:24 +0000 (00:03 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 3 Jun 2020 14:25:54 +0000 (15:25 +0100)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta-selftest/recipes-test/devtool/devtool-test-ignored.bb [new file with mode: 0644]
meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.patch [new file with mode: 0644]
meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.patch.expected [new file with mode: 0644]
meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.tar.gz [new file with mode: 0644]
meta/lib/oeqa/selftest/cases/devtool.py

diff --git a/meta-selftest/recipes-test/devtool/devtool-test-ignored.bb b/meta-selftest/recipes-test/devtool/devtool-test-ignored.bb
new file mode 100644 (file)
index 0000000..6a3d58c
--- /dev/null
@@ -0,0 +1,9 @@
+LICENSE = "CLOSED"
+INHIBIT_DEFAULT_DEPS = "1"
+
+SRC_URI = "file://${BPN}.tar.gz \
+           file://${BPN}.patch"
+
+S = "${WORKDIR}/${BPN}"
+
+EXCLUDE_FROM_WORLD = "1"
diff --git a/meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.patch b/meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.patch
new file mode 100644 (file)
index 0000000..96ea0eb
--- /dev/null
@@ -0,0 +1,7 @@
+diff --git a/ignored b/ignored
+index a579759..e3d7b43 100644
+--- a/ignored
++++ b/ignored
+@@ -1 +1 @@
+-I'm so ignored
++# I'm so ignored
diff --git a/meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.patch.expected b/meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.patch.expected
new file mode 100644 (file)
index 0000000..68ec6d9
--- /dev/null
@@ -0,0 +1,16 @@
+From 3a286343cc5cadd83f41d524ee3606ae51df9ee7 Mon Sep 17 00:00:00 2001
+From: Martin Jansa <Martin.Jansa@gmail.com>
+Date: Thu, 28 May 2020 01:32:31 +0200
+Subject: [PATCH] meta-selftest: add test of .gitignore in tarball
+
+---
+ ignored | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ignored b/ignored
+index a579759..e3d7b43 100644
+--- a/ignored
++++ b/ignored
+@@ -1 +1 @@
+-I'm so ignored
++# I'm so ignored
diff --git a/meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.tar.gz b/meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.tar.gz
new file mode 100644 (file)
index 0000000..b2e9935
Binary files /dev/null and b/meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.tar.gz differ
index 5886862d6c45a31c4e9d358a9ff42d93199c615b..0218f0821c97390bfd15873d9bb508e82f441164 100644 (file)
@@ -1108,6 +1108,32 @@ class DevtoolUpdateTests(DevtoolBase):
                            ('??', '.*/0001-Add-new-file.patch$')]
         self._check_repo_status(os.path.dirname(recipefile), expected_status)
 
+    def test_devtool_update_recipe_with_gitignore(self):
+        # First, modify the recipe
+        testrecipe = 'devtool-test-ignored'
+        bb_vars = get_bb_vars(['FILE'], testrecipe)
+        recipefile = bb_vars['FILE']
+        patchfile = os.path.join(os.path.dirname(recipefile), testrecipe, testrecipe + '.patch')
+        newpatchfile = os.path.join(os.path.dirname(recipefile), testrecipe, testrecipe + '.patch.expected')
+        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        self.track_for_cleanup(tempdir)
+        self.track_for_cleanup(self.workspacedir)
+        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+        # (don't bother with cleaning the recipe on teardown, we won't be building it)
+        result = runCmd('devtool modify %s' % testrecipe)
+        self.add_command_to_tearDown('cd %s; rm %s/*; git checkout %s %s' % (os.path.dirname(recipefile), testrecipe, testrecipe, os.path.basename(recipefile)))
+        result = runCmd('devtool finish --force-patch-refresh %s meta-selftest' % testrecipe)
+        # Check recipe got changed as expected
+        with open(newpatchfile, 'r') as f:
+            desiredlines = f.readlines()
+        with open(patchfile, 'r') as f:
+            newlines = f.readlines()
+        # Ignore the initial lines, because oe-selftest creates own meta-selftest repo
+        # which changes the metadata subject which is added into the patch, but keep
+        # .patch.expected as it is in case someone runs devtool finish --force-patch-refresh
+        # devtool-test-ignored manually, then it should generate exactly the same .patch file
+        self.assertEqual(desiredlines[5:], newlines[5:])
+
     def test_devtool_update_recipe_local_files_3(self):
         # First, modify the recipe
         testrecipe = 'devtool-test-localonly'