[arch-projects] [ABS] [PATCH 5/6] vcs prototypes: more efficient temp build directories

Linus Arver linusarver at gmail.com
Wed Nov 2 22:35:40 EDT 2011


On Wed, Nov 02, 2011 at 10:21:04PM -0400, Dave Reisner wrote:
> On Wed, Nov 02, 2011 at 07:13:48PM -0700, Linus Arver wrote:
> > On Wed, Nov 02, 2011 at 09:03:37PM -0400, Dave Reisner wrote:
> > > On Wed, Nov 02, 2011 at 05:52:37PM -0700, Linus Arver wrote:
> > > > The bzr, darcs, git, and hg version control systems use a single
> > > > internal folder at the root to store all VCS-related data (commits,
> > > > history, etc.). This folder can get quite large (hundreds of MiB) for
> > > > big projects and continues to grow as the project lives on.
> > > > 
> > > > We exclude this folder when creating a temporary build directory to save
> > > > time and space.
> > > > 
> > > > CVS and SVN pollute the source repo with "CVS" and ".svn" directories
> > > > recursively for every single directory, so there is no simple one-liner
> > > > solution to exclude the VCS data for these systems.
> > > > 
> > > > Signed-off-by: Linus Arver <linusarver at gmail.com>
> > > > ---
> > > >  prototypes/PKGBUILD-bzr.proto   |    6 ++++--
> > > >  prototypes/PKGBUILD-darcs.proto |    6 ++++--
> > > >  prototypes/PKGBUILD-git.proto   |    6 ++++--
> > > >  prototypes/PKGBUILD-hg.proto    |    6 ++++--
> > > >  4 files changed, 16 insertions(+), 8 deletions(-)
> > > > 
> > > > diff --git a/prototypes/PKGBUILD-bzr.proto b/prototypes/PKGBUILD-bzr.proto
> > > > index a01eea8..ef7187d 100644
> > > > --- a/prototypes/PKGBUILD-bzr.proto
> > > > +++ b/prototypes/PKGBUILD-bzr.proto
> > > > @@ -47,8 +47,10 @@ build() {
> > > >    msg "Starting build..."
> > > >  
> > > >    rm -rf "$_bzrmod-build"
> > > > -  cp -r "$_bzrmod" "$_bzrmod-build"
> > > > -  cd "$_bzrmod-build"
> > > > +  mkdir $_bzrmod-build
> > > > +  cd $_bzrmod
> > > > +  ls -A | grep -v .bzr | xargs -d '\n' cp -r -t ../"$_bzrmod-build"
> > > 
> > > Oh hell no. We are not parsing ls here. This can be done without the
> > > need for grep and findutils as well, e.g.
> > > 
> > >   mkdir "$_bzrmod-build"
> > >   cp -a "$_bzrmod"/!(.bzr) "$_bzrmod-build"
> > > 
> > > Note the proper quoting here, too, that you've stripped.
> > 
> > Hmm, I just did some tests, but the "!(.bzr)" syntax that you used gives
> > me a parse error.
> 
> Yes, it's a syntax error when extglob isn't enabled. We provide this by
> default in makepkg, so PKGBUILDs will inherit it.

Strange -- the test I did was from inside a PKGBUILD (and I just did a
"pacman --Syu" an hour ago).

Perhaps there's a bug in pacman/scripts/makepkg.sh.in. I skimmed the
code in there and there's a bit of shell option wizardry going on at
different points.

I guess I'll file a bug report for pacman... Meanwhile, I'll use the
"!(foo)" syntax, which is certainly cleaner and much more elegant.


More information about the arch-projects mailing list