Skip to content

Commit 2e4cfd0

Browse files
committed
dh_configpackge: Avoid using Dpkg::Path::get_control_path
It manages both to be a fairly new API, complicating backports, and implicitly deprecated in wheezy. dpkg-query --control-path is explicitly deprecated, but this version makes it easier to switch to --control-show in the future (see Debathena #1302).
1 parent 7b2972b commit 2e4cfd0

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

dh_configpackage

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use strict;
2929
use Debian::Debhelper::Dh_Lib;
3030
use Debian::Debhelper::config_package;
3131
use Digest::MD5;
32-
use Dpkg::Path qw(get_control_path);
32+
use IPC::Open3;
3333

3434

3535
=head1 SYNOPSIS
@@ -287,7 +287,7 @@ sub check_file {
287287
my $hassums = 0;
288288

289289
FINDMD5: {
290-
my $md5 = open($fh, "-|", qw(dpkg-query --showformat=${Conffiles}\n --show), $package);
290+
open($fh, "-|", qw(dpkg-query --showformat=${Conffiles}\n --show), $package);
291291
while (<$fh>) {
292292
next unless /^ \Q$name\E ([0-9a-f]{32})$/;
293293
$hassums = 1;
@@ -299,7 +299,16 @@ sub check_file {
299299
}
300300
close $fh;
301301

302-
my $md5sums = get_control_path($package, "md5sums") || "/var/lib/dpkg/info/$package.md5sums";
302+
open(my $devnull, ">/dev/null");
303+
my $pid = open3(undef, my $dpkg_query, $devnull, qw(dpkg-query --control-path), $package, "md5sums");
304+
my $md5sums = <$dpkg_query>;
305+
chomp $md5sums;
306+
close $dpkg_query;
307+
close $devnull;
308+
waitpid $pid, 0;
309+
310+
$md5sums ||= "/var/lib/dpkg/info/$package.md5sums";
311+
303312
if (-e $md5sums) {
304313
$hassums = 1;
305314
open($fh, $md5sums);

0 commit comments

Comments
 (0)