mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
RRS: fixup handling of upgrades where recipe moved to inc
Sometimes in the past it has been desirable to create a shared .inc file from a recipe, e.g. d5a95dc8985a42bb7e50bc4e7dc6b012d711ff08 in OE-Core for tzdata. Git detects this type of change as a rename of the .bb to a .inc with some changes, and an addition of a new .bb with new content; however we want to treat it as a change to the .bb file and ignore the .inc, otherwise it can look like the recipe was renamed and the history becomes broken (it wasn't, the recipe name stayed the same). Detect this situation and handle it properly. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
3deb6f1416
commit
c058850578
|
@ -234,6 +234,7 @@ def _get_recipes_filenames(ct, repo, repodir, layersubdir_start, logger):
|
|||
ct_files = []
|
||||
deleted = []
|
||||
moved_files = []
|
||||
added_files = []
|
||||
|
||||
incdirs = []
|
||||
commitobj = repo.commit(ct)
|
||||
|
@ -254,7 +255,12 @@ def _get_recipes_filenames(ct, repo, repodir, layersubdir_start, logger):
|
|||
continue
|
||||
|
||||
if typename == 'recipe':
|
||||
(to_typename, _, _) = recipeparse.detect_file_type(diffitem.b_path,
|
||||
layersubdir_start)
|
||||
if to_typename == 'recipe':
|
||||
ct_files.append(os.path.join(repodir, diffitem.b_path))
|
||||
if diffitem.a_path is None or diffitem.new_file:
|
||||
added_files.append(diffitem.b_path)
|
||||
if diffitem.a_path != diffitem.b_path:
|
||||
moved_files.append((diffitem.a_path, diffitem.b_path))
|
||||
elif typename == 'incfile':
|
||||
|
@ -268,6 +274,16 @@ def _get_recipes_filenames(ct, repo, repodir, layersubdir_start, logger):
|
|||
if not f in ct_files:
|
||||
ct_files.append(f)
|
||||
|
||||
# Check moves for recipe -> inc with an added recipe
|
||||
# (i.e. the move should really be to the newly added recipe)
|
||||
# example: d5a95dc8985a42bb7e50bc4e7dc6b012d711ff08 in OE-Core
|
||||
for i,(a,b) in enumerate(moved_files):
|
||||
if b.endswith('.inc'):
|
||||
for af in added_files:
|
||||
# This is naive, but good enough
|
||||
if af.rsplit('_')[0] == a.rsplit('_')[0]:
|
||||
moved_files[i] = (a,af)
|
||||
|
||||
return ct_files, deleted, moved_files
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user