summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils
diff options
context:
space:
mode:
authorAlexis Lothoré <alexis.lothore@bootlin.com>2023-08-23 12:35:20 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-08-23 22:33:39 +0100
commitdb6ace80a0c094748b0e8be6db9d3931be535a8c (patch)
tree1d71c9486a4c4fbb5c1b4a884a0f128752fd4b4a /meta/lib/oeqa/utils
parent3c1ee6d8b0f9d73148109522ce36daff0ad77f8b (diff)
downloadpoky-db6ace80a0c094748b0e8be6db9d3931be535a8c.tar.gz
oeqa/utils/gitarchive: fall back to local tags when listing existing tags
e9cff55e73cc has switched tag listing from bare "git tag" to "git ls-remote" to make sure not to miss remote tags which are not fetched locally. This mechanism first checks for configured remote repository, next for possibly passed url, and then fails if none worked. However there are still cases where no remote repository is configured and no url is provided (for instance: buildperf tests use an empty git directory to store tests). Fix those cases by putting back the old behavior (local tags check) as last resort, with at least a warning for future diagnostics if we still encounter tagging issues Fixes: e9cff55e73cc ("oeqa/utils/gitarchive: fix tag computation when creating archive") (From OE-Core rev: 34e1f845687d2f7169f5d6c1bb54e1a7ab5412c4) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils')
-rw-r--r--meta/lib/oeqa/utils/gitarchive.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/meta/lib/oeqa/utils/gitarchive.py b/meta/lib/oeqa/utils/gitarchive.py
index c15a44ce9e..ac36ecb3a9 100644
--- a/meta/lib/oeqa/utils/gitarchive.py
+++ b/meta/lib/oeqa/utils/gitarchive.py
@@ -116,18 +116,25 @@ def get_tags(repo, log, pattern=None, url=None):
116 cmd.append(pattern) 116 cmd.append(pattern)
117 try: 117 try:
118 tags_refs = repo.run_cmd(cmd) 118 tags_refs = repo.run_cmd(cmd)
119 tags = ["".join(d.split()[1].split('/', 2)[2:]) for d in tags_refs.splitlines()]
119 except GitError as e: 120 except GitError as e:
120 # If it fails, retry with repository url if one is provided 121 # If it fails, retry with repository url if one is provided
121 if not url: 122 if url:
122 raise(e) 123 log.info("No remote repository configured, use provided url")
123 log.info("No remote repository configured, use provided url") 124 cmd = base_cmd.copy()
124 cmd = base_cmd.copy() 125 cmd.append(url)
125 cmd.append(url) 126 if pattern:
126 if pattern: 127 cmd.append(pattern)
127 cmd.append(pattern) 128 tags_refs = repo.run_cmd(cmd)
128 tags_refs = repo.run_cmd(cmd) 129 tags = ["".join(d.split()[1].split('/', 2)[2:]) for d in tags_refs.splitlines()]
130 else:
131 log.warning("Read local tags only, some remote tags may be missed")
132 cmd = ["tag"]
133 if pattern:
134 cmd += ["-l", pattern]
135 tags = repo.run_cmd(cmd).splitlines()
129 136
130 return ["".join(d.split()[1].split('/', 2)[2:]) for d in tags_refs.splitlines()] 137 return tags
131 138
132def expand_tag_strings(repo, name_pattern, msg_subj_pattern, msg_body_pattern, 139def expand_tag_strings(repo, name_pattern, msg_subj_pattern, msg_body_pattern,
133 url, log, keywords): 140 url, log, keywords):