From d379cc1a6ffaef53eade61cb3d7aafca9f2f1790 Mon Sep 17 00:00:00 2001 From: David Rheinsberg Date: Mon, 2 Mar 2020 21:24:25 +0100 Subject: [PATCH] build: merge bump-version.sh into local makefile We already have a makefile for maintenance work. Merge the `bump-version.sh` script into `Makefile` as a new target so we avoid placing scripts spread around the repository. While at it, this commit also uses immediate assignment for shell-evaluated make variables. This ensures the shell commands are only executed once, and then are guaranteed to be of the same value for the remainder of the execution. --- Makefile | 10 ++++++++-- bump-version.sh | 8 -------- 2 files changed, 8 insertions(+), 10 deletions(-) delete mode 100755 bump-version.sh diff --git a/Makefile b/Makefile index 777ffb51..c0c850fc 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ PACKAGE_NAME = osbuild -VERSION = $$(python3 setup.py --version) +VERSION := $(shell python3 setup.py --version) +NEXT_VERSION := $(shell expr "$(VERSION)" + 1) -.PHONY: sdist tarball srpm rpm copy-rpms-to-test check-working-directory vagrant-test vagrant-test-keep-running +.PHONY: sdist tarball srpm rpm copy-rpms-to-test check-working-directory vagrant-test vagrant-test-keep-running bump-version sdist: python3 setup.py sdist @@ -51,3 +52,8 @@ vagrant-test-keep-running: check-working-directory copy-rpms-to-test - $(MAKE) -C test up - $(MAKE) -C test install-deps $(MAKE) -C test run-tests-remotely + +bump-version: + sed -i "s|Version:\s*$(VERSION)|Version:\\t$(NEXT_VERSION)|" osbuild.spec + sed -i "s|Release:\s*[[:digit:]]\+|Release:\\t1|" osbuild.spec + sed -i "s|version=\"$(VERSION)\"|version=\"$(NEXT_VERSION)\"|" setup.py diff --git a/bump-version.sh b/bump-version.sh deleted file mode 100755 index e74462db..00000000 --- a/bump-version.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -current_version=$(python3 setup.py --version) -new_version=$(expr "${current_version}" + 1) - -sed -i "s|Version:\s*${current_version}|Version:\\t${new_version}|" osbuild.spec -sed -i "s|Release:\s*[[:digit:]]\+|Release:\\t1|" osbuild.spec -sed -i "s|version=\"${current_version}\"|version=\"${new_version}\"|" setup.py