Re: X: package-contains-broken-symlink question

2013-04-06 Thread Niels Thykier
On 2013-04-06 20:10, Felix Natter wrote:
> hi,
> 
> I am currently fixing a warning in the freeplane package,
> and am wondering whether this lintian feature works correctly.
> 

It works but there is a limit to what it can do.

> X: freeplane: package-contains-broken-symlink
> usr/share/freeplane/framework.jar ../knopflerfish/framework.jar
> 
> (corresponds to this line in debian/freeplane.links:
> usr/share/knopflerfish/framework.jar usr/share/freeplane/framework.jar)
> 
> [...]
> 
> Could the problem be that /usr/share/knopflerfish/framework.jar is a
> symlink itself?
> 
> [...]
> 
> Thanks and Best Regards,
> 


Yes, since freeplane and knopflerfish are not built from the same
source, Lintian has no chance of knowing that the target file exist[1].
Lintian does have some exceptions (like /usr/share/java/.jar)
where it assumes the target will be provided by a direct dependency.
But that does not apply here since "framework.jar" does appear to be a
"public java library" (i.e. not in /usr/share/java).

~Niels

[1] http://lintian.debian.org/manual/section-1.3.html

See "same source analysis".


-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/5160951b.5030...@thykier.net



Re: Stanford IDG internal Perl style

2013-04-06 Thread Niels Thykier
On 2013-04-06 05:26, Russ Allbery wrote:
>>   $opt->mode eq 't' instead of $opt->mode eq 'tags'
>>   $opt->h instead of $opt->help
> Yeah, I was looking at that when I reviewed the document, and I think
> that's backwards.  It's left over from an old style we had for
> Getopt::Long where it didn't matter.  I'm going to change that.
> 

Noted.  :)

Do you have some examples of complex usage of Getopt::Long::Descriptive
by the way?  I had a stab at rewriting lintian's option parsing and for
sometimes I cannot find the way to do it with G::L::Descriptive.

Particularly, --display-info + --pedantic is translated to
--display-level.  While it is trivial to collect all the information and
merge it manually it loses the order.  (i.e. --pedantic --display-level
X is sometimes different from --display-level X --pedantic).

The possibility to having a sub interpreting the opt+value would do just
fine but I have not figured how to do it (if at all possible).

>> > Regarding the use of:
>> > Usage: lintian-info ...
>> > Usage: lintian-info --annotate
>> > Usage: lintian-info --tags ...
>> > For some reason, it only treats newlines as newlines if they are not
>> > followed by \t or space.  Possible reasons could be that the string is
>> > "s/\s\s++/ /"'ed, but I haven't checked the code.
> Oh, that's kind of annoying.  Although we conventionally ommitted the
> Usage: for subsequent lines anyway and just said:
> 
> Usage: lintian-info ...
>lintian-info --annotate
>lintian-info --tags ...
> 

That is the way I wanted to write it, but even "\n\t" is "two or more
spaces" and gets translated to " " resulting in:

Usage: lintian-info ... lintian-info --annotate [... and so on]

i.e. one long unreadable line.

~Niels



-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/51608ffe.7080...@thykier.net



[SCM] Debian package checker branch, master, updated. 2.5.11-227-gb60a6e5

2013-04-06 Thread Niels Thykier
The following commit has been merged in the master branch:
commit b60a6e5daeaf5fae3270524c2a44ec242b7327ee
Author: Niels Thykier 
Date:   Sat Apr 6 22:38:25 2013 +0200

t/runtests: Validate the name of tests

Before running any tests in a suite, check that the test name
(declared in the desc) matches the expected.

Signed-off-by: Niels Thykier 

diff --git a/t/runtests b/t/runtests
index 390f7f8..0b6a399 100755
--- a/t/runtests
+++ b/t/runtests
@@ -35,6 +35,7 @@ use threads;
 use Thread::Queue;
 
 use Data::Dumper;
+use File::Basename qw(basename dirname);
 use Getopt::Long qw(GetOptions);
 use List::MoreUtils qw(none);
 use Text::Template;
