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

Pierre Neidhardt ambrevar at gmail.com
Wed Feb 5 10:25:37 EST 2014


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?

> >  	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.

-- 
Pierre Neidhardt

Generosity and perfection are your everlasting goals.


More information about the pacman-dev mailing list