diff options
author | Steve Sakoman <steve@sakoman.com> | 2023-11-12 16:35:35 -1000 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2023-11-12 16:38:12 -1000 |
commit | b4fc02f9414ff16b541669150cabe0d79a95f155 (patch) | |
tree | 1409de6b0aa51bc69403d1f149f5127f1e37b174 | |
parent | 028ef3991e952797bd89435be1439bdde5009af4 (diff) | |
download | poky-b4fc02f9414ff16b541669150cabe0d79a95f155.tar.gz |
Revert "oeqa/utils/gitarchive: fix tag computation when creating archive"
This reverts commit b0d96ea432196800fedb45e6d1da44a3523fad63.
This caused failures on the build performance tests on the autobuilder.
(From OE-Core rev: c337b5a45d43eefee171e7043f70cf19e6eb2cce)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | meta/lib/oeqa/utils/gitarchive.py | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/meta/lib/oeqa/utils/gitarchive.py b/meta/lib/oeqa/utils/gitarchive.py index 2bb1bde774..cd60a605d4 100644 --- a/meta/lib/oeqa/utils/gitarchive.py +++ b/meta/lib/oeqa/utils/gitarchive.py | |||
@@ -100,36 +100,9 @@ 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): | ||
104 | """ Fetch remote tags from current repository | ||
105 | |||
106 | A pattern can be provided to filter returned tags list | ||
107 | An URL can be provided if local repository has no valid remote configured | ||
108 | """ | ||
109 | |||
110 | base_cmd = ['ls-remote', '--refs', '--tags', '-q'] | ||
111 | cmd = base_cmd.copy() | ||
112 | |||
113 | # First try to fetch tags from repository configured remote | ||
114 | cmd.append('origin') | ||
115 | if pattern: | ||
116 | cmd.append(pattern) | ||
117 | try: | ||
118 | tags_refs = repo.run_cmd(cmd) | ||
119 | except GitError as e: | ||
120 | # If it fails, retry with repository url if one is provided | ||
121 | if not url: | ||
122 | raise(e) | ||
123 | cmd = base_cmd.copy() | ||
124 | cmd.append(url) | ||
125 | if pattern: | ||
126 | cmd.append(pattern) | ||
127 | tags_refs = repo.run_cmd(cmd) | ||
128 | |||
129 | return ["".join(d.split()[1].split('/', 2)[2:]) for d in tags_refs.splitlines()] | ||
130 | 103 | ||
131 | def expand_tag_strings(repo, name_pattern, msg_subj_pattern, msg_body_pattern, | 104 | def expand_tag_strings(repo, name_pattern, msg_subj_pattern, msg_body_pattern, |
132 | url, keywords): | 105 | keywords): |
133 | """Generate tag name and message, with support for running id number""" | 106 | """Generate tag name and message, with support for running id number""" |
134 | keyws = keywords.copy() | 107 | keyws = keywords.copy() |
135 | # Tag number is handled specially: if not defined, we autoincrement it | 108 | # Tag number is handled specially: if not defined, we autoincrement it |
@@ -143,7 +116,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})') | 116 | tag_re = tag_re.format(tag_number='(?P<tag_number>[0-9]{1,5})') |
144 | 117 | ||
145 | keyws['tag_number'] = 0 | 118 | keyws['tag_number'] = 0 |
146 | for existing_tag in get_tags(repo, url=url): | 119 | for existing_tag in repo.run_cmd('tag').splitlines(): |
147 | match = re.match(tag_re, existing_tag) | 120 | match = re.match(tag_re, existing_tag) |
148 | 121 | ||
149 | if match and int(match.group('tag_number')) >= keyws['tag_number']: | 122 | if match and int(match.group('tag_number')) >= keyws['tag_number']: |
@@ -170,8 +143,7 @@ def gitarchive(data_dir, git_dir, no_create, bare, commit_msg_subject, commit_ms | |||
170 | if not no_tag and tagname: | 143 | if not no_tag and tagname: |
171 | tag_name, tag_msg = expand_tag_strings(data_repo, tagname, | 144 | tag_name, tag_msg = expand_tag_strings(data_repo, tagname, |
172 | tag_msg_subject, | 145 | tag_msg_subject, |
173 | tag_msg_body, | 146 | tag_msg_body, keywords) |
174 | push, keywords) | ||
175 | 147 | ||
176 | # Commit data | 148 | # Commit data |
177 | commit = git_commit_data(data_repo, data_dir, branch_name, | 149 | commit = git_commit_data(data_repo, data_dir, branch_name, |
@@ -209,7 +181,7 @@ def get_test_runs(log, repo, tag_name, **kwargs): | |||
209 | 181 | ||
210 | # Get a list of all matching tags | 182 | # Get a list of all matching tags |
211 | tag_pattern = tag_name.format(**str_fields) | 183 | tag_pattern = tag_name.format(**str_fields) |
212 | tags = get_tags(repo, pattern=tag_pattern) | 184 | tags = repo.run_cmd(['tag', '-l', tag_pattern]).splitlines() |
213 | log.debug("Found %d tags matching pattern '%s'", len(tags), tag_pattern) | 185 | log.debug("Found %d tags matching pattern '%s'", len(tags), tag_pattern) |
214 | 186 | ||
215 | # Parse undefined fields from tag names | 187 | # Parse undefined fields from tag names |