[X2Go-Commits] [buildscripts] 17/26: bin/sbuild-deb-package: backport from bin/build-deb-package: copy prepare_workspace () body, as we now use another layout and cache the git dir again.

git-admin at x2go.org git-admin at x2go.org
Sun Nov 13 20:35:47 CET 2016


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository buildscripts.

commit 3bad0d42f0e5a8ca8dc30631840d0b39eec86ad0
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sun Nov 13 19:56:38 2016 +0100

    bin/sbuild-deb-package: backport from bin/build-deb-package: copy prepare_workspace () body, as we now use another layout and cache the git dir again.
---
 bin/sbuild-deb-package |   39 +++++++++++++++++++++++++++------------
 1 file changed, 27 insertions(+), 12 deletions(-)

diff --git a/bin/sbuild-deb-package b/bin/sbuild-deb-package
index 6eb3731..de52f6b 100755
--- a/bin/sbuild-deb-package
+++ b/bin/sbuild-deb-package
@@ -129,20 +129,35 @@ set_vars() {
 
 prepare_workspace() {
 	# make sure our local working copy is up to date...
-
-	my_DIST="$1"
-	my_CODENAME="$2"
-	my_WORKDIR="$(dirname ${PROJECT_DIR})"
-
-	cd ${my_WORKDIR}
-	if [ ! -d ${PROJECT}/.git ]; then
-		git clone "git://${GIT_HOSTNAME}/${PROJECT_PATH}.git"
-		cd "${PROJECT}"
-		git checkout --force "${CHECKOUT}" || git checkout --force -b "${CHECKOUT}"
-
-		GIT_OBJECT_ID="$(git rev-parse --verify HEAD)"
+	if [ -d "${PROJECT_DIR}/.git" ]; then
+		cd "${PROJECT_DIR}" && {
+			git reset --hard
+			git checkout --force "${CHECKOUT}" || git checkout --force -b "${CHECKOUT}"
+			git pull origin "${CHECKOUT}"
+			git fetch origin upstream:upstream || true
+			git fetch origin pristine-tar:pristine-tar || true
+			# and again, get the ${CHECKOUT} refspec in pure state
+			git reset --hard
+			git clean -df
+		} || {
+			echo "Unable to switch to project directory \"${PROJECT_DIR}\". Check the permissions." >&2
+			exit 1
+		}
+	else
+		cd "$(dirname "${PROJECT_DIR}")" && {
+			git clone "git://${GIT_HOSTNAME}/${PROJECT_PATH}.git"
+			cd "${PROJECT}"
+			git checkout --force "${CHECKOUT}" || git checkout --force -b "${CHECKOUT}"
+			git fetch origin upstream:upstream
+			git fetch origin pristine-tar:pristine-tar || true
+			git clean -df
+		} || {
+			echo "Unable to switch to project directory \"$(dirname "${PROJECT_DIR}")\". Does it exist? Check the permissions." >&2
+			exit 1
+		}
 	fi
 
+	GIT_OBJECT_ID="$(git rev-parse --verify HEAD)"
 	cd "${PROJECT_DIR}"
 
 	# extract Debian source package name from debian/changelog

--
Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git


More information about the x2go-commits mailing list