Hi Frank, Hi Rafael,

Frank Lichtenheld schrieb am Mon 21. Apr, 01:47 (+0200):
> On Mon, Apr 21, 2008 at 12:32:01AM +0200, Rafael Laboissiere wrote:
> > * Frank Lichtenheld <[EMAIL PROTECTED]> [2008-04-21 00:02]:
> > 
> > > On Sun, Apr 20, 2008 at 03:19:32PM +0200, Rafael Laboissiere wrote:
> > > > C-style comments in dpatch's patches/00list files are allowed (see, e.g.
> > > > "man dpatch" for an example).  However, lintian wrongly complains with 
> > > > dpatch-index-references-non-existant-patch for lines containing
> > > > "/* comment */".
> > > 
> > > To be exact everything is allowed that gets transformed by cpp into a
> > > valid list file. So we can either run it through cpp ourself (but
> > > with which architecture defines?) or define a subset of features we
> > > will accept.
> > 
> > What about using "dpatch list-all"?
> 
> If you take a look at the code you will see that this is just a very big
> cpp wrapper ;) The problem that the outcome of the test would depend on
> the architecture you run lintian on remains.

What do you think about this patch? It simply removes all C and C++
comments.

#v+
--- /usr/share/lintian/checks/patch-systems     2008-03-03 22:49:47.000000000 
+0100
+++ /tmp/lintian/checks/patch-systems   2008-05-18 18:45:35.305553295 +0200
@@ -58,11 +58,27 @@
                if (! -r "debfiles/patches/00list") {
                        tag "dpatch-build-dep-but-no-patch-list", $pkg;
                } else {
+                       my $list_uses_cpp = 0;
+                       if (open(OPTS, '<', "debfiles/patches/00options")) {
+                               while(<OPTS>) {
+                                       if (/DPATCH_OPTION_CPP=1/) {
+                                               $list_uses_cpp = 1;
+                                               last;
+                                       }
+                               }
+                               close(OPTS);
+                       }
                        if (open(IN, '<', "debfiles/patches/00list")) {
                                my @patches;
                                while(<IN>) {
                                        chomp;
-                                       next if (/^\#/); #ignore comments
+                                       next if (/^\#/); #ignore comments or 
CPP directive
+                                       s/\/\/.*// if ($list_uses_cpp); # 
remove C++ style comments
+                                       if ($list_uses_cpp && /\/\*/) {
+                                               # remove C style comments
+                                               $_ .= <IN> while($_ !~ /\*\//);
+                                               s/\/\*[^*]*\*\///;
+                                       }
                                        next if (/^\s*$/); #ignore blank lines
                                        push @patches, split(' ', $_);
                                }
#v-

Bye, Jörg.
-- 
Die NASA brauchte 12 Jahre um einen Kugelschreiber zu entwickeln, der
kopfüber, in der Schwerelosigkeit und unter Wasser schreiben kann.
Die Russen benutzten einfach einen Bleistift …

Attachment: signature.asc
Description: Digital signature http://en.wikipedia.org/wiki/OpenPGP

Reply via email to