From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v2] devtool: Fix build-sdk when pn doesn't match filename
Date: Mon, 2 May 2016 13:34:00 +1200 [thread overview]
Message-ID: <1462152840-20223-1-git-send-email-paul.eggleton@linux.intel.com> (raw)
In-Reply-To: <58ebd32dbca98fa81cadf2bf91649beb7bb51210.1462147930.git.randy.e.witt@linux.intel.com>
From: Randy Witt <randy.e.witt@linux.intel.com>
If an image with the filename foo.bb could be built using the name "bar"
instead, then build-sdk would fail to create the derivative sdk.
This was because the code assumed that the file name matched the target,
which is not necessarily the case.
Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
Changes since v1:
* Ignore bbappend not existing when attempting to delete it, since
that will be the case if devtool build-sdk is run a second time
* Call config.write() so setting gets written out at the right time
* Use os.path.splitext() rather than rsplit() - no difference in
operation but if there's a function to do this we should use it
scripts/devtool | 3 +++
scripts/lib/devtool/build_image.py | 24 +++++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/scripts/devtool b/scripts/devtool
index 4780390..f090427 100755
--- a/scripts/devtool
+++ b/scripts/devtool
@@ -86,6 +86,9 @@ class ConfigHandler(object):
with open(self.config_file, 'w') as f:
self.config_obj.write(f)
+ def set(self, section, option, value):
+ self.config_obj.set(section, option, value)
+
class Context:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
diff --git a/scripts/lib/devtool/build_image.py b/scripts/lib/devtool/build_image.py
index e51d766..1e5d09b 100644
--- a/scripts/lib/devtool/build_image.py
+++ b/scripts/lib/devtool/build_image.py
@@ -18,6 +18,7 @@
"""Devtool plugin containing the build-image subcommand."""
import os
+import errno
import logging
from bb.process import ExecutionError
@@ -72,13 +73,17 @@ def build_image(args, config, basepath, workspace):
return result
def build_image_task(config, basepath, workspace, image, add_packages=None, task=None, extra_append=None):
- appendfile = os.path.join(config.workspace_path, 'appends',
- '%s.bbappend' % image)
-
# remove <image>.bbappend to make sure setup_tinfoil doesn't
# break because of it
- if os.path.isfile(appendfile):
- os.unlink(appendfile)
+ target_basename = config.get('SDK', 'target_basename', '')
+ if target_basename:
+ appendfile = os.path.join(config.workspace_path, 'appends',
+ '%s.bbappend' % target_basename)
+ try:
+ os.unlink(appendfile)
+ except OSError as exc:
+ if exc.errno != errno.ENOENT:
+ raise
tinfoil = setup_tinfoil(basepath=basepath)
rd = parse_recipe(config, tinfoil, image, True)
@@ -88,6 +93,15 @@ def build_image_task(config, basepath, workspace, image, add_packages=None, task
if not bb.data.inherits_class('image', rd):
raise TargetNotImageError()
+ # Get the actual filename used and strip the .bb and full path
+ target_basename = rd.getVar('FILE', True)
+ target_basename = os.path.splitext(os.path.basename(target_basename))[0]
+ config.set('SDK', 'target_basename', target_basename)
+ config.write()
+
+ appendfile = os.path.join(config.workspace_path, 'appends',
+ '%s.bbappend' % target_basename)
+
outputdir = None
try:
if workspace or add_packages:
--
2.5.5
next prev parent reply other threads:[~2016-05-02 1:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 0:13 [PATCH 0/2] extensible sdk fixes Randy Witt
2016-05-02 0:13 ` [PATCH 1/2] populate_sdk_ext: Change lockedsigs task mismatch to a warning Randy Witt
2016-05-02 0:13 ` [PATCH 2/2] devtool: Fix build-sdk when pn doesn't match filename Randy Witt
2016-05-02 1:34 ` Paul Eggleton [this message]
2016-05-09 22:46 ` [PATCH v3] " Paul Eggleton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462152840-20223-1-git-send-email-paul.eggleton@linux.intel.com \
--to=paul.eggleton@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.