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
This commit is contained in:
Juan RP 2010-04-27 01:34:19 +02:00
parent 8807a183f8
commit cb582f7373
4 changed files with 31 additions and 5 deletions

View File

@ -27,6 +27,11 @@
PKG_TMPLNAME="$1" PKG_TMPLNAME="$1"
. @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf . @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf
if [ -n "${MASTERDIR}" ]; then
export XBPS_MASTERDIR="${MASTERDIR}"
fi
. @@XBPS_INSTALL_SHAREDIR@@/shutils/init_funcs.sh . @@XBPS_INSTALL_SHAREDIR@@/shutils/init_funcs.sh
set_defvars set_defvars

View File

@ -59,6 +59,7 @@ set_defvars()
export XBPS_DIGEST_CMD="xbps-uhelper.static digest" export XBPS_DIGEST_CMD="xbps-uhelper.static digest"
export XBPS_CMPVER_CMD="xbps-uhelper.static cmpver" export XBPS_CMPVER_CMD="xbps-uhelper.static cmpver"
export XBPS_FETCH_CMD="xbps-uhelper.static fetch" export XBPS_FETCH_CMD="xbps-uhelper.static fetch"
export XBPS_REPO_CMD="xbps-repo.static"
# #
# Check that installed xbps utils version is recent enough. # Check that installed xbps utils version is recent enough.

View File

@ -95,7 +95,7 @@ install_pkg()
fi fi
# Install pkg into destdir. # Install pkg into destdir.
env xbps_machine=${xbps_machine} \ env xbps_machine=${xbps_machine} MASTERDIR=${_MASTERDIR} \
${fakeroot_cmd} ${fakeroot_cmd_args} \ ${fakeroot_cmd} ${fakeroot_cmd_args} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-doinst-helper \ @@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-doinst-helper \
${curpkgn} || exit $? ${curpkgn} || exit $?

View File

@ -38,7 +38,7 @@ trap "echo && exit 1" INT QUIT
usage() usage()
{ {
cat << _EOF cat << _EOF
$progname: [-C] [-c <config_file>] [-p <pkgdir>] [-u] <target> $progname: [-C] [-c <config_file>] [-m <masterdir>] [-p <pkgdir>] <target>
Targets: Targets:
build Build a package (fetch + extract + configure + build). build Build a package (fetch + extract + configure + build).
@ -55,8 +55,10 @@ Targets:
install install-destdir + stow. install install-destdir + stow.
list List installed packages in masterdir. list List installed packages in masterdir.
listfiles List installed files from <pkg>. listfiles List installed files from <pkg>.
make-repoidx Build a package index for the local repository associated
with the master directory, or updates it.
remove Remove package completely (destdir + masterdir). remove Remove package completely (destdir + masterdir).
stow Copy <pkg> files from destdir into masterdir and stow Stow <pkg> files from destdir into masterdir and
register package in database. register package in database.
unstow Remove <pkg> files from masterdir and unregister unstow Remove <pkg> files from masterdir and unregister
package from database. package from database.
@ -65,7 +67,10 @@ Options:
-C Do not remove build directory after successful installation. -C Do not remove build directory after successful installation.
-c Path to global configuration file: -c Path to global configuration file:
if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used. 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
<XBPS_MASTERDIR>/pkg-binpkgs.
_EOF _EOF
exit 1 exit 1
@ -130,10 +135,16 @@ check_config_vars()
# #
# main() # main()
# #
while getopts "Cc:p:" opt; do while getopts "Cc:m:p:" opt; do
case $opt in case $opt in
C) export dontrm_builddir=yes;; C) export dontrm_builddir=yes;;
c) config_file_specified=yes; XBPS_CONFIG_FILE="$OPTARG";; c) config_file_specified=yes; XBPS_CONFIG_FILE="$OPTARG";;
m)
_MASTERDIR="$OPTARG"
if [ ! -d ${_MASTERDIR} ]; then
mkdir -p ${_MASTERDIR}
fi
;;
p) p)
_PACKAGEDIR="$OPTARG" _PACKAGEDIR="$OPTARG"
if [ ! -d ${_PACKAGEDIR} ]; then if [ ! -d ${_PACKAGEDIR} ]; then
@ -158,6 +169,9 @@ fi
# Check configuration vars before anyting else, and set defaults vars. # Check configuration vars before anyting else, and set defaults vars.
# #
check_config_vars check_config_vars
if [ -n "${_MASTERDIR}" ]; then
export XBPS_MASTERDIR=${_MASTERDIR}
fi
. @@XBPS_INSTALL_SHAREDIR@@/shutils/init_funcs.sh . @@XBPS_INSTALL_SHAREDIR@@/shutils/init_funcs.sh
set_defvars set_defvars
@ -272,6 +286,12 @@ list|listfiles)
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh . $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
list_pkg_files $2 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) remove)
. $XBPS_SHUTILSDIR/pkgtarget_funcs.sh . $XBPS_SHUTILSDIR/pkgtarget_funcs.sh
setup_tmpl $(basename_cwd) setup_tmpl $(basename_cwd)