[ghc-rpm-macros] add ghc_bootstrapping to ghc_bootstrap; fix ghc-deps.sh when bootstrapping

Jens Petersen petersen at fedoraproject.org
Tue Oct 18 08:43:49 UTC 2011


commit 0b163b3d06efaa7cf43b74777a3edd315a7c96f9
Author: Jens Petersen <petersen at redhat.com>
Date:   Tue Oct 18 17:43:47 2011 +0900

    add ghc_bootstrapping to ghc_bootstrap; fix ghc-deps.sh when bootstrapping

 ghc-deps.sh         |   13 ++++++++++---
 ghc-rpm-macros.ghc  |    4 +++-
 ghc-rpm-macros.spec |    6 +++++-
 3 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/ghc-deps.sh b/ghc-deps.sh
index 0ad905b..add9b9f 100755
--- a/ghc-deps.sh
+++ b/ghc-deps.sh
@@ -11,6 +11,13 @@
 MODE=$1
 PKGBASEDIR=$2
 PKGCONFDIR=$PKGBASEDIR/package.conf.d
+GHC_VER=$(basename $PKGBASEDIR | sed -e s/ghc-//)
+
+if [ ! -x "/usr/bin/ghc-pkg-${GHC_VER}" -a -x "$PKGBASEDIR/ghc-pkg" ]; then
+    GHC_PKG="$PKGBASEDIR/ghc-pkg --global-conf=$PKGCONFDIR"
+else
+    GHC_PKG=/usr/bin/ghc-pkg
+fi
 
 case $MODE in
     --provides) FIELD=id ;;
@@ -45,7 +52,7 @@ for i in $files; do
 	    esac
 	    if [ "$META" ]; then
 		PKGVER=$(echo $LIB_FILE | sed -e "s%$PKGBASEDIR/\([^/]\+\)/libHS.*%\1%")
-		HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER $FIELD | sed -e "s/^$FIELD: \+//")
+		HASHS=$(${GHC_PKG} -f $PKGCONFDIR field $PKGVER $FIELD | sed -e "s/^$FIELD: \+//")
 		for i in $HASHS; do
 		    case $i in
 			*-*) echo $i | sed -e "s/\(.*\)-\(.*\)/$META(\1) = \2/" ;;
@@ -53,7 +60,7 @@ for i in $files; do
 		    esac
 		done
 		if [ "$MODE" = "--requires" -a "$SELF" ]; then
-		    HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER id | sed -e "s/^id: \+//")
+		    HASHS=$(${GHC_PKG} -f $PKGCONFDIR field $PKGVER id | sed -e "s/^id: \+//")
 		    for i in $HASHS; do
 			echo $i | sed -e "s/\(.*\)-\(.*\)/$SELF(\1) = \2/"
 		    done
@@ -64,7 +71,7 @@ for i in $files; do
 	if file $i | grep -q 'executable, .* dynamically linked'; then
 	    BIN_DEPS=$(ldd $i | grep libHS | grep -v libHSrts | sed -e "s%^\\tlibHS\(.*\)-ghc${GHCVERSION}.so =.*%\1%")
 	    for p in ${BIN_DEPS}; do
-		HASH=$(ghc-pkg --global field $p id | sed -e "s/^id: \+//")
+		HASH=$(${GHC_PKG} --global field $p id | sed -e "s/^id: \+//")
 		echo $HASH | sed -e "s/\(.*\)-\(.*\)/ghc(\1) = \2/"
 	    done
 	fi
diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc
index 970c6eb..98cda6c 100644
--- a/ghc-rpm-macros.ghc
+++ b/ghc-rpm-macros.ghc
@@ -221,7 +221,9 @@ find %{buildroot} -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \
 %global ghc_without_dynamic 1\
 %global without_prof 1\
 %global without_haddock 1\
-%global without_manual 1
+%global without_manual 1\
+# needs to be set also in ghc.spec\
+%global ghc_bootstrapping 1
 
 # skip prof libs, and documentation
 # - without_hscolour needs to be set locally in the spec file
diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index 08e9daf..457a63a 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -3,7 +3,7 @@
 %global macros_file %{_sysconfdir}/rpm/macros.ghc
 
 Name:           ghc-rpm-macros
-Version:        0.13.12
+Version:        0.13.13
 Release:        1%{?dist}
 Summary:        Macros for building packages for GHC
 
@@ -60,6 +60,10 @@ EOF
 
 
 %changelog
+* Mon Oct 17 2011 Jens Petersen <petersen at redhat.com> - 0.13.13-1
+- add ghc_bootstrapping to ghc_bootstrap for packages other than ghc
+- make ghc-deps.sh also work when bootstrapping a new ghc version
+
 * Sat Oct 15 2011 Jens Petersen <petersen at redhat.com> - 0.13.12-1
 - add ghc_exclude_docdir to exclude docdir from filelists
 


More information about the scm-commits mailing list