[packages/adapter: 556/631] adapter: make it work with multiple files

glen glen at pld-linux.org
Mon Sep 12 20:21:02 CEST 2016


commit 652057a5e0c3a3612725341aafbbf770065289d3
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Aug 26 15:58:57 2012 +0300

    adapter: make it work with multiple files

 adapter.sh | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/adapter.sh b/adapter.sh
index 78cad87..38881c6 100755
--- a/adapter.sh
+++ b/adapter.sh
@@ -16,12 +16,12 @@ REVISION=1.49
 VERSION="v0.35/$REVISION"
 VERSIONSTRING="\
 Adapter adapts .spec files for PLD Linux.
-$VERSION (C) 1999-2010 Free Penguins".
+$VERSION (C) 1999-2012 Free Penguins".
 
 PROGRAM=${0##*/}
 dir=$(d=$0; [ -L "$d" ] && d=$(readlink -f "$d"); dirname "$d")
 adapter=$dir/adapter.awk
-usage="Usage: $PROGRAM [FLAGS] SPECFILE
+usage="Usage: $PROGRAM [FLAGS] SPECFILEs
 
 -s|--no-sort|--skip-sort
 	skip BuildRequires, Requires sorting
@@ -60,7 +60,7 @@ fi
 t=$(getopt -o hsomdaV --long help,version,sort,sort-br,no-macros,skip-macros,skip-desc,skip-defattr -n "$PROGRAM" -- "$@") || exit $?
 eval set -- "$t"
 
-while true; do
+while :; do
 	case "$1" in
 	-h|--help)
 		echo 2>&1 "$usage"
@@ -246,6 +246,9 @@ import_rpm_macros() {
 }
 
 adapterize() {
+	local SPECFILE="$1"
+	[ -f "$SPECFILE" ] || SPECFILE="$(basename $SPECFILE .spec).spec"
+
 	local workdir
 	workdir=$(mktemp -d ${TMPDIR:-/tmp}/adapter-XXXXXX) || exit $?
 	awk=gawk
@@ -299,20 +302,19 @@ adapterize() {
 				cat $tmp.diff
 		fi
 	else
-		echo "The SPEC is perfect ;)"
+		echo "The spec $SPECFILE is perfect ;)"
 	fi
 
 	rm -rf $workdir
 }
 
-SPECFILE="$1"
-[ -f "$SPECFILE" ] || SPECFILE="$(basename $SPECFILE .spec).spec"
-
-if [ $# -ne 1 -o ! -f "$SPECFILE" ]; then
+if [ $# -eq 0 ]; then
 	echo "$usage"
 	exit 1
 fi
 
-adapterize
+for SPECFILE in "$@"; do
+	adapterize $SPECFILE
+done
 
 # vim: ts=4:sw=4
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/adapter.git/commitdiff/6ca0126d4d0c8c79feb7db10b0a0fade0f3b8885



More information about the pld-cvs-commit mailing list