X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=dh_md5sums;h=4a1264be9f373e66b1eddf8ac82b37bacaf36987;hb=18a0da8092ea9f3dc48bca92b36f592af25a608d;hp=9a3354de0d30d1767d297d73d224e19bc17e0013;hpb=67b74298f08a3e2b30e43cbcd7cdaccc2e1b1614;p=debhelper.git diff --git a/dh_md5sums b/dh_md5sums index 9a3354d..4a1264b 100755 --- a/dh_md5sums +++ b/dh_md5sums @@ -1,28 +1,71 @@ #!/usr/bin/perl -w -# -# Generate a DEBIAN/md5sums file, that lists the md5sums of all files in the -# package. +=head1 NAME + +dh_md5sums - generate DEBIAN/md5sums file + +=cut + +use strict; use Cwd; use Debian::Debhelper::Dh_Lib; -init(); -foreach $PACKAGE (@{$dh{DOPACKAGES}}) { - $TMP=tmpdir($PACKAGE); +=head1 SYNOPSIS + +B [S>] [B<-x>] [B<-X>I] [B<--include-conffiles>] + +=head1 DESCRIPTION + +B is a debhelper program that is responsible for generating +a F file, which lists the md5sums of each file in the package. +These files are used by the B package. + +All files in F are omitted from the F file, as are all +conffiles (unless you use the B<--include-conffiles> switch). + +The md5sums file is installed with proper permissions and ownerships. + +=head1 OPTIONS + +=over 4 + +=item B<-x>, B<--include-conffiles> + +Include conffiles in the md5sums list. Note that this information is +redundant since it is included elsewhere in Debian packages. + +=item B<-X>I, B<--exclude=>I - if (! -d "$TMP/DEBIAN") { - doit("install","-d","$TMP/DEBIAN"); +Exclude files that contain I anywhere in their filename from +being listed in the md5sums file. + +=back + +=cut + +init(options => { + "x" => \$dh{INCLUDE_CONFFILES}, # is -x for some unknown historical reason.. + "include-conffiles" => \$dh{INCLUDE_CONFFILES}, +}); + +foreach my $package (@{$dh{DOPACKAGES}}) { + next if is_udeb($package); + + my $tmp=tmpdir($package); + + if (! -d "$tmp/DEBIAN") { + doit("install","-d","$tmp/DEBIAN"); } # Check if we should exclude conffiles. my $exclude=""; - if (! $dh{INCLUDE} && -r "$TMP/DEBIAN/conffiles") { + if (! $dh{INCLUDE_CONFFILES} && -r "$tmp/DEBIAN/conffiles") { # Generate exclude regexp. - open (CONFF,"$TMP/DEBIAN/conffiles"); + open (CONFF,"$tmp/DEBIAN/conffiles"); while () { chomp; s/^\///; - $exclude.="! -path \"$_\" "; + $exclude.="! -path \"./$_\" "; } close CONFF; } @@ -32,14 +75,26 @@ foreach $PACKAGE (@{$dh{DOPACKAGES}}) { $exclude.="! \\( $dh{EXCLUDE_FIND} \\) "; } - $olddir=getcwd(); - complex_doit("cd $TMP >/dev/null ; find * -type f $exclude ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd $olddir >/dev/null"); + my $find="find . -type f $exclude ! -regex './DEBIAN/.*' -printf '%P\\0'"; + complex_doit("(cd $tmp >/dev/null ; $find | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums) >/dev/null"); # If the file's empty, no reason to waste inodes on it. - if (-z "$TMP/DEBIAN/md5sums") { - doit("rm","-f","$TMP/DEBIAN/md5sums"); + if (-z "$tmp/DEBIAN/md5sums") { + doit("rm","-f","$tmp/DEBIAN/md5sums"); } else { - doit("chmod",644,"$TMP/DEBIAN/md5sums"); - doit("chown","root.root","$TMP/DEBIAN/md5sums"); + doit("chmod",644,"$tmp/DEBIAN/md5sums"); + doit("chown","0:0","$tmp/DEBIAN/md5sums"); } } + +=head1 SEE ALSO + +L + +This program is a part of debhelper. + +=head1 AUTHOR + +Joey Hess + +=cut