mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-01-04 16:10:10 +00:00
gitpkgver: Update to match bitbake fetcher changes
The bitbake fetcher dropped support for multiple revisions on a single url. Update the gitpkgver code to match. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
parent
cb0a43ea78
commit
2920d49092
|
|
@ -70,54 +70,52 @@ def get_git_pkgv(d, use_tags):
|
|||
names = []
|
||||
for url in ud.values():
|
||||
if url.type == 'git' or url.type == 'gitsm':
|
||||
names.extend(url.revisions.keys())
|
||||
names.extend(url.revision)
|
||||
if len(names) > 0:
|
||||
format = '_'.join(names)
|
||||
else:
|
||||
format = 'default'
|
||||
|
||||
found = False
|
||||
for url in ud.values():
|
||||
if url.type == 'git' or url.type == 'gitsm':
|
||||
for name, rev in url.revisions.items():
|
||||
if not os.path.exists(url.localpath):
|
||||
return None
|
||||
if not os.path.exists(url.localpath):
|
||||
return None
|
||||
|
||||
found = True
|
||||
found = True
|
||||
|
||||
vars = { 'repodir' : quote(url.localpath),
|
||||
'rev' : quote(rev) }
|
||||
vars = { 'repodir' : quote(url.localpath),
|
||||
'rev' : quote(url.revision) }
|
||||
|
||||
rev = bb.fetch2.get_srcrev(d).split('+')[1]
|
||||
rev_file = os.path.join(url.localpath, "oe-gitpkgv_" + rev)
|
||||
rev = bb.fetch2.get_srcrev(d).split('+')[1]
|
||||
rev_file = os.path.join(url.localpath, "oe-gitpkgv_" + url.revision)
|
||||
|
||||
if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0:
|
||||
commits = bb.fetch2.runfetchcmd(
|
||||
"git --git-dir=%(repodir)s rev-list %(rev)s -- 2>/dev/null | wc -l"
|
||||
% vars, d, quiet=True).strip().lstrip('0')
|
||||
if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0:
|
||||
commits = bb.fetch2.runfetchcmd(
|
||||
"git --git-dir=%(repodir)s rev-list %(rev)s -- 2>/dev/null | wc -l"
|
||||
% vars, d, quiet=True).strip().lstrip('0')
|
||||
|
||||
if commits != "":
|
||||
oe.path.remove(rev_file, recurse=False)
|
||||
with open(rev_file, "w") as f:
|
||||
f.write("%d\n" % int(commits))
|
||||
else:
|
||||
commits = "0"
|
||||
if commits != "":
|
||||
oe.path.remove(rev_file, recurse=False)
|
||||
with open(rev_file, "w") as f:
|
||||
f.write("%d\n" % int(commits))
|
||||
else:
|
||||
with open(rev_file, "r") as f:
|
||||
commits = f.readline(128).strip()
|
||||
commits = "0"
|
||||
else:
|
||||
with open(rev_file, "r") as f:
|
||||
commits = f.readline(128).strip()
|
||||
|
||||
if use_tags:
|
||||
try:
|
||||
output = bb.fetch2.runfetchcmd(
|
||||
"git --git-dir=%(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null"
|
||||
% vars, d, quiet=True).strip()
|
||||
ver = gitpkgv_drop_tag_prefix(d, output)
|
||||
except Exception:
|
||||
ver = "0.0-%s-g%s" % (commits, vars['rev'][:7])
|
||||
else:
|
||||
ver = "%s+%s" % (commits, vars['rev'][:7])
|
||||
if use_tags:
|
||||
try:
|
||||
output = bb.fetch2.runfetchcmd(
|
||||
"git --git-dir=%(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null"
|
||||
% vars, d, quiet=True).strip()
|
||||
ver = gitpkgv_drop_tag_prefix(d, output)
|
||||
except Exception:
|
||||
ver = "0.0-%s-g%s" % (commits, vars['rev'][:7])
|
||||
else:
|
||||
ver = "%s+%s" % (commits, vars['rev'][:7])
|
||||
|
||||
format = format.replace(name, ver)
|
||||
format = format.replace(url.name, ver)
|
||||
|
||||
if found:
|
||||
return format
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user