fixes for when (subpackage) pkg-ver already installed

macros.ghc no longer uses ghc-pkg-wrapper

- %ghc_fix_rpath gets lib dir directly by globbing buildroot
- %ghc_gen_filelists reads pkg key from .conf
- ghc-deps.sh: read unique pkg id from .conf

before this preinstalled libs were interfering and this was further
exasperated on ghc8 where .conf filenames are not keyed so we were querying
`ghc-pkg list pkg` instead of pkg-ver.
This commit is contained in:
Jens Petersen 2017-03-03 10:04:39 +09:00
parent 09527a512d
commit b1fc196577
3 changed files with 13 additions and 7 deletions

View File

@ -23,8 +23,8 @@ for i in $files; do
case $i in
# exclude builtin_rts.conf
$pkgconfdir/*-*.conf)
pkgver=$(echo $i | sed -e "s%$pkgconfdir/\(.\+\)-.\+.conf%\1%")
ids=$($ghc_pkg field $pkgver $field | sed -e "s/rts//" -e "s/bin-package-db-[^ ]\+//")
id=$(grep "id: " $i | sed -e "s/id: //")
ids=$($ghc_pkg field $id $field | sed -e "s/rts//" -e "s/bin-package-db-[^ ]\+//")
for d in $ids; do
case $d in

View File

@ -10,7 +10,7 @@
#%%global without_hscolour 1
Name: ghc-rpm-macros
Version: 1.6.17
Version: 1.6.18
Release: 1%{?dist}
Summary: RPM macros for building Haskell packages for GHC
@ -147,6 +147,10 @@ EOF
%changelog
* Thu Mar 2 2017 Jens Petersen <petersen@redhat.com> - 1.6.18-1
- fix ghc_fix_rpath, ghc_gen_filelists, and ghc-deps.sh when pkg-ver already
installed
* Wed Feb 22 2017 Jens Petersen <petersen@redhat.com> - 1.6.17-1
- setup --global/--user in cabal_configure
- allow subpackage names to contain digits

View File

@ -70,11 +70,12 @@ LDFLAGS="${LDFLAGS:-%{?__global_ldflags}}"; export LDFLAGS\
%define pkgnamever %{pkgname}-%{pkgver}\
%define basepkg %{?ghc_name}%{!?ghc_name:ghc}-%{pkgname}\
%define docdir %{ghclibdocdir}/%{pkgnamever}\
keyname=$(%{_rpmconfigdir}/ghc-pkg-wrapper %{buildroot}%{ghclibdir} field %{pkgnamever} key)\
pkgdir="%{ghclibdir}/${keyname}"\
pkgconf=$(echo "%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf")\
key=$(grep "key: " %{buildroot}${pkgconf} | sed -e "s/key: //")\
pkgdir="%{ghclibdir}/${key}"\
rm -f %{basepkg}.files %{basepkg}-devel.files\
touch %{basepkg}.files %{basepkg}-devel.files\
echo "%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf" >> %{basepkg}-devel.files\
echo ${pkgconf} >> %{basepkg}-devel.files\
if [ -d "%{buildroot}${pkgdir}" ]; then\
echo "%%dir ${pkgdir}" >> %{basepkg}.files\
%if %{undefined ghc_without_shared}\
@ -168,7 +169,8 @@ for lib in %*; do\
rpath=$(chrpath $i | sed -e "s@^$i: R.*PATH=@@")\
case $rpath in\
*$PWD/$lib/dist/build*)\
syspath=$(%{_rpmconfigdir}/ghc-pkg-wrapper %{buildroot}%{ghclibdir} --package-db=%{buildroot}%{ghclibdir}/package.conf.d field $lib library-dirs)\
pkgid=$(cd %{buildroot}%{ghclibdir}; echo ${lib}*)\
syspath=$(%{_rpmconfigdir}/ghc-pkg-wrapper %{buildroot}%{ghclibdir} --package-db=%{buildroot}%{ghclibdir}/package.conf.d field $lib library-dirs | grep $pkgid)\
newrpath=$(echo $rpath | sed -e "s@$PWD/$lib/dist/build@${syspath}@g")\
chrpath -r $newrpath $i\
;;\