diff --git a/utils/sh/binpkg-genindex.sh b/utils/sh/binpkg-genindex.sh index 6e91b10746a..88699144ac0 100644 --- a/utils/sh/binpkg-genindex.sh +++ b/utils/sh/binpkg-genindex.sh @@ -31,6 +31,7 @@ XBPS_PKGINDEX_VERSION="1.0" # Current version for pkgindex plist # write_repo_pkgindex() { + local repodir="$1" local propsf= local pkgname= local pkgsum= @@ -39,25 +40,26 @@ write_repo_pkgindex() local i= local found= - [ ! -d $XBPS_PACKAGESDIR ] && exit 1 + [ -z "$repodir" ] && repodir=$XBPS_PACKAGESDIR + [ ! -d $repodir ] && exit 1 - found="$(echo $XBPS_PACKAGESDIR/*)" + found="$(echo $repodir/*)" if $(echo $found|grep -vq .xbps); then - msg_error "couldn't find binary packages on $XBPS_PACKAGESDIR." + msg_error "couldn't find binary packages on $repodir." fi pkgindexf=$(mktemp -t pkgidx.XXXXXXXXXX) || exit 1 tmppkgdir=$(mktemp -d -t pkgdir.XXXXXXXX) || exit 1 # Write the header. - msg_normal "Creating package index for $XBPS_PACKAGESDIR..." - write_repo_pkgindex_header $pkgindexf + msg_normal "Creating package index for $repodir..." + write_repo_pkgindex_header $pkgindexf $repodir # # Write pkg dictionaries from all packages currently available at # XBPS_PACKAGESDIR. # - for i in $(echo $XBPS_PACKAGESDIR/*.xbps); do + for i in $(echo $repodir/*.xbps); do pkgname="$(basename ${i%%-[0-9]*.*.$xbps_machine.xbps})" propsf="./var/cache/xbps/metadata/$pkgname/props.plist" cd $tmppkgdir && tar xfjp $i $propsf @@ -83,7 +85,7 @@ write_repo_pkgindex() exit 1 fi msg_normal "Package index created (total pkgs: $pkgsum)." - cp -f $pkgindexf $XBPS_PACKAGESDIR/pkg-index.plist + cp -f $pkgindexf $repodir/pkg-index.plist fi rm -f $pkgindexf rm -rf $tmppkgdir @@ -95,8 +97,9 @@ write_repo_pkgindex() write_repo_pkgindex_header() { local file="$1" + local repo="$2" - [ -z "$file" ] && return 1 + [ -z "$file" -o -z "$repo" ] && return 1 cat > $file <<_EOF @@ -106,7 +109,7 @@ write_repo_pkgindex_header() pkgindex-version $XBPS_PKGINDEX_VERSION location-local -$XBPS_PACKAGESDIR +$repodir available-packages _EOF diff --git a/xbps-src.sh b/xbps-src.sh index 49f5e6499ec..df97fa98cb5 100755 --- a/xbps-src.sh +++ b/xbps-src.sh @@ -49,9 +49,10 @@ Targets: configure Configure a package (fetch + extract + configure). extract Extract distribution file(s) into build directory. fetch Download distribution file(s). - genindex Generate a package index for a directory containing - binary packages. This uses the XBPS_PACKAGESDIR option - in the configuration file. + genindex [/path/dir] Generate a package index for a directory containing + binary packages. If no path is specified, the + XBPS_PACKAGESDIR in the configuration file will be + used by default. info Show information about . install-destdir build + install into destdir. install install-destdir + stow. @@ -263,7 +264,7 @@ extract|fetch|info) ;; genindex) . $XBPS_SHUTILSDIR/binpkg-genindex.sh - write_repo_pkgindex + write_repo_pkgindex $2 ;; install|install-destdir) [ -z "$2" ] && msg_error "missing package name after target."