summaryrefslogtreecommitdiffstats
path: root/scripts/oe-setup-builddir
diff options
context:
space:
mode:
authorMatthieu Crapet <Matthieu.Crapet@ingenico.com>2014-03-12 10:15:26 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-12 06:04:53 -0700
commit9a928c5f122e1e6fe3b0a420d62217e7b4f4bc74 (patch)
treebef089d6543459af5aad8dcc2dcccba3855b71ce /scripts/oe-setup-builddir
parent9104a32196405a4bf5312eccdc0d4a207f8bf9f1 (diff)
downloadpoky-9a928c5f122e1e6fe3b0a420d62217e7b4f4bc74.tar.gz
oe-setup-builddir: small rework
Changes: - drop useless subshell creation in test: if ! (test -r "$BUILDDIR/conf/local.conf"); then$ - replace "source" builtin by "." (bashsism) - fix indentation 4 spaces (drop some tabs too) - fix return => exit (return is not allowed in main) - drop "sed -i" (doesn't exist in BSD sed) - for homogeneity, always use [ ] (instead of test) - replace old [ "x" = "x$VAR" ] by [ -z "$VAR" ] (From OE-Core rev: 3a116577446f02bda0ef4e035360293ff73c9eef) Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oe-setup-builddir')
-rwxr-xr-xscripts/oe-setup-builddir47
1 files changed, 24 insertions, 23 deletions
diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index e4356f1551..c91e079512 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -25,51 +25,51 @@ fi
25 25
26mkdir -p $BUILDDIR/conf 26mkdir -p $BUILDDIR/conf
27 27
28if ! (test -d "$BUILDDIR"); then 28if [ ! -d "$BUILDDIR" ]; then
29 echo >&2 "Error: The builddir ($BUILDDIR) does not exist!" 29 echo >&2 "Error: The builddir ($BUILDDIR) does not exist!"
30 exit 1 30 exit 1
31fi 31fi
32 32
33if ! (test -w "$BUILDDIR"); then 33if [ ! -w "$BUILDDIR" ]; then
34 echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build" 34 echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build"
35 exit 1 35 exit 1
36fi 36fi
37 37
38cd "$BUILDDIR" 38cd "$BUILDDIR"
39 39
40if (test -f "$BUILDDIR/conf/templateconf.cfg") then 40if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then
41 TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg) 41 TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg)
42fi 42fi
43 43
44source $OEROOT/.templateconf 44. $OEROOT/.templateconf
45 45
46if ! (test -f "$BUILDDIR/conf/templateconf.cfg") then 46if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then
47 echo "$TEMPLATECONF" >$BUILDDIR/conf/templateconf.cfg 47 echo "$TEMPLATECONF" >$BUILDDIR/conf/templateconf.cfg
48fi 48fi
49 49
50# 50#
51# $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf 51# $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
52# 52#
53if [ "x" != "x$TEMPLATECONF" ]; then 53if [ -n "$TEMPLATECONF" ]; then
54 if ! (test -d "$TEMPLATECONF"); then 54 if [ ! -d "$TEMPLATECONF" ]; then
55 # Allow TEMPLATECONF=meta-xyz/conf as a shortcut 55 # Allow TEMPLATECONF=meta-xyz/conf as a shortcut
56 if [ -d "$OEROOT/$TEMPLATECONF" ]; then 56 if [ -d "$OEROOT/$TEMPLATECONF" ]; then
57 TEMPLATECONF="$OEROOT/$TEMPLATECONF" 57 TEMPLATECONF="$OEROOT/$TEMPLATECONF"
58 fi 58 fi
59 if ! (test -d "$TEMPLATECONF"); then 59 if [ ! -d "$TEMPLATECONF" ]; then
60 echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf" 60 echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf"
61 return 61 exit 1
62 fi 62 fi
63 fi 63 fi
64 OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample" 64 OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
65 OECORELOCALCONF="$TEMPLATECONF/local.conf.sample" 65 OECORELOCALCONF="$TEMPLATECONF/local.conf.sample"
66 OECORENOTESCONF="$TEMPLATECONF/conf-notes.txt" 66 OECORENOTESCONF="$TEMPLATECONF/conf-notes.txt"
67fi 67fi
68 68
69if [ "x" = "x$OECORELOCALCONF" ]; then 69if [ -z "$OECORELOCALCONF" ]; then
70 OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample" 70 OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample"
71fi 71fi
72if ! (test -r "$BUILDDIR/conf/local.conf"); then 72if [ ! -r "$BUILDDIR/conf/local.conf" ]; then
73cat <<EOM 73cat <<EOM
74You had no conf/local.conf file. This configuration file has therefore been 74You had no conf/local.conf file. This configuration file has therefore been
75created for you with some default values. You may wish to edit it to use a 75created for you with some default values. You may wish to edit it to use a
@@ -88,11 +88,11 @@ EOM
88 cp -f $OECORELOCALCONF $BUILDDIR/conf/local.conf 88 cp -f $OECORELOCALCONF $BUILDDIR/conf/local.conf
89fi 89fi
90 90
91if [ "x" = "x$OECORELAYERCONF" ]; then 91if [ -z "$OECORELAYERCONF" ]; then
92 OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample" 92 OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
93fi 93fi
94if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then 94if [ ! -r "$BUILDDIR/conf/bblayers.conf" ]; then
95cat <<EOM 95 cat <<EOM
96You had no conf/bblayers.conf file. The configuration file has been created for 96You had no conf/bblayers.conf file. The configuration file has been created for
97you with some default values. To add additional metadata layers into your 97you with some default values. To add additional metadata layers into your
98configuration please add entries to this file. 98configuration please add entries to this file.
@@ -109,10 +109,11 @@ EOM
109 109
110 # Put the abosolute path to the layers in bblayers.conf so we can run 110 # Put the abosolute path to the layers in bblayers.conf so we can run
111 # bitbake without the init script after the first run 111 # bitbake without the init script after the first run
112 sed "s|##OEROOT##|$OEROOT|g" $OECORELAYERCONF > $BUILDDIR/conf/bblayers.conf
113 # ##COREBASE## is deprecated as it's meaning was inconsistent, but continue 112 # ##COREBASE## is deprecated as it's meaning was inconsistent, but continue
114 # to replace it for compatibility. 113 # to replace it for compatibility.
115 sed -i -e "s|##COREBASE##|$OEROOT|g" $BUILDDIR/conf/bblayers.conf 114 sed -e "s|##OEROOT##|$OEROOT|g" \
115 -e "s|##COREBASE##|$OEROOT|g" \
116 $OECORELAYERCONF > $BUILDDIR/conf/bblayers.conf
116fi 117fi
117 118
118# Prevent disturbing a new GIT clone in same console 119# Prevent disturbing a new GIT clone in same console
@@ -126,7 +127,7 @@ cat <<EOM
126You can now run 'bitbake <target>' 127You can now run 'bitbake <target>'
127 128
128EOM 129EOM
129if [ "x" = "x$OECORENOTESCONF" ]; then 130if [ -z "$OECORENOTESCONF" ]; then
130 OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt" 131 OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt"
131fi 132fi
132[ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF 133[ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF