diff options
author | Matthieu Crapet <Matthieu.Crapet@ingenico.com> | 2014-03-12 10:15:26 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-12 06:04:53 -0700 |
commit | 9a928c5f122e1e6fe3b0a420d62217e7b4f4bc74 (patch) | |
tree | bef089d6543459af5aad8dcc2dcccba3855b71ce /scripts/oe-setup-builddir | |
parent | 9104a32196405a4bf5312eccdc0d4a207f8bf9f1 (diff) | |
download | poky-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-x | scripts/oe-setup-builddir | 47 |
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 | ||
26 | mkdir -p $BUILDDIR/conf | 26 | mkdir -p $BUILDDIR/conf |
27 | 27 | ||
28 | if ! (test -d "$BUILDDIR"); then | 28 | if [ ! -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 |
31 | fi | 31 | fi |
32 | 32 | ||
33 | if ! (test -w "$BUILDDIR"); then | 33 | if [ ! -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 |
36 | fi | 36 | fi |
37 | 37 | ||
38 | cd "$BUILDDIR" | 38 | cd "$BUILDDIR" |
39 | 39 | ||
40 | if (test -f "$BUILDDIR/conf/templateconf.cfg") then | 40 | if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then |
41 | TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg) | 41 | TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg) |
42 | fi | 42 | fi |
43 | 43 | ||
44 | source $OEROOT/.templateconf | 44 | . $OEROOT/.templateconf |
45 | 45 | ||
46 | if ! (test -f "$BUILDDIR/conf/templateconf.cfg") then | 46 | if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then |
47 | echo "$TEMPLATECONF" >$BUILDDIR/conf/templateconf.cfg | 47 | echo "$TEMPLATECONF" >$BUILDDIR/conf/templateconf.cfg |
48 | fi | 48 | fi |
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 | # |
53 | if [ "x" != "x$TEMPLATECONF" ]; then | 53 | if [ -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" |
67 | fi | 67 | fi |
68 | 68 | ||
69 | if [ "x" = "x$OECORELOCALCONF" ]; then | 69 | if [ -z "$OECORELOCALCONF" ]; then |
70 | OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample" | 70 | OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample" |
71 | fi | 71 | fi |
72 | if ! (test -r "$BUILDDIR/conf/local.conf"); then | 72 | if [ ! -r "$BUILDDIR/conf/local.conf" ]; then |
73 | cat <<EOM | 73 | cat <<EOM |
74 | You had no conf/local.conf file. This configuration file has therefore been | 74 | You had no conf/local.conf file. This configuration file has therefore been |
75 | created for you with some default values. You may wish to edit it to use a | 75 | created 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 |
89 | fi | 89 | fi |
90 | 90 | ||
91 | if [ "x" = "x$OECORELAYERCONF" ]; then | 91 | if [ -z "$OECORELAYERCONF" ]; then |
92 | OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample" | 92 | OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample" |
93 | fi | 93 | fi |
94 | if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then | 94 | if [ ! -r "$BUILDDIR/conf/bblayers.conf" ]; then |
95 | cat <<EOM | 95 | cat <<EOM |
96 | You had no conf/bblayers.conf file. The configuration file has been created for | 96 | You had no conf/bblayers.conf file. The configuration file has been created for |
97 | you with some default values. To add additional metadata layers into your | 97 | you with some default values. To add additional metadata layers into your |
98 | configuration please add entries to this file. | 98 | configuration 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 | ||
116 | fi | 117 | fi |
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 | |||
126 | You can now run 'bitbake <target>' | 127 | You can now run 'bitbake <target>' |
127 | 128 | ||
128 | EOM | 129 | EOM |
129 | if [ "x" = "x$OECORENOTESCONF" ]; then | 130 | if [ -z "$OECORENOTESCONF" ]; then |
130 | OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt" | 131 | OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt" |
131 | fi | 132 | fi |
132 | [ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF | 133 | [ ! -r "$OECORENOTESCONF" ] || cat $OECORENOTESCONF |