]> git.donarmstrong.com Git - debhelper.git/blob - dh_testversion
Fix build system auto-selection breakage.
[debhelper.git] / dh_testversion
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_testversion - ensure that the correct version of debhelper is installed (deprecated)
6
7 =cut
8
9 use Debian::Debhelper::Dh_Lib;
10 use Debian::Debhelper::Dh_Version; # contains the version number of debhelper.
11
12 =head1 SYNOPSIS
13
14 B<dh_testversion> [S<I<debhelper options>>] [I<operator>] [I<version>]
15
16 =head1 DESCRIPTION
17
18 Note: This program is deprecated. You should use build dependencies
19 instead.
20
21 dh_testversion compares the version of debhelper against the version you
22 specify, and if the condition is not met, exits with an error message.
23
24 You can use this in your debian/rules files if a new debhelper feature is
25 introduced, and your package requires that feature to build correctly. Use
26 debhelper's changelog to figure out the version you need.
27
28 Be sure not to overuse dh_testversion. If debhelper version 9.5
29 introduces a new dh_autofixbugs command, and your package uses it, then if
30 someone tries to build it with debhelper 1.0, the build will fail anyway when
31 dh_autofixbugs cannot be found, so there is no need for you to use
32 dh_testversion.
33
34 =head1 OPTIONS
35
36 =over 4
37
38 =item I<operator>
39
40 Optional comparison operator used in comparing the versions. If not 
41 specified, ">=" is used. For descriptions of the comparison operators, see 
42 dpkg --help.
43
44 =item I<version>
45
46 Version number to compare against the current version of debhelper. If not
47 specified, dh_testversion does nothing.
48
49 =back
50
51 =cut
52
53 init();
54 inhibit_log();
55
56 my($compare, $ver);
57
58 if ($#ARGV > 0) {
59         $compare=shift;
60         $ver=shift;
61 }
62 elsif ($#ARGV eq 0) {
63         $compare=">=";
64         $ver=shift;
65 }
66
67 warning("This program is deprecated, you should use build dependencies instead.");
68
69 if (defined $compare and defined $ver) {
70         warning("Something like: \"Build-Depends: debhelper ($compare $ver)\"");
71         system('dpkg','--compare-versions',$Debian::Debhelper::Dh_Version::version,$compare,$ver) == 0 ||
72                 error("debhelper version $Debian::Debhelper::Dh_Version::version is installed, but a version $compare $ver is needed to build this package.");
73 }
74
75 =head1 SEE ALSO
76
77 L<debhelper(7)>
78
79 This program is a part of debhelper.
80
81 =head1 AUTHOR
82
83 Joey Hess <joeyh@debian.org>
84
85 =cut