xbps-src: make -K and -C really work.

This commit is contained in:
Juan RP 2011-07-04 21:29:11 +02:00
parent 0ffa09c1b4
commit 24bad5c713
5 changed files with 14 additions and 18 deletions

View file

@ -48,7 +48,7 @@ install_pkglist_from_repos()
# ENODEV (19): package depends on missing dependencies. # ENODEV (19): package depends on missing dependencies.
# #
# Any other returned is criticial. # Any other returned is criticial.
autoremove_pkg_dependencies autoremove_pkg_dependencies $KEEP_AUTODEPS
msg_red "'${pkgname}': failed to install required dependencies! (error $rval)\n" msg_red "'${pkgname}': failed to install required dependencies! (error $rval)\n"
msg_error "'${pkgname}': please take a look the logs in \$wrksrc.\n" msg_error "'${pkgname}': please take a look the logs in \$wrksrc.\n"
fi fi
@ -82,7 +82,7 @@ install_pkg_from_repos()
# ENODEV (19): package depends on missing dependencies. # ENODEV (19): package depends on missing dependencies.
# #
# Any other returned is criticial. # Any other returned is criticial.
autoremove_pkg_dependencies autoremove_pkg_dependencies $KEEP_AUTODEPS
msg_red "'${pkgname}': failed to install '${pkg}' dependency! (error $rval)\n" msg_red "'${pkgname}': failed to install '${pkg}' dependency! (error $rval)\n"
msg_error "Please see ${wrksrc}/.xbps_install_${pkgdepname}.log to see what went wrong!\n" msg_error "Please see ${wrksrc}/.xbps_install_${pkgdepname}.log to see what went wrong!\n"
fi fi
@ -94,7 +94,7 @@ autoremove_pkg_dependencies()
{ {
local cmd saved_pkgname x f found local cmd saved_pkgname x f found
[ -n "$KEEP_AUTODEPS" ] && return 0 [ -n "$1" ] && return 0
cmd="${fakeroot_cmd} ${fakeroot_cmd_args} ${XBPS_BIN_CMD}" cmd="${fakeroot_cmd} ${fakeroot_cmd_args} ${XBPS_BIN_CMD}"

View file

@ -314,8 +314,8 @@ xbps_chroot_handler()
env IN_CHROOT=1 LANG=C \ env IN_CHROOT=1 LANG=C \
${chroot_cmd} $XBPS_MASTERDIR /bin/sh || rv=$? ${chroot_cmd} $XBPS_MASTERDIR /bin/sh || rv=$?
else else
[ -n "$3" ] && arg="-C" [ -n "$KEEP_WRKSRC" ] && arg="-C"
[ -n "$4" ] && arg="$arg -K" [ -n "$KEEP_AUTODEPS" ] && arg="$arg -K"
action="$arg $action" action="$arg $action"
env in_chroot=1 IN_CHROOT=1 LANG=C _ORIGINPKG="$pkg" \ env in_chroot=1 IN_CHROOT=1 LANG=C _ORIGINPKG="$pkg" \
${chroot_cmd} $XBPS_MASTERDIR sh -c \ ${chroot_cmd} $XBPS_MASTERDIR sh -c \

View file

@ -43,7 +43,7 @@ run_func_error()
remove_pkgdestdir_sighandler() remove_pkgdestdir_sighandler()
{ {
local lver subpkg _pkgname="$1" local lver subpkg _pkgname="$1" _kwrksrc="$2"
setup_tmpl ${_pkgname} setup_tmpl ${_pkgname}
[ -z "$sourcepkg" ] && return 0 [ -z "$sourcepkg" ] && return 0
@ -71,8 +71,7 @@ remove_pkgdestdir_sighandler()
msg_red "'${sourcepkg}-${lver}': removed files from DESTDIR...\n" msg_red "'${sourcepkg}-${lver}': removed files from DESTDIR...\n"
fi fi
[ -n "$2" ] && KEEP_AUTODEPS=1 autoremove_pkg_dependencies ${_kwrksrc}
autoremove_pkg_dependencies
} }
var_is_a_function() var_is_a_function()

View file

@ -40,7 +40,7 @@ install_pkg()
fi fi
# Remove automatic package dependencies if set. # Remove automatic package dependencies if set.
autoremove_pkg_dependencies autoremove_pkg_dependencies $KEEP_AUTODEPS
pkg="$curpkgn-$version" pkg="$curpkgn-$version"
[ -n "$INSTALLING_DEPS" ] && setup_tmpl $curpkgn [ -n "$INSTALLING_DEPS" ] && setup_tmpl $curpkgn
@ -167,7 +167,7 @@ install_pkg()
# Autoremove packages installed as dependencies if # Autoremove packages installed as dependencies if
# XBPS_PREFER_BINPKG_DEPS is set. # XBPS_PREFER_BINPKG_DEPS is set.
# #
autoremove_pkg_dependencies autoremove_pkg_dependencies $KEEP_AUTODEPS
return $? return $?
} }

