summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Barker <pbarker@konsulko.com>2020-06-04 18:33:01 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-05 07:35:01 +0100
commitd908ca51b72f4ba417e7573ae3d953535f53286c (patch)
tree4b4581a3c86176d66887c3debcce04e10b0390ab
parentee6de1281ee16df0d43f635a12881b39fd9061d0 (diff)
downloadopenembedded-core-contrib-d908ca51b72f4ba417e7573ae3d953535f53286c.tar.gz
archiver: Capture git submodules in mirror archiver
Using the new Fetch.expanded_urldata() function we can get URL data for all git submodules. Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/archiver.bbclass13
-rw-r--r--meta/lib/oeqa/selftest/cases/archiver.py54
2 files changed, 60 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 bc5447d2a3..37efed57c8 100644
--- a/meta/lib/oeqa/selftest/cases/archiver.py
+++ b/meta/lib/oeqa/selftest/cases/archiver.py
@@ -255,3 +255,57 @@ 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)
+
+ bitbake('-c clean git-submodule-test')
+ bitbake('-c deploy_archives -f git-submodule-test')
+
+ bb_vars = get_bb_vars(['DEPLOY_DIR_SRC'])
+ for target_file_name in [
+ 'git2_git.yoctoproject.org.git-submodule-test.tar.gz',
+ 'git2_git.yoctoproject.org.bitbake-gitsm-test1.tar.gz',
+ 'git2_git.yoctoproject.org.bitbake-gitsm-test2.tar.gz',
+ 'git2_git.openembedded.org.bitbake.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'
+ features += 'DL_DIR = "${TOPDIR}/downloads-shallow"\n'
+ self.write_config(features)
+
+ bitbake('-c clean git-submodule-test')
+ bitbake('-c deploy_archives -f git-submodule-test')
+
+ bb_vars = get_bb_vars(['DEPLOY_DIR_SRC'])
+ for target_file_name in [
+ 'gitsmshallow_git.yoctoproject.org.git-submodule-test_a2885dd-1_master.tar.gz',
+ 'gitsmshallow_git.yoctoproject.org.bitbake-gitsm-test1_bare_120f4c7-1.tar.gz',
+ 'gitsmshallow_git.yoctoproject.org.bitbake-gitsm-test2_bare_f66699e-1.tar.gz',
+ 'gitsmshallow_git.openembedded.org.bitbake_bare_52a144a-1.tar.gz',
+ 'gitsmshallow_git.openembedded.org.bitbake_bare_c39b997-1.tar.gz'
+ ]:
+ target_path = os.path.join(bb_vars['DEPLOY_DIR_SRC'], 'mirror', target_file_name)
+ self.assertTrue(os.path.exists(target_path))