[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RFC: New Upload Procedure



Christian Schwarz wrote:
> 
> On 26 Nov 1997, Martin Mitchell wrote:
> 
> > Thus I suggest:
> >
> >       /fixes:\s*\(bug\)?\#\d+\(,\s*\(bug\)?\#\d+\)*/i
> >
> > ie match 'bug' 0 or 1 times, but require #.
> 
> Relaxing the syntax has been suggested by a few people right now (in
> private mail to me).
> 
> In the previous discussion on debian-private some said that relaxing
> the syntax is a bad idea since there might be cases where the script
> closes a bug accidentially.
> 
> It would be good to hear more opinions on this.

To avoid accidental unwanted closing of bugs we must choose a syntax
that is "isolated" from the normal wording, but not necessarily a clumsy
one.

To provide "isolation" I would suggest to put the "thing" around
mandatory parenthesis, the verb "closes:" (the semicolon breaks a
sentence) and the # attached to the bugnumber.
I will relax syntax on the case, on the word "bug" and on all the
spaces, tabs and newlines.
I prefere "closes:" versus "fixes:".

In this syntax the constraints will be:
- all included in round parenthesis (). Blanks allowed around them.
- "closes:" mandatory w/o blanks between the word and the semicolon.
- "#1234" pound sign mandatory w/o blanks between it and the number.
- in case of another bugnumber, the mandatory coma must be attached 
  to the previous number, w/o blanks.
- the "bug" word is facultative; if present must be between the
  semicolon (or the coma) and the pound sign. Blanks allowed all around.

Here is a full perl script that implement this syntax; pipe a .changes
file through this and you'll get the buugnumbers on the output, one by
line:

#!/usr/bin/perl -000n
my $j, $m;
while ( m{\(\s*closes:\s*([\d\s,bug#\n]*)\)}gi ) {
        $m = $1;
        while ( $m =~ m{,?\s*(?:bug)?\s*\#(\d+)\s*}gi ) {
                for ( $j=1; defined ${$j}; $j++ ) { print ${$j},"\n"; }
        }
}

If this seems complex, it isn't. The first while extracts all inside the
parenthesis after the "closes:"; the second while extracts each single
bugnumber and the for prints each number found.
(people puzzled by (?: should note that this makes grouping without
recording in a positional parameter $1, $2 etc.)


Fabrizio
-- 
| fpolacco@icenet.fi    fpolacco@debian.org    fpolacco@pluto.linux.it
| Pluto Leader - Debian Developer & Happy Debian 1.3.1 User - vi-holic
| 6F7267F5 fingerprint 57 16 C4 ED C9 86 40 7B 1A 69 A1 66 EC FB D2 5E
> Just because Red Hat do it doesn't mean it's a good idea. [Ian J.]



--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: