]> Savannah Git Hosting - gnulib.git/commitdiff
announce-gen: du -h is more portable than du --human
authorAkim Demaille <akim@lrde.epita.fr>
Wed, 23 May 2012 07:47:48 +0000 (09:47 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 23 May 2012 09:36:18 +0000 (11:36 +0200)
* build-aux/announce-gen (sizes): Invoke du with -h instead
of --human.  Accept leading white space in its output.
These changes are required to accommodate OS/X's du.

ChangeLog
build-aux/announce-gen

index 64900db204535f86e1433360585185d44aa636e2..89ed235fcd356ff892c24f922c30e85d645bb481 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-23  Akim Demaille  <akim@lrde.epita.fr>
+
+       announce-gen: du -h is more portable than du --human
+       * build-aux/announce-gen (sizes): Invoke du with -h instead
+       of --human.  Accept leading white space in its output.
+
 2012-05-23  Akim Demaille  <akim@lrde.epita.fr>
 
        announce-gen: Improve diagnostics.
index 4d0b82cb2dda7e824c9512321e704cc382f9df02..ff581fac674d55366b39bda2e7b16371e66ab8f5 100755 (executable)
@@ -103,13 +103,13 @@ sub sizes (@)
   my %res;
   foreach my $f (@file)
     {
-      my $cmd = "du --human $f";
+      my $cmd = "du -h $f";
       my $t = `$cmd`;
       # FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
       $@
         and (warn "command failed: '$cmd'\n"), $fail = 1;
       chomp $t;
-      $t =~ s/^([\d.]+[MkK]).*/${1}B/;
+      $t =~ s/^\s*([\d.]+[MkK]).*/${1}B/;
       $res{$f} = $t;
     }
   return $fail ? undef : %res;