xbps-src: make -B flag build binpkgs for required pkg deps.

This commit is contained in:
Juan RP
2011-07-18 11:36:48 +02:00
parent 0b348a677c
commit e22c565811
5 changed files with 52 additions and 43 deletions

View File

@@ -25,14 +25,16 @@
_mount()
{
MASTERDIR="${XBPS_MASTERDIR}" HOSTDIR="${XBPS_HOSTDIR}" ${sudo_cmd} \
MASTERDIR="${XBPS_MASTERDIR}" DISTRIBUTIONDIR="${XBPS_DISTRIBUTIONDIR}" \
HOSTDIR="${XBPS_HOSTDIR}" ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/chroot-helper mount
return $?
}
_umount()
{
MASTERDIR="${XBPS_MASTERDIR}" HOSTDIR="${XBPS_HOSTDIR}" ${sudo_cmd} \
MASTERDIR="${XBPS_MASTERDIR}" DISTRIBUTIONDIR="${XBPS_DISTRIBUTIONDIR}" \
HOSTDIR="${XBPS_HOSTDIR}" ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/chroot-helper umount
return $?
}
@@ -231,8 +233,7 @@ create_busybox_links()
cd ${lbindir} || return 1
for f in $(${XBPS_MASTERDIR}/bin/busybox --list); do
if [ "$f" = "tar" -o "$f" = "xz" -o \
"$f" = "bzip2" -o "$f" = "gzip" -o "$f" = "sh" ]; then
if [ "$f" = "tar" -o "$f" = "sh" -o "$f" = "xz" ]; then
continue
fi
ln -s ../../../bin/busybox $f
@@ -313,12 +314,13 @@ xbps_chroot_handler()
[ -n "$KEEP_WRKSRC" ] && arg="$arg -C"
[ -n "$KEEP_AUTODEPS" ] && arg="$arg -K"
[ -n "$DESTDIR_ONLY_INSTALL" ] && arg="$arg -D"
[ -n "$BUILD_BINPKG" ] && arg="$arg -B"
action="$arg $action"
env in_chroot=1 IN_CHROOT=1 LANG=C _ORIGINPKG="$pkg" \
PATH=$PATH:/usr/local/bin \
${chroot_cmd} $XBPS_MASTERDIR sh -c \
"cd /xbps/srcpkgs/$pkg && xbps-src $action" || rv=$?
"xbps-src $action $pkg" || rv=$?
fi
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR.\n"

View File

@@ -1,5 +1,5 @@
#-
# Copyright (c) 2008-2010 Juan Romero Pardines.
# Copyright (c) 2008-2011 Juan Romero Pardines.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,7 @@ binpkg_cleanup()
{
local pkgdir="$1" binpkg="$2"
[ -z "$pkgdir" -o -z "$binpkg" ] && return 1
msg_red "\nInterrupted! removing $binpkg file!\n"
rm -f $pkgdir/$binpkg
exit 1
@@ -106,7 +107,6 @@ xbps_make_binpkg_real()
done
[ -n "$XBPS_COMPRESS_LEVEL" ] && clevel="-$XBPS_COMPRESS_LEVEL"
[ ! -d $pkgdir ] && mkdir -p $pkgdir
# Remove binpkg if interrupted...
@@ -117,12 +117,13 @@ xbps_make_binpkg_real()
tar --exclude "var/db/xbps/metadata/*/flist" \
-cpf - ${mfiles} ${dirs} | \
$XBPS_COMPRESS_CMD ${clevel} -qf > $pkgdir/$binpkg
if [ $? -eq 0 ]; then
rval=$?
if [ $rval -eq 0 ]; then
msg_normal_append "done.\n"
else
rm -f $pkgdir/$binpkg
msg_normal_append "failed!\n"
fi
return $?
return $rval
}

View File

@@ -123,6 +123,15 @@ install_pkg()
remove_tmpl_wrksrc $wrksrc
fi
autoremove_pkg_dependencies $KEEP_AUTODEPS
# Build binary package and update local repo index if
# -B is set.
if [ -n "$BUILD_BINPKG" ]; then
xbps_make_binpkg
[ $? -ne 0 ] && return $?
msg_normal "Updating pkg-index for local repository at:\n"
msg_normal " $XBPS_PACKAGESDIR\n"
${XBPS_REPO_CMD} genindex ${XBPS_PACKAGESDIR} 2>/dev/null
fi
return 0
fi
@@ -161,7 +170,17 @@ install_pkg()
# Autoremove packages installed as dependencies if
# XBPS_PREFER_BINPKG_DEPS is set.
#
autoremove_pkg_dependencies $KEEP_AUTODEPS
autoremove_pkg_dependencies $KEEP_AUTODEPS || return $?
# Build binary package and update local repo index if
# -B is set.
if [ -n "$BUILD_BINPKG" ]; then
xbps_make_binpkg
[ $? -ne 0 ] && return $?
msg_normal "Updating pkg-index for local repository at:\n"
msg_normal " $XBPS_PACKAGESDIR\n"
${XBPS_REPO_CMD} genindex ${XBPS_PACKAGESDIR} 2>/dev/null
fi
return $?
}