View file

@ -32,7 +32,6 @@
: ${sudo_cmd:=sudo} : ${sudo_cmd:=sudo}
: ${chroot_cmd:=chroot} : ${chroot_cmd:=chroot}
: ${xbps_machine:=$(uname -m)} : ${xbps_machine:=$(uname -m)}
: ${XBPS_UTILS_REQVER:=20100511}
# Required utilities in host system. # Required utilities in host system.
REQHOST_UTILS="gawk bash sed gcc msgfmt patch makeinfo perl fakeroot tar xz" REQHOST_UTILS="gawk bash sed gcc msgfmt patch makeinfo perl fakeroot tar xz"
@ -175,10 +174,10 @@ check_config_vars()
# #
while getopts "Cc:hKm:p:Ss:" opt; do while getopts "Cc:hKm:p:Ss:" opt; do
case $opt in case $opt in
C) KEEP_WRKSRC=1;; C) export KEEP_WRKSRC=1;;
c) XBPS_CONFIG_FILE="$OPTARG";; c) XBPS_CONFIG_FILE="$OPTARG";;
h) usage && exit 0;; h) usage && exit 0;;
K) KEEP_AUTODEPS=1;; K) export KEEP_AUTODEPS=1;;
m) m)
_MASTERDIR_FLAG=1 _MASTERDIR_FLAG=1
_MASTERDIR="$OPTARG" _MASTERDIR="$OPTARG"
@ -291,7 +290,7 @@ build|configure)
if [ -z "$base_chroot" -a -z "$IN_CHROOT" ]; then if [ -z "$base_chroot" -a -z "$IN_CHROOT" ]; then
. $XBPS_SHUTILSDIR/chroot.sh . $XBPS_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target ${_pkgname} $KEEP_WRKSRC $KEEP_AUTODEPS xbps_chroot_handler $target ${_pkgname}
else else
_ORIGINPKG="${_pkgname}" _ORIGINPKG="${_pkgname}"
setup_tmpl ${_ORIGINPKG} setup_tmpl ${_ORIGINPKG}
@ -377,8 +376,7 @@ install|install-destdir)
_ORIGINPKG="${_pkgname}" _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_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target ${_ORIGINPKG} \ xbps_chroot_handler $target ${_ORIGINPKG}
$KEEP_WRKSRC $KEEP_AUTODEPS
else else
setup_tmpl ${_ORIGINPKG} setup_tmpl ${_ORIGINPKG}
install_pkg $pkgname install_pkg $pkgname
@ -410,8 +408,7 @@ remove)
setup_tmpl ${_pkgname} 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_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target ${_pkgname} \ xbps_chroot_handler $target ${_pkgname}
$KEEP_WRKSRC $KEEP_AUTODEPS
else else
remove_pkg remove_pkg
fi fi