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

Linus Arver linusarver at gmail.com
Wed Nov 2 23:14:30 EDT 2011


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.

Signed-off-by: Linus Arver <linusarver at gmail.com>
---
 prototypes/PKGBUILD-bzr.proto   |    3 ++-
 prototypes/PKGBUILD-darcs.proto |    3 ++-
 prototypes/PKGBUILD-git.proto   |    3 ++-
 prototypes/PKGBUILD-hg.proto    |    3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/prototypes/PKGBUILD-bzr.proto b/prototypes/PKGBUILD-bzr.proto
index 6f36205..cbfda0c 100644
--- a/prototypes/PKGBUILD-bzr.proto
+++ b/prototypes/PKGBUILD-bzr.proto
@@ -46,7 +46,8 @@ build() {
   msg "Starting build..."
 
   rm -rf "$_bzrmod-build"
-  cp -r "$_bzrmod" "$_bzrmod-build"
+  mkdir "$_bzrmod-build"
+  cp -a "$_bzrmod"/!(.bzr) "$_bzrmod-build"
   cd "$_bzrmod-build"
 
   #
diff --git a/prototypes/PKGBUILD-darcs.proto b/prototypes/PKGBUILD-darcs.proto
index 7fbc1cb..5c261ab 100644
--- a/prototypes/PKGBUILD-darcs.proto
+++ b/prototypes/PKGBUILD-darcs.proto
@@ -44,7 +44,8 @@ build() {
   fi
 
   rm -rf "$_darcsmod-build"
-  cp -r "$_darcsmod" "$_darcsmod-build"
+  mkdir "$_darcsmod-build"
+  cp -a "$_darcsmod"/!(_darcs) "$_darcsmod-build"
   cd "$_darcsmod-build"
 
   msg "Starting build..."
diff --git a/prototypes/PKGBUILD-git.proto b/prototypes/PKGBUILD-git.proto
index 08ed0f2..54c93dc 100644
--- a/prototypes/PKGBUILD-git.proto
+++ b/prototypes/PKGBUILD-git.proto
@@ -46,7 +46,8 @@ build() {
   msg "Starting build..."
 
   rm -rf "$_gitname-build"
-  git clone "$_gitname" "$_gitname-build"
+  mkdir "$_gitname-build"
+  cp -a "$_gitname"/!(.git) "$_gitname-build"
   cd "$_gitname-build"
 
   #
diff --git a/prototypes/PKGBUILD-hg.proto b/prototypes/PKGBUILD-hg.proto
index 10b2cd1..bf83286 100644
--- a/prototypes/PKGBUILD-hg.proto
+++ b/prototypes/PKGBUILD-hg.proto
@@ -46,7 +46,8 @@ build() {
   msg "Starting build..."
 
   rm -rf "$_hgrepo-build"
-  cp -r "$_hgrepo" "$_hgrepo-build"
+  mkdir "$_hgrepo-build"
+  cp -a "$_hgrepo"/!(.hg) "$_hgrepo-build"
   cd "$_hgrepo-build"
 
   #
-- 
1.7.7.2



More information about the arch-projects mailing list