mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
repo-add; add option to remove existing package files from disk
When maintaining a custom repo, often it is undesirable to retain older versions of packages. This patch adds the --remove option to remove the current package file and it's signature from disk before adding the new one to the database. Documentation is also updated. This is an optional flag and default behaviour (leaving ondisk files alone) is not changed. Signed-off-by: Phillip Smith <fukawi2@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
37e85c0031
commit
58782b1c55
@ -75,6 +75,10 @@ repo-add Options
|
|||||||
Only add packages that are not already in the database. Warnings will be
|
Only add packages that are not already in the database. Warnings will be
|
||||||
printed upon detection of existing packages, but they will not be re-added.
|
printed upon detection of existing packages, but they will not be re-added.
|
||||||
|
|
||||||
|
*-R, \--remove*::
|
||||||
|
Remove old package files from the disk when updating their entry in the
|
||||||
|
database.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
linkman:makepkg[8], linkman:pacman[8], linkman:pkgdelta[8]
|
linkman:makepkg[8], linkman:pacman[8], linkman:pkgdelta[8]
|
||||||
|
@ -31,6 +31,7 @@ declare -r confdir='@sysconfdir@'
|
|||||||
QUIET=0
|
QUIET=0
|
||||||
DELTA=0
|
DELTA=0
|
||||||
ONLYADDNEW=0
|
ONLYADDNEW=0
|
||||||
|
RMEXISTING=0
|
||||||
WITHFILES=0
|
WITHFILES=0
|
||||||
SIGN=0
|
SIGN=0
|
||||||
VERIFY=0
|
VERIFY=0
|
||||||
@ -58,6 +59,7 @@ Multiple packages to add can be specified on the command line.\n")"
|
|||||||
printf -- "$(gettext "Options:\n")"
|
printf -- "$(gettext "Options:\n")"
|
||||||
printf -- "$(gettext " -d, --delta generate and add delta for package update\n")"
|
printf -- "$(gettext " -d, --delta generate and add delta for package update\n")"
|
||||||
printf -- "$(gettext " -n, --new only add packages that are not already in the database\n")"
|
printf -- "$(gettext " -n, --new only add packages that are not already in the database\n")"
|
||||||
|
printf -- "$(gettext " -R, --remove remove package file from disk when updating database entry\n")"
|
||||||
printf -- "$(gettext " -f, --files update database's file list\n")"
|
printf -- "$(gettext " -f, --files update database's file list\n")"
|
||||||
elif [[ $cmd == "repo-remove" ]] ; then
|
elif [[ $cmd == "repo-remove" ]] ; then
|
||||||
printf -- "$(gettext "Usage: repo-remove [options] <path-to-db> <packagename|delta> ...\n")"
|
printf -- "$(gettext "Usage: repo-remove [options] <path-to-db> <packagename|delta> ...\n")"
|
||||||
@ -304,6 +306,15 @@ db_write_entry() {
|
|||||||
local oldfilename=$(grep -A1 FILENAME "$pkgentry/desc" | tail -n1)
|
local oldfilename=$(grep -A1 FILENAME "$pkgentry/desc" | tail -n1)
|
||||||
local oldfile="$(dirname "$1")/$oldfilename"
|
local oldfile="$(dirname "$1")/$oldfilename"
|
||||||
fi
|
fi
|
||||||
|
elif (( RMEXISTING )); then
|
||||||
|
# only remove existing package if we're not doing deltas
|
||||||
|
pkgentry=$(find_pkgentry "$pkgname")
|
||||||
|
if [[ -n $pkgentry ]]; then
|
||||||
|
local oldfilename="$(sed -n '/^%FILENAME%$/ {n;p;q;}' "$pkgentry/desc")"
|
||||||
|
local oldfile="$(dirname "$1")/$oldfilename"
|
||||||
|
msg2 "$(gettext "Removing existing package '%s'")" "$oldfilename"
|
||||||
|
rm -f ${oldfile} ${oldfile}.sig
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -611,6 +622,7 @@ while (( $# )); do
|
|||||||
-q|--quiet) QUIET=1;;
|
-q|--quiet) QUIET=1;;
|
||||||
-d|--delta) DELTA=1;;
|
-d|--delta) DELTA=1;;
|
||||||
-n|--new) ONLYADDNEW=1;;
|
-n|--new) ONLYADDNEW=1;;
|
||||||
|
-R|--remove) RMEXISTING=1;;
|
||||||
-f|--files) WITHFILES=1;;
|
-f|--files) WITHFILES=1;;
|
||||||
--nocolor) USE_COLOR='n';;
|
--nocolor) USE_COLOR='n';;
|
||||||
-s|--sign)
|
-s|--sign)
|
||||||
|
Loading…
Reference in New Issue
Block a user