From: joey Date: Tue, 17 Aug 1999 05:11:15 +0000 (+0000) Subject: r179: Initial Import X-Git-Tag: debian_version_0_1~63 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d2273e03aae657f361060a9048edf407a3a9c694;p=debhelper.git r179: Initial Import --- diff --git a/Dh_Lib.pm b/Dh_Lib.pm index f20cd5d..2517431 100644 --- a/Dh_Lib.pm +++ b/Dh_Lib.pm @@ -12,6 +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 + &xargs %dh); sub init { @@ -121,6 +122,41 @@ sub complex_doit { } } +# Run a command that may have a huge number of arguments, like xargs does. +# Pass in a reference to an array containing the arguments, and then other +# parameters that are the command and any parameters that should be passed to +# it each time. +sub xargs { + my $args=shift; + + # The kernel can accept command lines up to 20k worth of characters. + my $command_max=20000; + + # Figure out length of static portion of command. + my $static_length=0; + foreach (@_) { + $static_length+=length($_)+1; + } + + my @collect=(); + my $length=$static_length; + foreach (@$args) { + if (length($_) + 1 + $static_length > $command_max) { + error("This command is greater than the maximum command size allowed by the kernel, and cannot be split up further. What on earth are you doing? \"@_ $_\""); + } + $length+=length($_) + 1; + if ($length < $command_max) { + push @collect, $_; + } + else { + doit(@_,@collect) if $#collect > -1; + @collect=(); + $length=$static_length; + } + } + doit(@_,@collect) if $#collect > -1; +} + # Print something if the verbose flag is on. sub verbose_print { my $message=shift; if ($dh{VERBOSE}) { diff --git a/debian/changelog b/debian/changelog index 8fdd8d5..2dc3d01 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +debhelper (1.2.42) unstable; urgency=low + + * dh_m5sums: don't generate bogus md5sums file if the package contains no + files. Yes, someone found a legitimate reason to do that. + + -- Joey Hess Thu, 25 Feb 1999 00:03:47 -0800 + debhelper (1.2.41) unstable; urgency=low * README: minor typo fix. diff --git a/dh_compress b/dh_compress index caffc11..d4ec3cf 100755 --- a/dh_compress +++ b/dh_compress @@ -78,7 +78,7 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { } if (@f) { - doit("gzip","-9f",@f); + xargs(\@f,"gzip","-9f"); } # Now change over any files we can that used to be hard links so diff --git a/dh_compress.1 b/dh_compress.1 index 8fa2d80..f662833 100644 --- a/dh_compress.1 +++ b/dh_compress.1 @@ -15,10 +15,11 @@ be compressed, namely all files in usr/info, usr/man, usr/X11R6/man, and all files in usr/doc that are larger than 4k in size, except the copyright file, .html files and .gif files, and all changelog files. .P -If a debian/compress file exits, however, it will be ran as a shell script, -and all filenames that the shell script outputs will be compressed instead -of the default files. Note that the shell script will be run from inside the -package build directory. +If a debian/package.compress file exists (debian/compress may be used for the +first binary package in debian/control), however, it will be ran as a shell +script, and all filenames that the shell script outputs will be compressed +instead of the default files. Note that the shell script will be run from +inside the package build directory. .SH EXAMPLE Here is a sample debian/compress file that causes dh_compress to compress the same files as it would by default. This is a good starting point for