Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bundle.bbclass): simplify varflag usage #290

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions classes-recipe/bundle.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -252,37 +252,37 @@ def write_manifest(d):

if imgtype == 'image':
if slotflags and 'file' in slotflags:
imgsource = d.getVarFlag('RAUC_SLOT_%s' % slot, 'file')
imgsource = slotflags.get('file')
else:
imgsource = "%s-%s.rootfs.%s" % (d.getVar('RAUC_SLOT_%s' % slot), machine, img_fstype)
imgname = imgsource
elif imgtype == 'kernel':
# TODO: Add image type support
if slotflags and 'file' in slotflags:
imgsource = d.getVarFlag('RAUC_SLOT_%s' % slot, 'file')
imgsource = slotflags.get('file')
else:
imgsource = "%s-%s.bin" % ("zImage", machine)
imgname = "%s.%s" % (imgsource, "img")
elif imgtype == 'boot':
if slotflags and 'file' in slotflags:
imgsource = d.getVarFlag('RAUC_SLOT_%s' % slot, 'file')
imgsource = slotflags.get('file')
else:
imgsource = "%s" % ("barebox.img")
imgname = imgsource
elif imgtype == 'file':
if slotflags and 'file' in slotflags:
imgsource = d.getVarFlag('RAUC_SLOT_%s' % slot, 'file')
imgsource = slotflags.get('file')
else:
bb.fatal('Unknown file for slot: %s' % slot)
imgname = "%s.%s" % (imgsource, "img")
else:
bb.fatal('Unknown image type: %s' % imgtype)

if slotflags and 'rename' in slotflags:
imgname = d.getVarFlag('RAUC_SLOT_%s' % slot, 'rename')
imgname = slotflags.get('rename')
if slotflags and 'offset' in slotflags:
padding = 'seek'
imgoffset = d.getVarFlag('RAUC_SLOT_%s' % slot, 'offset')
imgoffset = slotflags.get('offset')
if imgoffset:
sign, magnitude = imgoffset[:1], imgoffset[1:]
if sign == '+':
Expand All @@ -300,9 +300,9 @@ def write_manifest(d):
if slotflags and 'hooks' in slotflags:
if not have_hookfile:
bb.warn("A hook is defined for slot %s, but RAUC_BUNDLE_HOOKS[file] is not defined" % slot)
manifest.write("hooks=%s\n" % d.getVarFlag('RAUC_SLOT_%s' % slot, 'hooks'))
manifest.write("hooks=%s\n" % slotflags.get('hooks'))
if slotflags and 'adaptive' in slotflags:
manifest.write("adaptive=%s\n" % d.getVarFlag('RAUC_SLOT_%s' % slot, 'adaptive'))
manifest.write("adaptive=%s\n" % slotflags.get('adaptive'))
manifest.write("\n")

bundle_imgpath = "%s/%s" % (bundle_path, imgname)
Expand All @@ -327,8 +327,7 @@ def write_manifest(d):

for meta_section in (d.getVar('RAUC_META_SECTIONS') or "").split():
manifest.write("[meta.%s]\n" % meta_section)
for meta_key in d.getVarFlags('RAUC_META_%s' % meta_section):
meta_value = d.getVarFlag('RAUC_META_%s' % meta_section, meta_key)
for meta_key, meta_value in d.getVarFlags('RAUC_META_%s' % meta_section).items():
manifest.write("%s=%s\n" % (meta_key, meta_value))
manifest.write("\n");

Expand Down
Loading