add cabal-tweak-remove-upperbound

This commit is contained in:
Jens Petersen 2019-08-13 17:31:29 +02:00
parent 8532ad674a
commit f4b0280742
2 changed files with 44 additions and 1 deletions

37
cabal-tweak-remove-upperbound Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
set -e +x
USAGE="Usage: $0 dep"
if [ $# -ne 1 ]; then
echo "$USAGE"
exit 1
fi
DEP=$1
CABALFILE=$(ls *.cabal)
if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then
echo "There needs to be one .cabal file in the current dir!"
exit 1
fi
BREAK=[^[:alnum:]-]
if ! grep -q "$BREAK$DEP$BREAK[^,]*" $CABALFILE; then
echo "$CABALFILE does not match: $DEP"
exit 1
fi
if [ ! -f $CABALFILE.orig ]; then
BACKUP=.orig
fi
if grep -q "$BREAK$DEP$BREAK[^,]*&&" $CABALFILE; then
sed -i$BACKUP -e "s/\($BREAK$DEP$BREAK[^&,]*[^ ]\+\) *&&[^,]*/\1/g" $CABALFILE
fi
if grep -q "$BREAK$DEP$BREAK[^,]*==" $CABALFILE; then
sed -i$BACKUP -e "s/\($BREAK$DEP$BREAK[^=,]*\)==\([^,*]*\)\.\*/\1>=\2/g" $CABALFILE
fi

View File

@ -10,7 +10,7 @@
#%%global without_hscolour 1
Name: ghc-rpm-macros
Version: 2.0.3
Version: 2.0.4
Release: 1%{?dist}
Summary: RPM macros for building Haskell packages for GHC
@ -29,6 +29,7 @@ Source8: ghc-pkg-wrapper
Source9: macros.ghc-os
Source10: Setup.hs
Source11: cabal-tweak-drop-dep
Source12: cabal-tweak-remove-upperbound
Requires: redhat-rpm-config
# for ghc_version
Requires: ghc-compiler
@ -167,6 +168,7 @@ install -p -D -m 0644 %{SOURCE10} %{buildroot}/%{_datadir}/%{name}/Setup.hs
install -p -D -m 0755 %{SOURCE4} %{buildroot}/%{_bindir}/cabal-tweak-dep-ver
install -p -D -m 0755 %{SOURCE5} %{buildroot}/%{_bindir}/cabal-tweak-flag
install -p -D -m 0755 %{SOURCE11} %{buildroot}/%{_bindir}/cabal-tweak-drop-dep
install -p -D -m 0755 %{SOURCE12} %{buildroot}/%{_bindir}/cabal-tweak-remove-upperbound
install -p -D -m 0755 %{SOURCE8} %{buildroot}/%{_prefix}/lib/rpm/ghc-pkg-wrapper
%if 0%{?rhel} && 0%{?rhel} < 7
@ -190,6 +192,7 @@ EOF
%{_bindir}/cabal-tweak-dep-ver
%{_bindir}/cabal-tweak-drop-dep
%{_bindir}/cabal-tweak-flag
%{_bindir}/cabal-tweak-remove-upperbound
%{_datadir}/%{name}/Setup.hs
@ -203,6 +206,9 @@ EOF
%changelog
* Tue Aug 13 2019 Jens Petersen <petersen@redhat.com> - 2.0.4-1
- add cabal-tweak-remove-upperbound script
* Sat Aug 10 2019 Jens Petersen <petersen@redhat.com> - 2.0.3-1
- only depend on ghc-prof(pkgid) if libHSpkgid_p.a exists