replace %cabal_tweak_dep_ver with cabal-tweak-dep-ver script

rpmbuild doesn't handle spaces in quoted args
This commit is contained in:
Jens Petersen 2012-06-22 13:46:59 +09:00
parent bab627bc22
commit 7cdea6ff7e
3 changed files with 27 additions and 9 deletions

22
cabal-tweak-dep-ver Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
USAGE="Usage: $0 dep old new"
if [ $# -ne 3 ]; then
echo "$USAGE"
exit 1
fi
CABALFILE=*.cabal
if [ $(ls $CABALFILE | wc -l) -ne 1 ]; then
echo "There needs to be one .cabal file in the current dir!"
exit 1
fi
if ! grep -q "$1.*$2" $CABALFILE; then
echo "$CABALFILE does not match: $1 $2"
exit 1
fi
sed -i.$1 -e "s/\($1.*\)$2/\1$3/g" $CABALFILE

View File

@ -18,14 +18,6 @@ proceeding, to avoid dependency ABI breakage from a future ghc rebuild."\
%endif\
fi
# tweak depends versions
# cabal_tweak_dep_ver dep old new [backup]
%cabal_tweak_dep_ver()\
if ! grep -q "%1[ >=].*%2"; then\
exit 1\
fi\
sed -i.%{?3}%1 -e "s/\(%1[ >=].*\)%2/\1%3/g" %{pkg_name}-%{version}/%{pkg_name}.cabal
# configure
%cabal_configure\
%ghc_check_bootstrap\

View File

@ -19,6 +19,7 @@ Source0: ghc-rpm-macros.ghc
Source1: COPYING
Source2: AUTHORS
Source3: ghc-deps.sh
Source4: cabal-tweak-dep-ver
Requires: redhat-rpm-config
%description
@ -41,6 +42,8 @@ install -p -D -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{macros_file}
install -p -D -m 0755 %{SOURCE3} %{buildroot}/%{_prefix}/lib/rpm/ghc-deps.sh
install -p -D -m 0755 %{SOURCE4} %{buildroot}/%{_bindir}/cabal-tweak-dep-ver
# this is why this package is now arch-dependent:
# turn off shared libs and dynamic linking on secondary archs
%ifnarch %{ix86} x86_64
@ -57,11 +60,12 @@ EOF
%doc COPYING AUTHORS
%config(noreplace) %{macros_file}
%{_prefix}/lib/rpm/ghc-deps.sh
%{_bindir}/cabal-tweak-dep-ver
%changelog
* Fri Jun 22 2012 Jens Petersen <petersen@redhat.com> - 0.95.4-1
- add cabal_tweak_dep_ver macro to tweak a depend's version bound in .cabal
- new cabal-tweak-dep-ver script to tweak depends version bounds in .cabal
* Sat Jun 9 2012 Jens Petersen <petersen@redhat.com> - 0.95.3-1
- ghc-dep.sh: only use buildroot package.conf.d if it exists