[Pkg-haskell-commits] darcs: haskell-devscripts: Pass variables from the Makefile to the Dh_Haskell in environment variables; safer when they contain spaces or quotes.

Joachim Breitner mail at joachim-breitner.de
Tue Apr 28 08:48:12 UTC 2015


Tue Apr 28 08:21:51 UTC 2015  Joachim Breitner <mail at joachim-breitner.de>
  * Pass variables from the Makefile to the Dh_Haskell in environment variables; safer when they contain spaces or quotes.

    M ./Dh_Haskell.sh -49 +16
    M ./debian/changelog +7
    M ./hlibrary.mk -16 +42

Tue Apr 28 08:21:51 UTC 2015  Joachim Breitner <mail at joachim-breitner.de>
  * Pass variables from the Makefile to the Dh_Haskell in environment variables; safer when they contain spaces or quotes.
diff -rN -u old-haskell-devscripts/debian/changelog new-haskell-devscripts/debian/changelog
--- old-haskell-devscripts/debian/changelog	2015-04-28 08:48:12.429099450 +0000
+++ new-haskell-devscripts/debian/changelog	2015-04-28 08:48:12.445099445 +0000
@@ -1,3 +1,10 @@
+haskell-devscripts (0.9.4) UNRELEASED; urgency=medium
+
+  * Pass variables from the Makefile to the Dh_Haskell in environment
+    variables; safer when they contain spaces or quotes.
+
+ -- Joachim Breitner <nomeata at debian.org>  Tue, 28 Apr 2015 09:43:32 +0200
+
 haskell-devscripts (0.9.3) unstable; urgency=medium
 
   [ Dmitry Bogatov ]
