Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts/repo-add.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/repo-add.sh.in')
-rw-r--r--scripts/repo-add.sh.in28
1 files changed, 16 insertions, 12 deletions
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 63d94d37..e90f0e89 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -3,7 +3,7 @@
# repo-add - add a package to a given repo database file
# @configure_input@
#
-# Copyright (c) 2006 Aaron Griffin <aaron@archlinux.org>
+# Copyright (c) 2006-2008 Aaron Griffin <aaron@archlinux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,18 +25,20 @@ export TEXTDOMAINDIR='@localedir@'
myver='@PACKAGE_VERSION@'
confdir='@sysconfdir@'
-FORCE=0
+QUIET=0
REPO_DB_FILE=""
# ensure we have a sane umask set
umask 0022
msg() {
+ [ $QUIET -ne 0 ] && return
local mesg=$1; shift
printf "==> ${mesg}\n" "$@" >&1
}
msg2() {
+ [ $QUIET -ne 0 ] && return
local mesg=$1; shift
printf " -> ${mesg}\n" "$@" >&1
}
@@ -54,21 +56,20 @@ error() {
# print usage instructions
usage() {
printf "repo-add (pacman) %s\n\n" "$myver"
- printf "$(gettext "Usage: %s <path-to-db> [--force] <package> ...\n\n")" "$0"
+ printf "$(gettext "Usage: %s [-q] <path-to-db> <package> ...\n\n")" "$0"
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")"
printf "$(gettext "\
-The --force flag will add a 'force' entry to the sync database, which\n\
-tells pacman to skip its internal version number checking and update\n\
-the package regardless.\n\n")"
+The -q/--quiet flag will force this program to run silently except\n\
+in the case of warnings or errors.\n\n")"
echo "$(gettext "Example: repo-add /path/to/repo.db.tar.gz pacman-3.0.0.pkg.tar.gz")"
}
version() {
printf "repo-add (pacman) %s\n" "$myver"
printf "$(gettext "\
-Copyright (C) 2006 Aaron Griffin <aaron@archlinux.org>.\n\n\
+Copyright (C) 2006-2008 Aaron Griffin <aaron@archlinux.org>.\n\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n")"
}
@@ -117,7 +118,7 @@ db_write_delta()
# get md5sum and size of delta
md5sum="$(md5sum "$deltafile" | cut -d ' ' -f 1)"
- csize=$(du -b -L "$deltafile" | cut -f 1)
+ csize=$(du -kL "$deltafile" | awk '{print $1 * 1024}')
# ensure variables were found
if [ -z "$pkgname" -o -z "$fromver" -o -z "$tover" -o -z "$arch" ]; then
@@ -164,7 +165,7 @@ db_write_entry()
IFS=$OLDIFS
# get compressed size of package
- csize=$(du -b -L "$pkgfile" | cut -f 1)
+ csize=$(du -kL "$pkgfile" | awk '{print $1 * 1024}')
startdir=$(pwd)
pushd "$gstmpdir" 2>&1 >/dev/null
@@ -209,7 +210,7 @@ db_write_entry()
[ -n "$builddate" ] && echo -e "%BUILDDATE%\n$builddate\n" >>desc
[ -n "$packager" ] && echo -e "%PACKAGER%\n$packager\n" >>desc
write_list_entry "REPLACES" "$_replaces" "desc"
- [ $FORCE -eq 1 -o -n "$force" ] && echo -e "%FORCE%\n" >>desc
+ [ -n "$force" ] && echo -e "%FORCE%\n" >>desc
# create depends entry
msg2 "$(gettext "Creating 'depends' db entry...")"
@@ -236,7 +237,7 @@ db_write_entry()
if db_write_delta "$delta"; then
msg2 "$(gettext "Added delta '%s'")" "$(basename "$delta")"
else
- msg2 "$(gettext "Could not add delta '%s'")" "$(basename "$delta")"
+ warning "$(gettext "Could not add delta '%s'")" "$(basename "$delta")"
fi
fi
done
@@ -298,7 +299,10 @@ success=0
# parse arguments
for arg in "$@"; do
if [ "$arg" == "--force" -o "$arg" == "-f" ]; then
- FORCE=1
+ warning "$(gettext "the -f and --force options are no longer recognized")"
+ msg2 "$(gettext "use options=(force) in the PKGBUILD instead")"
+ elif [ "$arg" == "--quiet" -o "$arg" == "-q" ]; then
+ QUIET=1
elif [ -z "$REPO_DB_FILE" ]; then
REPO_DB_FILE=$(readlink -f "$arg")
if ! test_repo_db_file; then