This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch master
in repository debsums.

commit c14fe25936e4605ce8d4fa4c582f085555565a5e
Author: Axel Beckert <a...@deuxchevaux.org>
Date:   Tue Mar 3 10:37:53 2015 +0100

    Improve readability by using consistent spacing and indentation
    
    No code changes despite even "git diff --color-words=." doesn't
    recognize everything as whitespace-only change.
---
 debian/changelog |   1 +
 debsums          | 164 ++++++++++++++++++++++++++++---------------------------
 2 files changed, 84 insertions(+), 81 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 825d1c3..5a62ca9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,6 +32,7 @@ debsums (2.1~dev) UNRELEASED; urgency=medium
     + Quote HERE document delimiters to ease syntax highlighting and
       please perlcritic.
     + Whitespace cleanup, wrapping long lines.
+    + Improve code readability by using consistent spacing and indentation.
   * debsums.1:
     + Remove mentioning of /etc/apt/apt.conf.d/90debsums (Closes: #737240)
   * rdebsums:
diff --git a/debsums b/debsums
index cd153aa..e0e4bb8 100755
--- a/debsums
+++ b/debsums
@@ -23,7 +23,7 @@ use File::FnMatch qw(:fnmatch);
 sub version {
     my $changelog = File::Spec->catfile(dirname($0), "debian", "changelog");
     my $cmd;
-    if(-f $changelog) {
+    if (-f $changelog) {
         $cmd = "dpkg-parsechangelog '-l$changelog'";
     } else {
         $cmd = 'dpkg-query -s debsums';
@@ -31,16 +31,17 @@ sub version {
     $cmd .= ' | grep ^Version: | cut -d " " -f 2';
     my $res = `$cmd`;
     chomp($res);
-    if(!($res =~ /^[0-9.]+$/)) {
+    if (!($res =~ /^[0-9.]+$/)) {
         $res = "";
     }
     return $res;
 }
 
 (my $self = $0) =~ s!.*/!!;
+
 sub version_info {
-my $version_number = version();
-my $version = <<"EOT";
+    my $version_number = version();
+    my $version = <<"EOT";
 $self $version_number
 
 Copyright (c) 2002, 2004, 2005, 2006, 2007  Brendan O'Dea <bod\@debian.org>
@@ -51,7 +52,7 @@ PARTICULAR PURPOSE.
 Written by Brendan O'Dea <bod\@debian.org>, based on a program by
 Christoph Lameter <clameter\@debian.org> and Petr Cech <cech\@debian.org>.
 EOT
-return $version;
+    return $version;
 }
 
 my $help = <<"EOT";
@@ -107,13 +108,13 @@ my $my_noatime = 0;
 eval { $my_noatime = O_NOATIME };
 
 sub warn_or_die {
-  if(can_ignore()) {
-    unless($silent) {
-      warn $_[0];
+    if (can_ignore()) {
+        unless ($silent) {
+            warn $_[0];
+        }
+    } else {
+        die $_[0];
     }
-  } else {
-    die $_[0];
-  }
 }
 
 sub parse_dpkg {
@@ -144,36 +145,36 @@ $admindir ||= '/var/lib/dpkg';
 my $DPKG = $root . $admindir;
 
 my $is_path_pattern_opt = sub {
-  return shift =~ /^--path-(?:exclude|include)=/;
+    return shift =~ /^--path-(?:exclude|include)=/;
 };
 
 my $dpkg_conf = Dpkg::Conf->new();
 
-foreach((glob($root . "/etc/dpkg/dpkg.cfg.d/[0-9a-zA-Z_-]*"),
-         ($root . "/etc/dpkg/dpkg.cfg", $root . glob("~/.dpkg.cfg")))) {
-  if(-f $_) {
-    my $name = "$_";
-    $dpkg_conf->load($name);
-  }
+foreach ((glob($root . "/etc/dpkg/dpkg.cfg.d/[0-9a-zA-Z_-]*"),
+          ($root . "/etc/dpkg/dpkg.cfg", $root . glob("~/.dpkg.cfg")))) {
+    if (-f $_) {
+        my $name = "$_";
+        $dpkg_conf->load($name);
+    }
 }
 $dpkg_conf->filter(keep => $is_path_pattern_opt);
 my @dpkg_opts = $dpkg_conf->get_options;
 my @dpkg_patterns = ();
 foreach my $opt(@dpkg_opts) {
-  my @res = ($opt =~ /^--path-(exclude|include)=(.+)/);
-  push @dpkg_patterns, \@res;
+    my @res = ($opt =~ /^--path-(exclude|include)=(.+)/);
+    push @dpkg_patterns, \@res;
 }
 
 sub excluded_by_dpkg {
-  my $file = "/" . shift;
-  my $excluded = 0;
-  foreach my $rule(@dpkg_patterns) {
-    my ($type, $pattern) = @{$rule};
-    if(fnmatch($pattern, $file)) {
-      $excluded = $type eq 'exclude' ? 1 : 0;
+    my $file = "/" . shift;
+    my $excluded = 0;
+    foreach my $rule(@dpkg_patterns) {
+        my ($type, $pattern) = @{$rule};
+        if (fnmatch($pattern, $file)) {
+            $excluded = $type eq 'exclude' ? 1 : 0;
+        }
     }
-  }
-  return $excluded;
+    return $excluded;
 }
 
 
@@ -252,8 +253,9 @@ my %replaced;
                 and $field{Status} =~ /\sinstalled$/;
 
         $installed{$field{"binary:Package"}}{Version} = $field{Version};
-        if($field{"binary:Package"} ne $field{"Package"} &&
-           $field{"binary:Package"} eq ($field{"Package"} . ":" . $arch)) {
+        if ($field{"binary:Package"} ne $field{"Package"} &&
+            $field{"binary:Package"} eq ($field{"Package"} . ":" . $arch))
+        {
             $package_name{$field{"Package"}} = $field{"binary:Package"};
         }
         $installed{$field{"binary:Package"}}{Conffiles} = {
@@ -288,13 +290,13 @@ if ($md5sums)
 {
     open F, $md5sums
         or warn_or_die "$self: can't open sums file '$md5sums' ($!)\n";
-    if(fileno(F)) {
-    while (<F>)
-    {
-        my ($sum, $deb) = split;
-        $debsum{$deb} = $sum;
-    }
-    close F;
+    if (fileno(F)) {
+        while (<F>)
+        {
+            my ($sum, $deb) = split;
+            $debsum{$deb} = $sum;
+        }
+        close F;
     }
 }
 
@@ -379,17 +381,17 @@ sub is_replaced
 sub is_localepurge_file {
     my $path = shift;
     my $locale = "";
-    if($path =~ m!usr/share/(locale|man|gnome/help|omf|doc/kde/HTML)/!) {
+    if ($path =~ m!usr/share/(locale|man|gnome/help|omf|doc/kde/HTML)/!) {
         my $type = $1;
-        if($type eq "man" || $type eq "locale" || $type eq "doc/kde/HTML") {
-          $path =~ m!^usr/share/(?:man|locale|doc/kde/HTML)/([^/]+)/!;
-          $locale = $1;
-        } elsif($type eq "gnome/help") {
-          $path =~ m!^usr/share/gnome/help/[^/]+/([^/]+)/!;
-          $locale = $1;
-        } elsif($type eq "omf") {
-          $path =~ m!^usr/share/omf/([^/]+)/\1-([^/]+).omf$!;
-          $locale = $2;
+        if ($type eq "man" || $type eq "locale" || $type eq "doc/kde/HTML") {
+            $path =~ m!^usr/share/(?:man|locale|doc/kde/HTML)/([^/]+)/!;
+            $locale = $1;
+        } elsif ($type eq "gnome/help") {
+            $path =~ m!^usr/share/gnome/help/[^/]+/([^/]+)/!;
+            $locale = $1;
+        } elsif ($type eq "omf") {
+            $path =~ m!^usr/share/omf/([^/]+)/\1-([^/]+).omf$!;
+            $locale = $2;
         }
     }
     return length($locale) && !$locales{$locale};
@@ -404,8 +406,8 @@ sub resolve_path {
         my $token = shift @tokens;
         next if $token eq '.' || $token eq '';
         if ($token eq '..') {
-                pop @parts;
-                next;
+            pop @parts;
+            next;
         }
         my $fp = $root . '/' . join('/', @parts) . '/' . $token;
         if (-l $fp) {
@@ -432,23 +434,23 @@ sub resolve_path {
 
         my $resolved = resolve_path($path);
         if ((!sysopen F, "$root/$resolved", O_RDONLY|O_NONBLOCK|$my_noatime) &&
-           (!sysopen F, "$root/$resolved", O_RDONLY|O_NONBLOCK))
+            (!sysopen F, "$root/$resolved", O_RDONLY|O_NONBLOCK))
         {
             return 0 if $localepurge
                 and is_localepurge_file($path);
             return 0 if excluded_by_dpkg($path);
 
             my $err = "$self: can't open $pack file $root/$path ($!)\n";
-            if(can_ignore()) {
-              warn $err unless($silent);
-              return 0;
+            if (can_ignore()) {
+                warn $err unless ($silent);
+                return 0;
             } else {
-              if($!{ENOENT}) {
-                warn "$self: missing file $root/$path (from $pack package)\n";
-              } else {
-                warn $err;
-              }
-              return 2;
+                if ($!{ENOENT}) {
+                    warn "$self: missing file $root/$path (from $pack 
package)\n";
+                } else {
+                    warn $err;
+                }
+                return 2;
             }
         }
 
@@ -540,7 +542,7 @@ for (@ARGV)
         $pack = $_;
         unless (exists $installed{$pack})
         {
-            if(exists $package_name{$pack}) {
+            if (exists $package_name{$pack}) {
                 $pack = $package_name{$pack};
             }
             unless (exists $installed{$pack})
@@ -655,7 +657,7 @@ for (@ARGV)
         $pack = $field{"binary:Package"};
         unless (exists $installed{$pack})
         {
-            if(exists $package_name{$pack}) {
+            if (exists $package_name{$pack}) {
                 $pack = $package_name{$pack};
             }
             unless (exists $installed{$pack})
@@ -680,9 +682,9 @@ for (@ARGV)
             if (exists $debsum{$deb})
             {
                 open F, $deb or warn_or_die "$self: can't open $deb ($!)\n";
-                if(fileno(F)) {
-                $digest->addfile(\*F);
-                close F;
+                if (fileno(F)) {
+                    $digest->addfile(\*F);
+                    close F;
                 }
 
                 unless ($digest->hexdigest eq $debsum{$deb})
@@ -746,9 +748,9 @@ for (@ARGV)
             find sub {
                 return if -l or ! -f;
                 open F, $_ or warn_or_die "$self: can't open $_ ($!)\n";
-                if(fileno(F)) {
-                $digest->addfile(\*F);
-                close F;
+                if (fileno(F)) {
+                    $digest->addfile(\*F);
+                    close F;
                 }
                 my $md5 = $digest->hexdigest;
                 my $path = substr $File::Find::name, $skip;
@@ -785,24 +787,24 @@ for (@ARGV)
     unless ($config)
     {
         open SUMS, $sums or warn_or_die "$self: can't open $sums ($!)\n";
-        if(fileno(SUMS)) {
-        while (<SUMS>)
-        {
-            chomp;
-            my ($sum, $path) = split ' ', $_, 2;
-            unless ($path and $sum =~ /^[0-9a-f]{32}$/)
+        if (fileno(SUMS)) {
+            while (<SUMS>)
             {
-                warn "$self: invalid line ($.) in md5sums for $pack: $_\n";
-                next;
+                chomp;
+                my ($sum, $path) = split ' ', $_, 2;
+                unless ($path and $sum =~ /^[0-9a-f]{32}$/)
+                {
+                    warn "$self: invalid line ($.) in md5sums for $pack: $_\n";
+                    next;
+                }
+
+                $path =~ s!^\./!!;
+                next if exists $conffiles->{$path};
+                $status |= check $pack, $path, $sum;
             }
 
-            $path =~ s!^\./!!;
-            next if exists $conffiles->{$path};
-            $status |= check $pack, $path, $sum;
+            close SUMS;
         }
-
-        close SUMS;
-      }
     }
 
     next unless ($all or $config) and %$conffiles;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/debsums.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to