xbps-src: more improvements for -E and -t options.
If both options are set, check first if the binpkg exists before creating the temporary masterdir, and clean this up properly.
This commit is contained in:
parent
2f524cf66a
commit
bdb798fa64
|
@ -206,6 +206,8 @@ chroot_handler() {
|
|||
[ -n "$XBPS_ALT_REPOSITORY" ] && arg="$arg -r $XBPS_ALT_REPOSITORY"
|
||||
[ -n "$XBPS_USE_GIT_REVS" ] && arg="$arg -G"
|
||||
[ -n "$XBPS_PKG_OPTIONS" ] && arg="$arg -o $XBPS_PKG_OPTIONS"
|
||||
[ -n "$XBPS_TEMP_MASTERDIR" ] && arg="$arg -t -C"
|
||||
[ -n "$XBPS_BINPKG_EXISTS" ] && arg="$arg -E"
|
||||
|
||||
action="$arg $action"
|
||||
env -i PATH="/usr/bin:/usr/sbin:$PATH" HOME=/tmp IN_CHROOT=1 LANG=en_US.UTF-8 \
|
||||
|
|
|
@ -37,8 +37,8 @@ error_func() {
|
|||
exit_and_cleanup() {
|
||||
local rval=$1
|
||||
|
||||
if [ -n "$XBPS_TEMP_MASTERDIR" ]; then
|
||||
rm -rf "$XBPS_MASTERDIR"
|
||||
if [ -n "$XBPS_TEMP_MASTERDIR" -a "$XBPS_TEMP_MASTERDIR" != "1" ]; then
|
||||
rm -rf "$XBPS_TEMP_MASTERDIR"
|
||||
fi
|
||||
exit ${rval:=0}
|
||||
}
|
||||
|
|
20
xbps-src
20
xbps-src
|
@ -211,15 +211,18 @@ check_config_vars() {
|
|||
}
|
||||
|
||||
create_temporary_masterdir() {
|
||||
local tmpmdir=$(mktemp -d -q -p $XBPS_DISTDIR masterdir.XXXXXXXXX || exit 1)
|
||||
if [ -n "$IN_CHROOT" -o -z "$XBPS_TEMP_MASTERDIR" ]; then
|
||||
return
|
||||
fi
|
||||
XBPS_TEMP_MASTERDIR=$(mktemp -d -q -p $XBPS_DISTDIR masterdir.XXXXXXXXX || exit 1)
|
||||
|
||||
cp -a $XBPS_MASTERDIR/* $tmpmdir/
|
||||
cp -a $XBPS_MASTERDIR/* $XBPS_TEMP_MASTERDIR/
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: failed to setup temporary masterdir $tmpmdir!"
|
||||
echo "ERROR: failed to setup temporary masterdir $XBPS_TEMP_MASTERDIR!"
|
||||
exit 1
|
||||
fi
|
||||
export CHROOT_READY=1
|
||||
export XBPS_MASTERDIR=$tmpmdir
|
||||
export XBPS_MASTERDIR=$XBPS_TEMP_MASTERDIR
|
||||
}
|
||||
|
||||
|
||||
|
@ -352,7 +355,7 @@ while getopts "a:CEfgGhH:Ij:Lm:No:r:tV" opt; do
|
|||
N) readonly XBPS_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -N";;
|
||||
o) readonly XBPS_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+=" -o $OPTARG";;
|
||||
r) readonly XBPS_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+=" -r $OPTARG";;
|
||||
t) readonly XBPS_TEMP_MASTERDIR=1; XBPS_KEEP_ALL=1; XBPS_OPTIONS+=" -t -C";;
|
||||
t) export XBPS_TEMP_MASTERDIR=1; XBPS_OPTIONS+=" -t -C";;
|
||||
V) echo $XBPS_SRC_VERSION && exit 0;;
|
||||
--) shift; break;;
|
||||
esac
|
||||
|
@ -405,11 +408,6 @@ fi
|
|||
#
|
||||
check_config_vars
|
||||
|
||||
if [ -z "$IN_CHROOT" -a -n "$XBPS_TEMP_MASTERDIR" ]; then
|
||||
# Create a temporary masterdir (hardlinked) for this build.
|
||||
create_temporary_masterdir
|
||||
fi
|
||||
|
||||
if [ -n "$XBPS_HOSTDIR" ]; then
|
||||
export XBPS_REPOSITORY=$XBPS_HOSTDIR/binpkgs
|
||||
readonly XBPS_SRCDISTDIR=$XBPS_HOSTDIR/sources
|
||||
|
@ -537,6 +535,7 @@ check_build_requirements
|
|||
|
||||
trap 'exit_func' INT TERM
|
||||
|
||||
|
||||
#
|
||||
# Main switch.
|
||||
#
|
||||
|
@ -609,6 +608,7 @@ case "$XBPS_TARGET" in
|
|||
fetch|extract|build|configure|install|pkg)
|
||||
BEGIN_INSTALL=1
|
||||
read_pkg
|
||||
create_temporary_masterdir
|
||||
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
||||
chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue