Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ad8ac9b7d10c6e61b8e719e7685e801a3a5b70e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash

# Utility script to get "ebuilder"

BUILD_DIR=$1
EBUILDER_HASH=$2


if [[ -z "${BUILD_DIR}" ]]
then
  echo "BUILD_DIR not supplied, will assume current directory, for testing."
  BUILD_DIR=${PWD}
else
  # normally will exist by now, but if not, we'll create it.
  if [[ ! -d "${BUILD_DIR}" ]]
  then
    echo "WARNING: BUILD_DIR did not exist, so created it: $BUILD_DIR."
    mkdir -p $BUILD_DIR
  fi
fi

if [[ -z "${EBUILDER_HASH}" ]]
then
  echo "EBUILDER HASH, BRANCH, or TAG was not supplied, assuming 'master'"
  EBUILDER_HASH=master
fi

EBUILDER=eclipse.platform.releng.aggregator

RC=0
# don't clone, if already exists.
if [[ ! -d ${BUILD_DIR}/${EBUILDER} ]]
then
  # Not sure 'REPO_AND_ACCESS' is defined in all possible scenerios, so we'll provide a default.
  # It is in main scenerios, but not sure about things like "re-running unit tests at a later time".
  # If directory doesn't exist yet, create it first, so we can assign proper access
  # permissions for later "clean up" routines.
  mkdir -p "${BUILD_DIR}/${EBUILDER}"
  chmod -c g+ws "${BUILD_DIR}/${EBUILDER}"
  git clone ${REPO_AND_ACCESS:-git://git.eclipse.org/gitroot}/platform/${EBUILDER} ${BUILD_DIR}/${EBUILDER}
  RC=$?
  if [[ $RC != 0 ]]
  then
    echo "[ERROR] Cloning EBUILDER returned non zero return code: $RC"
    exit $RC
  fi
else
  echo "INFO: ebuilder directory found to exist. Not re-cloneing."
  echo "INFO:    Found: ${BUILD_DIR}/${EBUILDER}"
  echo "INFO:    But fetching to make sure up to date,"
  echo "INFO:    before checking out specific HASH (which may make it detached)."
  pushd ${BUILD_DIR}/${EBUILDER}
  git fetch
  RC=$?
  if [[ $RC != 0 ]]
  then
    echo "[ERROR] Fetch EBUILDER returned non zero return code: $RC"
    exit $RC
  fi
  git checkout $EBUILDER_HASH
  RC=$?
  if [[ $RC != 0 ]]
  then
    echo "[ERROR] Checking out EBUILDER for $EBUILDER_HASH returned non zero return code: $RC"
    exit $RC
  fi
  popd
fi

exit $RC

Back to the top