2014-04-09 14:42:07 +00:00
|
|
|
# vim: set ts=4 sw=4 et:
|
|
|
|
|
2019-10-21 18:18:34 +00:00
|
|
|
bulk_getlink() {
|
|
|
|
local p="${1##*/}"
|
|
|
|
local target="$(readlink $XBPS_SRCPKGDIR/$p)"
|
|
|
|
|
|
|
|
if [ $? -eq 0 -a -n "$target" ]; then
|
|
|
|
p=$target
|
|
|
|
fi
|
|
|
|
echo $p
|
|
|
|
}
|
|
|
|
|
2015-08-16 08:45:19 +00:00
|
|
|
bulk_sortdeps() {
|
2019-10-21 18:18:34 +00:00
|
|
|
local _pkgs _pkg pkgs pkg found f x tmpf
|
2019-07-03 17:36:22 +00:00
|
|
|
|
2019-10-21 18:18:34 +00:00
|
|
|
_pkgs="$@"
|
|
|
|
# Iterate over the list and make sure that only real pkgs are
|
|
|
|
# added to our pkglist.
|
|
|
|
for pkg in ${_pkgs}; do
|
|
|
|
found=0
|
|
|
|
f=$(bulk_getlink $pkg)
|
|
|
|
for x in ${pkgs}; do
|
|
|
|
if [ "$x" = "${f}" ]; then
|
|
|
|
found=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ $found -eq 0 ]; then
|
|
|
|
pkgs+="${f} "
|
|
|
|
fi
|
|
|
|
done
|
2019-07-10 17:48:54 +00:00
|
|
|
|
2019-10-21 18:18:34 +00:00
|
|
|
tmpf=$(mktemp) || exit 1
|
|
|
|
# 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
|
2019-11-30 11:23:44 +00:00
|
|
|
_pkgs="$($XBPS_DISTDIR/xbps-src show-build-deps $pkg 2>/dev/null)"
|
2019-10-21 18:18:34 +00:00
|
|
|
found=0
|
|
|
|
for x in ${_pkgs}; do
|
|
|
|
_pkg=$(bulk_getlink $x)
|
|
|
|
for f in ${pkgs}; do
|
|
|
|
if [ "${f}" != "${_pkg}" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
found=1
|
|
|
|
echo "${pkg} ${f}" >> $tmpf
|
2014-04-10 09:10:39 +00:00
|
|
|
done
|
2019-10-21 18:18:34 +00:00
|
|
|
done
|
|
|
|
[ $found -eq 0 ] && echo "${pkg} ${pkg}" >> $tmpf
|
2014-04-09 14:42:07 +00:00
|
|
|
done
|
2015-04-07 10:34:23 +00:00
|
|
|
tsort $tmpf|tac
|
2014-04-10 09:10:39 +00:00
|
|
|
rm -f $tmpf
|
2014-04-09 14:42:07 +00:00
|
|
|
}
|
|
|
|
|
2015-08-16 08:45:19 +00:00
|
|
|
bulk_build() {
|
2019-07-10 17:48:54 +00:00
|
|
|
local sys="$1"
|
|
|
|
local NPROCS=$(($(nproc)*2))
|
|
|
|
local NRUNNING=0
|
2015-08-16 08:45:19 +00:00
|
|
|
|
|
|
|
if [ "$XBPS_CROSS_BUILD" ]; then
|
|
|
|
source ${XBPS_COMMONDIR}/cross-profiles/${XBPS_CROSS_BUILD}.sh
|
2016-04-27 14:47:05 +00:00
|
|
|
export XBPS_ARCH=${XBPS_TARGET_MACHINE}
|
2015-08-16 08:45:19 +00:00
|
|
|
fi
|
|
|
|
if ! command -v xbps-checkvers &>/dev/null; then
|
2019-07-10 17:48:54 +00:00
|
|
|
msg_error "xbps-src: cannot find xbps-checkvers(1) command!\n"
|
2015-08-16 08:45:19 +00:00
|
|
|
fi
|
|
|
|
|
2019-07-10 17:48:54 +00: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 08:45:19 +00:00
|
|
|
}
|
|
|
|
|
2014-04-09 14:42:07 +00:00
|
|
|
bulk_update() {
|
2015-10-22 16:20:09 +00:00
|
|
|
local args="$1" pkgs f rval
|
2014-04-09 14:42:07 +00:00
|
|
|
|
|
|
|
pkgs="$(bulk_build ${args})"
|
2019-07-10 17:48:54 +00:00
|
|
|
[[ -z $pkgs ]] && return 0
|
|
|
|
|
2014-04-09 14:42:07 +00:00
|
|
|
msg_normal "xbps-src: the following packages must be rebuilt and updated:\n"
|
|
|
|
for f in ${pkgs}; do
|
2019-07-10 17:48:54 +00:00
|
|
|
echo " $f"
|
2014-04-09 14:42:07 +00:00
|
|
|
done
|
|
|
|
for f in ${pkgs}; do
|
2015-03-14 08:47:56 +00:00
|
|
|
XBPS_TARGET_PKG=$f
|
2014-04-09 14:42:07 +00: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 16:20:09 +00:00
|
|
|
$XBPS_LIBEXECDIR/build.sh $f $f pkg $XBPS_CROSS_BUILD
|
2014-04-09 14:42:07 +00:00
|
|
|
fi
|
2015-10-22 16:20:09 +00:00
|
|
|
if [ $? -eq 1 ]; then
|
2014-04-09 14:42:07 +00: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"
|
xbps-src: base-chroot-v2 (reduce artifacts/deps)
This patchset contains multiple changes to xbps-src and
its required package "base-chroot" for building packages
via chroot.
- moved xbps.d(5) conf files to `etc/xbps.d`.
- renamed xbps.d(5) repository files to `etc/xbps.d/repos-{local,remote}*`.
- do not set `--repository` to any xbps command that supports it,
xbps-src now simply populates `rootdir/etc/xbps.d` with correct
settings (taking care of CHROOT_READY/IN_CHROOT).
- Unless `-C` is set (to preserve builddir/destdir/autodeps), when
entering to the chroot (if CHROOT_READY is set), xbps-src will
clean up the masterdir and then perform a system update to always
use a constant set of packages for that exact date.
- Improved some normal/error msgs.
- Includes support for `xbps>=0.58`.
- common/hooks: switch to bsdtar.
- base-chroot:
- base-chroot-musl is gone, now unified for glibc/musl.
- deps removed: gettext, mpfr, readline, texinfo, which, xz.
- deps changed: tar -> bsdtar.
Effectively this reduces dependencies in `base-chroot`, makes
it unified for musl and glibc, switches xbps-src to use `bsdtar`
rather than GNU `tar` and `xz`, gets rid of useless host dependencies
like GNU gettext, texinfo, etc.
I've been testing these changes for 1 month or so already,
I was able to build from scratch `base-system` for both native
and multiple targets, i.e `./xbps-src -a target -Nt pkg base-system`
2020-01-01 10:15:35 +00:00
|
|
|
${XBPS_SUCMD} "$XBPS_INSTALL_CMD $XBPS_INSTALL_ARGS -u ${pkgs}" || return 1
|
2014-04-09 14:42:07 +00:00
|
|
|
fi
|
|
|
|
}
|