cabal-tweak-dep-ver: quote wildcards in match string and show file name when no match
This commit is contained in:
parent
7cdea6ff7e
commit
1cb0fba5fb
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e +x
|
||||||
|
|
||||||
USAGE="Usage: $0 dep old new"
|
USAGE="Usage: $0 dep old new"
|
||||||
|
|
||||||
if [ $# -ne 3 ]; then
|
if [ $# -ne 3 ]; then
|
||||||
@ -7,16 +9,20 @@ if [ $# -ne 3 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CABALFILE=*.cabal
|
DEP=$1
|
||||||
|
OLD=$(echo $2 | sed -e "s/*/\\\\*/g" -e "s/\./\\\\./g")
|
||||||
|
NEW=$3
|
||||||
|
|
||||||
if [ $(ls $CABALFILE | wc -l) -ne 1 ]; then
|
CABALFILE=$(ls *.cabal)
|
||||||
|
|
||||||
|
if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then
|
||||||
echo "There needs to be one .cabal file in the current dir!"
|
echo "There needs to be one .cabal file in the current dir!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q "$1.*$2" $CABALFILE; then
|
if ! grep -q "$DEP.*$OLD" $CABALFILE; then
|
||||||
echo "$CABALFILE does not match: $1 $2"
|
echo "$CABALFILE does not match: $DEP $OLD"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i.$1 -e "s/\($1.*\)$2/\1$3/g" $CABALFILE
|
sed -i.$1 -e "s/\($DEP.*\)$OLD/\1$NEW/g" $CABALFILE
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
%global macros_file %{_sysconfdir}/rpm/macros.ghc
|
%global macros_file %{_sysconfdir}/rpm/macros.ghc
|
||||||
|
|
||||||
Name: ghc-rpm-macros
|
Name: ghc-rpm-macros
|
||||||
Version: 0.95.4
|
Version: 0.95.4.1
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: Macros for building packages for GHC
|
Summary: Macros for building packages for GHC
|
||||||
|
|
||||||
@ -64,6 +64,10 @@ EOF
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jun 22 2012 Jens Petersen <petersen@redhat.com> - 0.95.4.1-1
|
||||||
|
- cabal-tweak-dep-ver: show file name when no match
|
||||||
|
- cabal-tweak-dep-ver: backslash quote . and * in the match string
|
||||||
|
|
||||||
* Fri Jun 22 2012 Jens Petersen <petersen@redhat.com> - 0.95.4-1
|
* Fri Jun 22 2012 Jens Petersen <petersen@redhat.com> - 0.95.4-1
|
||||||
- new cabal-tweak-dep-ver script to tweak depends version bounds in .cabal
|
- new cabal-tweak-dep-ver script to tweak depends version bounds in .cabal
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user