[arch-projects] [ABS] [PATCH v3 4/7] git prototype: remove temp build directory

Linus Arver linusarver at gmail.com
Wed Nov 9 00:56:46 EST 2011


Git comes with commands that are specifically designed to return the
working directory to a "pristine" state. We make use of these commands
to avoid the expensive operation of creating a temporary build
directory.

Having a single directory to pull in upstream code and build from
greatly simplifies the code, and as a bonus, saves disk space/time!

Signed-off-by: Linus Arver <linusarver at gmail.com>
---
 prototypes/PKGBUILD-git.proto |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/prototypes/PKGBUILD-git.proto b/prototypes/PKGBUILD-git.proto
index 7d9bb90..a2f2f40 100644
--- a/prototypes/PKGBUILD-git.proto
+++ b/prototypes/PKGBUILD-git.proto
@@ -35,20 +35,19 @@ build() {
   msg "Connecting to $_gitroot ..."
 
   if [[ -d "$_gitname" ]]; then
-    cd "$_gitname" && git pull origin
+    cd "$_gitname"
+    git clean -dxf
+    git reset --hard
+    git pull origin
     msg "The local files are updated."
-    cd ..
   else
     git clone --depth 1 "$_gitroot" "$_gitname"
+    cd "$_gitname"
   fi
 
   msg "GIT checkout done or connection timeout"
   msg "Starting build..."
 
-  rm -rf "$srcdir/$_gitname-build"
-  git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
-  cd "$srcdir/$_gitname-build"
-
   #
   # BUILD HERE
   #
@@ -58,7 +57,7 @@ build() {
 }
 
 package() {
-  cd "$srcdir/$_gitname-build"
+  cd "$srcdir/$_gitname"
   make DESTDIR="$pkgdir/" install
 }
 
-- 
1.7.7.2



More information about the arch-projects mailing list