From cb582f73738fed3b6ccc1355b21136a1281742a4 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 27 Apr 2010 01:34:19 +0200 Subject: [PATCH] xbps-src: add -m flag and make-repoidx target. * -m flag to specify a custom XBPS_MASTERDIR, overwritting the value from xbps-src.conf. * make-repoidx target to create a package index plist file for the local repository associated with a masterdir, or one specified by the -p flag. --HG-- extra : convert_revision : dbd502b532fd49cd17a79a187488a1e92f361ee0 --- xbps-src/libexec/xbps-src-doinst-helper.sh.in | 5 ++++ xbps-src/shutils/init_funcs.sh.in | 1 + xbps-src/shutils/pkgtarget_funcs.sh.in | 2 +- xbps-src/xbps-src.sh.in | 28 ++++++++++++++++--- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/xbps-src/libexec/xbps-src-doinst-helper.sh.in b/xbps-src/libexec/xbps-src-doinst-helper.sh.in index b9a96a7642..c6bc892c09 100644 --- a/xbps-src/libexec/xbps-src-doinst-helper.sh.in +++ b/xbps-src/libexec/xbps-src-doinst-helper.sh.in @@ -27,6 +27,11 @@ PKG_TMPLNAME="$1" . @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf + +if [ -n "${MASTERDIR}" ]; then + export XBPS_MASTERDIR="${MASTERDIR}" +fi + . @@XBPS_INSTALL_SHAREDIR@@/shutils/init_funcs.sh set_defvars diff --git a/xbps-src/shutils/init_funcs.sh.in b/xbps-src/shutils/init_funcs.sh.in index e6bca739f8..9f8d57eca3 100644 --- a/xbps-src/shutils/init_funcs.sh.in +++ b/xbps-src/shutils/init_funcs.sh.in @@ -59,6 +59,7 @@ set_defvars() export XBPS_DIGEST_CMD="xbps-uhelper.static digest" export XBPS_CMPVER_CMD="xbps-uhelper.static cmpver" export XBPS_FETCH_CMD="xbps-uhelper.static fetch" + export XBPS_REPO_CMD="xbps-repo.static" # # Check that installed xbps utils version is recent enough. diff --git a/xbps-src/shutils/pkgtarget_funcs.sh.in b/xbps-src/shutils/pkgtarget_funcs.sh.in index c2a629f99a..b1af324490 100644 --- a/xbps-src/shutils/pkgtarget_funcs.sh.in +++ b/xbps-src/shutils/pkgtarget_funcs.sh.in @@ -95,7 +95,7 @@ install_pkg() fi # Install pkg into destdir. - env xbps_machine=${xbps_machine} \ + env xbps_machine=${xbps_machine} MASTERDIR=${_MASTERDIR} \ ${fakeroot_cmd} ${fakeroot_cmd_args} \ @@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-doinst-helper \ ${curpkgn} || exit $? diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index caae0b4a8b..13abeb13a8 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -38,7 +38,7 @@ trap "echo && exit 1" INT QUIT usage() { cat << _EOF -$progname: [-C] [-c ] [-p ] [-u] +$progname: [-C] [-c ] [-m ] [-p ] Targets: build Build a package (fetch + extract + configure + build). @@ -55,8 +55,10 @@ Targets: install install-destdir + stow. list List installed packages in masterdir. listfiles List installed files from . + make-repoidx Build a package index for the local repository associated + with the master directory, or updates it. remove Remove package completely (destdir + masterdir). - stow Copy files from destdir into masterdir and + stow Stow files from destdir into masterdir and register package in database. unstow Remove files from masterdir and unregister package from database. @@ -65,7 +67,10 @@ Options: -C Do not remove build directory after successful installation. -c Path to global configuration file: if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used. - -p Package directory, overwritting XBPS_PACKAGESDIR in xbps-src.conf. + -m Master directory, overwritting the value set in the configuration + file at @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf. + -p Package directory, overwritting default path at + /pkg-binpkgs. _EOF exit 1 @@ -130,10 +135,16 @@ check_config_vars() # # main() # -while getopts "Cc:p:" opt; do +while getopts "Cc:m:p:" opt; do case $opt in C) export dontrm_builddir=yes;; c) config_file_specified=yes; XBPS_CONFIG_FILE="$OPTARG";; + m) + _MASTERDIR="$OPTARG" + if [ ! -d ${_MASTERDIR} ]; then + mkdir -p ${_MASTERDIR} + fi + ;; p) _PACKAGEDIR="$OPTARG" if [ ! -d ${_PACKAGEDIR} ]; then @@ -158,6 +169,9 @@ fi # Check configuration vars before anyting else, and set defaults vars. # check_config_vars +if [ -n "${_MASTERDIR}" ]; then + export XBPS_MASTERDIR=${_MASTERDIR} +fi . @@XBPS_INSTALL_SHAREDIR@@/shutils/init_funcs.sh set_defvars @@ -272,6 +286,12 @@ list|listfiles) . $XBPS_SHUTILSDIR/pkgtarget_funcs.sh list_pkg_files $2 ;; +make-repoidx) + echo "=> Updating package index for local repository at" + echo " $XBPS_PACKAGESDIR..." + ${XBPS_REPO_CMD} genindex ${XBPS_PACKAGESDIR} 2>/dev/null + [ $? -eq 0 ] && echo "=> done." + ;; remove) . $XBPS_SHUTILSDIR/pkgtarget_funcs.sh setup_tmpl $(basename_cwd)