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/
57 rel=$(expr ${release} + 1)
69 # - PACKAGE/PACKAGE.spec
70 # - ./PACKAGE/PACKAGE.spec
71 # - rpm/PACKAGE/PACKAGE
72 # - rpm/PACKAGE/PACKAGE.spec
73 # - ./rpm/PACKAGE/PACKAGE.spec
76 local specfile="${1%/}" package
79 specfile=${specfile##*/}
81 package=${specfile%.spec}
86 if [ ! -x /usr/bin/getopt ]; then
87 echo >&1 "You need to install util-linux to use relup.sh"
91 t=$(getopt -o 'm:inuth' -n "${0##*/}" -- "$@") || exit $?
92 # Note the quotes around `$t': they are essential!
119 echo 2>&1 "Internal error: [$1] not recognized!"
126 topdir=$(rpm -E '%{_topdir}')
133 # pkg: package %{name}
134 pkg=$(package_name "$pkg")
136 # spec: package/package.spec
137 spec=$(rpm -D "name $pkg" -E '%{_specdir}/%{name}.spec')
138 spec=${spec#$topdir/}
147 if [ "$update" = "1" ]; then
148 ./builder -g -ns "$spec"
152 rel=$(get_release "$spec")
153 if [ "$inc" = 1 ]; then
154 if [[ $rel = *%* ]]; then
156 newrel=$(bump_release ${rel%%%*})
157 set_release "$spec" $rel "${newrel}%${relmacro}"
159 newrel=$(bump_release ${rel})
160 set_release "$spec" $rel $newrel
166 [ -n "$message" ] && msg="$msg- $message$n"
167 msg="$msg- release ${rel%%%*} (by relup.sh)"
168 echo git commit -m "$msg" $spec
169 if [ "$test" != 1 ]; then
171 git commit -m "$msg" $spec