summaryrefslogtreecommitdiffstats
path: root/b2qt-init-build-env
diff options
context:
space:
mode:
Diffstat (limited to 'b2qt-init-build-env')
-rwxr-xr-xb2qt-init-build-env20
1 files changed, 19 insertions, 1 deletions
diff --git a/b2qt-init-build-env b/b2qt-init-build-env
index 1d598a5..ec9f394 100755
--- a/b2qt-init-build-env
+++ b/b2qt-init-build-env
@@ -24,7 +24,7 @@
24set -e 24set -e
25 25
26usage() { 26usage() {
27 echo "Usage: $0 <yocto build directory> [--force]" 27 echo "Usage: $0 <yocto build directory> [--force] [--reference <other build directory>]"
28} 28}
29 29
30while test -n "$1"; do 30while test -n "$1"; do
@@ -36,6 +36,10 @@ while test -n "$1"; do
36 "--force" | "-f") 36 "--force" | "-f")
37 FORCE_UPDATE=1 37 FORCE_UPDATE=1
38 ;; 38 ;;
39 "--reference" | "-r")
40 shift
41 REFDIR=$1
42 ;;
39 *) 43 *)
40 BUILDDIR=$1 44 BUILDDIR=$1
41 ;; 45 ;;
@@ -43,8 +47,16 @@ while test -n "$1"; do
43 shift 47 shift
44done 48done
45 49
50if [ -z "${BUILDDIR}" ]; then
51 usage
52 exit 1
53fi
54
46DIR=$(readlink -f $(dirname $0)) 55DIR=$(readlink -f $(dirname $0))
47BUILDDIR=$(readlink -f $BUILDDIR) 56BUILDDIR=$(readlink -f $BUILDDIR)
57if [ -n "${REFDIR}" ]; then
58 REFDIR=$(readlink -f ${REFDIR})
59fi
48 60
49checkout() { 61checkout() {
50 REPO=$1 62 REPO=$1
@@ -59,6 +71,12 @@ checkout() {
59 if [ ! -d ${BUILDDIR}/${REPODIR}/.git ]; then 71 if [ ! -d ${BUILDDIR}/${REPODIR}/.git ]; then
60 echo "Checking out ${REPODIR}" 72 echo "Checking out ${REPODIR}"
61 git init 73 git init
74 if [ -n "${REFDIR}" ]; then
75 REPOREFDIR=${REFDIR}/${REPODIR}/.git/objects
76 if [ -d ${REPOREFDIR} ]; then
77 echo ${REPOREFDIR} > .git/objects/info/alternates
78 fi
79 fi
62 git remote add origin ${REPO} -f 80 git remote add origin ${REPO} -f
63 git checkout ${REF} 81 git checkout ${REF}
64 git reset --hard ${SHA1} 82 git reset --hard ${SHA1}