xbps-src: support building bootstrap pkgs in chroot with -D.

The base_chroot var has been renamed to bootstrap, to avoid conflicts
with the base-chroot pkg. So now you can rebuild any bootstrap package
if the masterdir is ready (base-chroot already) installed and
installation is only to destdir.
This commit is contained in:
Juan RP
2011-07-06 08:16:56 +02:00
parent 8156eeb03e
commit 5355f32aca
33 changed files with 60 additions and 39 deletions

View File

@@ -101,7 +101,7 @@ autoremove_pkg_dependencies()
# If XBPS_PREFER_BINPKG_DEPS is set, we should remove those
# package dependencies installed by the target package, do it.
#
if [ -n "$XBPS_PREFER_BINPKG_DEPS" -a -z "$base_chroot" ]; then
if [ -n "$XBPS_PREFER_BINPKG_DEPS" -a -z "$bootstrap" ]; then
msg_normal "'$pkgname': removing automatically installed dependencies ...\n"
# Autoremove installed binary packages.
${cmd} -y reconfigure all && ${cmd} -Rpyf autoremove 2>&1 >/dev/null
@@ -188,7 +188,7 @@ install_pkg_deps()
[ $? -eq 0 ] && continue
prev_pkg="$j"
if [ -n "$XBPS_PREFER_BINPKG_DEPS" -a -z "$base_chroot" ]; then
if [ -n "$XBPS_PREFER_BINPKG_DEPS" -a -z "$bootstrap" ]; then
install_pkg_from_repos ${j}
if [ $? -eq 255 ]; then
# xbps-bin returned unexpected error
@@ -214,7 +214,7 @@ install_pkg_deps()
fi
done
if [ -n "$XBPS_PREFER_BINPKG_DEPS" -a -z "$base_chroot" ]; then
if [ -n "$XBPS_PREFER_BINPKG_DEPS" -a -z "$bootstrap" ]; then
install_pkg_from_repos ${curpkg}
if [ $? -eq 255 ]; then
# xbps-bin returned unexpected error
@@ -279,7 +279,7 @@ install_dependencies_pkg()
[ -z "$notinstalled_deps" ] && return 0
# Install direct build dependencies from binary packages.
if [ -n "$XBPS_PREFER_BINPKG_DEPS" -a -z "$base_chroot" ]; then
if [ -n "$XBPS_PREFER_BINPKG_DEPS" -a -z "$bootstrap" ]; then
msg_normal "'$pkg': installing dependencies from repositories ...\n"
for i in ${notinstalled_deps}; do
if [ -z "$pkglist" ]; then

View File

@@ -45,7 +45,7 @@ _umount()
return $?
}
[ -n "$base_chroot" ] && return 0
[ -n "$bootstrap" ] && return 0
if [ "${chroot_cmd}" = "chroot" ]; then
if [ "$(id -u)" -ne 0 ]; then
@@ -316,6 +316,8 @@ xbps_chroot_handler()
else
[ -n "$KEEP_WRKSRC" ] && arg="-C"
[ -n "$KEEP_AUTODEPS" ] && arg="$arg -K"
[ -n "$DESTDIR_ONLY_INSTALL" ] && arg="$arg -D"
action="$arg $action"
env in_chroot=1 IN_CHROOT=1 LANG=C _ORIGINPKG="$pkg" \
${chroot_cmd} $XBPS_MASTERDIR sh -c \

View File

@@ -50,7 +50,7 @@ install_pkg()
check_installed_pkg "$pkg"
if [ $? -eq 1 -o $? -eq 0 ]; then
instver="$($XBPS_PKGDB_CMD version $pkgname)"
if [ -n "$instver" ]; then
if [ -n "$instver" -a -z "$DESTDIR_ONLY_INSTALL" ]; then
echo "=> $pkgname-$instver already installed."
return 0
fi
@@ -130,6 +130,7 @@ install_pkg()
if [ -d "$wrksrc" -a -z "$KEEP_WRKSRC" ]; then
remove_tmpl_wrksrc $wrksrc
fi
return 0
fi
# Stow package into masterdir.
@@ -200,7 +201,6 @@ remove_pkg()
[ -z $pkgname ] && msg_error "unexistent package, aborting.\n"
ver=$($XBPS_PKGDB_CMD version $pkgname)
stow_pkg_handler unstow || return $?
for subpkg in ${subpackages}; do
if [ -d "$XBPS_DESTDIR/${subpkg}-${ver%_*}" ]; then
@@ -223,6 +223,8 @@ remove_pkg()
[ -f $XBPS_POST_INSTALL_DONE ] && rm -f $XBPS_POST_INSTALL_DONE
[ -f $XBPS_INSTALL_DONE ] && rm -f $XBPS_INSTALL_DONE
stow_pkg_handler unstow || return $?
[ -n "$found" ] && return 0
return 1

View File

@@ -90,7 +90,7 @@ reset_tmpl_vars()
local TMPL_VARS="pkgname distfiles configure_args \
make_build_args make_install_args build_style \
short_desc maintainer long_desc checksum wrksrc \
make_cmd base_chroot register_shell keep_empty_dirs \
make_cmd bootstrap register_shell keep_empty_dirs \
make_build_target configure_script noextract nofetch \
pre_configure pre_build pre_install build_depends \
post_configure post_build post_install nostrip \
@@ -285,6 +285,10 @@ set_tmpl_common_vars()
. $XBPS_SHUTILSDIR/install_files.sh
if [ -n "$IGNORE_BOOTSTRAP_PKGS" ]; then
unset bootstrap
fi
FILESDIR=$XBPS_SRCPKGDIR/$pkgname/files
PATCHESDIR=$XBPS_SRCPKGDIR/$pkgname/patches
DESTDIR=${XBPS_DESTDIR}/${pkgname}-${version}

View File

@@ -315,6 +315,16 @@ else
fi
export PATH="$MYPATH"
#
# If masterdir is ready (base-chroot installed and chroot set up) and
# XBPS_PREFER_BINPKG_DEPS enabled, force ignoring rules to handle
# bootstrap packages.
#
if [ -n "$DESTDIR_ONLY_INSTALL" -a -n "$XBPS_PREFER_BINPKG_DEPS" \
-a -f "$XBPS_MASTERDIR/.xbps_perms_done" ]; then
export IGNORE_BOOTSTRAP_PKGS=1
fi
#
# Main switch.
#
@@ -332,7 +342,7 @@ build|configure)
_pkgname=$(basename_cwd)
fi
if [ -z "$base_chroot" -a -z "$IN_CHROOT" ]; then
if [ -z "$bootstrap" -a -z "$IN_CHROOT" ]; then
. $XBPS_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target ${_pkgname}
else
@@ -416,7 +426,7 @@ install)
fi
setup_tmpl ${_pkgname}
_ORIGINPKG="${_pkgname}"
if [ -z "$IN_CHROOT" -a -z "$base_chroot" ]; then
if [ -z "$IN_CHROOT" -a -z "$bootstrap" ]; then
. $XBPS_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target ${_ORIGINPKG}
else
@@ -448,7 +458,7 @@ remove)
_pkgname=$(basename_cwd)
fi
setup_tmpl ${_pkgname}
if [ -z "$IN_CHROOT" -a -z "$base_chroot" ]; then
if [ -z "$IN_CHROOT" -a -z "$bootstrap" ]; then
. $XBPS_SHUTILSDIR/chroot.sh
xbps_chroot_handler $target ${_pkgname}
else