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

Attaching extra artifacts to bundle #53

Closed
wants to merge 1 commit into from
Closed

Attaching extra artifacts to bundle #53

wants to merge 1 commit into from

Conversation

ilkondr
Copy link
Contributor

@ilkondr ilkondr commented Sep 28, 2018

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

@ejoerns
Copy link
Member

ejoerns commented Sep 28, 2018

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?.

@ilkondr
Copy link
Contributor Author

ilkondr commented Sep 28, 2018

Unfortunately yes, this is tested on morty only at the moment.
I don't expect these changes in morty branch as it is not maintained (or is it?)

@ilkondr
Copy link
Contributor Author

ilkondr commented Sep 28, 2018

tested on the latest sumo and fixed [depends] flag handling

@yadutaf
Copy link

yadutaf commented Oct 24, 2018

Nice addition ! I can definitely find use cases for that 👍 . Would it be possible to support a space delimited list of files in RAUC_BUNDLE_EXTRA_* ? That would allow supporting recipes producing more than one artifact.

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)
Copy link

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...):

Suggested change
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.

Copy link
Contributor Author

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.

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'
Copy link

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'

Copy link
Contributor Author

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

@@ -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"
Copy link

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>
@ilkondr
Copy link
Contributor Author

ilkondr commented Mar 18, 2019

Added types 'artifact' which is default and 'source'.
Multiple files can now be listed in [files] flag.
Rebased on current master and force-pushed my changes.

@ejoerns
Copy link
Member

ejoerns commented Nov 21, 2019

FTR: I've proposed an alternative (more lightweight) implementation of extra artifact fetch in #102.

@ilkondr ilkondr closed this Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants