From: Elan Ruusamäe Date: Mon, 3 Oct 2005 23:35:59 +0000 (+0000) Subject: - add state parsing X-Git-Tag: auto/th/rpm-build-tools-4.5-5~7^2~281 X-Git-Url: http://git.pld-linux.org/?a=commitdiff_plain;h=5e551ed79227a95ef66d3223b850f0a5ee6fa66b;p=packages%2Frpm-build-tools.git - add state parsing Changed files: pearize.sh -> 1.23 --- diff --git a/pearize.sh b/pearize.sh index e725259..7805441 100644 --- a/pearize.sh +++ b/pearize.sh @@ -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")