Historical bug tracker for the Pacman package manager.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues
This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
FS#42482 - [paccache] No candidates should not be an error
Attached to Project:
Pacman
Opened by Eric Schultz (schultzter) - Tuesday, 21 October 2014, 16:42 GMT
Last edited by Allan McRae (Allan) - Wednesday, 19 November 2014, 06:53 GMT
Opened by Eric Schultz (schultzter) - Tuesday, 21 October 2014, 16:42 GMT
Last edited by Allan McRae (Allan) - Wednesday, 19 November 2014, 06:53 GMT
|
DetailsSummary and Info:
I've created a little systemd timer unit that runs paccache on a regular basis to keep my cache clean. But a lot of the time it runs without finding any candidates and that results in an error condition. Normally that's fine. But when run from systemd it gets reported as a failure. So either no candidates should not be an error; or there should be a flag to indicate this is acceptable. Thanks, Steps to Reproduce: 1. Create a systemd.service unit that runs paccache to clean-up the cache 2. Create a systemd.timer unit that regularly calls paccache service unit 3. Prune the cache so that next time the service runs there are no packages to prune 4. Check the status next time the service runs and it will show a failure (because there are no packages to remove) |
This task depends upon
Closed by Allan McRae (Allan)
Wednesday, 19 November 2014, 06:53 GMT
Reason for closing: Fixed
Additional comments about closing: git commit 566dc233570
Wednesday, 19 November 2014, 06:53 GMT
Reason for closing: Fixed
Additional comments about closing: git commit 566dc233570
pacclean.service
[Unit]
Description=Clean-up package cache
[Service]
Type=oneshot
Nice=19
IOSchedulingClass=2
IOSchedulingPriority=7
ExecStart=/usr/bin/paccache -r
ExecStart=/usr/bin/paccache -ruk0
pacclean.timer
[Unit]
Description=Clean-up package cache
[Timer]
# run 5 minutes after boot time
OnBootSec=5min
# run 1 week after service was last started
OnUnitActiveSec=1w
[Install]
WantedBy=multi-user.target
And this is the result of systemctl status pacclean
● pacclean.service - Clean-up package cache
Loaded: loaded (/usr/local/lib/systemd/system/pacclean.service; static)
Active: failed (Result: exit-code) since Tue 2014-10-21 21:54:43 EDT; 1h 15min ago
Process: 1183 ExecStart=/usr/bin/paccache -r (code=exited, status=1/FAILURE)
Main PID: 1183 (code=exited, status=1/FAILURE)
diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in
index 71aee23..eb04e69 100644
--- a/contrib/paccache.sh.in
+++ b/contrib/paccache.sh.in
@@ -24,7 +24,7 @@ declare -r myname='paccache'
declare -r myver='@PACKAGE_VERSION@'
declare -a cachedirs=() candidates=() cmdopts=() whitelist=() blacklist=()
-declare -i delete=0 dryrun=0 filecount=0 move=0 needsroot=0 totalsaved=0 verbose=0
+declare -i delete=0 dryrun=0 filecount=0 move=0 needsroot=0 noneisok=0 totalsaved=0 verbose=0
declare delim=$'\n' keep=3 movedir= scanarch=
USE_COLOR='y'
@@ -192,6 +192,8 @@ Usage: ${myname} <operation> [options] [targets...]
delimited.
-k, --keep <num> keep "num" of each package in the cache (default: 3).
--nocolor remove color from output.
+ -n, --noneisok do report an error if there are no candidates - use
+ when checking results in another script
-u, --uninstalled target uninstalled packages.
-v, --verbose increase verbosity. specify up to 3 times.
-z, --null use null delimiters for candidate names (only with -v
@@ -205,9 +207,9 @@ version() {
echo 'Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>'
}
-OPT_SHORT=':a:c:dfhi:k:m:rsuVvz'
+OPT_SHORT=':a:c:dfhi:k:m:nrsuVvz'
OPT_LONG=('arch:' 'cachedir:' 'dryrun' 'force' 'help' 'ignore:' 'keep:' 'move'
- 'nocolor' 'remove' 'uninstalled' 'version' 'verbose' 'null')
+ 'nocolor' 'noneisok' 'remove' 'uninstalled' 'version' 'verbose' 'null')
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
exit 1
@@ -252,6 +254,8 @@ while :; do
-m|--move)
move=1 movedir=$2
shift ;;
+ -n|--noneisok)
+ noneisok=1 ;;
-r|--remove)
delete=1 ;;
-u|--uninstalled)
@@ -328,7 +332,11 @@ done
if (( ! ${#candidates[*]} )); then
msg 'no candidate packages found for pruning'
- exit 1
+ if (( noneisok )); then
+ exit 0
+ else
+ exit 1
+ fi
fi
# grab this prior to signature scavenging