Commit c65ed784 authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmcs: add --skip-reqs support

parent 2946d4fd
...@@ -84,7 +84,47 @@ toalt_grprepl() ...@@ -84,7 +84,47 @@ toalt_grprepl()
return 1 return 1
} }
Usage="Usage: rpmcs [specfile] do_repls()
{
local i=$1
local SPEC=$2
# TODO use perl -pe
echog "fix build requires..."
ALLREPLRULES=""
for n in `print_buildreq $i` ; do
toalt_pkgrepl $n || continue
ALLREPLRULES="$ALLREPLRULES
s|(.*Req.*)$REPLRULE1|\1$REPLRULE2|g"
[ -n "$VERBOSE" ] && echo "Replace '$REPLRULE1' with '$REPLRULE2'"
done
echog "fix package requires..."
ALLREPLRULES=""
for n in `print_pkgreq $i` ; do
toalt_pkgrepl $n || continue
ALLREPLRULES="$ALLREPLRULES
s|(.*Req.*)$REPLRULE1|\1$REPLRULE2|g"
[ -n "$VERBOSE" ] && echo "Replace '$REPLRULE1' with '$REPLRULE2'"
done
echog "fix groups..."
for n in `print_grpreq $i` ; do
toalt_grprepl $n || continue
ALLREPLRULES="$ALLREPLRULES
s|(^Group.*)$GRPREPLRULE1|\1$GRPREPLRULE2|g"
[ -n "$VERBOSE" ] && echo "Replace '$GRPREPLRULE1' with '$GRPREPLRULE2'"
done
# Replace package names in source spec
sed -r -e "$ALLREPLRULES" <$i >$SPEC || { warning "Error with replacement" ; cat $i >$SPEC ; }
echo
echo "Total used replacement rules: $ALLREPLRULES"
}
Usage="Usage: rpmcs [--skip-reqs] [specfile]
spec file can be autodetected from git repo" spec file can be autodetected from git repo"
mygetopts() mygetopts()
{ {
...@@ -96,6 +136,7 @@ phelp() ...@@ -96,6 +136,7 @@ phelp()
echog "$Descr" echog "$Descr"
echog "$Usage" echog "$Usage"
echog " specfile - spec file (copy will be saved as specfile~)" echog " specfile - spec file (copy will be saved as specfile~)"
echog " --skip-reqs do not replace requires"
exit 0 exit 0
} }
...@@ -107,6 +148,10 @@ fi ...@@ -107,6 +148,10 @@ fi
LISTRPMARGS=$@ LISTRPMARGS=$@
} }
if [ "$1" = "--skip-reqs" ] ; then
SKIPREQS=1
shift
fi
# If run without params, try autodetect spec # If run without params, try autodetect spec
if [ -z "$1" ] ; then if [ -z "$1" ] ; then
...@@ -401,38 +446,11 @@ do ...@@ -401,38 +446,11 @@ do
subst "s|^ *%|%|g" $i subst "s|^ *%|%|g" $i
echog "DONE" echog "DONE"
# TODO use perl -pe if [ -z "$SKIPREQS" ] ; then
echog "fix build requires..." do_repls $i $SPEC
ALLREPLRULES="" else
for n in `print_buildreq $i` ; do cat $i > $SPEC
toalt_pkgrepl $n || continue fi
ALLREPLRULES="$ALLREPLRULES
s|(.*Req.*)$REPLRULE1|\1$REPLRULE2|g"
[ -n "$VERBOSE" ] && echo "Replace '$REPLRULE1' with '$REPLRULE2'"
done
echog "fix package requires..."
ALLREPLRULES=""
for n in `print_pkgreq $i` ; do
toalt_pkgrepl $n || continue
ALLREPLRULES="$ALLREPLRULES
s|(.*Req.*)$REPLRULE1|\1$REPLRULE2|g"
[ -n "$VERBOSE" ] && echo "Replace '$REPLRULE1' with '$REPLRULE2'"
done
echog "fix groups..."
for n in `print_grpreq $i` ; do
toalt_grprepl $n || continue
ALLREPLRULES="$ALLREPLRULES
s|(^Group.*)$GRPREPLRULE1|\1$GRPREPLRULE2|g"
[ -n "$VERBOSE" ] && echo "Replace '$GRPREPLRULE1' with '$GRPREPLRULE2'"
done
# Replace package names in source spec
sed -r -e "$ALLREPLRULES" <$i >$SPEC || { warning "Error with replacement" ; cat $i >$SPEC ; }
echo
echo "Total used replacement rules: $ALLREPLRULES"
# Restore changelog # Restore changelog
cat $SPEC.tmpspecchangelog >>$SPEC cat $SPEC.tmpspecchangelog >>$SPEC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment