]> pd.if.org Git - zpackage/blobdiff - zpm-addtopackage
cleanup package tests
[zpackage] / zpm-addtopackage
index a2e5aeec4c86c3a25c811b31b585d2c7010b4651..81c1bcb5b1cbc9fe7f8417de6bd4e54cd238b672 100755 (executable)
@@ -26,24 +26,23 @@ cleanpath() {
        printf "%s" "$clean"
 }
 
+tags=
+create=0
 # option for "multipackage" just to let the system know that's what you meant
 # option to take filenames from stdin
 # parse package, version, release from file if not given
-while getopts :f:v:r:d:a:u:l:p:b:P:S: opt; do
+while getopts :f:v:r:l:P:S:Cc opt; do
        case $opt in
                f) pkgfile="$OPTARG" ;;
                v) pkgver="$OPTARG" ;;
                r) pkgrel="$OPTARG" ;;
-               d) description="$OPTARG" ;;
-               a) arch="$OPTARG" ;;
-               u) url="$OPTARG" ;;
                l) licenses="$OPTARG" ;;
-               p) packager="$OPTARG" ;;
-               b) builddate="$OPTARG" ;;
                P) prefix="$OPTARG" ;;
                S) strip=$(cleanpath "$OPTARG"); ;;
-               t) tags="$OPTARG" ;;
-               c) tags="$tags +configuration" ;;
+               t) tags="$tags $OPTARG" ;;
+               c) tags="$tags configuration" ;;
+               C) create=1 ;;
+               *) echo 'unknown option'; exit 1 ;;
        esac
 done
 shift $((OPTIND - 1))
@@ -59,13 +58,22 @@ if [ -z "$pkgfile" ]; then
        pkgfile="$package-$pkgver-$pkgrel.zpm"
 fi
 
-# make sure package exists
-zpm newpackage -I -f $pkgfile -v $pkgver -r $pkgrel $package || exit 1
+# check for package file
+if [ ! -f "$pkgfile" ]; then
+       if [ $create -eq 1 ]; then
+               echo creating $pkgfile
+               zpm newpackage -I -f $pkgfile -v $pkgver -r $pkgrel $package || exit 1
+       else
+               echo $pkgfile does not exist
+               exit 1
+       fi
+fi
 
 zpm test -v $pkgfile
 
 #strip=$(cleanpath "$strip")
 for path in $*; do
+       echo adding $path
        mtime=$(zpm stat -f '%y' $path)
        uid=$(zpm stat -f '%u' $path)
        gid=$(zpm stat -f '%g' $path)