diff --git a/src/tito/builder/main.py b/src/tito/builder/main.py index d475fd84..8e8e7aa8 100644 --- a/src/tito/builder/main.py +++ b/src/tito/builder/main.py @@ -492,8 +492,8 @@ def _get_tag_for_version(self, version_and_release): '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): """ diff --git a/src/tito/common.py b/src/tito/common.py index 2b942efc..c080629e 100644 --- a/src/tito/common.py +++ b/src/tito/common.py @@ -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: diff --git a/src/tito/tagger/main.py b/src/tito/tagger/main.py index 45016683..47fe5632 100644 --- a/src/tito/tagger/main.py +++ b/src/tito/tagger/main.py @@ -489,7 +489,7 @@ def _update_package_metadata(self, new_version): 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) diff --git a/src/tito/tagger/susetagger.py b/src/tito/tagger/susetagger.py index 74cbc6b0..fd0172d8 100644 --- a/src/tito/tagger/susetagger.py +++ b/src/tito/tagger/susetagger.py @@ -192,7 +192,7 @@ def _update_package_metadata(self, new_version): (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)