diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-03-20 15:42:21 +0000 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2025-03-20 09:04:50 -0700 |
| commit | 2920d4909236106e1a36d56b3b20762a308ba3d4 (patch) | |
| tree | afc0bb5127e07f354b886208146c397c39a32aae /meta-oe/classes/gitpkgv.bbclass | |
| parent | cb0a43ea7885035b9f3cf071821ac7cb1685cbf7 (diff) | |
| download | meta-openembedded-2920d4909236106e1a36d56b3b20762a308ba3d4.tar.gz | |
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>
Diffstat (limited to 'meta-oe/classes/gitpkgv.bbclass')
| -rw-r--r-- | meta-oe/classes/gitpkgv.bbclass | 68 |
1 files changed, 33 insertions, 35 deletions
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): | |||
| 70 | names = [] | 70 | names = [] |
| 71 | for url in ud.values(): | 71 | for url in ud.values(): |
| 72 | if url.type == 'git' or url.type == 'gitsm': | 72 | if url.type == 'git' or url.type == 'gitsm': |
| 73 | names.extend(url.revisions.keys()) | 73 | names.extend(url.revision) |
| 74 | if len(names) > 0: | 74 | if len(names) > 0: |
| 75 | format = '_'.join(names) | 75 | format = '_'.join(names) |
| 76 | else: | 76 | else: |
| 77 | format = 'default' | 77 | format = 'default' |
| 78 | |||
| 79 | found = False | 78 | found = False |
| 80 | for url in ud.values(): | 79 | for url in ud.values(): |
| 81 | if url.type == 'git' or url.type == 'gitsm': | 80 | if url.type == 'git' or url.type == 'gitsm': |
| 82 | for name, rev in url.revisions.items(): | 81 | if not os.path.exists(url.localpath): |
| 83 | if not os.path.exists(url.localpath): | 82 | return None |
| 84 | return None | ||
| 85 | 83 | ||
| 86 | found = True | 84 | found = True |
| 87 | 85 | ||
| 88 | vars = { 'repodir' : quote(url.localpath), | 86 | vars = { 'repodir' : quote(url.localpath), |
| 89 | 'rev' : quote(rev) } | 87 | 'rev' : quote(url.revision) } |
| 90 | 88 | ||
| 91 | rev = bb.fetch2.get_srcrev(d).split('+')[1] | 89 | rev = bb.fetch2.get_srcrev(d).split('+')[1] |
| 92 | rev_file = os.path.join(url.localpath, "oe-gitpkgv_" + rev) | 90 | rev_file = os.path.join(url.localpath, "oe-gitpkgv_" + url.revision) |
| 93 | 91 | ||
| 94 | if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0: | 92 | if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0: |
| 95 | commits = bb.fetch2.runfetchcmd( | 93 | commits = bb.fetch2.runfetchcmd( |
| 96 | "git --git-dir=%(repodir)s rev-list %(rev)s -- 2>/dev/null | wc -l" | 94 | "git --git-dir=%(repodir)s rev-list %(rev)s -- 2>/dev/null | wc -l" |
| 97 | % vars, d, quiet=True).strip().lstrip('0') | 95 | % vars, d, quiet=True).strip().lstrip('0') |
| 98 | 96 | ||
| 99 | if commits != "": | 97 | if commits != "": |
| 100 | oe.path.remove(rev_file, recurse=False) | 98 | oe.path.remove(rev_file, recurse=False) |
| 101 | with open(rev_file, "w") as f: | 99 | with open(rev_file, "w") as f: |
| 102 | f.write("%d\n" % int(commits)) | 100 | f.write("%d\n" % int(commits)) |
| 103 | else: | ||
| 104 | commits = "0" | ||
| 105 | else: | ||
| 106 | with open(rev_file, "r") as f: | ||
| 107 | commits = f.readline(128).strip() | ||
| 108 | |||
| 109 | if use_tags: | ||
| 110 | try: | ||
| 111 | output = bb.fetch2.runfetchcmd( | ||
| 112 | "git --git-dir=%(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null" | ||
| 113 | % vars, d, quiet=True).strip() | ||
| 114 | ver = gitpkgv_drop_tag_prefix(d, output) | ||
| 115 | except Exception: | ||
| 116 | ver = "0.0-%s-g%s" % (commits, vars['rev'][:7]) | ||
| 117 | else: | 101 | else: |
| 118 | ver = "%s+%s" % (commits, vars['rev'][:7]) | 102 | commits = "0" |
| 119 | 103 | else: | |
| 120 | format = format.replace(name, ver) | 104 | with open(rev_file, "r") as f: |
| 105 | commits = f.readline(128).strip() | ||
| 106 | |||
| 107 | if use_tags: | ||
| 108 | try: | ||
| 109 | output = bb.fetch2.runfetchcmd( | ||
| 110 | "git --git-dir=%(repodir)s describe %(rev)s --tags --exact-match 2>/dev/null" | ||
| 111 | % vars, d, quiet=True).strip() | ||
| 112 | ver = gitpkgv_drop_tag_prefix(d, output) | ||
| 113 | except Exception: | ||
| 114 | ver = "0.0-%s-g%s" % (commits, vars['rev'][:7]) | ||
| 115 | else: | ||
| 116 | ver = "%s+%s" % (commits, vars['rev'][:7]) | ||
| 117 | |||
| 118 | format = format.replace(url.name, ver) | ||
| 121 | 119 | ||
| 122 | if found: | 120 | if found: |
| 123 | return format | 121 | return format |
