From d5f20d08198d5c5c7f28f8e93d44af1da939c511 Mon Sep 17 00:00:00 2001
From: sixg0000d <sixg0000d@gmail.com>
Date: Sep 04 2021 17:46:16 +0000
Subject: [PATCH 1/3] Remove dist tag from changelog


---

diff --git a/go2rpm/__main__.py b/go2rpm/__main__.py
index 81daa22..9113e83 100644
--- a/go2rpm/__main__.py
+++ b/go2rpm/__main__.py
@@ -660,15 +660,9 @@ def main():
         kwargs["auto_changelog_entry"] = True
 
     if version is None and tag is None:
-        if kwargs["rpmautospec"]:
-            kwargs["pkg_release"] = "%autorelease -p"
-        else:
-            kwargs["pkg_release"] = "0.1%{?dist}"
+        kwargs["pkg_release"] = "0.1"
     else:
-        if kwargs["rpmautospec"]:
-            kwargs["pkg_release"] = "%autorelease"
-        else:
-            kwargs["pkg_release"] = "1%{?dist}"
+        kwargs["pkg_release"] = "1"
 
     kwargs["date"] = time.strftime("%a %b %d %Y")
     kwargs["shortdate"] = time.strftime("%Y%m%d")
diff --git a/go2rpm/templates/profile1.spec b/go2rpm/templates/profile1.spec
index 79e8b3d..d23205e 100644
--- a/go2rpm/templates/profile1.spec
+++ b/go2rpm/templates/profile1.spec
@@ -32,7 +32,11 @@ Name:           %{goname}
 {% if version is none and tag is none %}
 Version:        0
 {% endif %}
-Release:        {{ pkg_release }}
+{% if rpmautospec %}
+Release:        %autorelease{% if version is none and tag is none %} -p{% endif %}
+{% else %}
+Release:        {{ pkg_release }}%{?dist}
+{% endif %}
 Summary:        {{ summary|default("# FIXME") }}
 
 {% if licenses != license %}
diff --git a/go2rpm/templates/profile2.spec b/go2rpm/templates/profile2.spec
index 159f46f..cfd3d96 100644
--- a/go2rpm/templates/profile2.spec
+++ b/go2rpm/templates/profile2.spec
@@ -37,7 +37,11 @@ Name:           %{goname}
 {% if version is none and tag is none %}
 Version:        0
 {% endif %}
-Release:        {{ pkg_release }}
+{% if rpmautospec %}
+Release:        %autorelease{% if version is none and tag is none %} -p{% endif %}
+{% else %}
+Release:        {{ pkg_release }}%{?dist}
+{% endif %}
 Summary:        {{ summary|default("# FIXME") }}
 
 {% if licenses != license %}

From b91e3e1f5b496fd55415e77e2584edf2027cafbe Mon Sep 17 00:00:00 2001
From: sixg0000d <sixg0000d@gmail.com>
Date: Sep 04 2021 18:01:17 +0000
Subject: [PATCH 2/3] Remove the 2nd empty line when rpmautospec


---

diff --git a/go2rpm/__main__.py b/go2rpm/__main__.py
index 9113e83..04f51c6 100644
--- a/go2rpm/__main__.py
+++ b/go2rpm/__main__.py
@@ -685,7 +685,6 @@ def main():
     else:
         with open(spec_file, "w") as fobj:
             fobj.write(spec_contents)
-            fobj.write("\n")
 
 
 if __name__ == "__main__":
diff --git a/go2rpm/templates/profile1.spec b/go2rpm/templates/profile1.spec
index d23205e..c7c3b1d 100644
--- a/go2rpm/templates/profile1.spec
+++ b/go2rpm/templates/profile1.spec
@@ -163,7 +163,7 @@ ln -s %{gopath}/src/%{goipath} %{buildroot}%{gopath}/src/%{altipath{{ loop.index
 %changelog
 {% if rpmautospec %}
 %autochangelog
-{%- else %}
+{% else %}
 {% if auto_changelog_entry %}
 {% if version is none and tag is none and commit is not none %}
 * {{ date }} {{ packager|default("go2rpm <nobody@fedoraproject.org>") }} - 0-{{ pkg_release }}.{{ shortdate }}git{{ shortcommit }}
diff --git a/go2rpm/templates/profile2.spec b/go2rpm/templates/profile2.spec
index cfd3d96..2f0e625 100644
--- a/go2rpm/templates/profile2.spec
+++ b/go2rpm/templates/profile2.spec
@@ -123,7 +123,7 @@ install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
 %changelog
 {% if rpmautospec %}
 %autochangelog
-{%- else %}
+{% else %}
 {% if auto_changelog_entry %}
 {% if version is none and tag is none and commit is not none %}
 * {{ date }} {{ packager|default("go2rpm <nobody@fedoraproject.org>") }} - 0-{{ pkg_release }}.{{ shortdate }}git{{ shortcommit }}

From 7d6622d64b799167ede5563f943a5c0a80ac8254 Mon Sep 17 00:00:00 2001
From: sixg0000d <sixg0000d@gmail.com>
Date: Sep 20 2021 05:22:16 +0000
Subject: [PATCH 3/3] Fix no new line when use autorelease


---

diff --git a/go2rpm/__main__.py b/go2rpm/__main__.py
index 04f51c6..ee8872c 100644
--- a/go2rpm/__main__.py
+++ b/go2rpm/__main__.py
@@ -660,8 +660,10 @@ def main():
         kwargs["auto_changelog_entry"] = True
 
     if version is None and tag is None:
+        kwargs["pkg_autorelease"] = "%autorelease -p"
         kwargs["pkg_release"] = "0.1"
     else:
+        kwargs["pkg_autorelease"] = "%autorelease"
         kwargs["pkg_release"] = "1"
 
     kwargs["date"] = time.strftime("%a %b %d %Y")
diff --git a/go2rpm/templates/profile1.spec b/go2rpm/templates/profile1.spec
index c7c3b1d..8987559 100644
--- a/go2rpm/templates/profile1.spec
+++ b/go2rpm/templates/profile1.spec
@@ -33,7 +33,7 @@ Name:           %{goname}
 Version:        0
 {% endif %}
 {% if rpmautospec %}
-Release:        %autorelease{% if version is none and tag is none %} -p{% endif %}
+Release:        {{ pkg_autorelease }}
 {% else %}
 Release:        {{ pkg_release }}%{?dist}
 {% endif %}
diff --git a/go2rpm/templates/profile2.spec b/go2rpm/templates/profile2.spec
index 2f0e625..d3a1035 100644
--- a/go2rpm/templates/profile2.spec
+++ b/go2rpm/templates/profile2.spec
@@ -38,7 +38,7 @@ Name:           %{goname}
 Version:        0
 {% endif %}
 {% if rpmautospec %}
-Release:        %autorelease{% if version is none and tag is none %} -p{% endif %}
+Release:        {{ pkg_autorelease }}
 {% else %}
 Release:        {{ pkg_release }}%{?dist}
 {% endif %}

