about summary refs log tree commit diff
path: root/xbump
blob: 9de58336a2d619f142147f553677c73b44713504 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh -e
# xbump PKGNAME [git commit options] - git commit a version bump

cd $(xdistdir)

pkg=$1; shift
[ -z "$pkg" ] && pkg=`basename $PWD`
version=$(./xbps-src show "$pkg" | sed -n '/^version/s/[^:]*:[\t]*//p')

if [ -n "$(git ls-files srcpkgs/"$pkg"/template)" ]; then
	msg="$pkg: update to $version."
else
	msg="New package: $pkg-$version"
fi

spkpattern=`xsubpkg "$pkg" | tr '\n' '|' | sed 's/\(.*\)|/^(\1)$/'`
shlibs=`git diff common/shlibs | grep "^+[^+]" | \
	sed "s/^+[^ ]\+ \(.*\)-[^-]\+_[0-9]\+$/\1/"`
if [ -n "`echo "$shlibs" | grep -vE "$spkpattern"`" ]; then
	echo "common/shlibs contains uncommitted changes for other packages." 2>&1
	exit 1
elif [ -n "$shlibs" ]; then
	git add common/shlibs
fi

dirs=$(./xbps-src show "$pkg" |
	sed -n '/^\(pkgname\|subpackage\)/s/[^:]*:[\t]*/srcpkgs\//p')

git add $dirs
git commit -m "$msg" "$@" $dirs