1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

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>
This commit is contained in:
Paul Barker
2020-01-07 11:27:33 +00:00
committed by Richard Purdie
parent f6c25f546b
commit 61e1b4136f
2 changed files with 176 additions and 19 deletions
+59
View File
@@ -195,3 +195,62 @@ class Archiver(OESelftestTestCase):
self._test_archiver_mode('patched', 'selftest-ed-1.14.1-r0-showdata.dump',
'ARCHIVER_MODE[dumpdata] = "1"\n')
def test_archiver_mode_mirror(self):
"""
Test that the archiver works with `ARCHIVER_MODE[src] = "mirror"`.
"""
self._test_archiver_mode('mirror', 'ed-1.14.1.tar.lz',
'BB_GENERATE_MIRROR_TARBALLS = "1"\n')
def test_archiver_mode_mirror_excludes(self):
"""
Test that the archiver works with `ARCHIVER_MODE[src] = "mirror"` and
correctly excludes an archive when its URL matches
`ARCHIVER_MIRROR_EXCLUDES`.
"""
target='selftest-ed'
target_file_name = 'ed-1.14.1.tar.lz'
features = 'INHERIT += "archiver"\n'
features += 'ARCHIVER_MODE[src] = "mirror"\n'
features += 'BB_GENERATE_MIRROR_TARBALLS = "1"\n'
features += 'ARCHIVER_MIRROR_EXCLUDE = "${GNU_MIRROR}"\n'
self.write_config(features)
bitbake('-c clean %s' % (target))
bitbake('-c deploy_archives %s' % (target))
bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS'])
glob_str = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS'], '%s-*' % (target))
glob_result = glob.glob(glob_str)
self.assertTrue(glob_result, 'Missing archiver directory for %s' % (target))
archive_path = os.path.join(glob_result[0], target_file_name)
self.assertFalse(os.path.exists(archive_path), 'Failed to exclude archive file %s' % (target_file_name))
def test_archiver_mode_mirror_combined(self):
"""
Test that the archiver works with `ARCHIVER_MODE[src] = "mirror"`
and `ARCHIVER_MODE[mirror] = "combined"`. Archives for multiple recipes
should all end up in the 'mirror' directory.
"""
features = 'INHERIT += "archiver"\n'
features += 'ARCHIVER_MODE[src] = "mirror"\n'
features += 'ARCHIVER_MODE[mirror] = "combined"\n'
features += 'BB_GENERATE_MIRROR_TARBALLS = "1"\n'
features += 'COPYLEFT_LICENSE_INCLUDE = "*"\n'
self.write_config(features)
for target in ['selftest-ed', 'selftest-hardlink']:
bitbake('-c clean %s' % (target))
bitbake('-c deploy_archives %s' % (target))
bb_vars = get_bb_vars(['DEPLOY_DIR_SRC'])
for target_file_name in ['ed-1.14.1.tar.lz', 'hello.c']:
glob_str = os.path.join(bb_vars['DEPLOY_DIR_SRC'], 'mirror', target_file_name)
glob_result = glob.glob(glob_str)
self.assertTrue(glob_result, 'Missing archive file %s' % (target_file_name))