[debsums] 138/184: check if missing files match dpkg path exclusion settings (Closes: #603887)
Axel Beckert
abe at deuxchevaux.org
Mon Mar 2 21:21:26 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 7462f356b8de5db130bfab9150f295063beea473
Author: Ryan Niebur <ryanryan52 at gmail.com>
Date: Tue Aug 30 00:50:24 2011 -0700
check if missing files match dpkg path exclusion settings (Closes: #603887)
---
debian/changelog | 4 +++-
debian/control | 2 +-
debsums | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index d65e4e2..5deaa96 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,8 +17,10 @@ debsums (2.0.49) UNRELEASED; urgency=low
- shorten debian/rules
* update policy version to 3.9.2.0
- set debian/source/format to 3.0 (native)
+ * check if missing files match dpkg path exclusion settings (Closes:
+ #603887)
- -- Ryan Niebur <ryan at debian.org> Sun, 28 Aug 2011 08:31:13 -0700
+ -- Ryan Niebur <ryan at debian.org> Tue, 30 Aug 2011 00:50:05 -0700
debsums (2.0.48+nmu3) unstable; urgency=low
diff --git a/debian/control b/debian/control
index 64e5298..bbef557 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ Vcs-Browser: http://git.debian.org/?p=collab-maint/debsums.git;a=summary
Package: debsums
Architecture: all
-Depends: perl (>= 5.8.0-3), ucf (>= 0.28), ${misc:Depends}
+Depends: perl (>= 5.8.0-3), ucf (>= 0.28), libfile-fnmatch-perl, ${misc:Depends}
Description: tool for verification of installed package files against MD5 checksums
debsums can verify the integrity of installed package files against
MD5 checksums installed by the package, or generated from a .deb
diff --git a/debsums b/debsums
index 15eac32..7201d4f 100755
--- a/debsums
+++ b/debsums
@@ -19,6 +19,8 @@ use Errno;
use POSIX;
use File::Basename;
use File::Spec;
+use Dpkg::Conf;
+use File::FnMatch qw(:fnmatch);
sub version {
my $changelog = File::Spec->catfile(dirname($0), "debian", "changelog");
@@ -143,6 +145,39 @@ $root ||= '';
$admindir ||= '/var/lib/dpkg';
my $DPKG = $root . $admindir;
+my $is_path_pattern_opt = sub {
+ 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);
+ }
+}
+$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;
+}
+
+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;
+ }
+ }
+ return $excluded;
+}
+
+
my %locales;
my $nopurge = '/etc/locale.nopurge';
@@ -358,6 +393,7 @@ sub is_localepurge_file {
{
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()) {
--
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