Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] xbps-src: add purge-binpkgs target
@ 2022-07-16 19:49 Chocimier
  2022-07-16 20:58 ` Duncaen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chocimier @ 2022-07-16 19:49 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Chocimier/void-packages-org purge-binpkgs
https://github.com/void-linux/void-packages/pull/38098

xbps-src: add purge-binpkgs target
Removes from local repository binary packages which
do not match template version.
Keeps in place packages for which template is missing.

Helps to sidestep #31347


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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-purge-binpkgs-38098.patch --]
[-- Type: text/x-diff, Size: 2934 bytes --]

From cb76c36a6acf71e0a0808a7ed2558c144a243dba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Sat, 16 Jul 2022 18:48:47 +0200
Subject: [PATCH] xbps-src: add purge-binpkgs target

Removes from local repository binary packages which
do not match template version.
Keeps in place packages for which template is missing.
---
 common/xbps-src/shutils/purge_binpkgs.sh | 35 ++++++++++++++++++++++++
 xbps-src                                 |  8 ++++++
 2 files changed, 43 insertions(+)
 create mode 100644 common/xbps-src/shutils/purge_binpkgs.sh

diff --git a/common/xbps-src/shutils/purge_binpkgs.sh b/common/xbps-src/shutils/purge_binpkgs.sh
new file mode 100644
index 000000000000..2e1c8135e28c
--- /dev/null
+++ b/common/xbps-src/shutils/purge_binpkgs.sh
@@ -0,0 +1,35 @@
+# vim: set ts=4 sw=4 et:
+
+purge_binpkgs() {
+    purge_directory() {
+        export XBPS_TARGET_ARCH="${XBPS_CROSS_BUILD:-${XBPS_MACHINE}}"
+        for filepath in "${1}"/*."$XBPS_TARGET_ARCH".xbps; do
+            ( # read_pkg exits is some cases. Use subshell to continue loop.
+                filename=${filepath##*/}
+                pkgname=${filename%-*.${XBPS_TARGET_ARCH}.xbps}
+                if [ "${pkgname%-dbg}" != "${pkgname}" ] && ! [ -e "${XBPS_SRCPKGDIR}/${pkgname}/template" ] && [ -e "${XBPS_SRCPKGDIR}/${pkgname%-dbg}/template" ]; then
+                    pkgname="${pkgname%-dbg}"
+                fi
+                export XBPS_TARGET_PKG="${pkgname}"
+                read_pkg ignore-problems
+                template_version="${version}_${revision}"
+                binpkg_version=${filename%.${XBPS_TARGET_ARCH}.xbps}
+                binpkg_version=${binpkg_version##*-}
+                if [ "${template_version}" = "_" ]; then
+                    :
+                elif [ "${binpkg_version}" != "${template_version}" ]; then
+                    rm -v "$filepath"
+                fi
+            )
+        done
+        xbps-rindex -c "${1}"
+        for i in debug multilib nonfree; do
+            if [ -d "${1}/${i}" ]; then
+                purge_directory "${1}/${i}"
+            fi
+        done
+    }
+
+    purge_directory "$XBPS_REPOSITORY"
+}
+
diff --git a/xbps-src b/xbps-src
index 4e8349091708..8ea7e0c5bc22 100755
--- a/xbps-src
+++ b/xbps-src
@@ -78,6 +78,11 @@ remove <pkgname>
 remove-autodeps
     Removes all package dependencies that were installed automatically.
 
+purge-binpkgs
+    Removes from local repository binary packages which
+    do not match template version.
+    Keeps in place packages for which template is missing.
+
 purge-distfiles
     Removes all obsolete distfiles in <hostdir>/sources.
 
@@ -824,6 +829,9 @@ case "$XBPS_TARGET" in
     purge-distfiles)
         purge_distfiles
         ;;
+    purge-binpkgs)
+        purge_binpkgs
+        ;;
     show)
         read_pkg ignore-problems
         show_pkg $XBPS_PRINT_VARIABLES

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

* Re: xbps-src: add purge-binpkgs target
  2022-07-16 19:49 [PR PATCH] xbps-src: add purge-binpkgs target Chocimier
@ 2022-07-16 20:58 ` Duncaen
  2022-10-15  2:16 ` github-actions
  2022-10-30  2:14 ` [PR PATCH] [Closed]: " github-actions
  2 siblings, 0 replies; 4+ messages in thread
From: Duncaen @ 2022-07-16 20:58 UTC (permalink / raw)
  To: ml

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

New comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/38098#issuecomment-1186290708

Comment:
You can use `xbps-checkvers` for this, basically like this PR https://github.com/void-linux/void-packages/pull/37700.

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

* Re: xbps-src: add purge-binpkgs target
  2022-07-16 19:49 [PR PATCH] xbps-src: add purge-binpkgs target Chocimier
  2022-07-16 20:58 ` Duncaen
@ 2022-10-15  2:16 ` github-actions
  2022-10-30  2:14 ` [PR PATCH] [Closed]: " github-actions
  2 siblings, 0 replies; 4+ messages in thread
From: github-actions @ 2022-10-15  2:16 UTC (permalink / raw)
  To: ml

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

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/38098#issuecomment-1279634427

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

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

* Re: [PR PATCH] [Closed]: xbps-src: add purge-binpkgs target
  2022-07-16 19:49 [PR PATCH] xbps-src: add purge-binpkgs target Chocimier
  2022-07-16 20:58 ` Duncaen
  2022-10-15  2:16 ` github-actions
@ 2022-10-30  2:14 ` github-actions
  2 siblings, 0 replies; 4+ messages in thread
From: github-actions @ 2022-10-30  2:14 UTC (permalink / raw)
  To: ml

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

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

xbps-src: add purge-binpkgs target
https://github.com/void-linux/void-packages/pull/38098

Description:
Removes from local repository binary packages which
do not match template version.
Keeps in place packages for which template is missing.

Helps to sidestep #31347


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

end of thread, other threads:[~2022-10-30  2:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-16 19:49 [PR PATCH] xbps-src: add purge-binpkgs target Chocimier
2022-07-16 20:58 ` Duncaen
2022-10-15  2:16 ` github-actions
2022-10-30  2:14 ` [PR PATCH] [Closed]: " github-actions

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).