[OE-core] [PATCH] archiver.bbclass: Handle gitsm URLs in the mirror archiver

Paul Barker pbarker at konsulko.com
Mon Feb 24 20:32:10 UTC 2020


To fully archive a `gitsm://` entry in SRC_URI we need to also capture
the submodules recursively.

Signed-off-by: Paul Barker <pbarker at konsulko.com>
---
 meta/classes/archiver.bbclass | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 013195df7d..a823708771 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -337,12 +337,10 @@ python do_ar_mirror() {
 
     bb.utils.mkdirhier(destdir)
 
-    fetcher = bb.fetch2.Fetch(src_uri, d)
-
-    for url in fetcher.urls:
+    def archive_url(fetcher, url):
         if is_excluded(url):
             bb.note('Skipping excluded url: %s' % (url))
-            continue
+            return
 
         bb.note('Archiving url: %s' % (url))
         ud = fetcher.ud[url]
@@ -376,6 +374,21 @@ python do_ar_mirror() {
         bb.note('Copying source mirror')
         cmd = 'cp -fpPRH %s %s' % (localpath, destdir)
         subprocess.check_call(cmd, shell=True)
+
+        if url.startswith('gitsm://'):
+            def archive_submodule(ud, url, module, modpath, d):
+                url += ";bareclone=1;nobranch=1"
+                newfetch = bb.fetch2.Fetch([url], d, cache=False)
+
+                for url in newfetch.urls:
+                    archive_url(newfetch, url)
+
+            ud.method.process_submodules(ud, ud.clonedir, archive_submodule, d)
+
+    fetcher = bb.fetch2.Fetch(src_uri, d, cache=False)
+
+    for url in fetcher.urls:
+        archive_url(fetcher, url)
 }
 
 def exclude_useless_paths(tarinfo):
-- 
2.20.1



More information about the Openembedded-core mailing list