Skip to contentSkip to conversation

Fix relative URI processing for gitsm

PATCH New Mark Hatle 1 participant 2 messages Oct 2, 2018

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

PATCH 1/1 Fix relative URI processing for gitsm

This patch depends on the prior patch set from Laurent Bonnans.

Identify and fix relative urls using os.path.join and os.path.realpath.

Mark Hatle (1):
gitsm: Allow relative URIs when fetching

 lib/bb/fetch2/gitsm.py | 5 +++++
 1 file changed, 5 insertions(+)
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/1 gitsm: Allow relative URIs when fetching

Some repositories may specify a relative submodule path. If this happens, it is our responsibility to use the parents URL (ud) and handle any relative processing ourselves.

---
 lib/bb/fetch2/gitsm.py | 5 +++++
 1 file changed, 5 insertions(+)
lib/bb/fetch2/gitsm.py +5 -0
index 4d3805a..0a982da 100644
@@ -31,6 +31,7 @@ NOTE: Switching a SRC_URI from "git://" to "gitsm://" requires a clean of your r
 
 import os
 import bb
+import copy
 from   bb.fetch2.git import Git
 from   bb.fetch2 import runfetchcmd
 from   bb.fetch2 import logger
@@ -77,6 +78,10 @@ class GitSM(Git):
                 submodules.append(m)
                 paths[m] = md['path']
                 uris[m] = md['url']
+                if uris[m].startswith('..'):
+                    newud = copy.copy(ud)
+                    newud.path = os.path.realpath(os.path.join(newud.path, md['url']))
+                    uris[m] = Git._get_repo_url(self, newud)
 
         for module in submodules:
             module_hash = runfetchcmd("%s ls-tree -z -d %s %s" % (ud.basecmd, ud.revisions[name], paths[module]), d, quiet=True, workdir=ud.clonedir)
Signature · 1 line
1.8.3.1