diff -rN -u old-haskell-devscripts/Dh_Haskell.sh new-haskell-devscripts/Dh_Haskell.sh
--- old-haskell-devscripts/Dh_Haskell.sh	2015-04-28 08:48:12.433099449 +0000
+++ new-haskell-devscripts/Dh_Haskell.sh	2015-04-28 08:48:12.453099447 +0000
@@ -32,8 +32,6 @@
 }
 
 packages_hc(){
-    DEB_DEFAULT_COMPILER=$1
-    DEB_PACKAGES=$2
     hcs=`{ for i in ${DEB_PACKAGES}; do package_hc $i; done; } | sort -u`
     if [ `echo ${hcs} | wc -w` = 0 ]; then hcs=${DEB_DEFAULT_COMPILER}; fi
     if [ `echo ${hcs} | wc -w` != 1 ]; then echo "Multiple compilers not supported: ${hc}"; exit 1; fi
@@ -341,10 +339,6 @@
 
 clean_recipe(){
     # local PS5=$PS4; PS4=" + clean_recipe> "; set -x
-    DEB_SETUP_BIN_NAME=$1
-    CABAL_PACKAGE=$2
-    MAKEFILE=$3
-    DEB_LINTIAN_OVERRIDES_FILE=$4
     [ ! -x "${DEB_SETUP_BIN_NAME}" ] || ${DEB_SETUP_BIN_NAME} clean
     rm -rf dist dist-ghc dist-ghcjs dist-hugs ${DEB_SETUP_BIN_NAME} Setup.hi Setup.ho Setup.o .*config*
     rm -f configure-ghc-stamp configure-ghcjs-stamp build-ghc-stamp build-ghcjs-stamp build-hugs-stamp build-haddock-stamp
@@ -363,26 +357,13 @@
 
 make_setup_recipe(){
     # local PS5=$PS4; PS4=" + make_setup_recipe> "; set -x
-    DEB_SETUP_BIN_NAME=$1
     for setup in Setup.lhs Setup.hs; do if test -e $setup; then ghc --make $setup -o ${DEB_SETUP_BIN_NAME}; exit 0; fi; done
     # PS4=$PS5
 }
 
 configure_recipe(){
     # local PS5=$PS4; PS4=" + configure_recipe> "; set -x
-    DEB_SETUP_BIN_NAME=$1
-    CABAL_PACKAGE=$2
-    CABAL_VERSION=$3
-    ENABLE_PROFILING=$4
-    NO_GHCI_FLAG=$5
-    DEB_SETUP_GHC6_CONFIGURE_ARGS=$6
-    DEB_SETUP_GHC_CONFIGURE_ARGS=$7
-    OPTIMIZATION=$8
-    TESTS=$9
-    DEB_DEFAULT_COMPILER=$10
-    DEB_PACKAGES=$11
-
-    hc=`packages_hc "${DEB_DEFAULT_COMPILER}" "${DEB_PACKAGES}"`
+    hc=`packages_hc`
 
     ENABLE_PROFILING=`{ for i in ${DEB_PACKAGES}; do package_ext $i | grep prof; done; } | sort -u | sed 's/prof/--enable-library-profiling/'`
     local GHC_OPTIONS
@@ -391,40 +372,36 @@
     ${DEB_SETUP_BIN_NAME} configure "--${hc}" -v2 --package-db=/`hc_pkgdir ${hc}` \
         --prefix=/`hc_prefix ${hc}` --libdir=/`hc_libdir ${hc}` \
 	--builddir=dist-${hc} \
-       --ghc-options="${GHC_OPTIONS}" \
-	--haddockdir=/`hc_docdir ${hc} ${CABAL_PACKAGE}-${CABAL_VERSION}` --datasubdir=${CABAL_PACKAGE}\
-	--htmldir=/`hc_htmldir ${hc} ${CABAL_PACKAGE}` ${ENABLE_PROFILING} ${NO_GHCI_FLAG} \
-	${DEB_SETUP_GHC6_CONFIGURE_ARGS} ${DEB_SETUP_GHC_CONFIGURE_ARGS} ${OPTIMIZATION} ${TESTS}
+	--ghc-options="${GHC_OPTIONS}" \
+	--haddockdir=/`hc_docdir ${hc} ${CABAL_PACKAGE}-${CABAL_VERSION}` \
+	--datasubdir=${CABAL_PACKAGE}\
+	--htmldir=/`hc_htmldir ${hc} ${CABAL_PACKAGE}` \
+	${ENABLE_PROFILING} \
+	${NO_GHCI_FLAG} \
+	${DEB_SETUP_GHC6_CONFIGURE_ARGS} \
+	${DEB_SETUP_GHC_CONFIGURE_ARGS} \
+	${OPTIMIZATION} \
+	${TESTS}
     # PS4=$PS5
 }
 
 build_recipe(){
     # local PS5=$PS4; PS4=" + build_recipe> "; set -x
-    DEB_SETUP_BIN_NAME=$1
-    DEB_DEFAULT_COMPILER=$2
-    DEB_PACKAGES=$3
-    hc=`packages_hc "${DEB_DEFAULT_COMPILER}" "${DEB_PACKAGES}"`
+    hc=`packages_hc`
     ${DEB_SETUP_BIN_NAME} build --builddir=dist-${hc}
     # PS4=$PS5
 }
 
 check_recipe(){
     # local PS5=$PS4; PS4=" + check_recipe> "; set -x
-    DEB_SETUP_BIN_NAME=$1
-    DEB_DEFAULT_COMPILER=$2
-    DEB_PACKAGES=$3
-    hc=`packages_hc "${DEB_DEFAULT_COMPILER}" "${DEB_PACKAGES}"`
+    hc=`packages_hc`
     ${DEB_SETUP_BIN_NAME} test --builddir=dist-${hc} --show-details=always
     # PS4=$PS5
 }
 
 haddock_recipe(){
     # local PS5=$PS4; PS4=" + haddock_recipe> "; set -x
-    DEB_SETUP_BIN_NAME=$1
-    DEB_HADDOCK_OPTS=$2
-    DEB_DEFAULT_COMPILER=$3
-    DEB_PACKAGES=$4
-    hc=`packages_hc "${DEB_DEFAULT_COMPILER}" "${DEB_PACKAGES}"`
+    hc=`packages_hc`
     haddock=`hc_haddock ${hc}`
     [ ! -x /usr/bin/${haddock} ] || ${DEB_SETUP_BIN_NAME} haddock --builddir=dist-${hc} --with-haddock=/usr/bin/${haddock} --with-ghc=${hc} ${DEB_HADDOCK_OPTS} || \
 	  echo "Haddock failed (no modules?), creating empty documentation package."
@@ -433,8 +410,7 @@
 
 extra_depends_recipe(){
     # local PS5=$PS4; PS4=" + extra_depends_recipe> "; set -x
-    DEB_SETUP_BIN_NAME=$1
-    hc=$2
+    hc=$1
     pkg_config=`${DEB_SETUP_BIN_NAME} register --builddir=dist-${hc} --gen-pkg-config | tr -d ' \n' | sed -r 's,^.*:,,'`
     dh_haskell_extra_depends ${hc} $pkg_config
     rm $pkg_config
@@ -443,13 +419,7 @@
 
 install_dev_recipe(){
     # local PS5=$PS4; PS4=" + install_dev_recipe> "; set -x
-    DEB_SETUP_BIN_NAME=$1
-    CABAL_PACKAGE=$2
-    CABAL_VERSION=$3
-    HASKELL_HIDE_PACKAGES=$4
-    DEB_GHC_EXTRA_PACKAGES=$5
-    DEB_LINTIAN_OVERRIDES_FILE=$6
-    PKG=$7
+    PKG=$1
 
     hc=`package_hc ${PKG}`
     libdir=`package_libdir ${PKG}`
@@ -489,9 +459,6 @@
 
 install_doc_recipe(){
     # local PS5=$PS4; PS4=" + install_doc_recipe> "; set -x
-    CABAL_PACKAGE=$1
-    CABAL_VERSION=$2
-    DEB_ENABLE_HOOGLE=$3
     PKG=$4
     hc=`package_hc ${PKG}`
     pkgid=${CABAL_PACKAGE}-${CABAL_VERSION}
diff -rN -u old-haskell-devscripts/hlibrary.mk new-haskell-devscripts/hlibrary.mk
--- old-haskell-devscripts/hlibrary.mk	2015-04-28 08:48:12.429099450 +0000
+++ new-haskell-devscripts/hlibrary.mk	2015-04-28 08:48:12.453099447 +0000
@@ -94,27 +94,48 @@
 
 DEB_BUILD_DEPENDENCIES = build-arch
 
+# We call the shell for most things, so make our variables available to it
+export DEB_SETUP_BIN_NAME
+export CABAL_PACKAGE
+export CABAL_VERSION
+export ENABLE_PROFILING
+export NO_GHCI_FLAG
+export DEB_SETUP_GHC6_CONFIGURE_ARGS
+export DEB_SETUP_GHC_CONFIGURE_ARGS
+export OPTIMIZATION
+export TESTS
+export DEB_DEFAULT_COMPILER
+export DEB_PACKAGES
+export DEB_HADDOCK_OPTS
+export HASKELL_HIDE_PACKAGES
+export DEB_GHC_EXTRA_PACKAGES
+export DEB_LINTIAN_OVERRIDES_FILE
+export DEB_ENABLE_HOOGLE
+export MAKEFILE
+
 clean::
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && clean_recipe $(DEB_SETUP_BIN_NAME) $(CABAL_PACKAGE) $(MAKEFILE) $(DEB_LINTIAN_OVERRIDES_FILE)
+	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
+	clean_recipe
 
 $(DEB_SETUP_BIN_NAME):
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && make_setup_recipe "$(DEB_SETUP_BIN_NAME)"
+	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
+	make_setup_recipe
 
 configure-ghc-stamp: $(DEB_SETUP_BIN_NAME)
 	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-	  configure_recipe "$(DEB_SETUP_BIN_NAME)" "$(CABAL_PACKAGE)" "$(CABAL_VERSION)" \
-	    "$(ENABLE_PROFILING)" "$(NO_GHCI_FLAG)" "$(DEB_SETUP_GHC6_CONFIGURE_ARGS)" \
-	    "$(DEB_SETUP_GHC_CONFIGURE_ARGS)" "$(OPTIMIZATION)" "$(TESTS)" "$(DEB_DEFAULT_COMPILER)" "$(DEB_PACKAGES)"
+	configure_recipe
 	touch $@
 
 build-ghc-stamp: configure-ghc-stamp
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && build_recipe "$(DEB_SETUP_BIN_NAME)" "$(DEB_DEFAULT_COMPILER)" "$(DEB_PACKAGES)"
+	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
+	build_recipe
 	touch $@
 
 ifeq ($(DEB_ENABLE_TESTS),yes)
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 check-ghc-stamp: build-ghc-stamp
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && check_recipe "$(DEB_SETUP_BIN_NAME)" "$(DEB_DEFAULT_COMPILER)" "$(DEB_PACKAGES)"
+	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
+	check_recipe
 	touch $@
 else
 check-ghc-stamp: build-ghc-stamp
@@ -132,7 +153,8 @@
 build/libghcjs-$(CABAL_PACKAGE)-prof build/libghcjs-$(CABAL_PACKAGE)-dev:: build-ghc-stamp check-ghc-stamp
 
 build-haddock-stamp:
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && haddock_recipe "$(DEB_SETUP_BIN_NAME)" "$(DEB_HADDOCK_OPTS)" "$(DEB_DEFAULT_COMPILER)" "$(DEB_PACKAGES)"
+	. /usr/share/haskell-devscripts/Dh_Haskell.sh &&\
+	haddock_recipe
 	touch build-haddock-stamp
 
 build/libghc-$(CABAL_PACKAGE)-doc:: configure-ghc-stamp build-haddock-stamp
@@ -152,34 +174,38 @@
 	$(DEB_SETUP_BIN_NAME) copy --builddir=dist-ghcjs --destdir=debian/tmp-inst-ghcjs
 
 debian/extra-depends-ghc: debian/tmp-inst-ghc
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && extra_depends_recipe "$(DEB_SETUP_BIN_NAME)" ghc
+	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
+	extra_depends_recipe ghc
 
 debian/extra-depends-ghcjs: debian/tmp-inst-ghcjs
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && extra_depends_recipe "$(DEB_SETUP_BIN_NAME)" ghcjs
+	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
+	extra_depends_recipe ghcjs
 
 DEB_LINTIAN_OVERRIDES_FILE = debian/libghc-$(CABAL_PACKAGE)-dev.lintian-overrides
 
 install/libghc-$(CABAL_PACKAGE)-dev:: debian/tmp-inst-ghc debian/extra-depends-ghc
 	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-	  install_dev_recipe "$(DEB_SETUP_BIN_NAME)" "$(CABAL_PACKAGE)" "$(CABAL_VERSION)" "$(HASKELL_HIDE_PACKAGES)" "$(DEB_GHC_EXTRA_PACKAGES)" $(DEB_LINTIAN_OVERRIDES_FILE) "$(notdir $@)"
+	install_dev_recipe "$(notdir $@)"
 
 install/libghcjs-$(CABAL_PACKAGE)-dev:: debian/tmp-inst-ghcjs debian/extra-depends-ghcjs
 	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-	  install_dev_recipe "$(DEB_SETUP_BIN_NAME)" "$(CABAL_PACKAGE)" "$(CABAL_VERSION)" "$(HASKELL_HIDE_PACKAGES)" "$(DEB_GHC_EXTRA_PACKAGES)" "$(DEB_LINTIAN_OVERRIDES_FILE)" "$(notdir $@)"
+	install_dev_recipe "$(notdir $@)"
 
 install/libghc-$(CABAL_PACKAGE)-prof:: debian/tmp-inst-ghc install/libghc-$(CABAL_PACKAGE)-dev debian/extra-depends-ghc
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && install_prof_recipe "$(notdir $@)"
+	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
+	install_prof_recipe "$(notdir $@)"
 
 install/libghcjs-$(CABAL_PACKAGE)-prof:: debian/tmp-inst-ghcjs install/libghcjs-$(CABAL_PACKAGE)-dev debian/extra-depends-ghcjs
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && install_prof_recipe "$(notdir $@)"
+	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
+	install_prof_recipe "$(notdir $@)"
 
 install/libghc-$(CABAL_PACKAGE)-doc:: debian/tmp-inst-ghc build-haddock-stamp debian/extra-depends-ghc
 	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-	  install_doc_recipe "$(CABAL_PACKAGE)" "$(CABAL_VERSION)" "$(DEB_ENABLE_HOOGLE)" "$(notdir $@)"
+	install_doc_recipe "$(notdir $@)"
 
 install/libghcjs-$(CABAL_PACKAGE)-doc:: debian/tmp-inst-ghcjs build-haddock-stamp debian/extra-depends-ghcjs
 	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-	  install_doc_recipe "$(CABAL_PACKAGE)" "$(CABAL_VERSION)" "$(DEB_ENABLE_HOOGLE)" "$(notdir $@)"
+	install_doc_recipe "$(notdir $@)"
 
 install/libhugs-$(CABAL_PACKAGE):: $(DEB_SETUP_BIN_NAME) dist-hugs debian/extra-depends-hugs
 	$(DEB_SETUP_BIN_NAME) copy --destdir=debian/libhugs-$(CABAL_PACKAGE) --builddir=dist-hugs




More information about the Pkg-haskell-commits mailing list