Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] xbps-src: add update-local and show-local-updates
@ 2021-04-18 14:59 Duncaen
  2021-06-13 20:08 ` [PR PATCH] [Closed]: " Duncaen
  0 siblings, 1 reply; 3+ messages in thread
From: Duncaen @ 2021-04-18 14:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 944 bytes --]

There is a new pull request by Duncaen against master on the void-packages repository

https://github.com/Duncaen/void-packages update-local
https://github.com/void-linux/void-packages/pull/30298

xbps-src: add update-local and show-local-updates
This makes it simple to bulk build all your outdated packages in the local repository, works with `-r` and branch repos.

There are two similar commands that already exist:
1. `update-sys` which builds outdated installed packages.
2. `update-bulk` which builds outdated packages in configured repositories, so depends on having synced the hosts repositories
and depends on builds already being finished in the remote repos.

With `update-local` you can instead just build a package manually once and then update them with `./xbps-src update-local` without depending on the state of the host system.

A patch file from https://github.com/void-linux/void-packages/pull/30298.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-update-local-30298.patch --]
[-- Type: text/x-diff, Size: 3432 bytes --]

From 7d88fd9e8a87a5060c4674569dda9282b5eb46f8 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Sun, 18 Apr 2021 16:54:42 +0200
Subject: [PATCH] xbps-src: add update-local and show-local-updates

---
 common/xbps-src/shutils/bulk.sh | 21 +++++++++++++--------
 xbps-src                        | 16 ++++++++++++++--
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/common/xbps-src/shutils/bulk.sh b/common/xbps-src/shutils/bulk.sh
index 8eb6e920f04f..c4cbf220181b 100644
--- a/common/xbps-src/shutils/bulk.sh
+++ b/common/xbps-src/shutils/bulk.sh
@@ -54,7 +54,7 @@ bulk_sortdeps() {
 }
 
 bulk_build() {
-    local sys="$1"
+    local cmd="$1"
     local NPROCS=$(($(nproc)*2))
     local NRUNNING=0
 
@@ -67,10 +67,15 @@ bulk_build() {
     fi
 
     # Compare installed pkg versions vs srcpkgs
-    if [[ $sys ]]; then
-        xbps-checkvers -f '%n' -I -D $XBPS_DISTDIR
-        return $?
-    fi
+    case "$cmd" in
+    installed)
+        exec xbps-checkvers -f '%n' -I -D "$XBPS_DISTDIR"
+        ;;
+    local)
+        exec xbps-checkvers -f '%n' -i -R "${XBPS_REPOSITORY}" -R "${XBPS_REPOSITORY}/nonfree" -D "$XBPS_DISTDIR"
+        ;;
+    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 +95,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 +117,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
diff --git a/xbps-src b/xbps-src
index 9d88873ab2c5..aa8656ffeee4 100755
--- a/xbps-src
+++ b/xbps-src
@@ -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.
@@ -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.
 
@@ -943,7 +949,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/}
@@ -952,7 +961,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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Closed]: xbps-src: add update-local and show-local-updates
  2021-04-18 14:59 [PR PATCH] xbps-src: add update-local and show-local-updates Duncaen
@ 2021-06-13 20:08 ` Duncaen
  0 siblings, 0 replies; 3+ messages in thread
From: Duncaen @ 2021-06-13 20:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 812 bytes --]

There's a closed pull request on the void-packages repository

xbps-src: add update-local and show-local-updates
https://github.com/void-linux/void-packages/pull/30298

Description:
This makes it simple to bulk build all your outdated packages in the local repository, works with `-r` and branch repos.

There are two similar commands that already exist:
1. `update-sys` which builds outdated installed packages.
2. `update-bulk` which builds outdated packages in configured repositories, so depends on having synced the hosts repositories
and depends on builds already being finished in the remote repos.

With `update-local` you can instead just build a packages manually once and then update them with `./xbps-src update-local` without depending on the state of the host system or remote repositories.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PR PATCH] xbps-src: add update-local and show-local-updates
@ 2022-06-26 22:50 Duncaen
  0 siblings, 0 replies; 3+ messages in thread
From: Duncaen @ 2022-06-26 22:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

There is a new pull request by Duncaen against master on the void-packages repository

https://github.com/Duncaen/void-packages update-local
https://github.com/void-linux/void-packages/pull/37700

xbps-src: add update-local and show-local-updates
This makes it simple to bulk build all your outdated packages in the local repository, works with `-r` and branch repos.

There are two similar commands that already exist:
1. `update-sys` which builds outdated installed packages.
2. `update-bulk` which builds outdated packages in configured repositories, so depends on having synced the hosts repositories
and depends on builds already being finished in the remote repos.

With `update-local` you can instead just build a packages manually once and then update them with `./xbps-src update-local` without depending on the state of the host system or remote repositories.

A patch file from https://github.com/void-linux/void-packages/pull/37700.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-update-local-37700.patch --]
[-- Type: text/x-diff, Size: 3491 bytes --]

From c9f3acb43a14d88a90242648a9eeeedb74d1e253 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Sun, 18 Apr 2021 16:54:42 +0200
Subject: [PATCH] xbps-src: add update-local and show-local-updates

---
 common/xbps-src/shutils/bulk.sh | 21 ++++++++++++++-------
 xbps-src                        | 16 ++++++++++++++--
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/common/xbps-src/shutils/bulk.sh b/common/xbps-src/shutils/bulk.sh
index c0228f10ac2b..b0c39b2b7398 100644
--- a/common/xbps-src/shutils/bulk.sh
+++ b/common/xbps-src/shutils/bulk.sh
@@ -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
diff --git a/xbps-src b/xbps-src
index 4e8349091708..ccf008db4894 100755
--- a/xbps-src
+++ b/xbps-src
@@ -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.
@@ -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.
 
@@ -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/}
@@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-26 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-18 14:59 [PR PATCH] xbps-src: add update-local and show-local-updates Duncaen
2021-06-13 20:08 ` [PR PATCH] [Closed]: " Duncaen
2022-06-26 22:50 [PR PATCH] " Duncaen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).