cat > $stmp <<'EOF'
@extra_headers@
Optional: @optional@
+License: @release_license@
+State: @release_state@
EOF
pear makerpm --spec-template=$stmp $tarball
rm -f $stmp
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() {
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)
done
fi
+# parse conflicts
+conflicts=$(grep '^Conflicts:' $template || :)
if [ -n "$conflicts" ]; then
echo "$conflicts" | while read tag dep; do
dep=$(add_epoch $dep)
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")