]> git.donarmstrong.com Git - debhelper.git/commitdiff
stop trying to handle substvars idempotently
authorJoey Hess <joey@gnu.kitenet.net>
Tue, 29 Dec 2009 20:27:20 +0000 (15:27 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Tue, 29 Dec 2009 20:27:20 +0000 (15:27 -0500)
In the beginning, I tried to be careful to have commands that added a
substvar remove it when ran again with different options that caused it
to not be needed. However, now when I look over the code, I see 3 places
that got it right, 1 that was right but I just broke, and a dozen that
don't even try to handle this case.

Also, handling the case is hard; code that adds substvars may be complex
and calculate versioned dependencies. The removal code then has to somehow
also come up with those same exact dependency strings. It's a recipe for
nasty code and maintenance headache even if I went and fixed everything
right now.

Instead, I dropped the whole thing. Many debhelper commands make no
pretense of being idempotent anyway; it's easy and normal to call dh_prep
when starting a binary package build, with the exact purpose of not needing
to worry about idempotency.

I did leave in the delsubstvar function, as well as the option to
addsubstvar that, confusingly, causes an item to be removed. Just for
library compatability reasons.

dh_installdebconf
dh_installxfonts
dh_perl
dh_python
doc/PROGRAMMING

index ff49f8ea132bdf9f603df60425c819e12d8cb1b1..3e51f8eec537c419aa07e9db981f1efafcd0d7b4 100755 (executable)
@@ -117,9 +117,6 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
        if ($config ne '' || $templates ne '') {
                addsubstvar($package, "misc:Depends", $debconfdep);
        }
-       else {
-               addsubstvar($package, "misc:Depends", $debconfdep, undef, 1); # remove
-       }
        
        if (($config ne '' || $templates ne '') && ! $dh{NOSCRIPTS}) {
                autoscript($package,"postrm","postrm-debconf");
index 21e7fcec0e968e06f72dc63027ac065d53d1b257..25e073bcd94e26044dbcf70732bf40f7659a4117 100755 (executable)
@@ -82,10 +82,6 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 
                addsubstvar($package, "misc:Depends", "xfonts-utils");
        }
-       else {
-               # remove
-               addsubstvar($package, "misc:Depends", "xfonts-utils", "", 1);
-       }
 }
 
 =head1 SEE ALSO
diff --git a/dh_perl b/dh_perl
index eaa08fa8e8a4ab21e06cee785590b1cfc892c7ba..d43043fa0d952b63b7e3cdd1e1747b1f3aeb2993 100755 (executable)
--- a/dh_perl
+++ b/dh_perl
@@ -90,8 +90,6 @@ use constant XS_MODULE => 4;
 foreach my $package (@{$dh{DOPACKAGES}}) {
        my $tmp=tmpdir($package);
 
-       delsubstvar($package, "perl:Depends"); # for idempotency
-       
        # Check also for alternate locations given on the command line
        my @dirs = grep -d, map "$tmp/$_", $vendorlib, $vendorarch, @ARGV;
 
index 8f8c378850a6308c927106c200221a7b5183da74..d7a4bed79882ad95fd4dbc1faa316f509067b8d5 100755 (executable)
--- a/dh_python
+++ b/dh_python
@@ -135,8 +135,6 @@ use constant SO_MODULE_NONSTANDARD => 16;
 foreach my $package (@{$dh{DOPACKAGES}}) {
        my $tmp = tmpdir($package);
 
-       delsubstvar($package, "python:Depends");
-
        my @dirs = ("usr/lib/site-python", "usr/lib/$package", "usr/share/$package", "usr/lib/games/$package", "usr/share/games/$package", @ARGV );
        my @dirs_so = ("usr/lib/site-python", @ARGV );
 
index 0fca4722019a3efb6c9285ab5686b0f02c2b02e4..ca76b9c9bf346dd8a40b46aefdfb295139e3b572 100644 (file)
@@ -216,9 +216,10 @@ addsubstvar($package, $substvar, $deppackage, $verinfo, $remove)
        - version info for the package (optional) (ie: ">= 1.1")
        - if this last parameter is passed, the thing that would be added
          is removed instead. This can be useful to ensure that a debhelper
-         command is idempotent. Note that without this parameter, if you
-         call the function twice with the same values it will only add one
-         item to the substvars file.
+         command is idempotent. (However, we generally don't bother,
+         and rely on the user calling dh_prep.) Note that without this
+         parameter, if you call the function twice with the same values it
+         will only add one item to the substvars file.
 delsubstvar($package, $substvar)
        This function removes the entire line for the substvar from the
        package's shlibs file.