Create dh_haskell_provides
Wed Jan 13 14:48:02 UTC 2010 Joachim Breitner <mail@joachim-breitner.de>
* Create dh_haskell_provides
diff -rN -u old-haskell-devscripts/Dh_Haskell.sh new-haskell-devscripts/Dh_Haskell.sh
--- old-haskell-devscripts/Dh_Haskell.sh 2014-07-25 09:02:48.856628955 +0000
+++ new-haskell-devscripts/Dh_Haskell.sh 2014-07-25 09:02:49.036629042 +0000
@@ -68,6 +68,18 @@
echo $package
}
+cabal_package_ids(){
+ local config
+ local package_ids
+ until [ -z "$1" ]
+ do
+ config=$1
+ package_ids="$package_ids `grep-dctrl -n -i -s Id "" $config`"
+ shift
+ done
+ echo $package_ids
+}
+
cabal_depends(){
local config
local dep
@@ -111,6 +123,32 @@
dependencies $packages
}
+provides_for_ghc6(){
+ local dep
+ local packages
+ for package_id in `cabal_package_ids $@` ; do
+ packages=", $packages `package_id_to_virtual_package dev $package_id`"
+ done
+ echo $packages | sed -e 's/^,[ ]*//'
+}
+
+provides_for_ghc6_prof(){
+ local dep
+ local packages
+ for package_id in `cabal_package_ids $@` ; do
+ packages=", $packages `package_id_to_virtual_package prof $package_id`"
+ done
+ echo $packages | sed -e 's/^,[ ]*//'
+}
+
+package_id_to_virtual_package(){
+ local type
+ local id
+ type="$1"
+ echo $2 | tr A-Z a-z | \
+ perl -pe 's/([a-z0-9]+)-([0-9\.]+)-(.....).........................../libghc6-\1-'$type'-\2-\3/'
+}
+
depends_for_hugs(){
local version
local upstream_version
diff -rN -u old-haskell-devscripts/README new-haskell-devscripts/README
--- old-haskell-devscripts/README 2014-07-25 09:02:48.856628955 +0000
+++ new-haskell-devscripts/README 2014-07-25 09:02:48.988629019 +0000
@@ -67,7 +67,8 @@
SEE ALSO
--------
-The manpages of dh_haskell_depends(1) and dh_haskell_shlibdeps(1).
+The manpages of dh_haskell_depends(1), dh_haskell_provides(1) and
+dh_haskell_shlibdeps(1).
AUTHOR
------
diff -rN -u old-haskell-devscripts/debian/changelog new-haskell-devscripts/debian/changelog
--- old-haskell-devscripts/debian/changelog 2014-07-25 09:02:48.856628955 +0000
+++ new-haskell-devscripts/debian/changelog 2014-07-25 09:02:49.036629042 +0000
@@ -8,6 +8,9 @@
[ Joachim Breitner ]
* Remove dh_haskell_prep, not needed any more
+ * Create dh_haskell_provides, to create a ${haskell:Provides} substvar
+ containing a string derived from the cabal package name, version and ABI
+ hash.
-- Joachim Breitner <nomeata@debian.org> Wed, 13 Jan 2010 14:28:53 +0100
diff -rN -u old-haskell-devscripts/debian/install new-haskell-devscripts/debian/install
--- old-haskell-devscripts/debian/install 2014-07-25 09:02:48.856628955 +0000
+++ new-haskell-devscripts/debian/install 2014-07-25 09:02:49.012629030 +0000
@@ -1,3 +1,4 @@
+dh_haskell_provides usr/bin/
dh_haskell_depends usr/bin/
dh_haskell_shlibdeps usr/bin/
Dh_Haskell.pm usr/share/haskell-devscripts/
diff -rN -u old-haskell-devscripts/debian/manpages new-haskell-devscripts/debian/manpages
--- old-haskell-devscripts/debian/manpages 2014-07-25 09:02:48.856628955 +0000
+++ new-haskell-devscripts/debian/manpages 2014-07-25 09:02:48.956629003 +0000
@@ -1,2 +1,3 @@
+dh_haskell_provides.1
dh_haskell_depends.1
dh_haskell_shlibdeps.1
diff -rN -u old-haskell-devscripts/dh_haskell_depends.pod new-haskell-devscripts/dh_haskell_depends.pod
--- old-haskell-devscripts/dh_haskell_depends.pod 2014-07-25 09:02:48.856628955 +0000
+++ new-haskell-devscripts/dh_haskell_depends.pod 2014-07-25 09:02:48.984629018 +0000
@@ -29,6 +29,7 @@
=head1 SEE ALSO
+L<dh_haskell_provides(1)>
L<dh_haskell_shlibdeps(1)>
L<debhelper(7)>
diff -rN -u old-haskell-devscripts/dh_haskell_provides new-haskell-devscripts/dh_haskell_provides
--- old-haskell-devscripts/dh_haskell_provides 1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-devscripts/dh_haskell_provides 2014-07-25 09:02:49.024629036 +0000
@@ -0,0 +1,95 @@
+#! /bin/sh
+#
+# Calculated provides substvars for haskell library packages.
+#
+# Copyright (C) 2006-2007 Arjan Oosting <arjan@debian.org>
+# Copyright (C) 2009 Joachim Breitner <nomeata@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of either:
+#
+# 1) The terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# 2) BSD 3-clause license.
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+#
+# * The names of contributors may not be used to endorse or promote
+# products derived from this software without specific prior
+# written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (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
+
+. /usr/share/haskell-devscripts/Dh_Haskell.sh
+
+for pkg in `dh_listpackages $args`; do
+ sfile=debian/$pkg.substvars
+ touch $sfile
+
+ case "$pkg" in
+ libghc6-*-dev|libghc6-*-prof)
+ config=`find_config_for_ghc6 $pkg`
+ if [ -f "$config" ] ; then
+ cfiles="$files $config"
+ else
+ cfiles="$files"
+ fi
+ if [ -z "$cfiles" ] ; then
+ echo "No installed package description files can not be found" >&2
+ exit 1
+ fi
+ case "$pkg" in
+ libghc6-*-dev)
+ grep -v \
+ -e ^haskell:Provides \
+ $sfile > $sfile.tmp || true
+ echo "haskell:Provides=`provides_for_ghc6 $cfiles`" >> $sfile.tmp
+ ;;
+ libghc6-*-prof)
+ grep -v \
+ -e ^haskell:Provides \
+ $sfile > $sfile.tmp || true
+ echo "haskell:Provides=`provides_for_ghc6_prof $cfiles`" >> $sfile.tmp
+ ;;
+ esac
+ mv $sfile.tmp $sfile
+ ;;
+ *)
+ ;;
+ esac
+done
diff -rN -u old-haskell-devscripts/dh_haskell_provides.pod new-haskell-devscripts/dh_haskell_provides.pod
--- old-haskell-devscripts/dh_haskell_provides.pod 1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-devscripts/dh_haskell_provides.pod 2014-07-25 09:02:49.000629026 +0000
@@ -0,0 +1,36 @@
+=head1 NAME
+
+dh_haskell_provides - calculates Haskell virtual package names on Cabalized libraries
+
+=head1 SYNOPSIS
+
+B<dh_haskell_provides> [S<I<debhelper options>>]
+[B<-X>I<package>]
+[B<--exclude=>I<package>]
+[S<I<file>> ...]
+
+=head1 DESCRIPTION
+
+dh_haskell_provides is a debhelper program that calculates the correct virtual
+package to provide, so that dependencies can guarantee ABI stability.
+
+For a package with an idea of package-version-longhashstring, it generates a
+virtual package of the form libghc6-package-dev-version-longh for the -dev
+package and libghc6-package-prof-version-longh for the prof package
+respectively.
+
+This script writes the debian/$package.substvars file, including in it the
+haskell:Provides. So, to use this package, include in the Provides: field in
+debian/control ${haskell:Provides}.
+
+=head1 SEE ALSO
+
+L<dh_haskell_provides(1)>
+L<dh_haskell_shlibdeps(1)>
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+Joachim Breitner <nomeata@debian.org>
+
+Based on ideas in dh_ocaml.
diff -rN -u old-haskell-devscripts/dh_haskell_shlibdeps.pod new-haskell-devscripts/dh_haskell_shlibdeps.pod
--- old-haskell-devscripts/dh_haskell_shlibdeps.pod 2014-07-25 09:02:48.852628953 +0000
+++ new-haskell-devscripts/dh_haskell_shlibdeps.pod 2014-07-25 09:02:49.024629036 +0000
@@ -30,6 +30,7 @@
=head1 SEE ALSO
L<dh_haskell_depends(1)>
+L<dh_haskell_provides(1)>
L<debhelper(7)>
=head1 AUTHOR
diff -rN -u old-haskell-devscripts/hlibrary.mk new-haskell-devscripts/hlibrary.mk
--- old-haskell-devscripts/hlibrary.mk 2014-07-25 09:02:48.852628953 +0000
+++ new-haskell-devscripts/hlibrary.mk 2014-07-25 09:02:49.028629038 +0000
@@ -109,6 +109,7 @@
[ 0 = `ls debian/tmp-inst-ghc6/$(DEB_HADDOCK_DIR)/ 2>/dev/null | wc -l` ] || \
cp -r debian/tmp-inst-ghc6/$(DEB_HADDOCK_DIR)/*.haddock \
debian/$(notdir $@)/$(DEB_HADDOCK_DIR)
+ dh_haskell_provides -p$(notdir $@)
dh_haskell_depends -p$(notdir $@)
dh_haskell_shlibdeps -p$(notdir $@)
@@ -116,6 +117,7 @@
cd debian/tmp-inst-ghc6 ; find usr/lib/haskell-packages/ghc6/lib/ \
! \( ! -name "*_p.a" ! -name "*.p_hi" \) \
-exec install -Dm 644 '{}' ../$(notdir $@)/'{}' ';'
+ dh_haskell_provides -p$(notdir $@)
dh_haskell_depends -p$(notdir $@)
install/haskell-$(CABAL_PACKAGE)-doc install/libghc6-$(CABAL_PACKAGE)-doc:: debian/tmp-inst-ghc6