about summary refs log tree commit diff
path: root/xbump
blob: 0d8f527e93134098099e6ee6133d2aef23269c2f (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
31
32
33
34
35
36
37
#!/bin/sh -e
# xbump PKGNAME [git commit options] - git commit a new package or package update

cd $(xdistdir)

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

if [ -z "$version" ]; then
	echo cannot parse version
	exit 1
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
	dirs=common/shlibs
fi

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

git add $dirs

if git diff --quiet --cached --diff-filter=A -- srcpkgs/"$pkg"/template; then
	msg="$pkg: update to $version."
else
	msg="New package: $pkg-$version"
fi

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