]> pd.if.org Git - zpackage/commitdiff
add missing shift optind
authorNathan Wagner <nw@hydaspes.if.org>
Fri, 31 Mar 2017 04:52:32 +0000 (23:52 -0500)
committerNathan Wagner <nw@hydaspes.if.org>
Fri, 31 Mar 2017 05:03:42 +0000 (00:03 -0500)
zpm-addtopackage
zpm-newpackage
zpm-test

index cccd12de666d3ce2c0574207583f2120401448db..1964b77589e29f6cf58778cb3b8e24fdc4a57cc0 100755 (executable)
@@ -1,7 +1,5 @@
 #!/bin/sh
 
-package=${1:-$ZPMPACKAGE}
-shift
 pkgver=${ZPMPKGVER:-1.0}
 pkgrel=${ZPMPKGREL:-1}
 
@@ -24,6 +22,10 @@ while getopts :f:v:r:d:a:u:l:p:b:P: opt; do
                c) tags="$tags +configuration" ;;
        esac
 done
+shift $((OPTIND - 1))
+
+package="$1"
+shift
 
 set -e
 if [ -z "$pkgfile" ]; then
@@ -33,7 +35,7 @@ fi
 if [ ! -f $pkgfile ]; then
        zpm newpackage $package || exit 1
 else
-       zpm-test -v $pkgfile
+       zpm test -v $pkgfile
 fi
 
 for path in $*; do
index 2b947015c47e60d852aedd432edb2d480fbe6ff4..7ab8aa8e5079f1028e8ef9df364a761f786b7e7c 100755 (executable)
@@ -1,12 +1,11 @@
 #!/bin/sh
 
-package=${1:-$ZPMPACKAGE}
 pkgver=${ZPMPKGVER:-1.0}
 pkgrel=${ZPMPKGREL:-1}
 
 builddate=$(date '+%s')
 
-while getopts :f:v:r:d:a:u:l:p:b: opt; do
+while getopts :f:v:r:d:a:u:l:p:b:I opt; do
        case $opt in
                f) pkgfile="$OPTARG" ;;
                v) pkgver="$OPTARG" ;;
@@ -17,8 +16,12 @@ while getopts :f:v:r:d:a:u:l:p:b: opt; do
                l) licenses="$OPTARG" ;;
                p) packager="$OPTARG" ;;
                b) builddate="$OPTARG" ;;
+               I) idempotent=1
        esac
 done
+shift $(( $OPTIND - 1))
+
+package=$1
 
 if [ -z "$pkgfile" ]; then
        pkgfile="$package-$pkgver-$pkgrel.zpm"
@@ -30,8 +33,12 @@ if [ ! -e $pkgfile ]; then
        zpm init $pkgfile
 fi
 
+if [ "$idempotent" = 1 ]; then
+       idempotent='or ignore'
+fi
+
 sqlite3 $pkgfile <<EOS
-insert or ignore into packages ("package", "version", "release", "build_time")
+insert $idempotent into packages ("package", "version", "release", "build_time")
 values ('$package', '$pkgver', $pkgrel, $builddate)
 ;
 EOS
index 9f7471868b00e425357690bd75308e4bb264ea8a..da8ca6fb135ee67679a088c786d4da1ac08d857e 100755 (executable)
--- a/zpm-test
+++ b/zpm-test
@@ -10,6 +10,7 @@ while getopts v opt; do
                 v) verbose=1 ;;
         esac
 done
+shift $((OPTIND - 1))
 
 for pkgfile in "$@"; do
 appid=$(sqlite3 $pkgfile 'pragma application_id;' | ( echo obase = 16; cat - ) | bc)