2 # script to run after "release bump" style change.
3 # takes Release from spec and creates commit with message
4 # groups similiar commits together.
11 if ! out=$(rpm --specfile "$specfile" --define 'prep %dump' -q 2>&1); then
13 echo >&2 "You need icon files being present in SOURCES."
20 ${0##*/} [-i] [-u] [-t] [-n] [-m <MESSAGE>] <SPECLIST>
24 Try to increment package release
28 Test mode (dry-run). do not commit
30 Specify commit message
36 rel=$(awk '/^%define[ ]+_?rel[ ]+/{print $NF}' $specfile)
37 if [ -z "$rel" ]; then
38 dump=$(get_dump "$specfile")
39 rel=$(echo "$dump" | awk '/PACKAGE_RELEASE/{print $NF; exit}')
49 s/^\(%define[ \t]\+_\?rel[ \t]\+\)$rel\$/\1$newrel/
50 s/^\(Release:[ \t]\+\)$rel\$/\1$newrel/
54 if [ ! -x /usr/bin/getopt ]; then
55 echo >&1 "You need to install util-linux to use relup.sh"
59 t=$(getopt -o 'm:inuth' -n "${0##*/}" -- "$@") || exit $?
60 # Note the quotes around `$t': they are essential!
87 echo 2>&1 "Internal error: [$1] not recognized!"
94 tmpd=$(mktemp -d "${TMPDIR:-/tmp}/relXXXXXX")
95 topdir=$(rpm -E '%{_topdir}')
98 name=${pkg%.spec} name=${name##*/}
99 spec=$(rpm -D "name $name" -E '%{_specdir}/%{name}.spec')
100 spec=${spec#$topdir/}
101 if [ "$update" = "1" ]; then
102 ./builder -g -ns "$spec"
104 rel=$(get_release "$spec")
105 if [ "$inc" = 1 ]; then
106 if [[ $rel = *%* ]]; then
109 newrel=$(expr ${relnum} + 1)
110 set_release "$spec" $rel "${newrel}%${relmacro}"
112 newrel=$(expr ${rel} + 1)
113 set_release "$spec" $rel $newrel
117 rel=$(get_release "$spec")
119 echo "$spec" >> "$tmpd/$rel"
124 for file in $(ls "$tmpd" 2>/dev/null); do
125 files=$(cat "$tmpd/$file")
126 pkg=$(cat "$tmpd/$file" |sed -e 's|/.*||')
127 spec=$(cat "$tmpd/$file" |sed -e 's|.*/||')
128 rel=$(basename "$file")
130 [ -n "$message" ] && msg="$msg- $message$n"
131 msg="$msg- release ${rel%%%*} (by relup.sh)$n"
132 if [ "$test" != 1 ]; then
134 git commit -m "$msg" $spec