[pacman-dev] [PATCH 6/6] bacman: code and indentation cleanup
lolilolicon
lolilolicon at gmail.com
Thu Sep 29 13:14:06 EDT 2011
$EXT is never used, don't set it. The redundant code came from makepkg,
which could probably use this fix too.
Also fixed is the vim mode line. bacman uses four space indentation, which
is against the project guidelines, but consistency in the same file is more
important, IMHO.
Signed-off-by: lolilolicon <lolilolicon at gmail.com>
---
contrib/bacman.in | 30 +++++++++++-------------------
1 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/contrib/bacman.in b/contrib/bacman.in
index a28f8e7..ec953ce 100755
--- a/contrib/bacman.in
+++ b/contrib/bacman.in
@@ -77,14 +77,14 @@ fi
# parse value of simple, non-repeating variable assignment
conf_var_val() {
- local var=${1//\//\\/}
- awk '
- /^[ \t]*'"${var}"'[ \t]*=/ {
- sub(/[^=]+=[ \t]*/, "")
- sub(/[ \t]*$/, "")
- print
- exit
- }'
+ local var=${1//\//\\/}
+ awk '
+ /^[ \t]*'"${var}"'[ \t]*=/ {
+ sub(/[^=]+=[ \t]*/, "")
+ sub(/[ \t]*$/, "")
+ print
+ exit
+ }'
}
DBPath=$(conf_var_val DBPath < @sysconfdir@/pacman.conf)
@@ -282,17 +282,7 @@ chmod 644 "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
#
echo "Generating the package..."
-case "$PKGEXT" in
- *tar.gz) EXT=${PKGEXT%.gz} ;;
- *tar.bz2) EXT=${PKGEXT%.bz2} ;;
- *tar.xz) EXT=${PKGEXT%.xz} ;;
- *tar) EXT=${PKGEXT} ;;
- *) echo "WARNING: '%s' is not a valid archive extension." \
- "$PKGEXT" ; EXT=$PKGEXT ;;
-esac
-
pkg_file="$pkg_dest/$pkg_namver-$pkg_arch${PKGEXT}"
-ret=0
# TODO: Maybe this can be set globally for robustness
shopt -s -o pipefail
@@ -302,6 +292,8 @@ case "$PKGEXT" in
*tar.bz2) bzip2 -c -f ;;
*tar.xz) xz -c -z - ;;
*tar) cat ;;
+ *) echo "WARNING: '%s' is not a valid archive extension." \
+ "$PKGEXT" >&2; cat ;;
esac > "${pkg_file}"; ret=$?
if [ $ret -ne 0 ]; then
@@ -317,5 +309,5 @@ echo Done
exit 0
-# vim: set ts=2 sw=2 noet:
+# vim: set ts=4 sw=4 et:
--
1.7.6.4
More information about the pacman-dev
mailing list