Some vcs prototypes do cd repo && update while others do it like cd repo update to update an existing repo. It makes sense to have them all do it the second way, because makepkg runs with `/bin/bash -e` [1]. The manpage for bash(1) states regarding the "-e" option: "The shell does not exit if the command that fails is ... part of any command executed in a && or || list except the command following the final && or || ..." I.e., if "cd repo" fails in "cd repo && update", the shell will not exit! The second form avoids this pitfall and is slightly easier to read, especially for the longer "update" commands. Thanks to Sebastian Schwarz [2] and lolilolicon [3] for the pointers. Lastly, we also check for the (hidden) version control directory in the if-statement for consisteny. [1]: http://projects.archlinux.org/pacman.git/commit/?id=b69edc1c3532816576198995... [2]: http://mailman.archlinux.org/pipermail/arch-projects/2011-November/002096.ht... [3]: http://mailman.archlinux.org/pipermail/arch-projects/2011-November/002099.ht... Signed-off-by: Linus Arver <linusarver@gmail.com> --- prototypes/PKGBUILD-bzr.proto | 5 +++-- prototypes/PKGBUILD-git.proto | 2 +- prototypes/PKGBUILD-hg.proto | 2 +- prototypes/PKGBUILD-svn.proto | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/prototypes/PKGBUILD-bzr.proto b/prototypes/PKGBUILD-bzr.proto index 3f6d2e9..287486d 100644 --- a/prototypes/PKGBUILD-bzr.proto +++ b/prototypes/PKGBUILD-bzr.proto @@ -34,8 +34,9 @@ build() { cd "$srcdir" msg "Connecting to $_bzrtrunk ..." - if [[ -d "$_bzrmod" ]]; then - cd "$_bzrmod" && bzr --no-plugins pull "$_bzrtrunk" -r "$pkgver" + if [[ -d "$_bzrmod/.bzr" ]]; then + cd "$_bzrmod" + bzr --no-plugins pull "$_bzrtrunk" -r "$pkgver" msg "The local files are updated." cd .. else diff --git a/prototypes/PKGBUILD-git.proto b/prototypes/PKGBUILD-git.proto index a2f2f40..b8f5de7 100644 --- a/prototypes/PKGBUILD-git.proto +++ b/prototypes/PKGBUILD-git.proto @@ -34,7 +34,7 @@ build() { cd "$srcdir" msg "Connecting to $_gitroot ..." - if [[ -d "$_gitname" ]]; then + if [[ -d "$_gitname/.git" ]]; then cd "$_gitname" git clean -dxf git reset --hard diff --git a/prototypes/PKGBUILD-hg.proto b/prototypes/PKGBUILD-hg.proto index b6610fa..e2ddca1 100644 --- a/prototypes/PKGBUILD-hg.proto +++ b/prototypes/PKGBUILD-hg.proto @@ -34,7 +34,7 @@ build() { cd "$srcdir" msg "Connecting to $_hgroot ..." - if [[ -d "$_hgrepo" ]]; then + if [[ -d "$_hgrepo/.hg" ]]; then cd "$_hgrepo" hg pull -u msg "The local files are updated." diff --git a/prototypes/PKGBUILD-svn.proto b/prototypes/PKGBUILD-svn.proto index 4a4f6cb..42f7f60 100644 --- a/prototypes/PKGBUILD-svn.proto +++ b/prototypes/PKGBUILD-svn.proto @@ -35,7 +35,8 @@ build() { msg "Connecting to $_svntrunk ..." if [[ -d "$_svnmod/.svn" ]]; then - (cd "$_svnmod" && svn up -r "$pkgver") + cd "$_svnmod" + svn up -r "$pkgver" msg "The local files are updated." cd .. else -- 1.7.7.3