ghc-deps.sh: split off buildroot from the ghclibdir arg for more precise paths

This allows using the ghclibdir for checking for prof libs,
avoiding collisions with other ghcX.Y-*-prof files:

Processing files: ghc-doctemplates-prof-0.9-7.fc37.x86_64
/usr/lib/rpm/ghc-deps.sh: line 60: [: too many arguments
/usr/lib/rpm/ghc-deps.sh: line 60: [: too many arguments
/usr/lib/rpm/ghc-deps.sh: line 60: [: too many arguments
This commit is contained in:
Jens Petersen 2022-06-10 14:36:23 +08:00
parent bb41ad6f7b
commit f6aa817b92
3 changed files with 16 additions and 12 deletions

View File

@ -6,19 +6,19 @@
set +x
MODE=$1
PKGBASEDIR=$2
if [ -z "$3" ];
BUILDROOT=$2
PKGBASEDIR=$3
if [ -z "$4" ];
then GHCPREFIX=ghc
else GHCPREFIX=$3
else GHCPREFIX=$4
fi
if [ -d $PKGBASEDIR/lib ];
if [ -d $BUILDROOT$PKGBASEDIR/lib ];
then PKGBASELIB=$PKGBASEDIR/lib
LIB=lib/
else PKGBASELIB=$PKGBASEDIR
fi
PKGCONFDIR=$PKGBASELIB/package.conf.d
GHC_PKG="/usr/lib/rpm/ghc-pkg-wrapper $PKGBASEDIR"
GHC_PKG="/usr/lib/rpm/ghc-pkg-wrapper $BUILDROOT$PKGBASEDIR"
case $MODE in
--provides) field=id ;;
@ -34,7 +34,7 @@ for i in $files; do
meta=""
case $i in
# exclude rts.conf
$PKGCONFDIR/*-*.conf)
$BUILDROOT$PKGCONFDIR/*-*.conf)
name=$(grep "^name: " $i | sed -e "s/name: //")
ids=$($GHC_PKG field $name $field | sed -e "s/\(^\| \)rts\( \|$\)/ /")
for d in $ids; do
@ -57,7 +57,7 @@ for i in $files; do
echo "$GHCPREFIX-prof($d)"
;;
*)
if [ -f /usr/lib*/ghc-*/$LIB*/libHS${d}_p.a -o -f $PKGBASELIB/*/libHS${d}_p.a ]; then
if [ -f $PKGBASELIB/*/libHS${d}_p.a -o -f $BUILDROOT$PKGBASELIB/*/libHS${d}_p.a ]; then
echo "$GHCPREFIX-prof($d)"
fi
;;

View File

@ -7,7 +7,7 @@
%endif
Name: ghc-rpm-macros
Version: 2.3.16
Version: 2.4.0
Release: 1%{?dist}
Summary: RPM macros for building Haskell packages for GHC
@ -183,6 +183,10 @@ EOF
%changelog
* Fri Jun 10 2022 Jens Petersen <petersen@redhat.com> - 2.4.0-1
- change ghc-deps.sh, splitting buildroot path from ghclibdir
so that the ghc version can be used more precisely
* Wed Jun 8 2022 Jens Petersen <petersen@redhat.com> - 2.3.16-1
- define ghc_prefix (used for ghcX.Y packaging)
- add _ghc_doc_dir