Patchwork [1/1] oe-setup-builddir: remove unreachable code, update comments

login
register
mail settings
Submitter Darren Hart
Date May 24, 2011, 10:31 p.m.
Message ID <d65327722591ceae682f08ff28cae38f4d32267d.1306276122.git.dvhart@linux.intel.com>
Download mbox | patch
Permalink /patch/4711/
State New, archived
Headers show

Comments

Darren Hart - May 24, 2011, 10:31 p.m.
From: Darren Hart <dvhart@linux.intel.com>

The script forces TEMPLATECONF to be non-empty with:

    TEMPLATECONF=${TEMPLATECONF:-meta-yocto/conf}

This ensures that OELOCALCONF and OELAYERSCONF will be non-empty as well. Remove
all the empty checks for these variables.

While this patch doesn't change behavior, all this code was unreachable, it does
bring up a point of intent. It appears as though OE*CONF was intended to be
configurable by the user via the environment, the code only allows for the user
to set TEMPLATECONF. This means that in order to use something other than the
sample default configs, the user must specify both a local.conf.sample and a
bblayers.conf.sample in their TEMPLATECONF directory.

Update the comments to correctly identify the required files as local.conf.sample
and bblayers.conf.sample.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
---
 scripts/create-pull-request |    2 +-
 scripts/oe-setup-builddir   |   32 +++++++++++++-------------------
 2 files changed, 14 insertions(+), 20 deletions(-)
Darren Hart - May 24, 2011, 10:35 p.m.
On 05/24/2011 03:31 PM, Darren Hart wrote:
> From: Darren Hart <dvhart@linux.intel.com>
> 
> The script forces TEMPLATECONF to be non-empty with:
> 
>     TEMPLATECONF=${TEMPLATECONF:-meta-yocto/conf}
> 
> This ensures that OELOCALCONF and OELAYERSCONF will be non-empty as well. Remove
> all the empty checks for these variables.
> 
> While this patch doesn't change behavior, all this code was unreachable, it does
> bring up a point of intent. It appears as though OE*CONF was intended to be
> configurable by the user via the environment, the code only allows for the user
> to set TEMPLATECONF. This means that in order to use something other than the
> sample default configs, the user must specify both a local.conf.sample and a
> bblayers.conf.sample in their TEMPLATECONF directory.
> 
> Update the comments to correctly identify the required files as local.conf.sample
> and bblayers.conf.sample.
> 
> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
> ---
>  scripts/create-pull-request |    2 +-
>  scripts/oe-setup-builddir   |   32 +++++++++++++-------------------
>  2 files changed, 14 insertions(+), 20 deletions(-)
> 
> diff --git a/scripts/create-pull-request b/scripts/create-pull-request
> index b808146..169b888 100755
> --- a/scripts/create-pull-request
> +++ b/scripts/create-pull-request
> @@ -24,7 +24,7 @@
>  # submission to Open Embedded and The Yocto Project, as well as to
>  # related projects and layers.
>  #
> -
> +set -x


EEEK, sorry about that. I've removed this and re-pushed to the same
contrib/dvhart/build branch. The only file changed is
scripts/oe-setup-builddir.

Apologies.

Patch

diff --git a/scripts/create-pull-request b/scripts/create-pull-request
index b808146..169b888 100755
--- a/scripts/create-pull-request
+++ b/scripts/create-pull-request
@@ -24,7 +24,7 @@ 
 # submission to Open Embedded and The Yocto Project, as well as to
 # related projects and layers.
 #
-
+set -x
 ODIR=pull-$$
 RELATIVE_TO="master"
 COMMIT_ID="HEAD"
diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index 5fc8b19..6c2e837 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -37,29 +37,26 @@  fi
 
 cd "$BUILDDIR"
 
-TEMPLATECONF=${TEMPLATECONF:-meta-yocto/conf}
 
 # 
-# $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
+# $TEMPLATECONF can point to a directory for the template local.conf &
+# bblayers.conf. If the user hasn't specified a path, default to
+# meta-yocto/conf.
 #
-if [ "x" != "x$TEMPLATECONF" ]; then
+TEMPLATECONF=${TEMPLATECONF:-meta-yocto/conf}
+if ! (test -d "$TEMPLATECONF"); then
+    # Allow TEMPLATECONF=meta-xyz/conf as a shortcut
+    if [ -d "$OEROOT/$TEMPLATECONF" ]; then
+        TEMPLATECONF="$OEROOT/$TEMPLATECONF"
+    fi
     if ! (test -d "$TEMPLATECONF"); then
-	# Allow TEMPLATECONF=meta-xyz/conf as a shortcut
-	if [ -d "$OEROOT/$TEMPLATECONF" ]; then
-	    TEMPLATECONF="$OEROOT/$TEMPLATECONF"
-	fi
-	if ! (test -d "$TEMPLATECONF"); then
-	    echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf"
-	    return
-	fi
+        echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf.sample & bblayers.conf.sample"
+        return
     fi
-    OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
-    OECORELOCALCONF="$TEMPLATECONF/local.conf.sample"
 fi
+OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
+OECORELOCALCONF="$TEMPLATECONF/local.conf.sample"
 
-if [ "x" = "x$OECORELOCALCONF" ]; then
-    OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample"
-fi
 if ! (test -r "$BUILDDIR/conf/local.conf"); then
 cat <<EOM
 You had no conf/local.conf file. This configuration file has therefore been
@@ -79,9 +76,6 @@  EOM
     cp -f $OECORELOCALCONF $BUILDDIR/conf/local.conf
 fi
 
-if [ "x" = "x$OECORELAYERCONF" ]; then
-    OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
-fi
 if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then
 cat <<EOM
 You had no conf/bblayers.conf file. The configuration file has been created for