backport cabal-tweak-flag and pkgdir ownership fix from f19 rawhide

This commit is contained in:
Jens Petersen 2013-01-18 19:08:45 +09:00
parent 14a268b914
commit be71f209c4
3 changed files with 61 additions and 4 deletions

50
cabal-tweak-flag Executable file
View File

@ -0,0 +1,50 @@
#!/bin/sh
# TODO:
# support "$0 FLAG NEW" when no upstream default
set -e +x
USAGE="Usage: $0 FLAG OLD NEW"
if [ $# -ne 3 ]; then
echo "$USAGE"
exit 1
fi
FLAG=$1
OLD=$2
NEW=$3
if [ "$OLD" = "$NEW" ]; then
echo "Old and new value can't be the same!"
exit 1
fi
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
if ! grep -q -i "^flag *$FLAG" $CABALFILE; then
echo "$CABALFILE does have flag $FLAG"
exit 1
fi
if ! grep -A3 -i "^flag *$FLAG" $CABALFILE | grep -q -i "default:"; then
echo "$CABALFILE: $FLAG flag might not have a default"
exit 1
fi
if ! grep -A3 -i "^flag *$FLAG" $CABALFILE | grep -q -i "default: *$OLD"; then
echo "$CABALFILE: $FLAG flag already defaults to $NEW"
exit 1
fi
if [ ! -f $CABALFILE.orig ]; then
BACKUP=.orig
fi
sed -i$BACKUP -e "/[Ff]lag *$FLAG/,/[Dd]efault: *$OLD/ s/\([Dd]efault: *\)$OLD/\1$NEW/" $CABALFILE

View File

@ -42,9 +42,9 @@ fi
%define pkgdir %{ghclibdir}/%{pkgnamever}\
%define docdir %{ghclibdocdir}/%{pkgnamever}\
rm -f %{basepkg}.files %{basepkg}-devel.files\
echo "%dir %{pkgdir}" >> %{basepkg}%{?ghc_without_shared:-devel}.files\
%if %{undefined ghc_without_shared}\
if [ -d "%{buildroot}%{pkgdir}" ]; then\
echo "%dir %{pkgdir}" >> %{basepkg}.files\
echo "%attr(755,root,root) %{pkgdir}/libHS%{pkgnamever}-ghc%{ghc_version}.so" >> %{basepkg}.files\
fi\
%endif\
@ -67,7 +67,7 @@ fi\
%endif\
echo "%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf" >> %{basepkg}-devel.files\
if [ -d "%{buildroot}%{pkgdir}" ]; then\
find %{buildroot}%{pkgdir} -type d | sed "s/^/%dir /" >> %{basepkg}-devel.files\
find %{buildroot}%{pkgdir} -mindepth 1 -type d | sed "s/^/%dir /" >> %{basepkg}-devel.files\
find %{buildroot}%{pkgdir} ! \\( -type d -o -name "libHS*.so" \\) >> %{basepkg}-devel.files\
fi\
if [ -d "%{buildroot}%{docdir}" ]; then\

View File

@ -6,8 +6,8 @@
#%%global without_hscolour 1
Name: ghc-rpm-macros
Version: 0.95.8
Release: 2%{?dist}
Version: 0.95.9
Release: 1%{?dist}
Summary: Macros for building packages for GHC
Group: Development/Libraries
@ -23,6 +23,7 @@ Source1: COPYING
Source2: AUTHORS
Source3: ghc-deps.sh
Source4: cabal-tweak-dep-ver
Source5: cabal-tweak-flag
Requires: redhat-rpm-config
%if %{undefined without_hscolour}
BuildRequires: redhat-rpm-config
@ -51,6 +52,7 @@ 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
install -p -D -m 0755 %{SOURCE5} %{buildroot}/%{_bindir}/cabal-tweak-flag
# this is why this package is now arch-dependent:
# turn off shared libs and dynamic linking on secondary archs
@ -69,9 +71,14 @@ EOF
%config(noreplace) %{macros_file}
%{_prefix}/lib/rpm/ghc-deps.sh
%{_bindir}/cabal-tweak-dep-ver
%{_bindir}/cabal-tweak-flag
%changelog
* Fri Jan 18 2013 Jens Petersen <petersen@redhat.com> - 0.95.9-1
- be more careful about library pkgdir ownership (#893777)
- add cabal-tweak-flag script for toggling flag default
* Thu Oct 25 2012 Jens Petersen <petersen@redhat.com> - 0.95.8-2
- BR redhat-rpm-config instead of ghc-rpm-macros
- no longer set without_hscolour in macros.ghc for bootstrapping