xbps-src: added -K flag to KEEP automatic installed deps, cleanups.

This commit is contained in:
Juan RP 2011-07-04 19:07:08 +02:00
parent 16b5107f61
commit 9b52e244c6
9 changed files with 57 additions and 42 deletions

View file

@ -39,7 +39,7 @@ REQHOST_UTILS="gawk bash sed gcc msgfmt patch makeinfo perl fakeroot tar xz"
check_reqhost_utils()
{
[ -n "$in_chroot" ] && return 0
[ -n "$IN_CHROOT" ] && return 0
for f in ${REQHOST_UTILS}; do
if ! command -v ${f} 2>&1 >/dev/null; then
@ -52,7 +52,7 @@ check_reqhost_utils()
usage()
{
cat << _EOF
$progname: [-ChS] [-c <file>] [-m <dir>] [-p <dir>] [-s <dir>] <target> [<pkgname>]
$progname: [-ChKS] [-c <file>] [-m <dir>] [-p <dir>] [-s <dir>] <target> [<pkgname>]
Targets:
bootstrap Build and install the bootstrap packages into <masterdir>.
@ -91,6 +91,8 @@ Options:
-c Path to global configuration file:
if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used.
-h Usage output.
-K Do not remove automatic package dependencies while building
or installing a package with XBPS_PREFER_BINPKG_DEPS enabled.
-m Master directory, overwritting the value set in the configuration
file xbps-src.conf.
-p Package directory, overwritting default path at
@ -171,11 +173,12 @@ check_config_vars()
#
# main()
#
while getopts "Cc:hm:p:Ss:" opt; do
while getopts "Cc:hKm:p:Ss:" opt; do
case $opt in
C) KEEP_WRKSRC=1;;
c) XBPS_CONFIG_FILE="$OPTARG";;
h) usage && exit 0;;
K) KEEP_AUTODEPS=1;;
m)
_MASTERDIR_FLAG=1
_MASTERDIR="$OPTARG"
@ -206,7 +209,7 @@ if [ -z "$target" ]; then
usage && exit 1
fi
if [ -n "$in_chroot" ]; then
if [ -n "$IN_CHROOT" ]; then
XBPS_CONFIG_FILE="/usr/local/etc/xbps-src.conf"
fi
@ -245,7 +248,7 @@ if [ "$(id -u)" -eq 0 ]; then
# disable sudo and fakeroot if uid==0
chroot_cmd="chroot"
unset sudo_cmd
if [ -n "$in_chroot" ]; then
if [ -n "$IN_CHROOT" ]; then
unset fakeroot_cmd
unset fakeroot_cmd_args
fi
@ -254,7 +257,7 @@ fi
#
# Sanitize PATH.
#
if [ -z "$in_chroot" ]; then
if [ -z "$IN_CHROOT" ]; then
# In non chroot case always prefer host tools.
MYPATH="$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/usr/bin:$PATH"
MYPATH="$XBPS_MASTERDIR/usr/local/bin:$MYPATH"
@ -286,9 +289,9 @@ build|configure)
_pkgname=$(basename_cwd)
fi
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
if [ -z "$base_chroot" -a -z "$IN_CHROOT" ]; then
. $XBPS_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target ${_pkgname}
xbps_chroot_handler $target ${_pkgname} $KEEP_WRKSRC $KEEP_AUTODEPS
else
_ORIGINPKG="${_pkgname}"
setup_tmpl ${_ORIGINPKG}
@ -372,9 +375,10 @@ install|install-destdir)
[ "$target" = "install-destdir" ] && DESTDIR_ONLY_INSTALL=1
_ORIGINPKG="${_pkgname}"
if [ -z "$in_chroot" -a -z "$base_chroot" ]; then
if [ -z "$IN_CHROOT" -a -z "$base_chroot" ]; then
. $XBPS_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target ${_ORIGINPKG} $KEEP_WRKSRC
xbps_chroot_handler $target ${_ORIGINPKG} \
$KEEP_WRKSRC $KEEP_AUTODEPS
else
setup_tmpl ${_ORIGINPKG}
install_pkg $pkgname
@ -404,9 +408,10 @@ remove)
_pkgname=$(basename_cwd)
fi
setup_tmpl ${_pkgname}
if [ -z "$in_chroot" -a -z "$base_chroot" ]; then
if [ -z "$IN_CHROOT" -a -z "$base_chroot" ]; then
. $XBPS_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target ${_pkgname} $KEEP_WRKSRC
xbps_chroot_handler $target ${_pkgname} \
$KEEP_WRKSRC $KEEP_AUTODEPS
else
remove_pkg
fi