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
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
esac
# TODO check that we have such a package,version,release
+ #cat <<EOS
zpm shell $pkgfile <<EOS
PRAGMA foreign_keys = ON;
begin;