Bug#763204: pkg-perl-tools: [Lintian checks] New version of lintian will deprecate "debfiles"
Niels Thykier
niels at thykier.net
Sun Sep 28 17:08:49 UTC 2014
Source: pkg-perl-tools
Version: 0.17
Severity: normal
Hi,
The upcoming version of Lintian will deprecate "debfiles" (both the
collection and the "$info->debfiles" method provided by
Lintian::Collect::Source). You can find a list of possibly affected
files in [1]. You can reading more about the rationale behind the
deprecation in [2].
*When* 2.5.28 is released, please apply the following changes to your
lintian checks:
* All method that previously (in)directly required the "debfiles"
collection will now require "unpacked" instead. Please update
the "Needs-Info" accordingly.
* Usage of the "debfiles" method is generally replaced by either
"index" or "index_resolved_path" and the extended API of
Lintian::Path.
- Most of the API is currently only available in the Lintian git
repository and will first be made available in version 2.5.28.
Future deprecations:
* The "unpacked" and "control" methods from Lintian::Collect-classes
is also scheduled for deprecation. Though, it may be deferred to
after Lintian/2.5.28.
Example (old code):
use strict; use warnings; use autodie;
use Lintian::Util qw(is_ancestor_of);
my $file = ...;
my $droot = $info->debfiles
my $dfile = $info->debfiles($file);
if ( -f $dfile and is_ancestor_of($droot, $dfile)) {
open(my $fd, '<', $dfile);
...;
close($fd);
}
Example replacement:
use strict; use warnings; use autodie;
my $file = ...;
my $dfile = $info->index_resolved_path("debian/$file");
if ($dfile and $dfile->is_open_ok) {
my $fd = $dfile->open;
...;
close($fd);
}
Other notable new API methods in Lintian::Path for accessing
the file contents:
* file_contents (slurp the file, check with is_open_ok)
* fs_path (path to the underlying file, check with is_open_ok
before opening it or passing to a method or an external tool)
~Niels
[1]:
$ git describe && grep debfiles -r lintian/
0.17
lintian/checks/pkg-perl/module-name.desc:Needs-Info: debfiles
lintian/checks/pkg-perl/usr-lib-perl5.desc:Needs-Info: debfiles
lintian/checks/pkg-perl/usr-lib-perl5.pm: my $d = $info->debfiles;
lintian/checks/pkg-perl/usr-lib-perl5.pm: is_ancestor_of($info->debfiles, $f));
[2] http://nthykier.wordpress.com/2014/09/27/lintian-upcoming-api-making-it-easier-to-write-correct-and-safe-code/
More information about the pkg-perl-maintainers
mailing list