Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2024-04-27 00:40:57 +0200
committerLevente Polyak <anthraxx@archlinux.org>2024-04-27 18:38:12 +0200
commit7b553afcb25286d04dcb4cbf12e18745e8b0139a (patch)
tree54764cbf0b3941f63456269e7467c6bee4e66630
parent01614c68171304ac33e565bf62040a4c37ca77a9 (diff)
feat(db): add partial split package option to db remove
By default passing a pkgbase removes all split packages, debug packages as well as entries from the state repo for all existing architectures. When using the `--partial` option it may most likely lead to undesired effects by leaving debug packages behind as well as dangling entries in the state repository. However, for specific use cases its required to get rid of old split package parts. Fixes #218 Component: pkgctl db remove Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
-rw-r--r--contrib/completion/bash/devtools.in1
-rw-r--r--contrib/completion/zsh/_devtools.in1
-rw-r--r--doc/man/pkgctl-db-remove.1.asciidoc15
-rw-r--r--src/lib/db/remove.sh32
4 files changed, 42 insertions, 7 deletions
diff --git a/contrib/completion/bash/devtools.in b/contrib/completion/bash/devtools.in
index 2d5b7bf..ec45b62 100644
--- a/contrib/completion/bash/devtools.in
+++ b/contrib/completion/bash/devtools.in
@@ -240,6 +240,7 @@ _pkgctl_db_move_opts() {
_pkgctl_db_remove_args=(
+ --partial
-a --arch
-h --help
)
diff --git a/contrib/completion/zsh/_devtools.in b/contrib/completion/zsh/_devtools.in
index 65c7352..6dc0340 100644
--- a/contrib/completion/zsh/_devtools.in
+++ b/contrib/completion/zsh/_devtools.in
@@ -78,6 +78,7 @@ _pkgctl_db_move_args=(
)
_pkgctl_db_remove_args=(
+ '--partial[Remove only partial pkgnames from a split package]'
'(-a --arch)'{-a,--arch}"[Override the architecture (disables auto-detection)]:arch:($DEVTOOLS_VALID_BINARY_ARCHES[*])"
'(-h --help)'{-h,--help}'[Display usage]'
"1:repo:($DEVTOOLS_VALID_REPOS[*])"
diff --git a/doc/man/pkgctl-db-remove.1.asciidoc b/doc/man/pkgctl-db-remove.1.asciidoc
index a95766d..9fe07c3 100644
--- a/doc/man/pkgctl-db-remove.1.asciidoc
+++ b/doc/man/pkgctl-db-remove.1.asciidoc
@@ -12,13 +12,24 @@ pkgctl db remove [OPTIONS] [REPO] [PKGBASE]...
Description
-----------
-Remove packages from pacman repositories.
+Remove packages from pacman repositories. By default passing a pkgbase removes
+all split packages, debug packages as well as entries from the state repo for
+all existing architectures.
+
+Beware when using the `--partial` option, as it may most likely lead to
+undesired effects by leaving debug packages behind as well as dangling entries
+in the state repository.
Options
-------
+*--partial*::
+ Remove only partial pkgnames from a split package. This leaves debug
+ packages behind and pkgbase entries in the state repo.
+
*-a, --arch* 'ARCH'::
- Override the architecture (disables auto-detection)
+ Remove only one specific architecture (disables auto-detection).
+ By default all architectures are removed when this option is not used.
*-h, --help*::
Show a help text
diff --git a/src/lib/db/remove.sh b/src/lib/db/remove.sh
index ba21c83..018b793 100644
--- a/src/lib/db/remove.sh
+++ b/src/lib/db/remove.sh
@@ -17,10 +17,18 @@ pkgctl_db_remove_usage() {
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] [REPO] [PKGBASE]...
- Remove packages from binary repositories.
+ Remove packages from pacman repositories. By default passing a pkgbase removes
+ all split packages, debug packages as well as entries from the state repo for
+ all existing architectures.
+
+ Beware when using the --partial option, as it may most likely lead to
+ undesired effects by leaving debug packages behind as well as dangling entries
+ in the state repository.
OPTIONS
- -a, --arch Override the architecture (disables auto-detection)
+ -a, --arch Remove only one specific architecture (disables auto-detection)
+ --partial Remove only partial pkgnames from a split package. This leaves
+ debug packages behind and pkgbase entries in the state repo.
-h, --help Show this help text
EXAMPLES
@@ -31,8 +39,9 @@ _EOF_
pkgctl_db_remove() {
local REPO=""
- local ARCH=any
local PKGBASES=()
+ local partial=0
+ local dbscripts_options=()
# option checking
while (( $# )); do
@@ -41,9 +50,14 @@ pkgctl_db_remove() {
pkgctl_db_remove_usage
exit 0
;;
+ --partial)
+ partial=1
+ dbscripts_options+=(--partial)
+ shift
+ ;;
-a|--arch)
(( $# <= 1 )) && die "missing argument for %s" "$1"
- ARCH=$2
+ dbscripts_options+=(--arch "$2")
shift 2
;;
-*)
@@ -64,6 +78,14 @@ pkgctl_db_remove() {
shift
PKGBASES+=("$@")
+ # print explenation about partial removal
+ if (( partial )); then
+ echo
+ msg_warn "${YELLOW}Removing only partial pkgnames from a split package.${ALL_OFF}"
+ msg_warn "${YELLOW}This leaves debug packages and pkgbase entries in the state repo!${ALL_OFF}"
+ fi
+
# shellcheck disable=SC2029
- ssh "${PACKAGING_REPO_RELEASE_HOST}" db-remove "${REPO}" "${ARCH}" "${PKGBASES[@]}"
+ echo
+ ssh "${PACKAGING_REPO_RELEASE_HOST}" db-remove "${dbscripts_options[@]}" "${REPO}" "${PKGBASES[@]}"
}