[pacman-dev] [PATCH v2] makepkg: print filenames and line numbers of references to $srcdir & $pkgdir in built package

Ivy Foster ivy.foster at gmail.com
Sat Oct 15 18:00:21 UTC 2016


On 15 Oct 2016, at  6:52 pm +1000, Allan McRae wrote:
> On 15/10/16 12:27, Ivy Foster wrote:
> > On 14 Oct 2016, at 10:07 pm -0400, Andrew Gregory wrote:
> >> On 10/14/16 at 08:21pm, ivy.foster at gmail.com wrote:
> >>> From: Ivy Foster <ivy.foster at gmail.com>
> >  > +		mapfile -t refs < <(find "$pkgdir" -type f -exec grep -n "${!var}" {} +)
> > 
> >> For packages with just a single file this won't print the name of the
> >> matching file.  GNU grep has -H for this, but it's not POSIX.  What
> >> about including /dev/null as an argument to grep so that it always has
> >> more than one file?
> > 
> > Ah, you're quite right. I'll fiddle with that and resubmit tomorrow, then.
> > 
> 
> Why no use -l?
> 
> -l, --files-with-matches  print only names of FILEs containing matches

I can do that instead, if you prefer. Personally, I wanted to use -n
rather than -l, because it matches the format of compiler warnings
(for ease of opening directly to the right line in your editor). Using
-l would have the benefit of being less verbose, I suppose.

Ivy


More information about the pacman-dev mailing list