[Piuparts-commits] [piuparts] 11/16: p: ignored_{files, patterns} prefixed with ':' will be verbose
Holger Levsen
holger at layer-acht.org
Thu Apr 13 15:04:52 UTC 2017
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch develop
in repository piuparts.
commit 055254f432e3bf0b1b80301d2e14fd8d5aec6b33
Author: Andreas Beckmann <anbe at debian.org>
Date: Tue Apr 11 14:13:09 2017 +0200
p: ignored_{files,patterns} prefixed with ':' will be verbose
Signed-off-by: Andreas Beckmann <anbe at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
debian/changelog | 3 +++
piuparts.1.txt | 13 +++++++++++--
piuparts.py | 38 ++++++++++++++++++++++++++++++++++----
3 files changed, 48 insertions(+), 6 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 718f1fe..ba915ea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,9 @@ piuparts (0.77) UNRELEASED; urgency=medium
--end-meta meta-data.
- Mount a new devpts instance on /dev/pts and /dev/ptmx inside the chroot
for better pty separation from the host. Inspired by pbuilder.
+ - Arguments to the --ignore/--ignore-regexp options (and internal
+ ignored_files/ignored_patterns settings) that are prefixed with a ':'
+ will verbosely log the ignored files if matched.
* piupartslib/packagesdb.py:
- Add new state "outdated" to ignore packages if a dependency distro
already has a newer version. (Closes: #856846)
diff --git a/piuparts.1.txt b/piuparts.1.txt
index ada24d5..a68e151 100644
--- a/piuparts.1.txt
+++ b/piuparts.1.txt
@@ -117,10 +117,19 @@ The tarball can be created with the '-s' option, or you can use one that *pbuild
any modifications to files will be reflected in the originals.
*-i* 'filename', *--ignore*='filename'::
- Add a filename to the list of filenames to be ignored when comparing changes before and after installation. By default, piuparts ignores files that always change during a package installation and uninstallation, such as *dpkg* status files. The filename should be relative to the root of the chroot (e.g., _var/lib/dpkg/status_). This option can be used as many times as necessary.
+ Add a filename to the list of filenames to be ignored when comparing changes
+ before and after installation. By default, piuparts ignores files that always
+ change during a package installation and uninstallation, such as *dpkg*
+ status files. The filename should be relative to the root of the chroot
+ (e.g., _var/lib/dpkg/status_).
+ Filenames prefixed with a ':' will be logged verbosely if found.
+ This option can be used as many times as necessary.
*-I* 'regexp', *--ignore-regexp*='regexp'::
- Add a regular expression pattern to the list of patterns for filenames to be ignored when comparing changes before and after installation. This option can be used as many times as necessary.
+ Add a regular expression pattern to the list of patterns for filenames to be
+ ignored when comparing changes before and after installation.
+ Patterns prefixed with a ':' will log verbosely all matching files.
+ This option can be used as many times as necessary.
*--install-purge-install*::
Purge package after installation and reinstall. All depedencies are installed during purge.
diff --git a/piuparts.py b/piuparts.py
index 9114307..f1d4ffc 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -1681,12 +1681,22 @@ class Chroot:
if selinux_enabled():
self.mount("/sys/fs/selinux", self.selinuxfs_path(), opts="bind,ro")
- def is_ignored(self, pathname):
+ def is_ignored(self, pathname, info="PATH"):
"""Is a file (or dir or whatever) to be ignored?"""
if pathname in settings.ignored_files:
return True
+ if ':' + pathname in settings.ignored_files:
+ logging.info("IGNORED %s: %s" % (info, pathname))
+ return True
for pattern in settings.ignored_patterns:
+ if pattern[0] == ':':
+ verbose = True
+ pattern = pattern[1:]
+ else:
+ verbose = False
if re.search('^' + pattern + '$', pathname):
+ if verbose:
+ logging.info("IGNORED %s: %s" % (info, pathname))
return True
return False
@@ -1704,7 +1714,7 @@ class Chroot:
if name.startswith(self.name):
name = name[len(self.name):]
ret = is_broken_symlink(self.name, dirpath, filename)
- if ret and not self.is_ignored(name):
+ if ret and not self.is_ignored(name, info="broken symlink"):
try:
target = os.readlink(full_name)
except os.error:
@@ -2180,20 +2190,38 @@ def diff_meta_data(tree1, tree2):
tree2 = tree2.copy()
for name in settings.ignored_files:
+ if name[0] == ':':
+ verbose = True
+ name = name[1:]
+ else:
+ verbose = False
if name in tree1:
+ if verbose:
+ logging.info("IGNORED PATH at 1: %s" % name)
del tree1[name]
if name in tree2:
+ if verbose:
+ logging.info("IGNORED PATH at 2: %s" % name)
del tree2[name]
for pattern in settings.ignored_patterns:
+ if pattern[0] == ':':
+ verbose = True
+ pattern = pattern[1:]
+ else:
+ verbose = False
pat = re.compile(pattern)
for name in tree1.keys():
m = pat.search(name)
if m:
+ if verbose:
+ logging.info("IGNORED PATH at 1: %s" % name)
del tree1[name]
for name in tree2.keys():
m = pat.search(name)
if m:
+ if verbose:
+ logging.info("IGNORED PATH at 2: %s" % name)
del tree2[name]
modified = []
@@ -2881,13 +2909,15 @@ def parse_command_line():
parser.add_option("-i", "--ignore", action="append", metavar="FILENAME",
default=[],
help="Add FILENAME to list of filenames to be " +
- "ignored when comparing changes to chroot.")
+ "ignored when comparing changes to chroot."
+ "FILENAMES prefixed with ':' will be reported verbosely.")
parser.add_option("-I", "--ignore-regex", action="append",
metavar="REGEX", default=[],
help="Add REGEX to list of Perl compatible regular " +
"expressions for filenames to be " +
- "ignored when comparing changes to chroot.")
+ "ignored when comparing changes to chroot."
+ "Patterns prefixed with ':' will report all matches verbosely.")
parser.add_option("--install-recommends",
action="store_true", default=False,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git
More information about the Piuparts-commits
mailing list