Martin Sivák has uploaded a new change for review.

Change subject: Automatize version manipulation and releases
......................................................................

Automatize version manipulation and releases

Change-Id: I82fb8e250991a9594f0186531f21317a81cbdd30
Signed-off-by: Martin Sivak <[email protected]>
---
M Makefile
A build-aux/bumpver.sh
2 files changed, 48 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-scheduler-proxy 
refs/changes/48/25148/1

diff --git a/Makefile b/Makefile
index 97c2eff..a5c0ae1 100644
--- a/Makefile
+++ b/Makefile
@@ -15,10 +15,19 @@
 #
 
 NAME=ovirt-scheduler-proxy
-VERSION=$(shell cat VERSION)
+VERSION=$(shell cat VERSION | tr -d '\n')
+LASTVERSION=$(shell git describe --abbrev=0 --tags | tr -d '\n')
 TARBALL=$(NAME)-$(VERSION).tar.gz
 
+AUTHOR=$(shell git config user.name)
+EMAIL=$(shell git config user.email)
+
 all: test pep8
+
+version:
+       git describe --tags >VERSION
+
+VERSION: version
 
 $(NAME).spec: $(NAME).spec.in VERSION
        sed -e 's/{VERSION}/$(VERSION)/g' $< >$@
@@ -26,8 +35,30 @@
 tarball: $(NAME).spec VERSION
        tar --xform='s,^,$(NAME)-$(VERSION)/,' -c -z -f $(TARBALL) `git 
ls-files` $(NAME).spec
 
+bumpver:
+       build-aux/bumpver.sh "$(LASTVERSION)" >VERSION
+       @echo "New version is $(VERSION)"
+
 tag:
        git tag $(VERSION)
+
+changelog:
+       @grep '$(VERSION)-1' $(NAME).spec.in || \
+       echo "Create a changelog entry first:" && \
+       echo "$(shell LANG=C date +"%a %b %d %Y") $(AUTHOR) <$(EMAIL)> 
$(VERSION)-1" && \
+       false
+
+release: checkclean bumpver all changelog tarball commit tag
+       @echo "Release $(VERSION) created successfully."
+       @echo "Push using git push origin HEAD:refs/for/master"
+       @echo "Once reviewed push tags using git push $(VERSION)"
+
+checkclean:
+       @echo "Checking if there are no uncommited changes..."
+       @git status --porcelain | grep -v "\\?\\?"
+
+commit:
+       git commit -a -m "Release of version $(VERSION)"
 
 srpm: tarball
        rpmbuild -ts $(TARBALL)
@@ -59,3 +90,5 @@
        $(MAKE) stop
        $(MAKE) start
 
+.PHONY: checkclean commit version bumpver release all test pythontest javatest 
start stop pep8 clean restart rpm srpm tag tarball
+
diff --git a/build-aux/bumpver.sh b/build-aux/bumpver.sh
new file mode 100755
index 0000000..88b4479
--- /dev/null
+++ b/build-aux/bumpver.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+declare -a part=( ${1//\./ } )
+declare    new
+declare -i carry=1
+
+for (( CNTR=${#part[@]}-1; CNTR>=0; CNTR-=1 )); do
+    len=${#part[CNTR]}
+    new=$((part[CNTR]+carry))
+    [ ${#new} -gt $len ] && carry=1 || carry=0
+    [ $CNTR -gt 0 ] && part[CNTR]=${new: -len} || part[CNTR]=${new}
+done
+new="${part[*]}"
+echo -ne "${new// /.}"
+


-- 
To view, visit http://gerrit.ovirt.org/25148
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82fb8e250991a9594f0186531f21317a81cbdd30
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-scheduler-proxy
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to