[pacman-dev] [PATCH] fixup! contrib: Add verify-pacman-repo-db.pl

Florian Pritz bluewind at xinu.at
Tue Aug 9 17:15:25 UTC 2016


Signed-off-by: Florian Pritz <bluewind at xinu.at>
---

Thanks for the review Andrew! Does this change look correct?

I've also fixed another minor spelling issue.

If Andrew signs off on this I'll squash it my branch.

 contrib/verify-pacman-repo-db.pl | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/contrib/verify-pacman-repo-db.pl b/contrib/verify-pacman-repo-db.pl
index 1d02c26..147f71e 100755
--- a/contrib/verify-pacman-repo-db.pl
+++ b/contrib/verify-pacman-repo-db.pl
@@ -141,39 +141,39 @@ sub check_repodb {
 			my $package = $1;
 			$self->{package_queue}->enqueue({
 					package => $package,
 					db_desc_content => $file_object->get_content(),
 					dirname => $dirname,
 				});
 			$pkgcount++;
 		}
 	}
 
-	$self->_debug(sprintf("Queued %d package from database '%s'\n", $pkgcount, $repodb));
+	$self->_debug(sprintf("Queued %d package(s) from database '%s'\n", $pkgcount, $repodb));
 }
 
 sub _parse_db_entry {
 	my $self = shift;
 	my $content = shift;
 	my %db;
 	my $key;
 
 	for my $line (split /\n/, $content) {
 		if ($line eq '') {
 			$key = undef;
 			next;
-		}
-		if ($line =~ m/^%(.+)%$/) {
+		} elsif ($key) {
+			push @{$db{$key}}, $line;
+		} elsif ($line =~ m/^%(.+)%$/) {
 			$key = $1;
 		} else {
-			push @{$db{$key}}, $line;
-			die "\$key not set. Is the db formated incorrectly?" unless $key;
+			die "\$key not set. Is the db formatted incorrectly?" unless $key;
 		}
 	}
 	return \%db;
 }
 
 sub _output {
 	my $self = shift;
 	my $output = shift;
 
 	return if $output eq "";
-- 
2.9.0


More information about the pacman-dev mailing list