diff options
author | joey <joey> | 2002-01-27 06:34:33 +0000 |
---|---|---|
committer | joey <joey> | 2002-01-27 06:34:33 +0000 |
commit | 81a1cb9028b75304b0261dfd91ba04c0e6b07bb4 (patch) | |
tree | 6d0e7665b9271a2724f36db307c267da45822f4b /Debian | |
parent | 26fc54549b83f4efd2db161b86159dd65da974a9 (diff) | |
download | debhelper-81a1cb9028b75304b0261dfd91ba04c0e6b07bb4.tar.gz |
r506: * Introduced the debian/compat file. This is the new, preferred way to say
what debhelper compatability level your package uses. It has the big
advantage of being available to debhelper when you run it at the command
line, as well as in debian/rules.
* A new v4 feature: dh_installinit, in v4 mode, will use invoke-rc.d.
This is in v4 for testing, but I may well roll it back into v3 (and
earlier) once woody is released and I don't have to worry about breaking
things (and, presumably, once invoke-rc.d enters policy).
* Some debhelper commands will now build up a new substvars variable,
${misc:Depends}, based on things they know your package needs to depend
on. For example, dh_installinit in v4 mode adds sysvinit (>= 2.80-1) to
that dep list, and dh_installxfonts adds a dep on xutils. This variable
should make it easier to keep track of what your package needs to depends
on, supplimenting the ${shlibs:Depends} and ${perl:Depends} substvars.
Hmm, this appears to be based loosely on an idea by Masato Taruishi
<taru@debian.org>, filtered through a long period of mulling it over.
Closes: #76352
* Use the addsubstvar function I wrote for the above in dh_perl too.
Diffstat (limited to 'Debian')
-rw-r--r-- | Debian/Debhelper/Dh_Lib.pm | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm index f5a376fd..a21db5da 100644 --- a/Debian/Debhelper/Dh_Lib.pm +++ b/Debian/Debhelper/Dh_Lib.pm @@ -12,7 +12,7 @@ use vars qw(@ISA @EXPORT %dh); @ISA=qw(Exporter); @EXPORT=qw(&init &doit &complex_doit &verbose_print &error &warning &tmpdir &pkgfile &pkgext &isnative &autoscript &filearray &GetPackages - &basename &dirname &xargs %dh &compat); + &basename &dirname &xargs %dh &compat &addsubstvar &delsubstvar); my $max_compat=4; @@ -218,6 +218,12 @@ sub compat { if (defined $ENV{DH_COMPAT}) { $c=$ENV{DH_COMPAT}; } + elsif (-e 'debian/compat') { + # Try the file.. + open (COMPAT_IN, "debian/compat") || die "debian/compat: $!"; + $c=<COMPAT_IN>; + chomp $c; + } if ($c > $max_compat) { error("Sorry, but $max_compat is the highest compatibility level of debhelper currently supported."); @@ -350,6 +356,64 @@ sub autoscript { complex_doit("echo '# End automatically added section' >> $outfile"); } +# Removes a whole substvar line. +sub delsubstvar { + my $package=shift; + my $substvar=shift; + + my $ext=pkgext($package); + my $substvarfile="debian/${ext}substvars"; + + complex_doit("grep -v '^${substvar}=' $substvarfile > $substvarfile.new || true"); + doit("mv", "$substvarfile.new","$substvarfile"); +} + +# Adds a dependency on some package to the specified +# substvar in a package's substvar's file. +sub addsubstvar { + my $package=shift; + my $substvar=shift; + my $deppackage=shift; + my $verinfo=shift; + my $remove=shift; + + my $ext=pkgext($package); + my $substvarfile="debian/${ext}substvars"; + my $str=$deppackage; + $str.=" ($verinfo)" if length $verinfo; + + # Figure out what the line will look like, based on what's there + # now, and what we're to add or remove. + my $line=""; + if (-e $substvarfile) { + my %items; + open(SUBSTVARS_IN, "$substvarfile") || die "read $substvarfile: $!"; + while (<SUBSTVARS_IN>) { + chomp; + if (/^\Q$substvar\E=(.*)/) { + %items = map { $_ => 1} split(", ", $1); + + last; + } + } + close SUBSTVARS_IN; + if (! $remove) { + $items{$str}=1; + } + else { + delete $items{$str}; + } + $line=join(", ", keys %items); + } + elsif (! $remove) { + $line=$str; + } + + if (length $line) { + complex_doit("echo '${substvar}=$line' >> $substvarfile"); + } +} + # Reads in the specified file, one word at a time, and returns an array of # the result. If a value is passed in as the second parameter, then glob # expansion is done in the directory specified by the parameter ("." is |