Add a -n option to repo-add to only add new packages
Packages are already in the pkg db were given a warning, and then readded anyway. With -n specified, the warning is printed, but skips readding it. Signed-off-by: Danny George <dangets@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
fe0586e240
commit
965e1de217
|
@ -68,6 +68,10 @@ repo-add Options
|
||||||
specified packages. This is useful for creating databases listing all files
|
specified packages. This is useful for creating databases listing all files
|
||||||
in a given sync repository for tools that may use this information.
|
in a given sync repository for tools that may use this information.
|
||||||
|
|
||||||
|
*-n, \--new*::
|
||||||
|
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.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
linkman:makepkg[8], linkman:pacman[8], linkman:pkgdelta[8]
|
linkman:makepkg[8], linkman:pacman[8], linkman:pkgdelta[8]
|
||||||
|
|
|
@ -30,6 +30,7 @@ declare -r confdir='@sysconfdir@'
|
||||||
|
|
||||||
QUIET=0
|
QUIET=0
|
||||||
DELTA=0
|
DELTA=0
|
||||||
|
ONLYADDNEW=0
|
||||||
WITHFILES=0
|
WITHFILES=0
|
||||||
SIGN=0
|
SIGN=0
|
||||||
VERIFY=0
|
VERIFY=0
|
||||||
|
@ -55,6 +56,7 @@ Multiple packages to add can be specified on the command line.\n")"
|
||||||
printf -- "\n"
|
printf -- "\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 " -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")"
|
||||||
|
@ -290,6 +292,9 @@ db_write_entry() {
|
||||||
|
|
||||||
if [[ -d $tmpdir/tree/$pkgname-$pkgver ]]; then
|
if [[ -d $tmpdir/tree/$pkgname-$pkgver ]]; then
|
||||||
warning "$(gettext "An entry for '%s' already existed")" "$pkgname-$pkgver"
|
warning "$(gettext "An entry for '%s' already existed")" "$pkgname-$pkgver"
|
||||||
|
if (( ONLYADDNEW )); then
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
if (( DELTA )); then
|
if (( DELTA )); then
|
||||||
pkgentry=$(find_pkgentry "$pkgname")
|
pkgentry=$(find_pkgentry "$pkgname")
|
||||||
|
@ -603,6 +608,7 @@ while (( $# )); do
|
||||||
case $1 in
|
case $1 in
|
||||||
-q|--quiet) QUIET=1;;
|
-q|--quiet) QUIET=1;;
|
||||||
-d|--delta) DELTA=1;;
|
-d|--delta) DELTA=1;;
|
||||||
|
-n|--new) ONLYADDNEW=1;;
|
||||||
-f|--files) WITHFILES=1;;
|
-f|--files) WITHFILES=1;;
|
||||||
-s|--sign)
|
-s|--sign)
|
||||||
check_gpg
|
check_gpg
|
||||||
|
|
Loading…
Reference in New Issue