From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 5/7] devtool: update-recipe: support replacing remote patches
Date: Thu, 10 Nov 2016 14:45:18 +1300 [thread overview]
Message-ID: <d773290fd743d15ea73086982be5b60236693cdd.1478742229.git.paul.eggleton@linux.intel.com> (raw)
In-Reply-To: <cover.1478742229.git.paul.eggleton@linux.intel.com>
In-Reply-To: <cover.1478742229.git.paul.eggleton@linux.intel.com>
If you have a patch remotely fetched in a recipe (e.g. from an http
server) that needs updating then add a local version and substitute the
entry in SRC_URI to point to it.
One can argue about how desirable it is to be modifying patches fetched
in this way, but then one can argue about how desirable it is to have
such patches in the recipe in the first place - and in any case if
devtool update-recipe is to correctly transfer changes to such patches
made in the git repository within the source tree to the recipe then
there isn't much choice but to do it this way.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
scripts/lib/devtool/standard.py | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index af0d467..34de7bd 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1104,6 +1104,15 @@ def _remove_file_entries(srcuri, filelist):
break
return entries, remaining
+def _replace_srcuri_entry(srcuri, filename, newentry):
+ """Replace entry corresponding to specified file with a new entry"""
+ basename = os.path.basename(filename)
+ for i in range(len(srcuri)):
+ if os.path.basename(srcuri[i].split(';')[0]) == basename:
+ srcuri.pop(i)
+ srcuri.insert(i, newentry)
+ break
+
def _remove_source_files(append, files, destpath):
"""Unlink existing patch files"""
for path in files:
@@ -1424,6 +1433,10 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
raise DevtoolError('Unable to find initial revision - please specify '
'it with --initial-rev')
+ dl_dir = rd.getVar('DL_DIR', True)
+ if not dl_dir.endswith('/'):
+ dl_dir += '/'
+
tempdir = tempfile.mkdtemp(prefix='devtool')
try:
local_files_dir = tempfile.mkdtemp(dir=tempdir)
@@ -1468,6 +1481,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
logger.info('No patches or local source files needed updating')
else:
# Update existing files
+ files_dir = _determine_files_dir(rd)
for basepath, path in upd_f.items():
logger.info('Updating file %s' % basepath)
if os.path.isabs(basepath):
@@ -1479,11 +1493,19 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
updatefiles = True
for basepath, path in upd_p.items():
patchfn = os.path.join(patches_dir, basepath)
- logger.info('Updating patch %s' % basepath)
+ if os.path.dirname(path) + '/' == dl_dir:
+ # This is a a downloaded patch file - we now need to
+ # replace the entry in SRC_URI with our local version
+ logger.info('Replacing remote patch %s with updated local version' % basepath)
+ path = os.path.join(files_dir, basepath)
+ _replace_srcuri_entry(srcuri, basepath, 'file://%s' % basepath)
+ updaterecipe = True
+ else:
+ logger.info('Updating patch %s' % basepath)
+ logger.debug('Moving new patch %s to %s' % (patchfn, path))
_move_file(patchfn, path)
updatefiles = True
# Add any new files
- files_dir = _determine_files_dir(rd)
for basepath, path in new_f.items():
logger.info('Adding new file %s' % basepath)
_move_file(os.path.join(local_files_dir, basepath),
--
2.5.5
next prev parent reply other threads:[~2016-11-10 1:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-10 1:45 [PATCH 0/7] A bunch of fixes for devtool update-recipe Paul Eggleton
2016-11-10 1:45 ` [PATCH 1/7] devtool: update-recipe: check output before treating it as a string Paul Eggleton
2016-11-10 1:45 ` [PATCH 2/7] oe-selftest: devtool: test update-recipe with only local files Paul Eggleton
2016-11-10 1:45 ` [PATCH 3/7] lib/oe/patch: fix handling of patches with no header Paul Eggleton
2016-11-10 1:45 ` [PATCH 4/7] devtool: update-recipe: fix handling of compressed local patches Paul Eggleton
2016-11-10 1:45 ` Paul Eggleton [this message]
2016-11-10 1:45 ` [PATCH 6/7] lib/oe/recipeutils: ignore archives by default in get_recipe_local_files() Paul Eggleton
2016-11-10 1:45 ` [PATCH 7/7] oe-selftest: devtool: test that updating a file with subdir= works 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=d773290fd743d15ea73086982be5b60236693cdd.1478742229.git.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox