-
Notifications
You must be signed in to change notification settings - Fork 62
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
Make snap more self-contained #163
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #163 +/- ##
=======================================
Coverage 87.35% 87.35%
=======================================
Files 15 15
Lines 3921 3921
=======================================
Hits 3425 3425
Misses 436 436
Partials 60 60
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
2 of the 3 proposed changes are good. I am a -1 on the mtools work-around, see inline comment for information.
snapcraft.yaml
Outdated
# in case the target directory does not already exist. 4.0.32 is available in | ||
# 22.04 and 4.0.43 is available in 23.10, so when the core24 base is released | ||
# mtools can be readded as a stage-package. | ||
mtools: |
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 must say I'm do not want to take this change. If there is a regression in mtools, I would prefer for the regression to be addressed as an SRU and updated properly in the archive instead. ubuntu-image is a tool which is used for building official Ubuntu image, so it should not use self-compiled tooling from outside of the archive.
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.
That's fair. I'll try to investigate what patch specifically resolves the issue - there's a post in the mailing list but I can't find a patch or any hosted VCS; I guess I have to dig into the release tarballs.
Once I've got it I'll try to initiative the SRU for it, however that works. Might be slow, I'm at the RISC-V Summit this week.
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.
mtools is actually more frustrating than I thought it would be, but conveniently the change between 4.0.33 and 4.0.34 (the release cut to fix this regression) is just:
dilyn@Ares:~/Downloads -> busybox diff mtools-4.0.33/mcopy.c mtools-4.0.34/mcopy.c
--- mtools-4.0.33/mcopy.c
+++ mtools-4.0.34/mcopy.c
@@ -107,7 +107,6 @@
Stream_t *File=mp->File;
Stream_t *Target, *Source;
struct MT_STAT stbuf;
- ssize_t ret;
char errmsg[80];
File->Class->get_data(File, &mtime, 0, 0, 0);
@@ -164,7 +163,7 @@
if ((Target = SimpleFileOpen(0, 0, unixFile,
O_WRONLY | O_CREAT | O_TRUNC,
errmsg, 0, 0, 0))) {
- ret = 0;
+ mt_off_t ret = 0;
if(needfilter && arg->textmode){
Source = open_filter(COPY(File),arg->convertCharset);
if (!Source)
Will test...
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.
This is actually a funny joke -- it's more complicated, because the Jammy package is actually 4.0.32. Harder to identify what small change is required.
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.
Update on this outstanding PR (sorry!), I've filed a bug against the mtools package and have started (I think...) the SRU process.
I'm simply too tired to figure out mtools. Why |
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 am generally +1 on these changes. Now that I think of it, I even think the python3-docutils pkg in build-packages
is also probably not used anymore (a leftover of a previous version of ubuntu-image, written in python). So it should be fine to remove it.
And kpartx
is now only used in our test suite, so I think it should not be needed anymore.
Side note: the added stage-packages explicitly reference python3.10. I guess it will have to be updated when we migrate to core24 (planned once it is available to unblock another PR) to use python 3.12.
Yeah the python version will have to be watched when the base changes. Ideally the *craft team will have a solution for staging python in snaps before core24 releases but I haven't heard any news on that front since the end of last year (this issue also hits I've removed python3-docutils and kpartx from the packages lists! |
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.
LGTM
@dilyn-corner would you mind rebasing you branch on main? We merged several branches recently and I would like to make sure your changes pass in CI (some tests are expected to fail but I can tell which ones). |
germinate will sometimes require python3-apt, specifically when dealing with adding a custom PPA to a Classic image build. Due to a bug in how staging python3 as a package works, all functional dependencies for python3 must also explicitly be added. See: https://chat.charmhub.io/charmhub/pl/11hfqf86y7yspbfmxehgbnoece Signed-off-by: Dilyn Corner <[email protected]>
fdisk, gdisk, and mtools are run-time dependencies, not build-time ones. Signed-off-by: Dilyn Corner <[email protected]>
kpartx is now only used by the test suite, not at run-time. Signed-off-by: Dilyn Corner <[email protected]>
Rebased, spread has run; indeed the failures seem unrelated! |
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.
Ok, seems sensible.
First commit is self-explanatory -- I don't think fdisk, gdisk, or mtools are ever used during the build and only matter for running
ubuntu-image
.Second commit resolves a bug that exists in a particular release of
mtools
in Jammy. I only saw this bug in the case where my Classic gadget snap was installing a firmware file to a bare partition (writing directly to sectors on the image). I don't really know why this doesn't show up when creating Core images.Third commit adds a required package (
python3-apt
) which matters when creating a Classic image which adds acustom-ppa
to the image (for instance, when building a Classic image which uses a kernel provided by some private Launchpad project).python3-apt
doesn't play nicely with particular Python interpreters. For instance, it isn't sufficient to stagepython3-apt
on 23.04. Instead, you must stage all of the python3 available in 22.04. Normally you would just addpython3
as astage-package
, but because of how Snapcraft handles certain dependencies which may be available in the base snap, we have to explicitly install all the packages python3 would normally get us. (Snapcraft itself has this same problem).