-
Notifications
You must be signed in to change notification settings - Fork 90
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
Attaching extra artifacts to bundle #53
Conversation
First of all thanks for you contribution! Did you test this on morty only or also on current poky releases? Note that the two patches must be squashed for giving them a chance of being merged as they add and remove the same things. Is your intention to have them into morty branch, too?. |
Unfortunately yes, this is tested on morty only at the moment. |
tested on the latest sumo and fixed |
Nice addition ! I can definitely find use cases for that 👍 . Would it be possible to support a space delimited list of files in |
classes/bundle.bbclass
Outdated
bundle_extrapath = '%s/%s' % (bundle_path, extrafilename) | ||
shutil.copy(extrasrc, bundle_extrapath) | ||
st = os.stat(extrasrc) | ||
os.chmod(bundle_extrapath, st.st_mode | stat.S_IEXEC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be a good idea to raise an error when the extra type is not supported. Maybe something like (testing the Github suggestion feature at the same time...):
os.chmod(bundle_extrapath, st.st_mode | stat.S_IEXEC) | |
os.chmod(bundle_extrapath, st.st_mode | stat.S_IEXEC) | |
else: | |
bb.error("Unsupported extratype '%s' for RAUC_EXTRA_%s[file]" % (extratype, extra)) |
However, considering there is a single supported type for now, maybe the code to support multiple types could be removed ? Or do you plan to add more types in the near future ? For folders, one could probably detect it transparently without an extra flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I leave this code for supporting multiple types as I was not sure single type is enough for me.
Now I understand that this single type covers all my needs.
Maybe we should add something like "source" type that means extra atrifact is fetched via SRC_URI link.
Please feel free to suggest another types which you consider useful.
classes/bundle.bbclass
Outdated
extratype = extraflags.get('type') if extraflags and 'type' in extraflags else None | ||
if not extratype: | ||
bb.debug(1, "No type given for extra '%s', defaulting to 'file'" % extra) | ||
extratype = 'file' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 4 lines could probably be simplified into something like:
extratype = extraflags.get('type') if extraflags and 'type' in extraflags else 'file'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, but I'd like to leave this debug message in place. So this kind of "internal magic" will be traced to log file
classes/bundle.bbclass
Outdated
@@ -33,6 +33,10 @@ | |||
# RAUC_SLOT_dtb[type] ?= "file" | |||
# RAUC_SLOT_dtb[file] ?= "${MACHINE}-variant1.dtb" | |||
# | |||
# You can attach extra artifacts to your bundle as well | |||
# RAUC_BUNDLE_EXTRAS ?= "upgrade-hooks-recipe" | |||
# RAUC_BUNDLE_EXTRA_upgrade-hooks-recipe[file] ?= "upgrade-hooks.tar" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the "type" flag be documented here as well ? Not sure it is needed since only the "file" type is supported for now.
Signed-off-by: Ilya Kondrashkin <kondrashkin.ilya@gmail.com>
Added types 'artifact' which is default and 'source'. |
FTR: I've proposed an alternative (more lightweight) implementation of extra artifact fetch in #102. |
This patch implements ability to add extra artifacts to your bundle using recipe description (as it done for upgrade slots). These extra artifacts can be used as additional pre- and post-install logic providers or something else as/if you like