[devscripts] 01/01: chdist: Improve apt-file 3.x handling
James McCoy
jamessan at debian.org
Mon Dec 7 01:50:45 UTC 2015
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository devscripts.
commit cb5a47089f224a55cd7a8a8a2ed12b4cc0ca63aa
Author: James McCoy <jamessan at debian.org>
Date: Sun Dec 6 20:48:27 2015 -0500
chdist: Improve apt-file 3.x handling
Use dpkg-query to check apt-file's version and determine the actual name
of the conffile.
Signed-off-by: James McCoy <jamessan at debian.org>
---
scripts/chdist.pl | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/scripts/chdist.pl b/scripts/chdist.pl
index 222bd14..1a9dcc4 100755
--- a/scripts/chdist.pl
+++ b/scripts/chdist.pl
@@ -273,11 +273,23 @@ sub apt_file
my ($dist, @args) = @_;
dist_check($dist);
aptconfig($dist);
- my $aptconfdir = '/etc/apt/apt.conf.d';
- my ($aptfile_conf) = glob($aptconfdir.'/*apt-file.conf');
- if ($aptfile_conf) {
+ my @query = ('dpkg-query', '-W', '-f');
+ open(my $fd, '-|', @query, '${Version}', 'apt-file')
+ or fatal('Unable to run dpkg-query.');
+ my $aptfile_version = <$fd>;
+ close($fd);
+ if (version_compare('3.0~', $aptfile_version) < 0) {
+ open($fd, '-|', @query, '${Conffiles}\n', 'apt-file')
+ or fatal('Unable to run dpkg-query.');
+ my @aptfile_confs = map { (split)[0] }
+ grep { /apt\.conf\.d/ } <$fd>;
+ close($fd);
# New-style apt-file
- cp($aptfile_conf, "$datadir/$dist/$aptconfdir");
+ for my $conffile (@aptfile_confs) {
+ if (! -f "$datadir/$dist/$conffile") {
+ cp($conffile, "$datadir/$dist/$conffile");
+ }
+ }
}
else {
my $cache_directory = $datadir . '/' . $dist . "/var/cache/apt/apt-file";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list