Using the new Fetch.expanded_urldata() function we can get URL data for all git submodules.
Signed-off-by: Paul Barker <[email protected]> --- meta/classes/archiver.bbclass | 13 ++++--- meta/lib/oeqa/selftest/cases/archiver.py | 46 ++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass index 780c562b68..c2c049c343 100644 --- a/meta/classes/archiver.bbclass +++ b/meta/classes/archiver.bbclass @@ -345,13 +345,12 @@ python do_ar_mirror() { fetcher = bb.fetch2.Fetch(src_uri, d) - for url in fetcher.urls: - if is_excluded(url): - bb.note('Skipping excluded url: %s' % (url)) + for ud in fetcher.expanded_urldata(): + if is_excluded(ud.url): + bb.note('Skipping excluded url: %s' % (ud.url)) continue - bb.note('Archiving url: %s' % (url)) - ud = fetcher.ud[url] + bb.note('Archiving url: %s' % (ud.url)) ud.setup_localpath(d) localpath = None @@ -367,7 +366,7 @@ python do_ar_mirror() { if len(ud.mirrortarballs) and not localpath: bb.warn('Mirror tarballs are listed for a source but none are present. ' \ 'Falling back to original download.\n' \ - 'SRC_URI = %s' % (url)) + 'SRC_URI = %s' % (ud.url)) # Check original download if not localpath: @@ -376,7 +375,7 @@ python do_ar_mirror() { if not localpath or not os.path.exists(localpath): bb.fatal('Original download is missing for a source.\n' \ - 'SRC_URI = %s' % (url)) + 'SRC_URI = %s' % (ud.url)) # We now have an appropriate localpath bb.note('Copying source mirror') diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py index 606eaabcb0..d557d9b576 100644 --- a/meta/lib/oeqa/selftest/cases/archiver.py +++ b/meta/lib/oeqa/selftest/cases/archiver.py @@ -254,3 +254,49 @@ class Archiver(OESelftestTestCase): 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)) + + def test_archiver_mode_mirror_gitsm(self): + """ + Test that the archiver correctly handles git submodules with + `ARCHIVER_MODE[src] = "mirror"`. + """ + 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) + + # We assume ovmf will continue to pull in openssl as a submodule in the + # future + bitbake('-c clean ovmf') + bitbake('-c deploy_archives ovmf') + + bb_vars = get_bb_vars(['DEPLOY_DIR_SRC']) + for target_file_name in ['git2_github.com.tianocore.edk2.git.tar.gz', 'git2_github.com.openssl.openssl.tar.gz']: + target_path = os.path.join(bb_vars['DEPLOY_DIR_SRC'], 'mirror', target_file_name) + self.assertTrue(os.path.exists(target_path)) + + def test_archiver_mode_mirror_gitsm_shallow(self): + """ + Test that the archiver correctly handles git submodules with + `ARCHIVER_MODE[src] = "mirror"`. + """ + 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' + features += 'BB_GIT_SHALLOW = "1"\n' + features += 'BB_GENERATE_SHALLOW_TARBALLS = "1"\n' + self.write_config(features) + + # We assume ovmf will continue to pull in openssl as a submodule in the + # future + bitbake('-c clean ovmf') + bitbake('-c deploy_archives ovmf') + + bb_vars = get_bb_vars(['DEPLOY_DIR_SRC']) + for target_file_name in ['gitsmshallow_github.com.tianocore.edk2*.tar.gz', 'gitsmshallow_github.com.openssl.openssl*.tar.gz']: + target_path = os.path.join(bb_vars['DEPLOY_DIR_SRC'], 'mirror', target_file_name) + self.assertTrue(os.path.exists(target_path)) -- 2.26.2
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#139190): https://lists.openembedded.org/g/openembedded-core/message/139190 Mute This Topic: https://lists.openembedded.org/mt/74657936/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
