substitute tilde ~ with at @ for git tags

Closes: #377
This commit is contained in:
Matthias Blümel 2020-09-11 13:28:30 +02:00
parent 5575554c95
commit 95e723feac
4 changed files with 11 additions and 11 deletions

View file

@ -492,8 +492,8 @@ class Builder(ConfigObject, BuilderBase):
'version': version,
'release': release
}
# Strip extra dashes if one of the params is empty
return tag_format.format(**kwargs).strip('-')
# Strip extra dashes if one of the params is empty and replace ~ by @
return tag_format.format(**kwargs).strip('-').replace("~", "@")
def copy_extra_sources(self):
"""

View file

@ -399,7 +399,7 @@ def render_cheetah(template_file, destination_directory, cheetah_input):
def tag_exists_locally(tag):
(status, output) = getstatusoutput("git tag | grep %s" % tag)
(status, output) = getstatusoutput("git tag | grep %s" % tag.replace("~", "@"))
if status > 0:
return False
else:
@ -423,7 +423,7 @@ def tag_exists_remotely(tag):
def get_local_tag_sha1(tag):
tag_sha1 = run_command(
"git ls-remote ./. --tag %s | awk '{ print $1 ; exit }'"
% tag)
% tag.replace("~", "@"))
tag_sha1 = extract_sha1(tag_sha1)
return tag_sha1
@ -438,7 +438,7 @@ def head_points_to_tag(tag):
"""
debug("Checking that HEAD commit is %s" % tag)
head_sha1 = run_command("git rev-list --max-count=1 HEAD")
tag_sha1 = run_command("git rev-list --max-count=1 %s" % tag)
tag_sha1 = run_command("git rev-list --max-count=1 %s" % tag.replace("~", "@"))
debug(" head_sha1 = %s" % head_sha1)
debug(" tag_sha1 = %s" % tag_sha1)
return head_sha1 == tag_sha1
@ -455,7 +455,7 @@ def undo_tag(tag):
# Using --merge here as it appears to undo the changes in the commit,
# but preserve any modified files:
output = run_command("git tag -d %s && git reset --merge HEAD^1" % tag)
output = run_command("git tag -d %s && git reset --merge HEAD^1" % tag.replace("~", "@"))
print(output)
@ -483,7 +483,7 @@ def get_remote_tag_sha1(tag):
repo_url = get_git_repo_url()
print("Checking for tag [%s] in git repo [%s]" % (tag, repo_url))
cmd = "git ls-remote %s --tag %s | awk '{ print $1 ; exit }'" % \
(repo_url, tag)
(repo_url, tag.replace("~", "@"))
upstream_tag_sha1 = run_command(cmd)
upstream_tag_sha1 = extract_sha1(upstream_tag_sha1)
return upstream_tag_sha1
@ -788,7 +788,7 @@ def get_build_commit(tag, test=False):
else:
tag_sha1 = run_command(
"git ls-remote ./. --tag %s | awk '{ print $1 ; exit }'"
% tag)
% tag.replace("~", "@"))
tag_sha1 = extract_sha1(tag_sha1)
commit_id = run_command('git rev-list --max-count=1 %s' % tag_sha1)
return commit_id
@ -800,7 +800,7 @@ def get_commit_count(tag, commit_id):
# just the tag.
#
# so we need to pass in the tag as well.
# output = run_command("git describe --match=%s %s" % (tag, commit_id))
# output = run_command("git describe --match=%s %s" % (tag.replace("~", "@"), commit_id))
# if tag == output:
# return 0
# else:

View file

@ -489,7 +489,7 @@ class VersionTagger(ConfigObject):
run_command('git commit -m {0} -m {1} -m {2}'.format(
quote(msg), quote("Created by command:"), quote(" ".join(sys.argv[:]))))
new_tag = self._get_new_tag(new_version)
new_tag = self._get_new_tag(new_version).replace('~', '@')
tag_msg = "Tagging package [%s] version [%s] in directory [%s]." % \
(self.project_name, new_tag,
self.relative_project_dir)

View file

@ -192,7 +192,7 @@ class SUSETagger(VersionTagger):
(self.project_name, new_version_w_suffix,
self.relative_project_dir)
new_tag = self._get_new_tag(new_version)
new_tag = self._get_new_tag(new_version).replace('~', '@')
run_command('git tag -m "%s" %s' % (tag_msg, new_tag))
print
print("Created tag: %s" % new_tag)