gitpkgver: Update to match bitbake fetcher changes
PATCH v2 1/1 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 <[email protected]>
--- meta-oe/classes/gitpkgv.bbclass | 68 ++++++++++++++++----------------- 1 file changed, 33 insertions(+), 35 deletions(-)
meta-oe/classes/gitpkgv.bbclass +33 -35
@@ -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" - 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]) + if commits != "": + oe.path.remove(rev_file, recurse=False) + with open(rev_file, "w") as f: + f.write("%d\n" % int(commits)) else: - ver = "%s+%s" % (commits, vars['rev'][:7]) - - format = format.replace(name, ver) + 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]) + + format = format.replace(url.name, ver) if found: return format