From da823b92acb1420848f4998d03350caf8638fdae Mon Sep 17 00:00:00 2001 From: PyroPeter Date: Tue, 11 Jan 2011 21:13:10 +0100 Subject: [PATCH] repo-add: Create/modify pkgfile-db Signed-off-by: PyroPeter --- scripts/repo-add.sh.in | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index d09d1b4..b926ec9 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -29,6 +29,7 @@ confdir='@sysconfdir@' QUIET=0 DELTA=0 +WITHFILES=0 REPO_DB_FILE= LOCKFILE= CLEAN_LOCK=0 @@ -62,8 +63,8 @@ error() { # print usage instructions usage() { printf "repo-add, repo-remove (pacman) %s\n\n" "$myver" - printf "$(gettext "Usage: repo-add [-d] [-q] ...\n")" - printf "$(gettext "Usage: repo-remove [-q] ...\n\n")" + printf "$(gettext "Usage: repo-add [-d] [-q] [-f] ...\n")" + printf "$(gettext "Usage: repo-remove [-q] [-f] ...\n\n")" printf "$(gettext "\ repo-add will update a package database by reading a package file.\n\ Multiple packages to add can be specified on the command line.\n\n")" @@ -78,6 +79,9 @@ and errors\n\n")" Use the -d/--delta flag to automatically generate and add a delta file\n\ between the old entry and the new one, if the old package file is found\n\ next to the new one.\n\n")" + printf "$(gettext "\ +Use the -f/--files flag to update a files-db (for pkgfile) instead of a\n\ +normal one.\n\n")" echo "$(gettext "Example: repo-add /path/to/repo.db.tar.gz pacman-3.0.0.pkg.tar.gz")" echo "$(gettext "Example: repo-remove /path/to/repo.db.tar.gz kernel26")" } @@ -289,6 +293,13 @@ db_write_entry() write_list_entry "PROVIDES" "$_provides" "depends" write_list_entry "OPTDEPENDS" "$_optdepends" "depends" + # create files file if wanted + if (( WITHFILES )); then + msg2 "$(gettext "Creating 'files' db entry...")" + bsdtar -tf "$startdir/$pkgfile" | + awk 'BEGIN {print "%FILES%"} /^[^.]/' > files + fi + cd "$startdir" # create a delta file @@ -474,6 +485,7 @@ for arg in "$@"; do case "$arg" in -q|--quiet) QUIET=1;; -d|--delta) DELTA=1;; + -f|--files) WITHFILES=1;; *) if [[ -z $REPO_DB_FILE ]]; then REPO_DB_FILE="$arg" -- 1.7.3.4