SPECS: verup.sh (NEW) - something that evolved from relup.sh
glen
glen at pld-linux.org
Sun Apr 2 13:25:10 CEST 2006
Author: glen Date: Sun Apr 2 11:25:10 2006 GMT
Module: SPECS Tag: HEAD
---- Log message:
- something that evolved from relup.sh
---- Files affected:
SPECS:
verup.sh (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SPECS/verup.sh
diff -u /dev/null SPECS/verup.sh:1.1
--- /dev/null Sun Apr 2 13:25:10 2006
+++ SPECS/verup.sh Sun Apr 2 13:25:04 2006
@@ -0,0 +1,51 @@
+#!/bin/sh
+# script to run after version change.
+# takes Version from spec and creates commit with message
+# groups similiar commits together.
+# "- $ver"
+# - fails when specfile defines Icon: but the icon is not present in SOURCES
+# TODO
+# - optional message after rel: "- up to 1.1.9 (soname changed)"
+# - check if release is not integer and complain
+# - interactive support (like adapter that asks)
+
+set -e
+specfile="$1"
+
+get_dump() {
+ local specfile="$1"
+ if ! out=$(rpm --specfile "$specfile" --define 'prep %dump' -q 2>&1); then
+ echo >&2 "$out"
+ echo >&2 "You need icon files being present in SOURCES."
+ exit 1
+ fi
+ echo "$out"
+}
+
+# here's the brain of this script
+get_version() {
+ local specfile="$1"
+
+ dump=$(get_dump "$specfile")
+ version=$(echo "$dump" | awk '/PACKAGE_VERSION/{print $NF; exit}')
+ rc=$(awk '/^%define[ ]*_rc[ ]/{print $NF}' $specfile)
+ if [[ $specfile == *php-pear-* ]]; then
+ status=$(cvs diff -u $specfile | awk '/^\+%define[ ]*_status[ ]*/{print $NF}')
+ newpkg=$(cvs diff -u $specfile | awk '/^\+%package/{printf(" (added %s package)", $2)}')
+ fi
+ echo "$version$rc${status:+ $status}$newpkg"
+}
+
+tmpd=$(mktemp -d "${TMPDIR:-/tmp}/relXXXXXX")
+for spec in "$@"; do
+ rel=$(get_version "$spec")
+ echo "$spec" >> "$tmpd/$rel"
+done
+
+# batch commit
+ls -1 "$tmpd" 2>/dev/null | while read file; do
+ files=$(cat "$tmpd/$file")
+ rel=$(basename "$file")
+ cvs ci -m "- $rel" $files
+done
+rm -rf $tmpd
================================================================
More information about the pld-cvs-commit
mailing list