From 2920d4909236106e1a36d56b3b20762a308ba3d4 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 20 Mar 2025 15:42:21 +0000 Subject: 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 Signed-off-by: Khem Raj --- meta-oe/classes/gitpkgv.bbclass | 68 ++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 35 deletions(-) (limited to 'meta-oe/classes') diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass index 5ab507969c..af98f256ab 100644 --- a/meta-oe/classes/gitpkgv.bbclass +++ b/meta-oe/classes/gitpkgv.bbclass @@ -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 -- cgit v1.2.3-54-g00ecf