diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index b3eb8248d0..bdcfa4978c 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -74,6 +74,9 @@ from bb.fetch2 import runfetchcmd | |||
74 | from bb.fetch2 import logger | 74 | from bb.fetch2 import logger |
75 | 75 | ||
76 | 76 | ||
77 | sha1_re = re.compile(r'^[0-9a-f]{40}$') | ||
78 | slash_re = re.compile(r"/+") | ||
79 | |||
77 | class GitProgressHandler(bb.progress.LineFilterProgressHandler): | 80 | class GitProgressHandler(bb.progress.LineFilterProgressHandler): |
78 | """Extract progress information from git output""" | 81 | """Extract progress information from git output""" |
79 | def __init__(self, d): | 82 | def __init__(self, d): |
@@ -249,8 +252,8 @@ class Git(FetchMethod): | |||
249 | ud.setup_revisions(d) | 252 | ud.setup_revisions(d) |
250 | 253 | ||
251 | for name in ud.names: | 254 | for name in ud.names: |
252 | # Ensure anything that doesn't look like a sha256 checksum/revision is translated into one | 255 | # Ensure any revision that doesn't look like a SHA-1 is translated into one |
253 | if not ud.revisions[name] or len(ud.revisions[name]) != 40 or (False in [c in "abcdef0123456789" for c in ud.revisions[name]]): | 256 | if not sha1_re.match(ud.revisions[name] or ''): |
254 | if ud.revisions[name]: | 257 | if ud.revisions[name]: |
255 | ud.unresolvedrev[name] = ud.revisions[name] | 258 | ud.unresolvedrev[name] = ud.revisions[name] |
256 | ud.revisions[name] = self.latest_revision(ud, d, name) | 259 | ud.revisions[name] = self.latest_revision(ud, d, name) |
@@ -259,10 +262,10 @@ class Git(FetchMethod): | |||
259 | if gitsrcname.startswith('.'): | 262 | if gitsrcname.startswith('.'): |
260 | gitsrcname = gitsrcname[1:] | 263 | gitsrcname = gitsrcname[1:] |
261 | 264 | ||
262 | # for rebaseable git repo, it is necessary to keep mirror tar ball | 265 | # For a rebaseable git repo, it is necessary to keep a mirror tar ball |
263 | # per revision, so that even the revision disappears from the | 266 | # per revision, so that even if the revision disappears from the |
264 | # upstream repo in the future, the mirror will remain intact and still | 267 | # upstream repo in the future, the mirror will remain intact and still |
265 | # contains the revision | 268 | # contain the revision |
266 | if ud.rebaseable: | 269 | if ud.rebaseable: |
267 | for name in ud.names: | 270 | for name in ud.names: |
268 | gitsrcname = gitsrcname + '_' + ud.revisions[name] | 271 | gitsrcname = gitsrcname + '_' + ud.revisions[name] |
@@ -697,7 +700,6 @@ class Git(FetchMethod): | |||
697 | Return a unique key for the url | 700 | Return a unique key for the url |
698 | """ | 701 | """ |
699 | # Collapse adjacent slashes | 702 | # Collapse adjacent slashes |
700 | slash_re = re.compile(r"/+") | ||
701 | return "git:" + ud.host + slash_re.sub(".", ud.path) + ud.unresolvedrev[name] | 703 | return "git:" + ud.host + slash_re.sub(".", ud.path) + ud.unresolvedrev[name] |
702 | 704 | ||
703 | def _lsremote(self, ud, d, search): | 705 | def _lsremote(self, ud, d, search): |