[debsums] 03/07: Simplify parsing of dpkg-{parsechangelog, query} output

Axel Beckert abe at deuxchevaux.org
Tue Mar 3 11:35:23 UTC 2015


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

abe pushed a commit to branch master
in repository debsums.

commit f515f98e4f986b5f0162b32b1f35dd51ce3b621b
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Tue Mar 3 11:06:55 2015 +0100

    Simplify parsing of dpkg-{parsechangelog,query} output
    
    Use more specific options which exactly show the version and nothing
    else.
---
 debian/changelog | 2 ++
 debsums          | 5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e880bf0..acd92ee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -30,6 +30,8 @@ debsums (2.1~dev) UNRELEASED; urgency=medium
     + Warn if found md5sums file is empty. (Closes: #577197)
     + Broaden character set which is considered a valid version number.
       (Closes: #779626)
+    + Simplify parsing of dpkg-{parsechangelog,query} output by using more
+      specific options, allowing to drop the calls to grep and cut.
     + Remove obsolete CVS keywords.
     + Quote HERE document delimiters to ease syntax highlighting and
       please perlcritic.
diff --git a/debsums b/debsums
index d0cbb43..f7c523b 100755
--- a/debsums
+++ b/debsums
@@ -24,11 +24,10 @@ sub version {
     my $changelog = File::Spec->catfile(dirname($0), "debian", "changelog");
     my $cmd;
     if (-f $changelog) {
-        $cmd = "dpkg-parsechangelog '-l$changelog'";
+        $cmd = qq(dpkg-parsechangelog -SVersion '-l$changelog');
     } else {
-        $cmd = 'dpkg-query -s debsums';
+        $cmd = q(dpkg-query -W -f '${Version}' debsums);
     }
-    $cmd .= ' | grep ^Version: | cut -d " " -f 2';
     my $res = `$cmd`;
     chomp($res);
     if (!($res =~ /^[0-9.~a-z+]+$/)) {

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



More information about the Pkg-perl-cvs-commits mailing list