-
Notifications
You must be signed in to change notification settings - Fork 60
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
Fix snapcraft.yaml
to properly use stage-packages
#137
Conversation
Codecov Report
@@ Coverage Diff @@
## main #137 +/- ##
=======================================
Coverage 88.71% 88.71%
=======================================
Files 11 11
Lines 2383 2383
=======================================
Hits 2114 2114
Misses 265 265
Partials 4 4 |
Required to pickup the germinate stage-package Signed-off-by: Dilyn Corner <[email protected]>
c94e50e
to
d6d91cf
Compare
debootstrap is a stage-package but is not in the $PATH. Additionally, DEBOOTSTRAP_DIR must be set because the canonical path of /usr/share/debootstrap is prefixed with $SNAP as a snap. Signed-off-by: Dilyn Corner <[email protected]>
When building classic images, ubuntu-image will optionally run make to build the gadget tree. Canonical's gadget snaps use a Makefile to create certain artifacts, and some important commands used in this Makefile (chdist, grub-mkimage) are provided by devscripts and grub-common. Add these dependencies as stage-packages so that ubuntu-image can readily build some gadget snaps, especially on non-Ubuntu systems. Signed-off-by: Dilyn Corner <[email protected]>
snapcraft.yaml
to properly use stage-packages
Thank you for this PR @dilyn-corner ! The changes themselves look good, I just need to run some tests to see if everything is still working as expected. The additional stage-packages feel okay as well - we wanted to leave those out and leave this to gadget owners to recommend packages to install, but I think they're common enough in the gadget-build world that they make sense. |
Yes I was very hesitant on adding the requirements for building some gadgets -- this would be less of an issue if I'm certain my testing isn't as comprehensive as yours, but I've been building a few dozen different (Classic) images over the last few days with these changes and haven't noticed any breaks FWIW. |
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.
Looks good indeed!
As for using snapcraft for building the gadgets - we actually long time ago initially used it indeed! Then had to change to Makefiles due to snapcraft being in Ubuntu universe. Now we could revisit this eventually, but I think all of these problems will go away when we switch to imagecraft.
Expanding the
PYTHONPATH
is required to pickup the germinatestage-package
Without specifying
PTYHONPATH
you may hit such an error:Additionally,
debootstrap
is astage-package
but will not be used -- ifdebootstrap
is not installed on the host, you'll run into both a "missing from$PATH
" error and, after you correct the$PATH
variable used in thesnapcraft.yaml
, you end up withdebootstrap
being unable to find some relevant files in/usr/share
-- this can be resolved by setting an environment variableDEBOOTSTRAP_DIR
.The last commit in this PR adds two new
stage-packages
:devscripts
andgrub-common
. It's possible that a user will not have these packages installed, and they are requirements for building some variations of ourpc-gadget
snap (https://github.com/snapcore/pc-gadget/tree/classic). I leave it up to whomever reviews this to determine if these are valid inclusions forubuntu-image
.