On Thu, May 01, 2008 at 09:45:34PM +0200, Mathieu Parent wrote: > The files add checks for the proposal: > http://wiki.debian.org/Proposals/CopyrightFormat
That specification seems to be still very volatile, from what I can see from the changelog. > # control-file -- lintian check script -*- perl -*- > # > # Copyright (C) 2004 Marc Brockschmidt ? > # Check that every file in the tree has a license > my $command = 'cd unpacked && find . -type f -a -not \( -false'; > foreach my $section (@data) { > next if not $section->{files}; > #patterns are comma separated > #TODO: manage quoted strings with comma in it > $command .= ' -o -path ./'.join(' -o -path ./', split > m/,\s/, $section->{files}); > > } > $command .= ' \) ; cd .. '; > my $files_without_copyright = `$command`; > if ($files_without_copyright) { > foreach my $file (split '\n', $files_without_copyright) > { > tag 'debian-copyright-file-without-copyright', > $file; > } > } Hmm, there must be a better way to check that. I'm pretty sure we have a list of files already available somewhere in the lintian working directory. (If we haven't, we should) > # Check that every pattern match something > foreach my $section (@data) { > #next section if this is not a files section > next if not $section->{files}; > #files are comma separated > #TODO: manage quoted strings (with comma in it) > my @patterns = split m/,\s/, $section->{files} ; > foreach my $pattern (@patterns) { > if (not `ls -l && cd unpacked && find . -type f > -a -path $pattern ; cd ..`) { > tag > 'debian-copyright-section-without-match', $pattern ; > } > } > } > } Same here. > Tag: debian-copyright-unknown-field > Type: warning > Info: The package contains a copyright file that as an unknown field. Typo s/as/has/ > Tag: debian-copyright-file-without-copyright > Type: warning > Info: The package contains a copyright file that does match the specified > file. ? That makes no sense. > Tag: debian-copyright-section-without-match > Type: warning > Info: The package contains a copyright file which has a section which does > match any file. s/does/doesn't/ maybe? > # pgp sig? -> skip until end of signature > elsif (m/^-----BEGIN PGP SIGNATURE/) { > while (<$COPYRIGHT>) { > $line_number++; > last if m/^-----END PGP SIGNATURE/o; > } > } > # other pgp control? -> skip until the next blank line > elsif (m/^-----BEGIN PGP/) { > while (<$COPYRIGHT>) { > $line_number++; > last if /^\s*$/o; > } > } Since when can copyright files contain signatures? > # new field? > elsif (m/^(\S+):\s*(.*)$/o) { > my ($tag,$value) = (lc $1,$2); > #format-specification, files and notice always start a section > if($tag =~ /format-specification|files|notice/i) { You already make an lc on $tag, no need to make all the regexes case-insensitive. > # not used So why is it included? > sub _ensure_file_is_sane { Please use the one from Util.pm > my ($file) = @_; > > # if file exists and is not 0 bytes > if (-f $file and -s $file) { > return 1; > } > return 0; > } > > # ------------------------ > > sub fail { Please use the one from Util.pm > my $str = "internal error"; > if (@_) { > $str .= ": ".join( "\n", @_)."\n"; > } elsif ($!) { > $str .= ": $!\n"; > } else { > $str .= ".\n"; > } > $! = 2; # set return code outside eval() > die $str; Gruesse, -- Frank Lichtenheld <[EMAIL PROTECTED]> www: http://www.djpig.de/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]