2014-04-09 16:42:07 +02:00
|
|
|
# vim: set ts=4 sw=4 et:
|
|
|
|
|
2015-08-16 10:45:19 +02:00
|
|
|
bulk_sortdeps() {
|
2019-07-10 19:48:54 +02:00
|
|
|
local pkgs="$@"
|
|
|
|
local pkg _pkg
|
|
|
|
local NPROCS=$(($(nproc)*2))
|
|
|
|
local NRUNNING=0
|
2019-07-03 19:36:22 +02:00
|
|
|
|
2019-07-05 12:08:45 +02:00
|
|
|
tmpf=$(mktemp) || exit 1
|
2019-07-10 19:48:54 +02:00
|
|
|
|
|
|
|
# Perform a topological sort of all *direct* build dependencies.
|
2014-04-09 16:42:07 +02:00
|
|
|
for pkg in ${pkgs}; do
|
2019-07-10 19:48:54 +02:00
|
|
|
if [ $NRUNNING -eq $NPROCS ]; then
|
|
|
|
NRUNNING=0
|
|
|
|
wait
|
|
|
|
fi
|
|
|
|
NRUNNING=$((NRUNNING+1))
|
|
|
|
(
|
|
|
|
for _pkg in $(./xbps-src show-build-deps $pkg 2>/dev/null); do
|
|
|
|
echo "$pkg $_pkg" >> $tmpf
|
2014-04-10 11:10:39 +02:00
|
|
|
done
|
2019-07-10 19:48:54 +02:00
|
|
|
echo "$pkg $pkg" >> $tmpf
|
|
|
|
) &
|
2014-04-09 16:42:07 +02:00
|
|
|
done
|
2019-07-10 19:48:54 +02:00
|
|
|
wait
|
2015-04-07 12:34:23 +02:00
|
|
|
tsort $tmpf|tac
|
2014-04-10 11:10:39 +02:00
|
|
|
rm -f $tmpf
|
2014-04-09 16:42:07 +02:00
|
|
|
}
|
|
|
|
|
2015-08-16 10:45:19 +02:00
|
|
|
bulk_build() {
|
2019-07-10 19:48:54 +02:00
|
|
|
local sys="$1"
|
|
|
|
local NPROCS=$(($(nproc)*2))
|
|
|
|
local NRUNNING=0
|
2015-08-16 10:45:19 +02:00
|
|
|
|
|
|
|
if [ "$XBPS_CROSS_BUILD" ]; then
|
|
|
|
source ${XBPS_COMMONDIR}/cross-profiles/${XBPS_CROSS_BUILD}.sh
|
2016-04-27 16:47:05 +02:00
|
|
|
export XBPS_ARCH=${XBPS_TARGET_MACHINE}
|
2015-08-16 10:45:19 +02:00
|
|
|
fi
|
|
|
|
if ! command -v xbps-checkvers &>/dev/null; then
|
2019-07-10 19:48:54 +02:00
|
|
|
msg_error "xbps-src: cannot find xbps-checkvers(1) command!\n"
|
2015-08-16 10:45:19 +02:00
|
|
|
fi
|
|
|
|
|
2019-07-10 19:48:54 +02:00
|
|
|
# Compare installed pkg versions vs srcpkgs
|
|
|
|
if [[ $sys ]]; then
|
|
|
|
xbps-checkvers -f '%n' -I -D $XBPS_DISTDIR
|
|
|
|
return $?
|
|
|
|
fi
|
|
|
|
# compare repo pkg versions vs srcpkgs
|
|
|
|
for f in $(xbps-checkvers -f '%n' -D $XBPS_DISTDIR); do
|
|
|
|
if [ $NRUNNING -eq $NPROCS ]; then
|
|
|
|
NRUNNING=0
|
|
|
|
wait
|
|
|
|
fi
|
|
|
|
NRUNNING=$((NRUNNING+1))
|
|
|
|
(
|
|
|
|
setup_pkg $f $XBPS_TARGET_MACHINE &>/dev/null
|
|
|
|
if show_avail &>/dev/null; then
|
|
|
|
echo "$f"
|
|
|
|
fi
|
|
|
|
) &
|
|
|
|
done
|
|
|
|
wait
|
|
|
|
return $?
|
2015-08-16 10:45:19 +02:00
|
|
|
}
|
|
|
|
|
2014-04-09 16:42:07 +02:00
|
|
|
bulk_update() {
|
2015-10-22 18:20:09 +02:00
|
|
|
local args="$1" pkgs f rval
|
2014-04-09 16:42:07 +02:00
|
|
|
|
|
|
|
pkgs="$(bulk_build ${args})"
|
2019-07-10 19:48:54 +02:00
|
|
|
[[ -z $pkgs ]] && return 0
|
|
|
|
|
2014-04-09 16:42:07 +02:00
|
|
|
msg_normal "xbps-src: the following packages must be rebuilt and updated:\n"
|
|
|
|
for f in ${pkgs}; do
|
2019-07-10 19:48:54 +02:00
|
|
|
echo " $f"
|
2014-04-09 16:42:07 +02:00
|
|
|
done
|
|
|
|
for f in ${pkgs}; do
|
2015-03-14 09:47:56 +01:00
|
|
|
XBPS_TARGET_PKG=$f
|
2014-04-09 16:42:07 +02:00
|
|
|
read_pkg
|
|
|
|
msg_normal "xbps-src: building ${pkgver} ...\n"
|
|
|
|
if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then
|
|
|
|
chroot_handler pkg $XBPS_TARGET_PKG
|
|
|
|
else
|
2015-10-22 18:20:09 +02:00
|
|
|
$XBPS_LIBEXECDIR/build.sh $f $f pkg $XBPS_CROSS_BUILD
|
2014-04-09 16:42:07 +02:00
|
|
|
fi
|
2015-10-22 18:20:09 +02:00
|
|
|
if [ $? -eq 1 ]; then
|
2014-04-09 16:42:07 +02:00
|
|
|
msg_error "xbps-src: failed to build $pkgver pkg!\n"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "$pkgs" -a -n "$args" ]; then
|
|
|
|
echo
|
|
|
|
msg_normal "xbps-src: updating your system, confirm to proceed...\n"
|
2015-03-14 07:50:05 +01:00
|
|
|
${XBPS_SUCMD} "xbps-install --repository=$XBPS_REPOSITORY --repository=$XBPS_REPOSITORY/nonfree -u ${pkgs}" || return 1
|
2014-04-09 16:42:07 +02:00
|
|
|
fi
|
|
|
|
}
|