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
snapcraft.yaml: use build-base and adopt-info, rm builddeb plugin #7904
snapcraft.yaml: use build-base and adopt-info, rm builddeb plugin #7904
Conversation
@@ -29,9 +25,25 @@ passthrough: | |||
# https://forum.snapcraft.io/t/5547/10 | |||
parts: | |||
snapd: | |||
# FIXME: this should probably go upstream | |||
plugin: x-builddeb |
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 think doing this in override-build is much nicer!
I haven't reviewd it yet, but I suspect the type: is still a blocker per #7092 |
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!
As per SU, I need to drop |
80f531b
to
ed26d4b
Compare
I ended up force-pushing this since it's small enough to re-review I think. Also fixed the tests. I think this can fully supercede #7092 and when the store is ready we can submit a follow-up to set |
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.
Thank you! This looks great.
One minor issue (not a blocker) - if I run this twice without a "snapcraft clean" in between I get a strange error on my 19.10 host:
|
@mvo5 I'll look into that, we can probably fix that easily in this PR somehow |
@mvo5 that issue has been fixed, should fully support iterative re-builds like that now |
build-aux/snap/snapcraft.yaml
Outdated
adopt-info: snapd | ||
# the base is only needed here for snapcraft to check the ELF sections of | ||
# binaries inside the snap, which is an unnecessary check for snapcraft itself | ||
base: core |
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 think this should be build-base: core
, no?
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.
With just build-base: core
snapcraft errors like this https://pastebin.ubuntu.com/p/PhMkTmKcRw/
I believe this is a bug in snapcraft where it assumes that if there is a build-base defined then there must also be a base defined. Should the snapd snap not declare a base?
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.
No, this was n'acked in my original PR, see #7092 (comment)
Marking blocked until base:core is clarified. |
@stolowski yes you're correct sorry I forgot about that situation. I have filed a bug against snapcraft for this: https://bugs.launchpad.net/snapcraft/+bug/1857019 |
@stolowski hmm, looking at the fix that snapcraft team implemented in #7092, that fix relies upon While unfortunate, I don't think we can build with the "modern" snapcraft with multipass/lxd here (and also with |
Ah, right, I forgot that these things were interconnected... Oh well... |
114b8a4
to
4180ba3
Compare
Note that I updated this to use |
b757cdb
to
eb0bca0
Compare
At @sergiusens request, I tested this against snapcraft edge and it worked successfully. Specifically all I tested was running the diff --git a/tests/main/snapd-snap/task.yaml b/tests/main/snapd-snap/task.yaml
index 4a7022bb3f..6310b6e85f 100644
--- a/tests/main/snapd-snap/task.yaml
+++ b/tests/main/snapd-snap/task.yaml
@@ -8,7 +8,8 @@ priority: 100
prepare: |
echo "Install snapcraft from candidate"
- snap install snapcraft --candidate --classic
+ # TODO: move this back to candidate
+ snap install snapcraft --edge --classic
restore: |
cd "$PROJECT_PATH" (and I had a bad rebase earlier that had just deleted the contents of the x_builddeb.py file, but not the full file itself somehow, so I fully deleted it and force pushed again). |
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 to me, thanks for pursuing it!
We can modernize the snapd snap by setting base to core, which allows the snap to be built with the modern snapcraft, using multipass or lxd (or natively with --destructive-mode). This also means we need to drop usage of build in favor of override-build, since in modern snapcraft the build keyword is removed entirely. Also, with a modern snapcraft, we can set the license without using passthrough, and we also should migrate to using snapcraftctl set-version, which is the preferred way to set the version in override-pull. We can also now eliminate usage of the x-builddeb custom plugin and just use the same commands as part of the override-build snippet. The test is now updated to build the snap natively with --destructive-mode, the lxd provider isn't quite stable enough for us to rely on it here and run the tests on other OS's. Unfortunately, we are still not able to set type: snapd yet, since the store isn't ready, so just add that there as a TODO. Thanks to @stolowski and @cmatsuoka for some of these changes! Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
This avoids the warnings about all the go files and such inside snap/ Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
… builds Leaving these set leads to the debian build system including files from $SNAPCRAFT_STAGE in the build and using those libraries, etc. which it should not be doing. Without this, after building successfully once, re-building the snap without cleaning would fail like this: dpkg-shlibdeps: error: no dependency information found for /root/stage/lib/x86_64-linux-gnu/libc.so.6 (used by debian/snapd/usr/lib/snapd/snap-seccomp) Hint: check if the library actually comes from a package. dh_shlibdeps: dpkg-shlibdeps -Tdebian/snapd.substvars debian/snapd/usr/bin/snapfuse debian/snapd/usr/bin/snap debian/snapd/usr/lib/snapd/snap-confine debian/snapd/usr/lib/snapd/snap-seccomp debian/snapd/usr/lib/snapd/snap-bootstrap debian/snapd/usr/lib/snapd/snap-gdb-shim debian/snapd/usr/lib/snapd/snap-repair debian/snapd/usr/lib/snapd/snapd debian/snapd/usr/lib/snapd/snap-failure debian/snapd/usr/lib/snapd/snap-discard-ns debian/snapd/usr/lib/systemd/system-environment-generators/snapd-env-generator debian/snapd/lib/systemd/system-generators/snapd-generator returned exit code 2 debian/rules:102: recipe for target 'binary' failed make: *** [binary] Error 2 dpkg-buildpackage: error: debian/rules binary gave error exit status 2 Failed to run 'override-build': Exit code was 2. because libc.so.6 was included in the linker search path during compiling when it should just be using the one from the build environment instead. Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
This was somehow undone in one of the force pushes... Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2d7ffcd
to
5c6b927
Compare
Codecov Report
@@ Coverage Diff @@
## master #7904 +/- ##
==========================================
- Coverage 80.84% 80.84% -0.01%
==========================================
Files 707 707
Lines 56445 56445
==========================================
- Hits 45634 45633 -1
Misses 7277 7277
- Partials 3534 3535 +1
Continue to review full report at Codecov.
|
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.
Thank you!
Snapcraft in candidate suports this now so I remove the "blocked" label. |
sudo apt-get build-dep -y ./ | ||
./get-deps.sh --skip-unused-check | ||
# set version after installing dependencies so we have all the tools here | ||
snapcraftctl set-version $(./mkversion.sh --output-only) |
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.
snapcraftctl set-version $(./mkversion.sh --output-only) | |
snapcraftctl set-version "$(./mkversion.sh --output-only)" |
Happy to see follow ups or if you are feeling lucky, commit this suggestion and wait for green.
# TODO: should we unset $PATH to not include $SNAPCRAFT_STAGE too? | ||
unset LD_FLAGS | ||
unset LD_LIBRARY_PATH | ||
# if we are root, disable tests |
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.
Saying why we disable tests would be more useful. I see what the code does but am not the wiser.
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.
sure I'll add this in a followup
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.
LTGM but please see comments inline.
We can modernize the snapd snap by setting build-base to core, which allows the snap to be built with the modern snapcraft, using multipass or lxd (or natively with --destructive-mode). This also means we need to drop usage of build in favor of override-build, since in modern snapcraft the build keyword is removed entirely.
Finally, we can eliminate usage of the x-builddeb custom plugin and just use the same commands as part of the override-build snippet.
Also drive-by update to HACKING.md fixing typo from before
Note that this still does not yet set
type: snapd
because the store is still not ready for the transition, but we should land this anyways and make that change later.