summary refs log tree commit diff
path: root/xbump
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2014-09-15 02:07:14 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2014-09-15 02:07:14 +0200
commit9dd1336424ad49a3581aaf580319b205a7965dd4 (patch)
tree49d3256c38008fb4f7c5dc742a87d980cde93b03 /xbump
parent62b3fdae6eece0c0fceec406c391f48b53e455a3 (diff)
downloadxtools-9dd1336424ad49a3581aaf580319b205a7965dd4.tar.gz
xtools-9dd1336424ad49a3581aaf580319b205a7965dd4.tar.xz
xtools-9dd1336424ad49a3581aaf580319b205a7965dd4.zip
xbump: use xdistdir, detect new packages, add subpackages
Diffstat (limited to 'xbump')
-rwxr-xr-xxbump19
1 files changed, 14 insertions, 5 deletions
diff --git a/xbump b/xbump
index e970a19..df30d9f 100755
--- a/xbump
+++ b/xbump
@@ -1,10 +1,19 @@
-#!/bin/sh
+#!/bin/sh -e
 # xbump PKGNAME [git commit options] - git commit a version bump
 
-cd ~/xbps-packages
+cd $(xdistdir)
 
 pkg=$1; shift
-version=$(./xbps-src show "$pkg" | sed -n '/version/s/[^:]*:[\t]*//p')
+version=$(./xbps-src show "$pkg" | sed -n '/^version/s/[^:]*:[\t]*//p')
 
-git add srcpkgs/"$pkg" &&
-git commit -m "$pkg: update to $version." "$@" srcpkgs/"$pkg"
+if [ -n "$(git ls-files srcpkgs/"$pkg"/template)" ]; then
+	msg="$pkg: update to $version."
+else
+	msg="New package: $pkg-$version"
+fi
+
+dirs=$(./xbps-src show "$pkg" |
+	sed -n '/^\(pkgname\|subpackage\)/s/[^:]*:[\t]*/srcpkgs\//p')
+
+git add $dirs
+git commit -m "$msg" "$@" $dirs