Skip to contentSkip to conversation

a few questions on the proper use of TEMPLATECONF

DISCUSSION Robert P. J. Day 1 participant 2 messages Aug 4, 2014

lore
Share & tools
lore
#0 lore raw

first time perusing all that templateconf stuff, so some admittedly
simple questions.

i'm looking at oe-setup-builddir, which is where the initialization
of the new build dir is done, so let's start at the top:

if [ -z "$BUILDDIR" ]; then
echo >&2 "Error: The build directory (BUILDDIR) must be set!" exit 1
fi

mkdir -p $BUILDDIR/conf

if [ ! -d "$BUILDDIR" ]; then
echo >&2 "Error: The builddir ($BUILDDIR) does not exist!" exit 1
fi

if [ ! -w "$BUILDDIR" ]; then
echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build" exit 1
fi

cd "$BUILDDIR"

so, at that point, i have either a new project, or i've simply reset my working environment into an existing project. so far, so good. the next few lines are just a bit puzzling:

  if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then
    TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg)
  fi

. $OEROOT/.templateconf

could that not have been written with an "else" clause?

  if [ -f "$BUILDDIR/conf/templateconf.cfg" ]; then
    TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg)
  else
    . $OEROOT/.templateconf
  fi

after all, if you have an existing templateconf.cfg and use that to set TEMPLATECONF, what is the point of subsequently sourcing the OEROOT .templateconf file, which will simply realize it's been set and do nothing? (yes, i realize it doesn't hurt, but i firmly believe in not invoking code that clearly has no value -- it's just confusing for people who want to RTFS. :-)

next, i assume that while it's natural to put overriding conf files
in a layer/conf file, they can be placed anywhere, correct?

also, there appear to be a few typos in that script. here:

echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf"

i assume those names should be local.conf.sample and
bblayers.conf.sample, yes? and a couple other minor typos in comments.

thoughts?

rday

p.s. oh, one more observation. at the end of oe-setup-builddir:

if [ -z "$OECORENOTESCONF" ]; then
OECORENOTESCONF="$OEROOT/meta/conf/conf-notes.txt"
fi

given that poky uses "meta-yocto/conf" as the default basis for the sample files, why is this code explicitly using "meta/conf"? i notice that there are two files with that name under the poky checkout:

[poky]$ find . -name conf-notes.txt
./meta-yocto/conf/conf-notes.txt
./meta/conf/conf-notes.txt
$

do you really want to mixing those references? yes, the files appear
to be identical, but it's still potentially confusing.

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw

short followup to my earlier post ... it seems like
oe-setup-builddir doesn't do a whole lot of input validation. for fun, i tried to define a new project using /tmp for TEMPLATECONF, knowing there was nothing valid there to be used as sample files, and here's what i got (in part):

cp: cannot stat ‘/tmp/local.conf.sample’: No such file or directory You had no conf/bblayers.conf file. The configuration file has been created for
you with some default values. To add additional metadata layers into your
configuration please add entries to this file.

The Yocto Project has extensive documentation about OE including a reference manual
which can be found at:
http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:
http://www.openembedded.org/

sed: can't read /tmp/bblayers.conf.sample: No such file or directory

in the end, despite the obviously fatal errors, i got a new build
directory with no local.conf, and an empty bblayers.conf. that doesn't really match what the error messages were telling me above.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================