xbps-src: new targets: update-bulk and update-sys.
* update-bulk: This rebuilds all pkgs in system repositories that are outdated. with this xbps-bulk is now considered fully obsolete. * update-sys: This rebuilds all pkgs in system that are oudated and once built, updates them via xbps-install(8). This target defines a new configuration option "XBPS_SUCMD" that is the command to execute to update the system. By default set to "sudo sh -c". CAVEATS - need to check if binpkg is in local repo. - need to add support to specify alternative rootdir. - need to add support to specify system repos.
This commit is contained in:
parent
1af40eb476
commit
d4e4d826e6
3 changed files with 97 additions and 48 deletions
78
common/xbps-src/shutils/bulk.sh
Normal file
78
common/xbps-src/shutils/bulk.sh
Normal file
|
@ -0,0 +1,78 @@
|
|||
# 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() {
|
||||
local args="$1" pkg= pkgs= _pkgs= _realdep= _deps= found= x= result=
|
||||
|
||||
if ! command -v xbps-checkvers &>/dev/null; then
|
||||
msg_error "xbps-src: cannot find xbps-checkvers(8) command!\n"
|
||||
fi
|
||||
_pkgs=$(xbps-checkvers ${args} -d $XBPS_DISTDIR | awk '{print $2}')
|
||||
# Only add to the list real pkgs, not subpkgs.
|
||||
for pkg in ${_pkgs}; do
|
||||
_realdep=$(bulk_getlink $pkg)
|
||||
unset found
|
||||
for x in ${pkgs}; do
|
||||
if [ "$x" = "${_realdep}" ]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$found" ]; then
|
||||
pkgs="$pkgs ${_realdep}"
|
||||
fi
|
||||
done
|
||||
for pkg in ${pkgs}; do
|
||||
unset found
|
||||
setup_pkg $pkg $XBPS_CROSS_BUILD
|
||||
_deps="$(show_pkg_build_deps | sed -e 's|[<>].*\$||g')"
|
||||
_realdep=$(bulk_getlink $pkg)
|
||||
for x in ${_deps}; do
|
||||
if [ "${_realdep}" = "${pkg}" ]; then
|
||||
found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ -n $found ] && result="${_realdep} ${result}"
|
||||
done
|
||||
[ -n "$result" ] && echo "$result"
|
||||
}
|
||||
|
||||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue