summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest
diff options
context:
space:
mode:
authorPaul Barker <pbarker@konsulko.com>2020-01-07 11:27:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-10 21:18:22 +0000
commit61e1b4136fb8ceb3785dcfdb22a3b80d062faaa6 (patch)
treed7f1abe452990c94c11f5e51cad9741f5f69e10a /meta/lib/oeqa/selftest
parentf6c25f546b7baf823b21ccb29db8854112aeebd5 (diff)
downloadpoky-61e1b4136fb8ceb3785dcfdb22a3b80d062faaa6.tar.gz
archiver.bbclass: Add new mirror archiver mode
We define a new method of populating a source mirror using the archiver bbclass instead of simply copying the contents of the downloads directory. This allows the archiver features such as copyleft license filtering and recipe type filtering to be used when preparing a source mirror. This new archiver mode is selected by setting `ARCHIVE_MODE[src]` to 'mirror'. The source mirror mode can either be 'split' (default) or 'combined', controlled by `ARCHIVER_MODE[mirror]`. Additionally, sources can be excluded as needed by setting `ARCHIVER_MIRROR_EXCLUDE` to a list of URI prefixes. These options are described in more detail in the new entries in the header of archiver.bbclass. New oeqa selftest cases are added to cover the mirror archiver mode. (From OE-Core rev: 2c8b31ae0ab95a8b100e8bade23f51574e273c9a) Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r--meta/lib/oeqa/selftest/cases/archiver.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py
index 6bd0e06ec4..fab2f56c39 100644
--- a/meta/lib/oeqa/selftest/cases/archiver.py
+++ b/meta/lib/oeqa/selftest/cases/archiver.py
@@ -195,3 +195,62 @@ class Archiver(OESelftestTestCase):
195 195
196 self._test_archiver_mode('patched', 'selftest-ed-1.14.1-r0-showdata.dump', 196 self._test_archiver_mode('patched', 'selftest-ed-1.14.1-r0-showdata.dump',
197 'ARCHIVER_MODE[dumpdata] = "1"\n') 197 'ARCHIVER_MODE[dumpdata] = "1"\n')
198
199 def test_archiver_mode_mirror(self):
200 """
201 Test that the archiver works with `ARCHIVER_MODE[src] = "mirror"`.
202 """
203
204 self._test_archiver_mode('mirror', 'ed-1.14.1.tar.lz',
205 'BB_GENERATE_MIRROR_TARBALLS = "1"\n')
206
207 def test_archiver_mode_mirror_excludes(self):
208 """
209 Test that the archiver works with `ARCHIVER_MODE[src] = "mirror"` and
210 correctly excludes an archive when its URL matches
211 `ARCHIVER_MIRROR_EXCLUDES`.
212 """
213
214 target='selftest-ed'
215 target_file_name = 'ed-1.14.1.tar.lz'
216
217 features = 'INHERIT += "archiver"\n'
218 features += 'ARCHIVER_MODE[src] = "mirror"\n'
219 features += 'BB_GENERATE_MIRROR_TARBALLS = "1"\n'
220 features += 'ARCHIVER_MIRROR_EXCLUDE = "${GNU_MIRROR}"\n'
221 self.write_config(features)
222
223 bitbake('-c clean %s' % (target))
224 bitbake('-c deploy_archives %s' % (target))
225
226 bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS'])
227 glob_str = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS'], '%s-*' % (target))
228 glob_result = glob.glob(glob_str)
229 self.assertTrue(glob_result, 'Missing archiver directory for %s' % (target))
230
231 archive_path = os.path.join(glob_result[0], target_file_name)
232 self.assertFalse(os.path.exists(archive_path), 'Failed to exclude archive file %s' % (target_file_name))
233
234 def test_archiver_mode_mirror_combined(self):
235 """
236 Test that the archiver works with `ARCHIVER_MODE[src] = "mirror"`
237 and `ARCHIVER_MODE[mirror] = "combined"`. Archives for multiple recipes
238 should all end up in the 'mirror' directory.
239 """
240
241 features = 'INHERIT += "archiver"\n'
242 features += 'ARCHIVER_MODE[src] = "mirror"\n'
243 features += 'ARCHIVER_MODE[mirror] = "combined"\n'
244 features += 'BB_GENERATE_MIRROR_TARBALLS = "1"\n'
245 features += 'COPYLEFT_LICENSE_INCLUDE = "*"\n'
246 self.write_config(features)
247
248 for target in ['selftest-ed', 'selftest-hardlink']:
249 bitbake('-c clean %s' % (target))
250 bitbake('-c deploy_archives %s' % (target))
251
252 bb_vars = get_bb_vars(['DEPLOY_DIR_SRC'])
253 for target_file_name in ['ed-1.14.1.tar.lz', 'hello.c']:
254 glob_str = os.path.join(bb_vars['DEPLOY_DIR_SRC'], 'mirror', target_file_name)
255 glob_result = glob.glob(glob_str)
256 self.assertTrue(glob_result, 'Missing archive file %s' % (target_file_name))