diff options
author | Martin Jansa <Martin.Jansa@gmail.com> | 2020-05-30 00:03:24 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-06-04 13:27:29 +0100 |
commit | 456e7ab51361af23671f6c74a18fbd54a79ac1e8 (patch) | |
tree | 45244e697c04fe034c6301224db54c2d2a47f2df | |
parent | eb4e519f4c2c6d8ee5f635bc477de3c4b5d5c2d6 (diff) | |
download | poky-456e7ab51361af23671f6c74a18fbd54a79ac1e8.tar.gz |
meta-selftest: add test of .gitignore in tarball
(From OE-Core rev: 8ee4f7c076b0fdbfc5b9d6b5bbbf8a02f5d062a7)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
5 files changed, 58 insertions, 0 deletions
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 index 0000000000..6a3d58c884 --- /dev/null +++ b/meta-selftest/recipes-test/devtool/devtool-test-ignored.bb | |||
@@ -0,0 +1,9 @@ | |||
1 | LICENSE = "CLOSED" | ||
2 | INHIBIT_DEFAULT_DEPS = "1" | ||
3 | |||
4 | SRC_URI = "file://${BPN}.tar.gz \ | ||
5 | file://${BPN}.patch" | ||
6 | |||
7 | S = "${WORKDIR}/${BPN}" | ||
8 | |||
9 | 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 index 0000000000..96ea0eb4e3 --- /dev/null +++ b/meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.patch | |||
@@ -0,0 +1,7 @@ | |||
1 | diff --git a/ignored b/ignored | ||
2 | index a579759..e3d7b43 100644 | ||
3 | --- a/ignored | ||
4 | +++ b/ignored | ||
5 | @@ -1 +1 @@ | ||
6 | -I'm so ignored | ||
7 | +# 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 index 0000000000..68ec6d9875 --- /dev/null +++ b/meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.patch.expected | |||
@@ -0,0 +1,16 @@ | |||
1 | From 3a286343cc5cadd83f41d524ee3606ae51df9ee7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | Date: Thu, 28 May 2020 01:32:31 +0200 | ||
4 | Subject: [PATCH] meta-selftest: add test of .gitignore in tarball | ||
5 | |||
6 | --- | ||
7 | ignored | 2 +- | ||
8 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
9 | |||
10 | diff --git a/ignored b/ignored | ||
11 | index a579759..e3d7b43 100644 | ||
12 | --- a/ignored | ||
13 | +++ b/ignored | ||
14 | @@ -1 +1 @@ | ||
15 | -I'm so ignored | ||
16 | +# 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 index 0000000000..b2e9935eb9 --- /dev/null +++ b/meta-selftest/recipes-test/devtool/devtool-test-ignored/devtool-test-ignored.tar.gz | |||
Binary files differ | |||
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 5886862d6c..0218f0821c 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -1108,6 +1108,32 @@ class DevtoolUpdateTests(DevtoolBase): | |||
1108 | ('??', '.*/0001-Add-new-file.patch$')] | 1108 | ('??', '.*/0001-Add-new-file.patch$')] |
1109 | self._check_repo_status(os.path.dirname(recipefile), expected_status) | 1109 | self._check_repo_status(os.path.dirname(recipefile), expected_status) |
1110 | 1110 | ||
1111 | def test_devtool_update_recipe_with_gitignore(self): | ||
1112 | # First, modify the recipe | ||
1113 | testrecipe = 'devtool-test-ignored' | ||
1114 | bb_vars = get_bb_vars(['FILE'], testrecipe) | ||
1115 | recipefile = bb_vars['FILE'] | ||
1116 | patchfile = os.path.join(os.path.dirname(recipefile), testrecipe, testrecipe + '.patch') | ||
1117 | newpatchfile = os.path.join(os.path.dirname(recipefile), testrecipe, testrecipe + '.patch.expected') | ||
1118 | tempdir = tempfile.mkdtemp(prefix='devtoolqa') | ||
1119 | self.track_for_cleanup(tempdir) | ||
1120 | self.track_for_cleanup(self.workspacedir) | ||
1121 | self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') | ||
1122 | # (don't bother with cleaning the recipe on teardown, we won't be building it) | ||
1123 | result = runCmd('devtool modify %s' % testrecipe) | ||
1124 | self.add_command_to_tearDown('cd %s; rm %s/*; git checkout %s %s' % (os.path.dirname(recipefile), testrecipe, testrecipe, os.path.basename(recipefile))) | ||
1125 | result = runCmd('devtool finish --force-patch-refresh %s meta-selftest' % testrecipe) | ||
1126 | # Check recipe got changed as expected | ||
1127 | with open(newpatchfile, 'r') as f: | ||
1128 | desiredlines = f.readlines() | ||
1129 | with open(patchfile, 'r') as f: | ||
1130 | newlines = f.readlines() | ||
1131 | # Ignore the initial lines, because oe-selftest creates own meta-selftest repo | ||
1132 | # which changes the metadata subject which is added into the patch, but keep | ||
1133 | # .patch.expected as it is in case someone runs devtool finish --force-patch-refresh | ||
1134 | # devtool-test-ignored manually, then it should generate exactly the same .patch file | ||
1135 | self.assertEqual(desiredlines[5:], newlines[5:]) | ||
1136 | |||
1111 | def test_devtool_update_recipe_local_files_3(self): | 1137 | def test_devtool_update_recipe_local_files_3(self): |
1112 | # First, modify the recipe | 1138 | # First, modify the recipe |
1113 | testrecipe = 'devtool-test-localonly' | 1139 | testrecipe = 'devtool-test-localonly' |