summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlias Tsitsimpis <iliastsi@debian.org>2020-02-23 17:00:23 +0200
committerIlias Tsitsimpis <iliastsi@debian.org>2020-02-23 17:00:23 +0200
commit42621767aff795d7070572e6b416100160e5bdd5 (patch)
tree0dc08df0747c34d02a17a2949b14b34a5b3e1db4
parent691e2f17638663f75e5940e57ec8ddef9ae00cd9 (diff)
Ensure build fails when dh_haskell_{depends,provides} fail
-rw-r--r--Dh_Haskell.sh59
-rw-r--r--debian/changelog6
-rw-r--r--dh_haskell_depends5
-rw-r--r--dh_haskell_provides11
4 files changed, 72 insertions, 9 deletions
diff --git a/Dh_Haskell.sh b/Dh_Haskell.sh
index 8d2ee6f..56672ef 100644
--- a/Dh_Haskell.sh
+++ b/Dh_Haskell.sh
@@ -1,4 +1,5 @@
run () {
+ set -eo pipefail
echo -n "Running" >&2
printf " %q" "$@" >&2
echo >&2
@@ -6,26 +7,32 @@ run () {
}
cpu(){
+ set -eo pipefail
ghc -e 'putStr System.Info.arch'
}
os(){
+ set -eo pipefail
ghc -e 'putStr System.Info.os'
}
ghcjs_version(){
+ set -eo pipefail
ghcjs --numeric-ghcjs-version
}
ghcjs_ghc_version(){
+ set -eo pipefail
ghcjs --numeric-ghc-version
}
package_prefix(){
+ set -eo pipefail
echo $1 | sed -n -e 's|^\([^-]*\)-.*-[^-]*$|\1|p'
}
package_hc(){
+ set -eo pipefail
case $1 in
ghc|ghc-prof) echo "ghc";;
*) echo $1 | sed -n -e 's|^lib\([^-]*\)-.*-[^-]*$|\1|p';;
@@ -33,6 +40,7 @@ package_hc(){
}
package_ext(){
+ set -eo pipefail
case $1 in
# I'm told the ghc build uses these scripts, hence these special cases
ghc) echo "dev";;
@@ -42,6 +50,7 @@ package_ext(){
}
packages_hc(){
+ set -eo pipefail
hcs=`{ for i in ${DEB_PACKAGES}; do package_hc $i; done; } | LC_ALL=C 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
@@ -49,6 +58,7 @@ packages_hc(){
}
hc_libdir(){
+ set -eo pipefail
case $1 in
ghc) echo "usr/lib/haskell-packages/ghc/lib";;
ghcjs) echo "usr/lib/ghcjs/.cabal/lib";;
@@ -57,10 +67,12 @@ hc_libdir(){
}
package_libdir(){
+ set -eo pipefail
hc_libdir `package_hc $1`
}
hc_pkgdir(){
+ set -eo pipefail
case $1 in
ghc) echo "var/lib/ghc/package.conf.d";;
ghcjs) echo "usr/lib/ghcjs/.ghcjs/`cpu`-`os`-`ghcjs_version`-`ghcjs_ghc_version`/ghcjs/package.conf.d";;
@@ -69,10 +81,12 @@ hc_pkgdir(){
}
package_pkgdir(){
+ set -eo pipefail
hc_pkgdir `package_hc $1`
}
hc_prefix(){
+ set -eo pipefail
case $1 in
ghc) echo "usr";;
ghcjs) echo "usr/lib/ghcjs";;
@@ -81,6 +95,7 @@ hc_prefix(){
}
hc_haddock(){
+ set -eo pipefail
case $1 in
ghc) echo "haddock";;
ghcjs) echo "haddock-ghcjs";;
@@ -89,28 +104,33 @@ hc_haddock(){
}
hc_docdir(){
+ set -eo pipefail
hc=$1
pkgid=$2
echo "usr/lib/${hc}-doc/haddock/${pkgid}/"
}
hc_htmldir(){
+ set -eo pipefail
hc=$1
CABAL_PACKAGE=$2
echo "usr/share/doc/lib${hc}-${CABAL_PACKAGE}-doc/html/"
}
hc_hoogle(){
+ set -eo pipefail
local hc
hc=$1
echo "/usr/lib/${hc}-doc/hoogle/"
}
strip_hash(){
+ set -eo pipefail
echo "$1" | sed 's/-................................$//'
}
sort_uniq(){
+ set -eo pipefail
{
for i in "$@" ; do
echo $i
@@ -119,6 +139,7 @@ sort_uniq(){
}
dependency(){
+ set -eo pipefail
local package
local version
local next_upstream_version
@@ -129,6 +150,7 @@ dependency(){
}
ghc_pkg_field(){
+ set -eo pipefail
hc=$1
pkg=$2
field=$3
@@ -136,6 +158,7 @@ ghc_pkg_field(){
}
providing_package_for_ghc(){
+ set -eo pipefail
local package
local dep
local dir
@@ -154,7 +177,7 @@ providing_package_for_ghc(){
lib=`ghc_pkg_field $hc $dep hs-libraries | grep -i ^hs-libraries | sed -e 's|hs-libraries: *\([^ ]*\).*|\1|' `
for dir in $dirs ; do
if [ -e "${dir}/lib${lib}.a" ] ; then
- package=`dpkg-query -S ${dir}/lib${lib}.a | cut -d':' -f 1` || exit $?
+ package=`dpkg-query -S ${dir}/lib${lib}.a | cut -d':' -f 1`
continue
fi
done
@@ -162,6 +185,7 @@ providing_package_for_ghc(){
}
providing_package_for_ghc_prof(){
+ set -eo pipefail
local package
local dep
local dir
@@ -180,7 +204,7 @@ providing_package_for_ghc_prof(){
lib=`ghc_pkg_field $hc $dep hs-libraries | grep -i ^hs-libraries | sed -e 's|hs-libraries: *\([^ ]*\).*|\1|' `
for dir in $dirs ; do
if [ -e "${dir}/lib${lib}_p.a" ] ; then
- package=`dpkg-query -S ${dir}/lib${lib}_p.a | cut -d':' -f 1` || exit $?
+ package=`dpkg-query -S ${dir}/lib${lib}_p.a | cut -d':' -f 1`
continue
fi
done
@@ -188,6 +212,7 @@ providing_package_for_ghc_prof(){
}
cabal_package_ids(){
+ set -eo pipefail
local config
local package_ids
until [ -z "$1" ]
@@ -200,6 +225,7 @@ cabal_package_ids(){
}
cabal_depends(){
+ set -eo pipefail
local config
local dep
local depends
@@ -223,6 +249,7 @@ cabal_depends(){
}
hashed_dependency(){
+ set -eo pipefail
local hc
local type
local pkgid
@@ -241,6 +268,7 @@ hashed_dependency(){
}
depends_for_ghc(){
+ set -eo pipefail
local dep
local packages
local pkgid
@@ -268,6 +296,7 @@ depends_for_ghc(){
}
depends_for_ghc_prof(){
+ set -eo pipefail
local dep
local packages
local pkgid
@@ -295,6 +324,7 @@ depends_for_ghc_prof(){
}
usable_ghc_pkg() {
+ set -eo pipefail
local ghcpkg
local version
if [ -x inplace/bin/ghc-pkg ]
@@ -314,6 +344,7 @@ usable_ghc_pkg() {
}
tmp_package_db() {
+ set -eo pipefail
local ghcpkg
ghcpkg="`usable_ghc_pkg`"
if [ -n "${ghcpkg}" ]
@@ -331,6 +362,7 @@ tmp_package_db() {
}
provides_for_ghc(){
+ set -eo pipefail
local hc
local dep
local packages
@@ -344,6 +376,7 @@ provides_for_ghc(){
}
provides_for_ghc_prof(){
+ set -eo pipefail
local hc
local dep
local packages
@@ -357,6 +390,7 @@ provides_for_ghc_prof(){
}
package_id_to_virtual_package(){
+ set -eo pipefail
local hc
local type
local pkgid
@@ -380,6 +414,7 @@ package_id_to_virtual_package(){
}
depends_for_hugs(){
+ set -eo pipefail
local version
local upstream_version
version=`dpkg-query --showformat='${Version}' -W hugs`
@@ -388,6 +423,7 @@ depends_for_hugs(){
}
find_config_for_ghc(){
+ set -eo pipefail
local f
local pkg
pkg=$1
@@ -411,6 +447,7 @@ find_config_for_ghc(){
}
clean_recipe(){
+ set -eo pipefail
# local PS5=$PS4; PS4=" + clean_recipe> "; set -x
[ ! -x "${DEB_SETUP_BIN_NAME}" ] || run ${DEB_SETUP_BIN_NAME} clean
run rm -rf dist dist-ghc dist-ghcjs dist-hugs ${DEB_SETUP_BIN_NAME} Setup.hi Setup.ho Setup.o .*config*
@@ -429,6 +466,7 @@ clean_recipe(){
}
make_setup_recipe(){
+ set -eo pipefail
# local PS5=$PS4; PS4=" + make_setup_recipe> "; set -x
for setup in Setup.lhs Setup.hs
do
@@ -442,6 +480,7 @@ make_setup_recipe(){
}
configure_recipe(){
+ set -eo pipefail
# local PS5=$PS4; PS4=" + configure_recipe> "; set -x
# dak gets all neurotic about file timestamps older than 1975
@@ -455,7 +494,14 @@ configure_recipe(){
hc=`packages_hc`
- ENABLE_PROFILING=`{ for i in ${DEB_PACKAGES}; do package_ext $i | grep prof; done; } | LC_ALL=C sort -u | sed 's/prof/--enable-library-profiling/'`
+ ENABLE_PROFILING=""
+ for i in ${DEB_PACKAGES}; do
+ pkg_ext="`package_ext $i`"
+ if [ "$pkg_ext" == "prof" ]; then
+ ENABLE_PROFILING="--enable-library-profiling"
+ break
+ fi
+ done
local GHC_OPTIONS
for i in `dpkg-buildflags --get LDFLAGS`
do
@@ -486,6 +532,7 @@ configure_recipe(){
}
build_recipe(){
+ set -eo pipefail
# local PS5=$PS4; PS4=" + build_recipe> "; set -x
hc=`packages_hc`
run ${DEB_SETUP_BIN_NAME} build --builddir=dist-${hc}
@@ -493,6 +540,7 @@ build_recipe(){
}
check_recipe(){
+ set -eo pipefail
# local PS5=$PS4; PS4=" + check_recipe> "; set -x
hc=`packages_hc`
run ${DEB_SETUP_BIN_NAME} test --builddir=dist-${hc} --show-details=direct
@@ -500,6 +548,7 @@ check_recipe(){
}
haddock_recipe(){
+ set -eo pipefail
# local PS5=$PS4; PS4=" + haddock_recipe> "; set -x
hc=`packages_hc`
haddock=`hc_haddock ${hc}`
@@ -512,6 +561,7 @@ haddock_recipe(){
}
extra_depends_recipe(){
+ set -eo pipefail
# local PS5=$PS4; PS4=" + extra_depends_recipe> "; set -x
hc=$1
pkg_config=$(LC_ALL=C.UTF-8 ${DEB_SETUP_BIN_NAME} register --builddir=dist-${hc} --gen-pkg-config --verbose=verbose+nowrap | sed -r -n '/^Creating package registration file: /s///p')
@@ -521,6 +571,7 @@ extra_depends_recipe(){
}
install_dev_recipe(){
+ set -eo pipefail
# local PS5=$PS4; PS4=" + install_dev_recipe> "; set -x
PKG=$1
@@ -550,6 +601,7 @@ install_dev_recipe(){
}
install_prof_recipe(){
+ set -eo pipefail
# local PS5=$PS4; PS4=" + install_prof_recipe> "; set -x
PKG=$1
libdir=`package_libdir ${PKG}`
@@ -564,6 +616,7 @@ install_prof_recipe(){
}
install_doc_recipe(){
+ set -eo pipefail
# local PS5=$PS4; PS4=" + install_doc_recipe> "; set -x
PKG=$1
hc=`package_hc ${PKG}`
diff --git a/debian/changelog b/debian/changelog
index c63a6d1..ba79b18 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+haskell-devscripts (0.15.2) unstable; urgency=medium
+
+ * Ensure build fails when dh_haskell_{depends,provides} fail
+
+ -- Ilias Tsitsimpis <iliastsi@debian.org> Fri, 03 Jan 2020 12:26:55 +0200
+
haskell-devscripts (0.15.1) unstable; urgency=medium
* Patch from Chris Lamb to explicitly set UTC for 1975 hack.
diff --git a/dh_haskell_depends b/dh_haskell_depends
index 970ee01..d58a73f 100644
--- a/dh_haskell_depends
+++ b/dh_haskell_depends
@@ -52,7 +52,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-set -e
+set -e
. /usr/share/haskell-devscripts/Dh_Haskell.sh
@@ -85,7 +85,8 @@ for pkg in `dh_listpackages $args`; do
-e ^haskell:Recommends \
-e ^haskell:Suggests \
$sfile > $sfile.tmp || true
- echo "haskell:Depends=`depends_for_ghc ${hc} $cfiles`" >> $sfile.tmp
+ depends="`depends_for_ghc ${hc} $cfiles`"
+ echo "haskell:Depends=$depends" >> $sfile.tmp
echo "haskell:Recommends=" >> $sfile.tmp
doc=`echo $pkg | sed -e 's/-dev$/-doc/'`
prof=`echo $pkg | sed -e 's/-dev$/-prof/'`
diff --git a/dh_haskell_provides b/dh_haskell_provides
index 90cffb2..28d7c83 100644
--- a/dh_haskell_provides
+++ b/dh_haskell_provides
@@ -53,7 +53,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-set -e
+set -e
if test -e debian/Dh_Haskell.sh
then
@@ -88,19 +88,22 @@ for pkg in `dh_listpackages $args`; do
grep -a -v \
-e ^haskell:Provides \
$sfile > $sfile.tmp || true
- echo "haskell:Provides=`provides_for_ghc $hc $cfiles`" >> $sfile.tmp
+ provides="`provides_for_ghc $hc $cfiles`"
+ echo "haskell:Provides=$provides" >> $sfile.tmp
mv $sfile.tmp $sfile
grep -a -v \
-e ^haskell:${hc}-package \
$sfile > $sfile.tmp || true
- echo "haskell:${hc}-package=`cabal_package_ids $cfiles`" >> $sfile.tmp
+ package_ids="`cabal_package_ids $cfiles`"
+ echo "haskell:${hc}-package=$package_ids" >> $sfile.tmp
mv $sfile.tmp $sfile
;;
prof)
grep -a -v \
-e ^haskell:Provides \
$sfile > $sfile.tmp || true
- echo "haskell:Provides=`provides_for_ghc_prof $hc $cfiles`" >> $sfile.tmp
+ provides="`provides_for_ghc_prof $hc $cfiles`"
+ echo "haskell:Provides=$provides" >> $sfile.tmp
mv $sfile.tmp $sfile
;;
esac