chiark / gitweb /
dopush: Move $upstreamversion setting out to give it wider scope
[dgit.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # dgit
4 # Integration between git and Debian-style archives
5 #
6 # Copyright (C)2013-2016 Ian Jackson
7 #
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21 export prefix=/usr
22
23 %:
24         dh $@
25
26 override_dh_gencontrol:
27         dh_gencontrol
28         set -e; \
29          cd debian/dgit; \
30          v=$$(perl -ne 'print if s/^version:\s+//i' DEBIAN/control); \
31          perl -i -pe "s/UNRELEASED/$$v/g if m/###substituted###/" usr/bin/dgit
32
33 globalperl=/usr/share/perl5
34 infraperl=/usr/share/dgit/infra/perl5
35
36 override_dh_auto_install:
37         make install prefix=/usr DESTDIR=debian/dgit
38         make install-infra prefix=/usr DESTDIR=debian/dgit-infrastructure \
39                 perldir=$(infraperl)
40 #       # Most of the Perl modules in dgit-infrastructure live in
41 #       # $(infraperl).  The exception is Debian::Dgit::Infra, which
42 #       # lives in $(globalperl) and adds $(infraperl) to @INC.
43         set -ex; \
44          base=debian/dgit-infrastructure; \
45          mod=Debian/Dgit/Infra.pm; \
46          src=$${base}$(infraperl)/$${mod}; \
47          dst=$${base}$(globalperl)/$${mod}; \
48          mkdir -p $${dst%/*}; \
49          mv -f $$src $$dst; \
50          perl -i -p -e 'next unless m/###substituted###/;' \
51                 -e 'next unless s/^# (?=unshift \@INC,)//;' \
52                 -e 'die unless s{q\{\S+\}}{q{$(infraperl)}};' \
53                  $$dst
54
55 debian/tests/control: tests/enumerate-tests debian/tests/control.in
56         $< gencontrol >$@.new && mv -f $@.new $@
57
58 debian/tests/control: tests/lib-core tests/lib-restricts
59 debian/tests/control: tests/tests $(wildcard tests/tests/*[^~#])