@@ -257,7 +258,7 @@ if ($singletest) {
 $desc =~ s/\.changes$//;
 $desc = "$desc.desc";
 if (-f $desc) {
-@tests = read_dpkg_control($desc);
+push @tests, read_test_desc($desc);
 }
 } elsif ($tag) {
 @tests = find_tests_for_tag($tag, "$TESTSET/changes/*.desc");
@@ -265,7 +266,7 @@ if ($singletest) {
 unless (-d "$TESTSET/changes") {
 fail("cannot find $TESTSET/changes: $!");
 }
-@tests = map { read_dpkg_control($_) } 
sort(glob("$TESTSET/changes/*.desc"));
+@tests = map { read_test_desc($_) } sort(glob("$TESTSET/changes/*.desc"));
 }
 print "Found the following changes tests: @tests\n" if $DEBUG;
 print "Changes tests:\n" if @tests;
@@ -284,9 +285,9 @@ foreach my $tsi (['debs', "$TESTSET/debs/*/desc", sub { 
generic_test_runner('deb
 if ($singletest) {
 my $test = $singletest;
 if (-d "$TESTSET/$tdir/$test") {
-@tests = read_dpkg_control("$TESTSET/$tdir/$test/desc");
+push @tests, read_test_desc("$TESTSET/$tdir/$test/desc");
 } elsif (-f "$LINTIAN_ROOT/checks/$singletest.desc"){
-@tests = map { read_dpkg_control($_) } glob 
"$TESTSET/$tdir/$singletest-*/desc";
+@tests = map { read_test_desc($_) } 
glob("$TESTSET/$tdir/$singletest-*/desc");
 }
 } elsif ($tag) {
 @tests = find_tests_for_tag($tag, $globstr);
@@ -294,7 +295,7 @@ foreach my $tsi (['debs', "$TESTSET/debs/*/desc", sub { 
generic_test_runner('deb
 unless (-d "$TESTSET/$tdir/") {
 fail("cannot find $TESTSET/$tdir: $!");
 }
-@tests = map { read_dpkg_control($_) } glob $globstr;
+@tests = map { read_test_desc($_) } glob($globstr);
 }
 @tests = sort {
 $a->{sequence} <=> $b->{sequence}
@@ -336,7 +337,7 @@ sub find_tests_for_tag {
 my ($tag, $glob) = @_;
 return generic_find_test_for_tag($tag, $glob, sub {
 my ($tag, $desc) = @_;
-my ($data) = read_dpkg_control($desc);
+my $data = read_test_desc($desc);
 my $tagnames = $data->{'test-for'}//'';
 $tagnames .= ' ' . $data->{'test-against'} if $data->{'test-against'};
 my %table = map { $_ => 1 } split(m/\s++/o, $tagnames);
@@ -576,11 +577,11 @@ sub generic_find_test_for_tag {
 my $testname;
 next unless $res;
 
-if ($res =~ m/^\d+$/o){
+if (not ref $res and $res =~ m/^\d+$/o){
 # returned a truth value; use the regex to deduce the test name
 ($testname) = ($file =~ m,.*/([^/]+)[/\.]tags$,);
 } else {
-# The code returned the test name for us
+# The code returned the test name or test data for us
 $testname = $res;
 }
 push @tests, $testname;
@@ -916,6 +917,33 @@ sub check_test_is_sane {
 return 1;
 }
 
+sub read_test_desc {
+my ($filename) = @_;
+my @paragraphs = read_dpkg_control($filename);
+my $testdata;
+my $expected_name;
+if (scalar(@paragraphs) != 1) {
+fail("$filename does not have exactly one paragraph")
+}
+$testdata = $paragraphs[0];
+if ($filename =~ m{/desc$}) {
+# t///desc
+$expected_name = basename(dirname($filename));
+} else {
+# t/changes/.desc
+$expected_name = basename($filename, '.desc');
+}
+
+if (!exists $testdata->{'testname'}) {
+fail("$filename is missing Testname field");
+}
+if ($expected_name ne $testdata->{'testname'}) {
+fail("$filename is called $testdata->{'testname'}"
+ . " instead of $expected_name");
+}
+return $testdata;
+}
+
 sub msg_flush {
 my %msg = ( id => threads->tid() );
 $MSG_Q->enqueue(\%msg);

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/e1uozua-0002v2...@vasks.debian.org



[SCM] Debian package checker branch, master, updated. 2.5.11-226-gf94756e

2013-04-06 Thread Niels Thykier
The following commit has been merged in the master branch:
commit f94756e8708980b3cfc6bb550f14a37d046a8695
Author: Niels Thykier 
Date:   Sat Apr 6 21:59:55 2013 +0200

t/runtests: Include newlines when Lintian fails

Dump lintian output line-by-line without dropping the newlines.  This
makes the output much more readable.  Since the dump is no longer
"atomic", prefix the output with the testname as well.

Signed-off-by: Niels Thykier 

diff --git a/t/runtests b/t/runtests
index 1c65562..390f7f8 100755
--- a/t/runtests
+++ b/t/runtests
@@ -491,7 +491,10 @@ sub run_lintian {
 $status = ($? >> 8) & 255;
 unless ($status == 0 or $status == 1) {
 msg_print "FAILED\n";
-msg_print @data;
+for my $line (@data) {
+#NB: $line has trailing newline.
+msg_print "$testdata->{testname}: $line";
+}
 fail "$LINTIAN @options $file exited with status $status";
 } else {
 @data = sort @data if $testdata->{sort};

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/e1uozmu-0007wt...@vasks.debian.org



Bug#704197: Please review: systemd checks

2013-04-06 Thread Michael Stapelberg
Hi Niels,

Niels Thykier  writes:
> I think you are missing a return here?
Indeed, thanks.

New files are attached, here is the list of things that I know need to
be fixed:

1) We don’t have any documentation references in the .desc file yet.
2) I need to switch to lab_data_path in check_maintainer_scripts().

Could you please also say a few words on how the usual inclusion process
works? I.e., what are the next steps after there are no more things left
to fix? Also, do I need to mark the checks as experimental because they
are new?

-- 
Best regards,
Michael


systemd
Description: Binary data


systemd.desc
Description: Binary data


Bug#704197: Please review: systemd checks

2013-04-06 Thread Niels Thykier
On 2013-04-06 18:33, Michael Stapelberg wrote:
> Hi Niels,
> 
> Niels Thykier  writes:
>> [...]
>> Almost; it definitely plugs the issues I mentioned.  That said, I
>> believe we prefer to emit tags instead of erroring out when we see an
>> unexpected file type (e.g. see control-file-is-not-a-file).
>>   Secondly, there is a bug in that link_resolved is only applicable to
>> links.  So if it is not a regular file and not a link, the code will
>> croak in $path->link_resolved[2].
> Okay, so how about this?
> 
> sub check_init_script {
> my ($pkg, $info, $file) = @_;
> 
> my $lsb_source_seen;
> my $path = $info->index ($file);
> unless ($path->is_regular_file ||
> ($path->is_symlink && defined($path->link_resolved))) {
> tag 'init-script-is-not-a-file', $file;

I think you are missing a return here?

> }
> open(my $fh, '<', $info->unpacked($file))
> or fail "cannot open $file: $!";
> # …
> }
> 
>> It really looks like a implementation of Text::ParseWords's
>> shellwords[3].  If so, we can get that entire sub as a oneliner (we
>> already use Text::ParseWords elsewhere).
> I switched to shellwords. We can always rever to the code we’ve had
> before, but in my tests, shellwords works fine.
> 

Appreciated.

> Find the new files attached.
> 


~Niels


-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/516064aa.6050...@thykier.net



X: package-contains-broken-symlink question

2013-04-06 Thread Felix Natter
hi,

I am currently fixing a warning in the freeplane package,
and am wondering whether this lintian feature works correctly.

X: freeplane: package-contains-broken-symlink
usr/share/freeplane/framework.jar ../knopflerfish/framework.jar

(corresponds to this line in debian/freeplane.links:
usr/share/knopflerfish/framework.jar usr/share/freeplane/framework.jar)

However:

$ dpkg -S /usr/share/knopflerfish/framework.jar 
libknopflerfish-osgi-framework-java: /usr/share/knopflerfish/framework.jar

and from debian/control:

Build-Depends-Indep: javahelp2, groovy, libcommons-lang-java,
libcommons-io-java, libjgoodies-forms-java, simplyhtml (>=0.16.07),
libbatik-java, librhino-java, libfop-java, libxerces2-java,
libxml-commons-external-java, libjaxp1.3-java, libjlatexmath-java,
libknopflerfish-osgi-framework-java, libjsyntaxpane-java (>=0.9.6~r156)

Depends: ${misc:Depends}, default-jre | sun-java6-jre, javahelp2,
groovy, libcommons-lang-java, libcommons-io-java,
libjgoodies-forms-java, simplyhtml (>=0.16.07), libbatik-java,
librhino-java, libfop-java, libxerces2-java,
libxml-commons-external-java, libjaxp1.3-java, libjlatexmath-java,
libknopflerfish-osgi-framework-java, libjsyntaxpane-java (>=0.9.6~r156),
libjortho-freeplane-java (= ${binary:Version})

=> libknopflerfish-osgi-framework-java is a direct dependency.

Could the problem be that /usr/share/knopflerfish/framework.jar is a
symlink itself?

The freeplane package repo is here:
  http://anonscm.debian.org/gitweb/?p=pkg-java/freeplane.git

Please CC: me on replies, I am not subscribed to lintian-maint.

Thanks and Best Regards,
-- 
Felix Natter


-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87li8vfs2i@bitburger.home.felix



Re: Stanford IDG internal Perl style

2013-04-06 Thread Russ Allbery
Niels Thykier  writes:
> On 2013-03-29 18:24, Russ Allbery wrote:

>> * For loading configuration files, use Config::Any in most situations.
>> Some older files use AppConfig, but Config::Any is the current
>> standard.

> How do you get errors from Config::Any?  Documentation has nothing about
> it AFAICT and the implementation just returns an empty listref on error.

Oh, hm.  Indeed, it only returns errors when you use file name extensions
to map unambiguously to a particular configuration syntax.  It looks like
we mostly don't handle errors.  I'll ask about that.

-- 
Russ Allbery (r...@debian.org)   


-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87a9pbh8x0@windlord.stanford.edu



Bug#704197: Please review: systemd checks

2013-04-06 Thread Michael Stapelberg
Hi Niels,

Niels Thykier  writes:
>> sub check_init_script {
>> my ($pkg, $info, $file) = @_;
>> 
>> my $lsb_source_seen;
>> my $path = $info->index ($file);
>> fail "$file is neither a regular file nor a resolvable symlink"
>> unless ($path->is_regular_file || defined($path->link_resolved));
>> open(my $fh, '<', $info->unpacked($file))
>> or fail "cannot open $file: $!";
>> 
>> # …
>> }
>> 
>> Does that seem alright to you?
>> 
>
> Almost; it definitely plugs the issues I mentioned.  That said, I
> believe we prefer to emit tags instead of erroring out when we see an
> unexpected file type (e.g. see control-file-is-not-a-file).
>   Secondly, there is a bug in that link_resolved is only applicable to
> links.  So if it is not a regular file and not a link, the code will
> croak in $path->link_resolved[2].
Okay, so how about this?

sub check_init_script {
my ($pkg, $info, $file) = @_;

my $lsb_source_seen;
my $path = $info->index ($file);
unless ($path->is_regular_file ||
($path->is_symlink && defined($path->link_resolved))) {
tag 'init-script-is-not-a-file', $file;
}
open(my $fh, '<', $info->unpacked($file))
or fail "cannot open $file: $!";
# …
}

> It really looks like a implementation of Text::ParseWords's
> shellwords[3].  If so, we can get that entire sub as a oneliner (we
> already use Text::ParseWords elsewhere).
I switched to shellwords. We can always rever to the code we’ve had
before, but in my tests, shellwords works fine.

Find the new files attached.

-- 
Best regards,
Michael


systemd
Description: Binary data


systemd.desc
Description: Binary data


Re: Stanford IDG internal Perl style

2013-04-06 Thread Niels Thykier
On 2013-03-29 18:24, Russ Allbery wrote:
> * For loading configuration files, use Config::Any in most situations.
> Some older files use AppConfig, but Config::Any is the current
> standard.

How do you get errors from Config::Any?  Documentation has nothing about
it AFAICT and the implementation just returns an empty listref on error.

~Niels



-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/51602bc6.2070...@thykier.net