summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri Merejkowsky2016-01-12 15:31:03 +0100
committerDimitri Merejkowsky2016-01-12 15:31:03 +0100
commit735ff3fdbd9fe28082b5e636ff9fd972870d6918 (patch)
tree4abc922db5056583b6860f17237714ab9fd69453
parent6fb5afc4141ce930c050dcb9a6fec157b1cb01f7 (diff)
downloadaur-735ff3fdbd9fe28082b5e636ff9fd972870d6918.tar.gz
make-release: reset pkgrel when version changes
-rw-r--r--make-release.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/make-release.py b/make-release.py
index cb6df476a85..7fb158a87e8 100644
--- a/make-release.py
+++ b/make-release.py
@@ -18,12 +18,16 @@ def clean():
def set_version(version):
+ version_changed = False
pkgbuild = os.path.join(THIS_DIR, "PKGBUILD")
with open(pkgbuild, "r") as fp:
lines = fp.readlines()
new_lines = list()
for line in lines:
if line.startswith("pkgver"):
+ previous_version = line.split("=")[1]
+ if previous_version != version:
+ version_changed = True
new_line = "pkgver='%s'\n" % version
new_lines.append(new_line)
else:
@@ -31,6 +35,21 @@ def set_version(version):
with open(pkgbuild, "w") as fp:
fp.writelines(new_lines)
+ return version_changed
+
+def reset_pkgrel():
+ pkgbuild = os.path.join(THIS_DIR, "PKGBUILD")
+ with open(pkgbuild, "r") as fp:
+ lines = fp.readlines()
+ new_lines = list()
+ for line in lines:
+ if line.startswith("pkgrel"):
+ new_line = "pkgrel='1'\n"
+ new_lines.append(new_line)
+ else:
+ new_lines.append(line)
+ with open(pkgbuild, "w") as fp:
+ fp.writelines(new_lines)
def set_checksums():
cmd = ["/usr/bin/updpkgsums"]
@@ -61,7 +80,9 @@ def push():
def make_release(version):
clean()
- set_version(version)
+ version_changed = set_version(version)
+ if version_changed:
+ reset_pkgrel()
set_checksums()
run_makepkg()
update_srcinfo()