X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-add;h=4025bde71ee60b290e300f91cdf186a1c629d452;hb=837982b6e11a00d6416de2c25004f94ccc6b0d4a;hp=51c08054038f67091447596deec893e55241f375;hpb=ddeb616cccad9c19467be36be9415cbb82a836ce;p=zpackage diff --git a/zpm-add b/zpm-add index 51c0805..4025bde 100755 --- a/zpm-add +++ b/zpm-add @@ -54,15 +54,28 @@ fi pkgid="$1" shift -set -x eval $(zpm parse -E $pkgid) -if [ -z "$pkgfile" ]; +if [ -z "$pkgfile" ]; then pkgfile=$ZPM_PACKAGE_FILE fi +if [ -z "$release" ]; then + if [ -z "$pkgfile" ]; then + die "cannot determine package file" + else + pkgstr=$(zpm findpkg $pkgfile $pkgid) + if [ -z "$pkgstr" ]; then + die "unable to find package id for $pkgid in $pkgfile" + fi + pkgid=$pkgstr + # need to reparse the new package id + eval $(zpm parse -E $pkgid) + fi +fi + # look for a .zpm file here -if [ -z "$pkgfile" ] && [ -n "$release" ] && [ -f "$pkgid.zpm" ]; +if [ -z "$pkgfile" ] && [ -f "$pkgid.zpm" ]; then pkgfile="$pkgid.zpm" fi @@ -80,14 +93,9 @@ fi zpm test -v $pkgfile -if [ -z "$release" ]; then - pkgstr=$(zpm findpkg -f $pkgfile $pkgid) -fi - -if [ -z "$pkgstr" ]; then - die "unable to find package id for $pkgid" -fi -pkgid=$pkgstr +package=$(zpm quote "$name") +pkgver=$(zpm quote "$version") +pkgrel=$(zpm quote "$release") #strip=$(cleanpath "$strip") for path in $*; do @@ -147,6 +155,7 @@ for path in $*; do esac # TODO check that we have such a package,version,release + #cat <