[pacman-dev] [PATCH v2 6/6] pacsearch: pattern arguments work as for pacman

Andrew Gregory andrew.gregory.8 at gmail.com
Thu Feb 6 21:27:16 EST 2014


On 02/05/14 at 04:25pm, Pierre Neidhardt wrote:
> On 14-02-05 09:51:17, Andrew Gregory wrote:
> > On 02/04/14 at 12:16am, Pierre Neidhardt wrote:
> > >  	# We grab the following fields: repo, name, ver, group, installed, and
> > >  	# desc. We grab leading space for 'group' and 'installed' so that we do not
> > >  	# need to test if non-empty when printing.
> > > -	my @pkgfields = /^(.*?)\/(.*?) (.*?)( \(.*?\))?( \[.*\])?\n(.*)$/s;
> > > +	my @pkgfields = /^(.*?)\/(.*?) (.*?)( \(.*?\))?( \[.*\])?$/s;
> > > +	my $desc = <$syncout>;
> > 
> > The description needs to be read after the check for a regex match,
> > otherwise that line will just be lost on failures.
> 
> Actually this is done on purpose. If we do not read 'desc' right now, on failure
> the next line will be that description which will be parsed as if it were a
> 'repo/pkgname pkgver ...' line.
> 
> I am getting you wrong on this?

Right now pacsearch prints any line it can't parse.  If you read an
extra line for the description before you check for a regex match,
that line will simply be lost.

> > >  	if(not @pkgfields) {
> > >  		# skip any non-matching line and just print it for the user
> > >  		print $_, "\n";
> > 
> > This newline needs to be removed.
> 
> Right, forgot that. Thought I cannot find a case when that happens.


More information about the pacman-dev mailing list