diff options
author | Sven Bartscher <kritzefitz@debian.org> | 2016-07-09 19:41:10 +0200 |
---|---|---|
committer | Sven Bartscher <kritzefitz@debian.org> | 2016-07-09 19:41:10 +0200 |
commit | d5b409940017fb01d323361870b39936ab25fff4 (patch) | |
tree | b241738b31801d0d93c96f208d2bfe81efdd0e2d /Dh_Haskell.sh | |
parent | 10aafd99fa43a5f2ecf7ea5a5e6008e6e80126f5 (diff) |
Use ghc-pkg to construct virtual package names instead of parsing
package IDs, as we have been informaed that these should be opaque and
have no stable format to rely on.
Diffstat (limited to 'Dh_Haskell.sh')
-rw-r--r-- | Dh_Haskell.sh | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/Dh_Haskell.sh b/Dh_Haskell.sh index e969e4b..6237ef1 100644 --- a/Dh_Haskell.sh +++ b/Dh_Haskell.sh @@ -26,7 +26,10 @@ package_prefix(){ } package_hc(){ - echo $1 | sed -n -e 's|^lib\([^-]*\)-.*-[^-]*$|\1|p' + case $1 in + ghc|ghc-prof) echo "ghc";; + *) echo $1 | sed -n -e 's|^lib\([^-]*\)-.*-[^-]*$|\1|p';; + esac } package_ext(){ @@ -215,7 +218,7 @@ hashed_dependency(){ hc=$1 type=$2 pkgid=$3 - virtual_pkg=`package_id_to_virtual_package "${hc}" "$type" $pkgid` + virtual_pkg=`package_id_to_virtual_package "${hc}" "$type" $pkgid ghc-pkg` # As a transition measure, check if dpkg knows about this virtual package if dpkg-query -W $virtual_pkg >/dev/null 2>/dev/null; then @@ -277,14 +280,32 @@ depends_for_ghc_prof(){ echo $packages | sed -e 's/^,[ ]*//' } +tmp_package_db() { + if [ -x inplace/bin/ghc-pkg ] + then + # We are building ghc and need to use the new ghc-pkg + ghcpkg="inplace/bin/ghc-pkg --package-db debian/tmp-db/" + else + ghcpkg="ghc-pkg --package-db debian/tmp-db/" + fi + if [ ! -f debian/tmp-db/package.cache ] + then + mkdir debian/tmp-db + cp $@ debian/tmp-db/ + $ghcpkg --package-db debian/tmp-db/ recache + fi + echo "$ghcpkg" +} + provides_for_ghc(){ local hc local dep local packages hc=$1 shift + ghcpkg="`tmp_package_db $@`" for package_id in `cabal_package_ids $@` ; do - packages="$packages, `package_id_to_virtual_package "${hc}" dev $package_id`" + packages="$packages, `package_id_to_virtual_package "${hc}" dev $package_id "${ghcpkg}"`" done echo $packages | sed -e 's/^,[ ]*//' } @@ -295,8 +316,9 @@ provides_for_ghc_prof(){ local packages hc=$1 shift + ghcpkg="`tmp_package_db $@`" for package_id in `cabal_package_ids $@` ; do - packages="$packages, `package_id_to_virtual_package "${hc}" prof $package_id`" + packages="$packages, `package_id_to_virtual_package "${hc}" prof $package_id "${ghcpkg}"`" done echo $packages | sed -e 's/^,[ ]*//' } @@ -305,12 +327,15 @@ package_id_to_virtual_package(){ local hc local type local pkgid + local ghcpkg hc="$1" type="$2" pkgid="$3" - echo ${pkgid} | tr A-Z a-z | \ - grep '[a-z0-9]\+-[0-9\.]\+-[^-]\+$' | \ - perl -pe 's/([a-z0-9-]+)-([0-9\.]+)-([^-]{1,5})[^-]*$/lib'${hc}'-\1-'$type'-\2-\3/' + ghcpkg="$4" + name=`${ghcpkg} --simple-output field "${pkgid}" name` + version=`${ghcpkg} --simple-output field "${pkgid}" version` + abi=`${ghcpkg} --simple-output field "${pkgid}" abi | cut -c1-5` + echo "lib${hc}-${name}-${version}-${type}-${abi}" | tr A-Z a-z } depends_for_hugs(){ @@ -368,7 +393,7 @@ make_setup_recipe(){ if test -e $setup then run ghc --make $setup -o ${DEB_SETUP_BIN_NAME} - exit 0 + exit 0 fi done # PS4=$PS5 |