xbps-src: add update-local and show-local-updates

This commit is contained in:
Duncaen 2021-04-18 16:54:42 +02:00 committed by Duncan Overbruck
parent 82f3d8eae6
commit 4c43245e0b
2 changed files with 28 additions and 9 deletions

View file

@ -54,7 +54,7 @@ bulk_sortdeps() {
}
bulk_build() {
local sys="$1"
local cmd="$1"
local NPROCS=$(($(nproc)*2))
local NRUNNING=0
@ -67,10 +67,17 @@ bulk_build() {
fi
# Compare installed pkg versions vs srcpkgs
if [[ $sys ]]; then
bulk_sortdeps $(xbps-checkvers -f '%n' -I -D $XBPS_DISTDIR)
case "$cmd" in
installed)
bulk_sortdeps $(xbps-checkvers -f '%n' -I -D "$XBPS_DISTDIR")
return $?
fi
;;
local)
bulk_sortdeps $(xbps-checkvers -f '%n' -i -R "${XBPS_REPOSITORY}" -R "${XBPS_REPOSITORY}/nonfree" -D "$XBPS_DISTDIR")
return $?
;;
esac
# compare repo pkg versions vs srcpkgs
for f in $(xbps-checkvers -f '%n' -D $XBPS_DISTDIR); do
if [ $NRUNNING -eq $NPROCS ]; then
@ -90,9 +97,9 @@ bulk_build() {
}
bulk_update() {
local args="$1" pkgs f rval
local cmd="$1" pkgs f rval
pkgs="$(bulk_build ${args})"
pkgs="$(bulk_build "${cmd}")"
[[ -z $pkgs ]] && return 0
msg_normal "xbps-src: the following packages must be rebuilt and updated:\n"
@ -112,7 +119,7 @@ bulk_update() {
msg_error "xbps-src: failed to build $pkgver pkg!\n"
fi
done
if [ -n "$pkgs" -a -n "$args" ]; then
if [ -n "$pkgs" -a "$cmd" == installed ]; 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//[$'\n']/ }" || return 1