[SCM] Debian package checker branch, master, updated. 2.5.11-198-g362b026
The following commit has been merged in the master branch:
commit 362b02621465723f1cb69672d34d6ec9e20c849c
Author: Niels Thykier <niels@thykier.net>
Date: Sat Mar 30 10:53:45 2013 +0100
lib: Revise some of the SYNOPSIS examples
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/lib/Lintian/CollScript.pm b/lib/Lintian/CollScript.pm
index b4770d4..1b857f3 100644
--- a/lib/Lintian/CollScript.pm
+++ b/lib/Lintian/CollScript.pm
@@ -38,12 +38,9 @@ Lintian::CollScript - Collection script handle
my $cs = Lintian::CollScript->new ("$ENV{'LINTIAN_ROOT'}/collection/index.desc");
my $name = $cs->name;
- foreach my $needs (@{ $cs->needs_info }) {
+ foreach my $needs ($cs->needs_info) {
print "$name needs $needs\n";
}
- if ($cs->is_check_type ('binary') && $cs->is_check_type ('source')) {
- # Check applies to binary pkgs AND source pkgs
- }
=head1 DESCRIPTION
diff --git a/lib/Lintian/Collect/Package.pm b/lib/Lintian/Collect/Package.pm
index bca2e3b..664f022 100644
--- a/lib/Lintian/Collect/Package.pm
+++ b/lib/Lintian/Collect/Package.pm
@@ -34,16 +34,18 @@ Lintian::Collect::Package - Lintian base interface to binary and source package
=head1 SYNOPSIS
my ($name, $type, $dir) = ('foobar', 'source', '/path/to/lab-entry');
- my $collect = Lintian::Collect->new ($name, $type, $dir);
- my $file;
- eval { $file = $collect->unpacked ('bin/ls'); };
- if ( $file && -e $file ) {
- # work with $file
- ;
+ my $info = Lintian::Collect->new ($name, $type, $dir);
+ my $filename = "etc/conf.d/$name.conf";
+ my $file = $info->index ($filename);
+ if ($file && $file->is_regular_file) {
+ open my $fd, '<', $info->unpacked ($filename)
+ or die "opening $filename: $!";
+ # Use $fd ...
+ close $fd;
} elsif ($file) {
- print "/bin/ls is not available in the Package\n";
+ print "$file is available, but not a regular file\n";
} else {
- print "Package has not been unpacked\n";
+ print "$file is missing\n";
}
=head1 DESCRIPTION
diff --git a/lib/Lintian/Data.pm b/lib/Lintian/Data.pm
index d2179d7..15a809e 100644
--- a/lib/Lintian/Data.pm
+++ b/lib/Lintian/Data.pm
@@ -215,7 +215,7 @@ Lintian::Data - Lintian interface to query lists of keywords
if ($list->known($keyword)) {
# do something ...
}
- my $hash = Lintian::Data->new('another-type', '\s+');
+ my $hash = Lintian::Data->new('another-type', qr{\s++});
if ($list->value($keyword) > 1) {
# do something ...
}
diff --git a/lib/Lintian/Path.pm b/lib/Lintian/Path.pm
index b16b7ef..82ef3be 100644
--- a/lib/Lintian/Path.pm
+++ b/lib/Lintian/Path.pm
@@ -35,7 +35,7 @@ Lintian::Path - Lintian representation of a path entry in a package
my ($name, $type, $dir) = ('lintian', 'source', '/path/to/entry');
my $info = Lintian::Collect->new ($name, $type, $dir);
- my $path = $info->index->{'bin/ls'};
+ my $path = $info->index-> ('bin/ls');
if ($path->is_file) {
# is file (or hardlink)
if ($path->is_hardlink) { }
@@ -45,8 +45,11 @@ Lintian::Path - Lintian representation of a path entry in a package
if ($path->owner eq 'root') { }
if ($path->group eq 'root') { }
} elsif ($path->is_symlink) {
- my $target = $path->link;
- # is symlink (points to $target)
+ my $resolved = $path->link_resolved;
+ if (defined $resolved) {
+ # is a resolvable symlink (pointing to $target)
+ my $more_info = $info->index-> ($resolved);
+ }
}
=head1 INSTANCE METHODS
diff --git a/lib/Lintian/Profile.pm b/lib/Lintian/Profile.pm
index 14a3ea9..2b5a200 100644
--- a/lib/Lintian/Profile.pm
+++ b/lib/Lintian/Profile.pm
@@ -39,12 +39,12 @@ Lintian::Profile - Profile parser for Lintian
=head1 SYNOPSIS
# Load the debian profile (if available)
- my $profile = Lintian::Profile->new ('debian', $ENV{'LINTIAN_ROOT'});
+ my $profile = Lintian::Profile->new ('debian');
# Load the debian profile using an explicit search path
- $profile = Lintian::Profile->new ('debian', $ENV{'LINTIAN_ROOT'},
+ $profile = Lintian::Profile->new ('debian',
['/path/to/alt/root', $ENV{'LINTIAN_ROOT'}]);
# Load the "default" profile for the current vendor
- $profile = Lintian::Profile->new (undef, $ENV{'LINTIAN_ROOT'});
+ $profile = Lintian::Profile->new;
foreach my $tag ($profile->tags) {
print "Enabled tag: $tag\n";
}
@@ -81,7 +81,7 @@ my %SEC_FIELDS = (
'severity' => 1,
);
-=item Lintian::Profile->new($profname[, $ipath])
+=item Lintian::Profile->new ([$profname[, $ipath]])
Creates a new profile from the profile. $profname is the name of the
profile and $ipath is a list reference containing containing the path
diff --git a/lib/Lintian/Tag/Info.pm b/lib/Lintian/Tag/Info.pm
index 3c6ff4b..a831b15 100644
--- a/lib/Lintian/Tag/Info.pm
+++ b/lib/Lintian/Tag/Info.pm
@@ -56,7 +56,9 @@ Lintian::Tag::Info - Lintian interface to tag metadata
=head1 SYNOPSIS
- my $tag_info = Lintian::Tag::Info->new('some-tag');
+ my $cs = Lintian::CheckScript->new ("$ENV{'LINTIAN_ROOT'}/checks/",
+ 'files');
+ my $tag_info = $cs->get_tag ('some-tag');
print "Tag info is:\n";
print $tag_info->description('text', ' ');
print "\nTag info in HTML is:\n";
diff --git a/lib/Lintian/Tags.pm b/lib/Lintian/Tags.pm
index f4ca28d..2340272 100644
--- a/lib/Lintian/Tags.pm
+++ b/lib/Lintian/Tags.pm
@@ -49,13 +49,15 @@ Lintian::Tags - Manipulate and output Lintian tags
=head1 SYNOPSIS
my $tags = Lintian::Tags->new;
- $tags->file_start('/path/to/file', 'pkg', '1.0', 'i386', 'binary');
- $tags->file_overrides('/path/to/file', 'pkg', 'binary');
- $tags->tag('lintian-tag', 'data');
- tag('other-lintian-tag', 'data');
- my %overrides = $tags->overrides('/path/to/file');
+ my $proc = Lintian::Processable::Package->new ('/path/to/file');
+ $tags->file_start ($proc);
+ $tags->file_overrides ('/path/to/an/overrides-file');
+ $tags->tag ('lintian-tag', 'extra tag information');
+ tag ('other-lintian-tag', 'with some extra data');
+ tag ('third-lintian-tag'); # with no extra).
+ my %overrides = $tags->overrides ($proc);
my %stats = $tags->statistics;
- if ($tags->displayed('lintian-tag')) {
+ if ($tags->displayed ('lintian-tag')) {
# do something if that tag would be displayed...
}
--
Debian package checker
Reply to: