diff options
author | Alexis Lothoré <alexis.lothore@bootlin.com> | 2023-08-23 12:35:19 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-08-23 22:33:39 +0100 |
commit | 3c1ee6d8b0f9d73148109522ce36daff0ad77f8b (patch) | |
tree | 3d447c89097ca113d56eaa601b6f77c12b6ac17a /meta/lib/oeqa/utils | |
parent | 92983dba651cffe5c11973d90aad00c581a79c93 (diff) | |
download | poky-3c1ee6d8b0f9d73148109522ce36daff0ad77f8b.tar.gz |
oeqa/utils/gitarchive: allow to pass a logger to get_tags
Propagate a "log" parameter to get_tags in order to know what method is
used to retrieve existing tags
(From OE-Core rev: f8212eda45444dfb330e4d930eeceefde936adeb)
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.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/meta/lib/oeqa/utils/gitarchive.py b/meta/lib/oeqa/utils/gitarchive.py index 1a28a09efe..c15a44ce9e 100644 --- a/meta/lib/oeqa/utils/gitarchive.py +++ b/meta/lib/oeqa/utils/gitarchive.py | |||
@@ -100,7 +100,7 @@ def git_commit_data(repo, data_dir, branch, message, exclude, notes, log): | |||
100 | if os.path.exists(tmp_index): | 100 | if os.path.exists(tmp_index): |
101 | os.unlink(tmp_index) | 101 | os.unlink(tmp_index) |
102 | 102 | ||
103 | def get_tags(repo, pattern=None, url=None): | 103 | def get_tags(repo, log, pattern=None, url=None): |
104 | """ Fetch remote tags from current repository | 104 | """ Fetch remote tags from current repository |
105 | 105 | ||
106 | A pattern can be provided to filter returned tags list | 106 | A pattern can be provided to filter returned tags list |
@@ -120,6 +120,7 @@ def get_tags(repo, pattern=None, url=None): | |||
120 | # If it fails, retry with repository url if one is provided | 120 | # If it fails, retry with repository url if one is provided |
121 | if not url: | 121 | if not url: |
122 | raise(e) | 122 | raise(e) |
123 | log.info("No remote repository configured, use provided url") | ||
123 | cmd = base_cmd.copy() | 124 | cmd = base_cmd.copy() |
124 | cmd.append(url) | 125 | cmd.append(url) |
125 | if pattern: | 126 | if pattern: |
@@ -129,7 +130,7 @@ def get_tags(repo, pattern=None, url=None): | |||
129 | return ["".join(d.split()[1].split('/', 2)[2:]) for d in tags_refs.splitlines()] | 130 | return ["".join(d.split()[1].split('/', 2)[2:]) for d in tags_refs.splitlines()] |
130 | 131 | ||
131 | def expand_tag_strings(repo, name_pattern, msg_subj_pattern, msg_body_pattern, | 132 | def expand_tag_strings(repo, name_pattern, msg_subj_pattern, msg_body_pattern, |
132 | url, keywords): | 133 | url, log, keywords): |
133 | """Generate tag name and message, with support for running id number""" | 134 | """Generate tag name and message, with support for running id number""" |
134 | keyws = keywords.copy() | 135 | keyws = keywords.copy() |
135 | # Tag number is handled specially: if not defined, we autoincrement it | 136 | # Tag number is handled specially: if not defined, we autoincrement it |
@@ -143,7 +144,7 @@ def expand_tag_strings(repo, name_pattern, msg_subj_pattern, msg_body_pattern, | |||
143 | tag_re = tag_re.format(tag_number='(?P<tag_number>[0-9]{1,5})') | 144 | tag_re = tag_re.format(tag_number='(?P<tag_number>[0-9]{1,5})') |
144 | 145 | ||
145 | keyws['tag_number'] = 0 | 146 | keyws['tag_number'] = 0 |
146 | for existing_tag in get_tags(repo, url=url): | 147 | for existing_tag in get_tags(repo, log, url=url): |
147 | match = re.match(tag_re, existing_tag) | 148 | match = re.match(tag_re, existing_tag) |
148 | 149 | ||
149 | if match and int(match.group('tag_number')) >= keyws['tag_number']: | 150 | if match and int(match.group('tag_number')) >= keyws['tag_number']: |
@@ -171,7 +172,7 @@ def gitarchive(data_dir, git_dir, no_create, bare, commit_msg_subject, commit_ms | |||
171 | tag_name, tag_msg = expand_tag_strings(data_repo, tagname, | 172 | tag_name, tag_msg = expand_tag_strings(data_repo, tagname, |
172 | tag_msg_subject, | 173 | tag_msg_subject, |
173 | tag_msg_body, | 174 | tag_msg_body, |
174 | push, keywords) | 175 | push, log, keywords) |
175 | 176 | ||
176 | # Commit data | 177 | # Commit data |
177 | commit = git_commit_data(data_repo, data_dir, branch_name, | 178 | commit = git_commit_data(data_repo, data_dir, branch_name, |
@@ -209,7 +210,7 @@ def get_test_runs(log, repo, tag_name, **kwargs): | |||
209 | 210 | ||
210 | # Get a list of all matching tags | 211 | # Get a list of all matching tags |
211 | tag_pattern = tag_name.format(**str_fields) | 212 | tag_pattern = tag_name.format(**str_fields) |
212 | tags = get_tags(repo, pattern=tag_pattern) | 213 | tags = get_tags(repo, log, pattern=tag_pattern) |
213 | log.debug("Found %d tags matching pattern '%s'", len(tags), tag_pattern) | 214 | log.debug("Found %d tags matching pattern '%s'", len(tags), tag_pattern) |
214 | 215 | ||
215 | # Parse undefined fields from tag names | 216 | # Parse undefined fields from tag names |