2014-04-09 14:42:07 +00:00
|
|
|
# vim: set ts=4 sw=4 et:
|
|
|
|
|
|
|
|
bulk_getlink() {
|
|
|
|
local p="$(basename $1)"
|
|
|
|
local target="$(readlink $XBPS_SRCPKGDIR/$p)"
|
|
|
|
|
|
|
|
if [ $? -eq 0 -a -n "$target" ]; then
|
|
|
|
p=$target
|
|
|
|
fi
|
|
|
|
echo $p
|
|
|
|
}
|
|
|
|
|
|
|
|
bulk_build() {
|
|
|
|
if ! command -v xbps-checkvers &>/dev/null; then
|
|
|
|
msg_error "xbps-src: cannot find xbps-checkvers(8) command!\n"
|
|
|
|
fi
|
2014-04-17 08:36:45 +00:00
|
|
|
_pkgs=$(xbps-checkvers ${1} --distdir=$XBPS_DISTDIR | awk '{print $2}')
|
2014-04-10 09:10:39 +00:00
|
|
|
# Iterate over the list and make sure that only real pkgs are
|
|
|
|
# added to our pkglist.
|
2014-04-09 14:42:07 +00:00
|
|
|
for pkg in ${_pkgs}; do
|
2014-04-10 09:10:39 +00:00
|
|
|
found=0
|
|
|
|
f=$(bulk_getlink $pkg)
|
2014-04-09 14:42:07 +00:00
|
|
|
for x in ${pkgs}; do
|
2014-04-10 09:10:39 +00:00
|
|
|
if [ "$x" = "${f}" ]; then
|
2014-04-09 14:42:07 +00:00
|
|
|
found=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2014-04-10 09:10:39 +00:00
|
|
|
if [ $found -eq 0 ]; then
|
|
|
|
pkgs+="${f} "
|
2014-04-09 14:42:07 +00:00
|
|
|
fi
|
|
|
|
done
|
2014-04-10 09:10:39 +00: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 14:42:07 +00:00
|
|
|
for pkg in ${pkgs}; do
|
2014-04-10 09:10:39 +00:00
|
|
|
. ${XBPS_SRCPKGDIR}/${pkg}/template
|
|
|
|
_pkgs="$(show_pkg_build_deps | sed -e 's|[<>].*\$||g')"
|
2014-04-10 09:26:02 +00:00
|
|
|
found=0
|
2014-04-10 09:10:39 +00:00
|
|
|
for x in ${_pkgs}; do
|
|
|
|
_pkg=$(bulk_getlink $x)
|
|
|
|
for f in ${pkgs}; do
|
|
|
|
if [ "${f}" != "${_pkg}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
2014-04-10 09:26:02 +00:00
|
|
|
found=1
|
2014-04-10 09:10:39 +00:00
|
|
|
echo "${pkg} ${f}" >> $tmpf
|
|
|
|
done
|
2014-04-09 14:42:07 +00:00
|
|
|
done
|
2014-04-10 09:26:02 +00:00
|
|
|
[ $found -eq 0 ] && echo "${pkg} ${pkg}" >> $tmpf
|
2014-04-09 14:42:07 +00:00
|
|
|
done
|
2014-04-10 09:10:39 +00:00
|
|
|
tsort $tmpf|tac
|
|
|
|
rm -f $tmpf
|
2014-04-09 14:42:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bulk_update() {
|
|
|
|
local args="$1" pkgs=
|
|
|
|
|
|
|
|
pkgs="$(bulk_build ${args})"
|
|
|
|
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
|
|
|
|
BEGIN_INSTALL=1
|
|
|
|
XBPS_TARGET_PKG="$f"
|
|
|
|
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
|
|
|
|
install_pkg pkg $XBPS_CROSS_BUILD
|
|
|
|
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"
|
|
|
|
${XBPS_SUCMD} "xbps-install --repository=$XBPS_REPOSITORY --repository=$XBPS_REPOSITORY/nonfree -u ${pkgs}"
|
|
|
|
fi
|
|
|
|
}
|