[arch-projects] [ABS] [PATCH 2/6] vcs prototypes: consistent $PWD after checkout

Linus Arver linusarver at gmail.com
Wed Nov 2 20:50:12 EDT 2011


Before, some vcs prototypes (bzr, git, hg, svn) cd'ed into the repo
directory after a checkout, but not on an initial clone. The cvs/darcs
prototypes made it uniform by always going into the repo after the
checkout, whether on an initial clone or an update.

With this change, we make all vcs prototypes simply not remain in the
repo directory after a checkout (whether initial clone or update). Of
course, the other alternative is to always remain in the repo directory
after a checkout, but in principal one rarely needs to do work inside
the checked-out directory after a pull/update, so this way is better.

Signed-off-by: Linus Arver <linusarver at gmail.com>
---
 prototypes/PKGBUILD-bzr.proto   |    1 +
 prototypes/PKGBUILD-cvs.proto   |    2 +-
 prototypes/PKGBUILD-darcs.proto |    2 +-
 prototypes/PKGBUILD-git.proto   |    1 +
 prototypes/PKGBUILD-hg.proto    |    1 +
 prototypes/PKGBUILD-svn.proto   |    1 +
 6 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/prototypes/PKGBUILD-bzr.proto b/prototypes/PKGBUILD-bzr.proto
index fca5f36..629525a 100644
--- a/prototypes/PKGBUILD-bzr.proto
+++ b/prototypes/PKGBUILD-bzr.proto
@@ -37,6 +37,7 @@ build() {
   if [[ -d "$_bzrmod" ]]; then
     cd "$_bzrmod" && bzr --no-plugins pull "$_bzrtrunk" -r "$pkgver"
     msg "The local files are updated."
+    cd ..
   else
     bzr --no-plugins branch "$_bzrtrunk" "$_bzrmod" -q -r "$pkgver"
   fi
diff --git a/prototypes/PKGBUILD-cvs.proto b/prototypes/PKGBUILD-cvs.proto
index 997373d..cc0d86f 100644
--- a/prototypes/PKGBUILD-cvs.proto
+++ b/prototypes/PKGBUILD-cvs.proto
@@ -37,9 +37,9 @@ build() {
   if [[ -d "$_cvsmod/CVS" ]]; then
     cd "$_cvsmod"
     cvs -z3 update -d
+    cd ..
   else
     cvs -z3 -d "$_cvsroot" co -D "$pkgver" -f "$_cvsmod"
-    cd "$_cvsmod"
   fi
 
   msg "CVS checkout done or server timeout"
diff --git a/prototypes/PKGBUILD-darcs.proto b/prototypes/PKGBUILD-darcs.proto
index cbeef29..1687306 100644
--- a/prototypes/PKGBUILD-darcs.proto
+++ b/prototypes/PKGBUILD-darcs.proto
@@ -38,10 +38,10 @@ build() {
     msg "Retrieving missing patches"
     cd "$_darcsmod"
     darcs pull -a "$_darcstrunk/$_darcsmod"
+    cd ..
   else
     msg "Retrieving complete sources"
     darcs get --partial --set-scripts-executable "$_darcstrunk/$_darcsmod"
-    cd "$_darcsmod"
   fi
 
   rm -rf "$srcdir/$_darcsmod-build"
diff --git a/prototypes/PKGBUILD-git.proto b/prototypes/PKGBUILD-git.proto
index 7ece6f3..17c2ce6 100644
--- a/prototypes/PKGBUILD-git.proto
+++ b/prototypes/PKGBUILD-git.proto
@@ -37,6 +37,7 @@ build() {
   if [[ -d "$_gitname" ]]; then
     cd "$_gitname" && git pull origin
     msg "The local files are updated."
+    cd ..
   else
     git clone "$_gitroot" "$_gitname"
   fi
diff --git a/prototypes/PKGBUILD-hg.proto b/prototypes/PKGBUILD-hg.proto
index df9abd5..1c3e8f2 100644
--- a/prototypes/PKGBUILD-hg.proto
+++ b/prototypes/PKGBUILD-hg.proto
@@ -38,6 +38,7 @@ build() {
     cd "$_hgrepo"
     hg pull -u
     msg "The local files are updated."
+    cd ..
   else
     hg clone "$_hgroot" "$_hgrepo"
   fi
diff --git a/prototypes/PKGBUILD-svn.proto b/prototypes/PKGBUILD-svn.proto
index f103c78..9fba37f 100644
--- a/prototypes/PKGBUILD-svn.proto
+++ b/prototypes/PKGBUILD-svn.proto
@@ -36,6 +36,7 @@ build() {
 
   if [[ -d "$_svnmod/.svn" ]]; then
     (cd "$_svnmod" && svn up -r "$pkgver")
+    cd ..
   else
     svn co "$_svntrunk" --config-dir ./ -r "$pkgver" "$_svnmod"
   fi
-- 
1.7.7.1



More information about the arch-projects mailing list