X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-newpackage;h=8b9fb0badcb1aeab6722518c495df0336766de7c;hb=62f6ff407bc4f2cf03d1fa7cf3dc9a3f4026624a;hp=fbd44b5afc41c298ff3273f42e87551ff6a17687;hpb=ecdd57da7df775c039aee834e1f74172004f352b;p=zpackage diff --git a/zpm-newpackage b/zpm-newpackage index fbd44b5..8b9fb0b 100755 --- a/zpm-newpackage +++ b/zpm-newpackage @@ -1,37 +1,90 @@ #!/bin/sh -package=${1:-$ZPMPACKAGE} -pkgver=${ZPMPACKAGEVER:-1.0} -pkgrel=${ZPMPACKAGEREL:-1} - builddate=$(date '+%s') -while getopts :f:v:r:d:a:u:l:p:b: opt; do +# the repo implied by the arguments + +create=0 + +# newpackage -f pkgfile $pkgid +while getopts :Cf:r:d:a:u:l:p:b:In: 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" ;; + C) create=1 ;; p) packager="$OPTARG" ;; b) builddate="$OPTARG" ;; + I) idempotent=1 esac done +shift $(( OPTIND - 1)) -set -e +die() { + echo $* 1>&2 + exit 1 +} + +pkgid=$1 +shift + +if [ -z "$pkgid" ]; then + die "must specify pkgid" +fi + +eval "$(zpm parse -E $pkgid)" if [ -z "$pkgfile" ]; then - pkgfile="$package-$pkgver-$pkgrel.zpm" + pkgfile=$ZPM_PACKAGE_FILE +fi + +# cases C = create ok, R = full package id, F = specified package file + +# immediate error +# C-- 100 error, must specify something +# --- 000 error, must specify something +if [ -z "$release" ] && [ -z "$pkgfile" ]; then + die must specify package file or complete package id fi -if [ ! -e $pkgfile ]; then - sqlite3 $pkgfile < db.sql +# --F 001 error, wouldn't know which pkgid to create, could derive from file? +# C-F 101 error, since package wouldn't exist in file to find +if [ -z "$release" ]; then + die must specify complete package id fi -sqlite3 $pkgfile <