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

Linus Arver linusarver at gmail.com
Thu Nov 3 22:41:49 EDT 2011


On Thu, Nov 03, 2011 at 07:51:44AM -0500, Jesse Young wrote:
> On Wed, 2 Nov 2011 20:14:30 -0700
> Linus Arver <linusarver at gmail.com> 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. Since commit
> > 0e79802c0ac8453376d8c0f99629f5a3b499f571 in pacman includes "shopt -s
> > extglob" in pacman/scripts/makepkg.sh.in, we can use the simple
> > "!(foo)" syntax.
> > 
> > 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 that I
> > am aware of.
> 
> Not as nice as not copying the files in the first place, but you
> could do
> $ find "$_svnmod-build" -type d -name .svn -exec rm -rf {} \;
> For these recursive structures
> 

Thanks, I'll incorporate your one-liner solution in this patch to make
it more comprehensive.

> Another option, and I'm only familiar with how git does it, is to
> $ scm export | tar -xvf -
> or similar to only copy the latest commit to the build directory.
> 

I've done some googling and it looks like you meant to say

$ git archive master | tar -x -C /somewhere/else

(http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export).

I still think the solution using plain `cp' is better because it's far
simpler and results in an identical file structure (the root .git/ is
excluded, but .gitignore files are still there). Plus you don't need to
supply the branch/commit/tree name.

> All this being said, why do we need a separate build directory? It
> should be easy to do a "distclean" with most SCMs (eg. git clean) to
> get a pristine working directory.
> 
> Jesse

Well one reason off the top of my head is if you need to apply a local
patch (e.g., projects like lilypond still use python2 but just have
`python' in their scripts, so you need to do a fairly invasive change).
Once you do that, your working tree is dirty and you won't be able to
pull from upstream without doing a "git reset --hard". (git-clean
removes untracked files, which will prevent repackaging (e.g., your
compiled binary will be deleted)).

But I guess it depends. If you're just pulling in vanilla upstream, then
a temp build directory makes no sense. As far as git is concerned, since
the compiled binaries/docs/etc will not be tracked, it will happily pull
in the later commits even if your directory has lots of stray files. So
no problem there.

I guess there should be 2 versions to choose from in the PKGBUILD ---
one with and one without a temp build directory. I'll make it so that
both are commented out, and leave the PKGBUILD author to shape it to
their needs. Since this patch series is getting a bit tedious, I'll just
do the git prototype for now (I'm not knowledgeable enough in the other
VCSs anyway...).

-Linus


More information about the arch-projects mailing list