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

Linus Arver linusarver at gmail.com
Wed Nov 2 23:13:01 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 1134d62..f47844b 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 7727064..a5a9fd1 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 b077246..008526d 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 ea55126..4e6a42e 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 1d3d56f..ada253b 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 b4534e7..33599c1 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.2



More information about the arch-projects mailing list