[packages/rpm-build-tools] geoip: add autocommit

glen glen at pld-linux.org
Tue Sep 1 14:21:15 CEST 2015


commit a7085f49763accc5e30a7d34d15e55be1a668a66
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Tue Sep 1 15:21:03 2015 +0300

    geoip: add autocommit

 update-geoip.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/update-geoip.sh b/update-geoip.sh
index 6dbfb1a..82a0046 100755
--- a/update-geoip.sh
+++ b/update-geoip.sh
@@ -2,14 +2,18 @@
 # Update GeoIP packages to new version provided by MaxMind.
 #
 # Author: Elan Ruusamäe <glen at pld-linux.org>
+#
+# Changelog:
 # 2012-07-04 Created initial version
 # 2014-03-04 Rewritten to be smarter when checking for updates avoiding full download if no changes.
 # 2014-06-06 Fix finding new versions if multiple previous archives were present
+# 2015-08-25 Add auto commit support
 
 set -e
 
 update=false
 status=false
+commit=true
 while [ $# -gt 0 ]; do
 	case "$1" in
 	update|-u|-update|--update)
@@ -85,6 +89,12 @@ update_version() {
 	out=$(builder -bb $specfile 2>&1) || echo "$out"
 }
 
+commit_vcs() {
+	local specfile="$1" version="$2"
+
+	git commit -m "updated to $version" $specfile
+}
+
 # get version from package files
 # set $version variable
 version_from_files() {
@@ -133,6 +143,9 @@ for pkg in ${*:-$pkgs}; do
 	oldvers=$(awk '/^Version:[ 	]+/{print $NF}' $specfile)
 	if [ "$oldvers" != "$version" ]; then
 		update_version $specfile $version
+		if $commit; then
+			commit_vcs $specfile $version
+		fi
 	fi
 	cd ..
 done
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/a7085f49763accc5e30a7d34d15e55be1a668a66



More information about the pld-cvs-commit mailing list