summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/devtool')
-rw-r--r--scripts/lib/devtool/standard.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index af0d467985..34de7bd623 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1104,6 +1104,15 @@ def _remove_file_entries(srcuri, filelist):
1104 break 1104 break
1105 return entries, remaining 1105 return entries, remaining
1106 1106
1107def _replace_srcuri_entry(srcuri, filename, newentry):
1108 """Replace entry corresponding to specified file with a new entry"""
1109 basename = os.path.basename(filename)
1110 for i in range(len(srcuri)):
1111 if os.path.basename(srcuri[i].split(';')[0]) == basename:
1112 srcuri.pop(i)
1113 srcuri.insert(i, newentry)
1114 break
1115
1107def _remove_source_files(append, files, destpath): 1116def _remove_source_files(append, files, destpath):
1108 """Unlink existing patch files""" 1117 """Unlink existing patch files"""
1109 for path in files: 1118 for path in files:
@@ -1424,6 +1433,10 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
1424 raise DevtoolError('Unable to find initial revision - please specify ' 1433 raise DevtoolError('Unable to find initial revision - please specify '
1425 'it with --initial-rev') 1434 'it with --initial-rev')
1426 1435
1436 dl_dir = rd.getVar('DL_DIR', True)
1437 if not dl_dir.endswith('/'):
1438 dl_dir += '/'
1439
1427 tempdir = tempfile.mkdtemp(prefix='devtool') 1440 tempdir = tempfile.mkdtemp(prefix='devtool')
1428 try: 1441 try:
1429 local_files_dir = tempfile.mkdtemp(dir=tempdir) 1442 local_files_dir = tempfile.mkdtemp(dir=tempdir)
@@ -1468,6 +1481,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
1468 logger.info('No patches or local source files needed updating') 1481 logger.info('No patches or local source files needed updating')
1469 else: 1482 else:
1470 # Update existing files 1483 # Update existing files
1484 files_dir = _determine_files_dir(rd)
1471 for basepath, path in upd_f.items(): 1485 for basepath, path in upd_f.items():
1472 logger.info('Updating file %s' % basepath) 1486 logger.info('Updating file %s' % basepath)
1473 if os.path.isabs(basepath): 1487 if os.path.isabs(basepath):
@@ -1479,11 +1493,19 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
1479 updatefiles = True 1493 updatefiles = True
1480 for basepath, path in upd_p.items(): 1494 for basepath, path in upd_p.items():
1481 patchfn = os.path.join(patches_dir, basepath) 1495 patchfn = os.path.join(patches_dir, basepath)
1482 logger.info('Updating patch %s' % basepath) 1496 if os.path.dirname(path) + '/' == dl_dir:
1497 # This is a a downloaded patch file - we now need to
1498 # replace the entry in SRC_URI with our local version
1499 logger.info('Replacing remote patch %s with updated local version' % basepath)
1500 path = os.path.join(files_dir, basepath)
1501 _replace_srcuri_entry(srcuri, basepath, 'file://%s' % basepath)
1502 updaterecipe = True
1503 else:
1504 logger.info('Updating patch %s' % basepath)
1505 logger.debug('Moving new patch %s to %s' % (patchfn, path))
1483 _move_file(patchfn, path) 1506 _move_file(patchfn, path)
1484 updatefiles = True 1507 updatefiles = True
1485 # Add any new files 1508 # Add any new files
1486 files_dir = _determine_files_dir(rd)
1487 for basepath, path in new_f.items(): 1509 for basepath, path in new_f.items():
1488 logger.info('Adding new file %s' % basepath) 1510 logger.info('Adding new file %s' % basepath)
1489 _move_file(os.path.join(local_files_dir, basepath), 1511 _move_file(os.path.join(local_files_dir, basepath),