|
...
|
...
|
@@ -302,20 +302,31 @@ sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install `cat $FILES/pips/*`
|
|
302
|
302
|
# be owned by the installation user, we create the directory and change the
|
|
303
|
303
|
# ownership to the proper user.
|
|
304
|
304
|
function git_clone {
|
|
305
|
|
- # if there is an existing checkout, move it out of the way
|
|
306
|
|
- if [[ "$RECLONE" == "yes" ]]; then
|
|
307
|
|
- # FIXME(ja): if we were smarter we could speed up RECLONE by
|
|
308
|
|
- # using the old git repo as the basis of our new clone...
|
|
309
|
|
- if [ -d $2 ]; then
|
|
310
|
|
- mv $2 /tmp/stack.`date +%s`
|
|
311
|
|
- fi
|
|
312
|
|
- fi
|
|
313
|
305
|
|
|
314
|
|
- if [ ! -d $2 ]; then
|
|
315
|
|
- git clone $1 $2
|
|
|
306
|
+ GIT_REMOTE=$1
|
|
|
307
|
+ GIT_DEST=$2
|
|
|
308
|
+ GIT_BRANCH=$3
|
|
|
309
|
+
|
|
|
310
|
+ # do a full clone only if the directory doesn't exist
|
|
|
311
|
+ if [ ! -d $GIT_DEST ]; then
|
|
|
312
|
+ git clone $GIT_REMOTE $GIT_DEST
|
|
316
|
313
|
cd $2
|
|
317
|
314
|
# This checkout syntax works for both branches and tags
|
|
318
|
|
- git checkout $3
|
|
|
315
|
+ git checkout $GIT_BRANCH
|
|
|
316
|
+ elif [[ "$RECLONE" == "yes" ]]; then
|
|
|
317
|
+ # if it does exist then simulate what clone does if asked to RECLONE
|
|
|
318
|
+ cd $GIT_DEST
|
|
|
319
|
+ # set the url to pull from and fetch
|
|
|
320
|
+ git remote set-url origin $GIT_REMOTE
|
|
|
321
|
+ git fetch origin
|
|
|
322
|
+ # remove the existing ignored files (like pyc) as they cause breakage
|
|
|
323
|
+ # (due to the py files having older timestamps than our pyc, so python
|
|
|
324
|
+ # thinks the pyc files are correct using them)
|
|
|
325
|
+ sudo git clean -f -d
|
|
|
326
|
+ git checkout -f origin/$GIT_BRANCH
|
|
|
327
|
+ # a local branch might not exist
|
|
|
328
|
+ git branch -D $GIT_BRANCH || true
|
|
|
329
|
+ git checkout -b $GIT_BRANCH
|
|
319
|
330
|
fi
|
|
320
|
331
|
}
|
|
321
|
332
|
|