Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions common/xbps-src/shutils/bulk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bulk_sortdeps() {
}

bulk_build() {
local sys="$1"
local cmd="$1"
local NPROCS=$(($(nproc)*2))
local NRUNNING=0

Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand Down
16 changes: 14 additions & 2 deletions xbps-src
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ show-repo-updates
show-sys-updates
Prints the list of outdated packages in your system.

show-local-updates
Prints the list of outdated packages in your local repositories.

sort-dependencies <pkg> <pkgN+1> ...
Given a list of packages specified as additional arguments, a sorted dependency
list will be returned to stdout.
Expand All @@ -132,6 +135,9 @@ update-bulk
update-sys
Rebuilds all packages in your system that are outdated and updates them.

update-local
Rebuilds all packages in your local repositories that are outdated.

update-check <pkgname>
Check upstream site of <pkgname> for new releases.

Expand Down Expand Up @@ -962,7 +968,10 @@ case "$XBPS_TARGET" in
bulk_build
;;
show-sys-updates)
bulk_build -I
bulk_build installed
;;
show-local-updates)
bulk_build local
;;
sort-dependencies)
bulk_sortdeps ${@/$XBPS_TARGET/}
Expand All @@ -971,7 +980,10 @@ case "$XBPS_TARGET" in
bulk_update
;;
update-sys)
bulk_update -I
bulk_update installed
;;
update-local)
bulk_update local
;;
update-check)
read_pkg ignore-problems
Expand Down