]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - pearize.sh
- add state parsing
[packages/rpm-build-tools.git] / pearize.sh
index e725259fb213a311d2ea09c2929d914e4f8759df..78054416ed043e33c28a3e5d2350f5acf749b7d9 100644 (file)
@@ -37,6 +37,8 @@ stmp=$(mktemp "${TMPDIR:-/tmp}/fragXXXXXX")
 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 @@ template=$(rpm -q --qf "%{name}-%{version}$rc$pre$beta.spec\n" --specfile "$spec
 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 @@ add_epoch() {
        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 @@ if [ -n "$requires" ]; then
        done
 fi
 
+# parse conflicts
+conflicts=$(grep '^Conflicts:' $template || :)
 if [ -n "$conflicts" ]; then
        echo "$conflicts" | while read tag dep; do
                dep=$(add_epoch $dep)
@@ -94,6 +98,12 @@ if [ -n "$conflicts" ]; then
        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
 
 diff=$(mktemp "${TMPDIR:-/tmp}/fragXXXXXX")
This page took 1.540143 seconds and 4 git commands to generate.