summaryrefslogtreecommitdiff
path: root/dh_haskell_blurbs
blob: 0f7c8a3226fe3384c802e6c311099545cc77c82a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#! /bin/bash
#
# Create substvars for the Haskell package description blurbs
#
# Copyright (C) 2013 Joachim Breitner <nomeata@debian.org>

set -e 

DEB_DEFAULT_COMPILER=$1
shift

. /usr/share/haskell-devscripts/Dh_Haskell.sh

# PS4=" + dh_haskell_blurbs> "
# set -x

packages=`dh_listpackages`
hc=`packages_hc ${DEB_DEFAULT_COMPILER} ${packages}`

for pkg in `dh_listpackages $args`; do
    sfile=debian/$pkg.substvars
    touch $sfile

    grep -v -a \
	-e ^haskell:Blurb \
	-e ^haskell:ShortBlurb \
	-e ^haskell:LongDescription \
	-e ^haskell:ShortDescription \
	$sfile > $sfile.tmp || true

    ext=`package_ext ${pkg}`
    case "$ext" in
	dev) cat >> $sfile.tmp <<'__END__' ;;
haskell:ShortBlurb=
haskell:Blurb=This package provides a library for the Haskell programming language.${Newline}See http://www.haskell.org/ for more information on Haskell.
__END__

	prof) cat >> $sfile.tmp <<'__END__' ;;
haskell:ShortBlurb=; profiling libraries
haskell:Blurb=This package provides a library for the Haskell programming language, compiled${Newline}for profiling.  See http://www.haskell.org/ for more information on Haskell.
__END__

	doc) cat >> $sfile.tmp <<'__END__' ;;
haskell:ShortBlurb=; documentation
haskell:Blurb=This package provides the documentation for a library for the Haskell${Newline}programming language.${Newline}See http://www.haskell.org/ for more information on Haskell.
__END__

    esac

    shortDescription="$(
	cat debian/control |
	grep-dctrl -F Source '' -s X-Description -n|
	head -n1
	)"

    longDescription="$(
	cat debian/control |
	grep-dctrl -F Source '' -s X-Description -n|
	sed 's/^[\t ]//;s/^\.$//'|	 # remove initial space
	tail -n +2|			 # skip short description
	perl -pe 's/\n$/\$\{Newline}/'|   # prepare for dpkg-gencontrol
	perl -pe 's/\$\{Newline}$//'      # but not final lineline
	)"

    cat >> $sfile.tmp <<__END__
haskell:ShortDescription=$shortDescription
haskell:LongDescription=$longDescription
__END__

    version=$(dpkg-query --showformat='${version}' --show ${hc} | egrep -o ".*-" \
	| egrep -o "[^-]*")
    echo "haskell:${hc}-version=${hc} (>= ${version}), ${hc} (<< ${version}+)" >> $sfile.tmp

    mv $sfile.tmp $sfile
done