summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-06-16 13:07:15 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2015-06-16 13:07:15 +0200
commit713f20c3f530c5daf9d930285fffee990ac868db (patch)
tree35d9e811806f0ec1891a169cc625a0e4d19648e3
parent92015e44b50c5827ceff4f6fe31700390fbb48cd (diff)
downloadxtools-713f20c3f530c5daf9d930285fffee990ac868db.tar.gz
xtools-713f20c3f530c5daf9d930285fffee990ac868db.tar.xz
xtools-713f20c3f530c5daf9d930285fffee990ac868db.zip
xgensum: -f to force redownload of distfiles.
-rw-r--r--README2
-rwxr-xr-xxgensum21
2 files changed, 18 insertions, 5 deletions
diff --git a/README b/README
index 253c219..4f9efa8 100644
--- a/README
+++ b/README
@@ -10,7 +10,7 @@ https://github.com/voidlinux/xbps
   xdiff [-u|-l] [DIR] - merge/diff/list XBPS .new-* files
   xdistdir - figure out XBPS_DISTDIR
   xdowngrade PKGS.xbps... - install XBPS package directly from .xbps file
-  xgensum [-i] TEMPLATE - update SHA256 sums in templates
+  xgensum [-f] [-i] TEMPLATE - update SHA256 sums in templates
   xgrep PATTERN PKGS... - search files limited to XBPS package contents
   xhog - list installed XBPS packages ordered by size
   xlg PKG - open short commit log for XBPS template
diff --git a/xgensum b/xgensum
index c22a43b..38b1136 100755
--- a/xgensum
+++ b/xgensum
@@ -1,5 +1,9 @@
 #!/bin/bash
-# xgensum [-i] TEMPLATE - update SHA256 sums in templates
+# xgensum [-f] [-i] TEMPLATE - update SHA256 sums in templates
+
+case "$1" in
+	-f) f=$1; shift
+esac
 
 case "$1" in
 	-i*) i=$1; shift
@@ -8,17 +12,26 @@ esac
 if [ -f $1 ]; then
 	. "$1"
 elif [ -f $1/template ]; then
-	exec "$0" $i "$1/template"
+	exec "$0" $f $i "$1/template"
 elif [ -f template ]; then
-	exec "$0" $i template
+	exec "$0" $f $i template
 else
-	echo Usage: gensum TEMPLATE
+	echo 'Usage: xgensum [-f] [-i] TEMPLATE'
 fi
 
 XBPS_DISTDIR=$(xdistdir)
 XBPS_SRCDISTDIR=$($XBPS_DISTDIR/xbps-src show-var XBPS_SRCDISTDIR | tail -1)
 srcdir="$XBPS_SRCDISTDIR/$pkgname-$version"
 
+if [ "$f" = -f ]; then
+	for f in $distfiles; do
+		curfile=$(basename "${f#*>}")
+		distfile="$srcdir/$curfile"
+		rm -vf "$distfile"
+	done
+	$XBPS_DISTDIR/xbps-src -I clean $pkgname
+fi
+
 $XBPS_DISTDIR/xbps-src -I fetch $pkgname
 
 sums=""