2014-04-09 16:42:07 +02:00
|
|
|
# vim: set ts=4 sw=4 et:
|
|
|
|
|
|
|
|
bulk_getlink() {
|
2015-09-11 07:55:40 +02:00
|
|
|
local p="${1##*/}"
|
2014-04-09 16:42:07 +02:00
|
|
|
local target="$(readlink $XBPS_SRCPKGDIR/$p)"
|
|
|
|
|
|
|
|
if [ $? -eq 0 -a -n "$target" ]; then
|
|
|
|
p=$target
|
|
|
|
fi
|
|
|
|
echo $p
|
|
|
|
}
|
|
|
|
|
2015-08-16 10:45:19 +02:00
|
|
|
bulk_sortdeps() {
|
2015-03-17 11:04:09 +01:00
|
|
|
local _pkgs _pkg pkgs pkg found f x tmpf
|
2015-03-14 09:47:56 +01:00
|
|
|
|
2015-08-16 10:45:19 +02:00
|
|
|
_pkgs="$@"
|
2014-04-10 11:10:39 +02:00
|
|
|
# Iterate over the list and make sure that only real pkgs are
|
|
|
|
# added to our pkglist.
|
2014-04-09 16:42:07 +02:00
|
|
|
for pkg in ${_pkgs}; do
|
2014-04-10 11:10:39 +02:00
|
|
|
found=0
|
|
|
|
f=$(bulk_getlink $pkg)
|
2014-04-09 16:42:07 +02:00
|
|
|
for x in ${pkgs}; do
|
2014-04-10 11:10:39 +02:00
|
|
|
if [ "$x" = "${f}" ]; then
|
2014-04-09 16:42:07 +02:00
|
|
|
found=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2014-04-10 11:10:39 +02:00
|
|
|
if [ $found -eq 0 ]; then
|
|
|
|
pkgs+="${f} "
|
2014-04-09 16:42:07 +02:00
|
|
|
fi
|
|
|
|
done
|
2014-04-10 11:10:39 +02:00
|
|
|
|
|
|
|
tmpf=$(mktemp)
|
|
|
|
# Now make the real dependency graph of all pkgs to build.
|
|
|
|
# Perform a topological sort of all pkgs but only with build dependencies
|
|
|
|
# that are found in previous step.
|
2014-04-09 16:42:07 +02:00
|
|
|
for pkg in ${pkgs}; do
|
2015-04-07 12:34:23 +02:00
|
|
|
_pkgs="$(./xbps-src show-build-deps $pkg 2>/dev/null)"
|
2014-04-10 11:26:02 +02:00
|
|
|
found=0
|
2014-04-10 11:10:39 +02:00
|
|
|
for x in ${_pkgs}; do
|
|
|
|
_pkg=$(bulk_getlink $x)
|
|
|
|
for f in ${pkgs}; do
|
|
|
|
if [ "${f}" != "${_pkg}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2014-04-10 11:26:02 +02:00
|
|
|
found=1
|
2014-04-10 11:10:39 +02:00
|
|
|
echo "${pkg} ${f}" >> $tmpf
|
|
|
|
done
|
2014-04-09 16:42:07 +02:00
|
|
|
done
|
2014-04-10 11:26:02 +02:00
|
|
|
[ $found -eq 0 ] && echo "${pkg} ${pkg}" >> $tmpf
|
2014-04-09 16:42:07 +02:00
|
|
|
done
|
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() {
|
|
|
|
|
|
|
|
if [ "$XBPS_CROSS_BUILD" ]; then
|
|
|
|
source ${XBPS_COMMONDIR}/cross-profiles/${XBPS_CROSS_BUILD}.sh
|
|
|
|
export XBPS_ARCH=${XBPS_TARGET_ARCH}
|
|
|
|
fi
|
|
|
|
if ! command -v xbps-checkvers &>/dev/null; then
|
|
|
|
msg_error "xbps-src: cannot find xbps-checkvers(8) command!\n"
|
|
|
|
fi
|
|
|
|
|
|
|
|
bulk_sortdeps "$(xbps-checkvers ${1} --distdir=$XBPS_DISTDIR | awk '{print $2}')"
|
|
|
|
}
|
|
|
|
|
2014-04-09 16:42:07 +02:00
|
|
|
bulk_update() {
|
2015-03-14 09:47:56 +01:00
|
|
|
local args="$1" pkgs f
|
2014-04-09 16:42:07 +02:00
|
|
|
|
|
|
|
pkgs="$(bulk_build ${args})"
|
2015-04-11 08:40:16 +02:00
|
|
|
if [ -z "$pkgs" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
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
|
|
|
|
echo " $f"
|
|
|
|
done
|
|
|
|
echo
|
|
|
|
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-03-14 07:50:05 +01:00
|
|
|
$XBPS_LIBEXECDIR/build.sh $f $f pkg $XBPS_CROSS_BUILD || return 1
|
2014-04-09 16:42:07 +02:00
|
|
|
fi
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
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
|
|
|
|
}
|