SPECS: pearize.sh - add state parsing

glen glen at pld-linux.org
Tue Oct 4 01:36:04 CEST 2005


Author: glen                         Date: Mon Oct  3 23:36:04 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- add state parsing

---- Files affected:
SPECS:
   pearize.sh (1.22 -> 1.23) 

---- Diffs:

================================================================
Index: SPECS/pearize.sh
diff -u SPECS/pearize.sh:1.22 SPECS/pearize.sh:1.23
--- SPECS/pearize.sh:1.22	Tue Oct  4 01:20:54 2005
+++ SPECS/pearize.sh	Tue Oct  4 01:35:59 2005
@@ -37,6 +37,8 @@
 cat > $stmp <<'EOF'
 @extra_headers@
 Optional: @optional@
+License: @release_license@
+State: @release_state@
 EOF
 pear makerpm --spec-template=$stmp $tarball
 rm -f $stmp
@@ -45,12 +47,6 @@
 mv $template .$template~
 template=.$template~
 
-requires=$(grep '^Requires:' $template || :)
-conflicts=$(grep '^Conflicts:' $template || :)
-preamble=$(mktemp "${TMPDIR:-/tmp}/fragXXXXXX")
-# take just main package preamble, preamble of tests (and other) subpackage(s) just confuses things.
-sed -ne '/^Name:/,/^BuildRoot/p' $spec > $preamble
-
 # take as argument dependency in form NAME EQUALITY VERSION
 # adds rpm epoch to VERSION if the package is installed and has epoch bigger than zero.
 add_epoch() {
@@ -73,9 +69,15 @@
 	fi
 }
 
+preamble=$(mktemp "${TMPDIR:-/tmp}/fragXXXXXX")
+# take just main package preamble, preamble of tests (and other) subpackage(s) just confuses things.
+sed -ne '/^Name:/,/^BuildRoot/p' $spec > $preamble
+
 # create backup
 bak=$(cp -fbv $spec $spec | awk '{print $NF}' | tr -d "['\`]" )
 
+# parse requires
+requires=$(grep '^Requires:' $template || :)
 if [ -n "$requires" ]; then
 	echo "$requires" | while read tag dep; do
 		dep=$(add_epoch $dep)
@@ -85,6 +87,8 @@
 	done
 fi
 
+# parse conflicts
+conflicts=$(grep '^Conflicts:' $template || :)
 if [ -n "$conflicts" ]; then
 	echo "$conflicts" | while read tag dep; do
 		dep=$(add_epoch $dep)
@@ -93,6 +97,12 @@
 		fi
 	done
 fi
+
+# parse state
+state=$(awk '/^State:/{print $2}' $template)
+sed -i -e "/^%define.*_status/{
+	/%define.*_status.*$state/!s/.*/%define\t\t_status\t\t$state/
+}" $spec
 
 rm -f $preamble
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/pearize.sh?r1=1.22&r2=1.23&f=u




More information about the pld-cvs-commit mailing list