[debsums] 119/184: rather than filing in the version at build time, figure it out in a smarter way during runtime
Axel Beckert
abe at deuxchevaux.org
Mon Mar 2 21:21:25 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 72b73ba3a327c8b55a6429d1be19be458ced3f0e
Author: Ryan Niebur <ryanryan52 at gmail.com>
Date: Sun Dec 20 13:42:27 2009 -0800
rather than filing in the version at build time, figure it out in a smarter way during runtime
---
debian/changelog | 4 +++-
debsums.in | 27 +++++++++++++++++++++++++--
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index f291f0f..dd4344a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,8 +7,10 @@ debsums (2.0.48) UNRELEASED; urgency=low
(Closes: 559551)
* update localepurge handling (Closes: #548278)
* set Standards-Version to 3.8.3
+ * rather than filing in the version at build time, figure it out in a
+ smarter way during runtime
- -- Ryan Niebur <ryan at debian.org> Sun, 20 Dec 2009 13:32:19 -0800
+ -- Ryan Niebur <ryan at debian.org> Sun, 20 Dec 2009 13:42:25 -0800
debsums (2.0.47) unstable; urgency=low
diff --git a/debsums.in b/debsums.in
index f4d48a5..8a5e821 100755
--- a/debsums.in
+++ b/debsums.in
@@ -17,10 +17,31 @@ use Digest::MD5;
use constant ELF_MAGIC => "\177ELF";
use Errno;
use POSIX;
+use File::Basename;
+use File::Spec;
+
+sub version {
+ my $changelog = File::Spec->catfile(dirname($0), "debian", "changelog");
+ my $cmd;
+ if(-f $changelog) {
+ $cmd = "dpkg-parsechangelog '-l$changelog'";
+ } else {
+ $cmd = 'dpkg-query -s debsums';
+ }
+ $cmd .= ' | grep ^Version: | cut -d " " -f 2';
+ my $res = `$cmd`;
+ chomp($res);
+ if(!($res =~ /^[0-9.]+$/)) {
+ $res = "";
+ }
+ return $res;
+}
(my $self = $0) =~ s!.*/!!;
+sub version_info {
+my $version_number = version();
my $version = <<EOT;
-$self #VERSION#
+$self $version_number
Copyright (c) 2002, 2004, 2005, 2006, 2007 Brendan O'Dea <bod\@debian.org>
This is free software, licensed under the terms of the GNU General Public
@@ -30,6 +51,8 @@ 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;
+}
my $help = <<EOT;
$self checks the MD5 sums of installed debian packages.
@@ -73,7 +96,7 @@ GetOptions (
'ignore-permissions' => \my $ignore_permissions,
g => sub { $gen_opt = 'missing' },
help => sub { print $help; exit },
- version => sub { print $version; exit },
+ version => sub { print version_info(); exit },
) or die "Try '$self --help' for more information.\n";
sub can_ignore {
--
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