Closed Bug 1841370 Opened 1 year ago Closed 14 days ago

Add a way to repackage development builds as Snaps for testing

Categories

(Firefox Build System :: General, enhancement)

Unspecified
Linux
enhancement

Tracking

(firefox128 fixed)

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: jld, Assigned: gerard-majax)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 2 obsolete files)

There's a feature I wanted a while ago, and wrote some code for, and now that several other people have found themselves wanting it it's probably time to check it in: Repackaging the local build (or, optionally, a downloaded CI build) as a Snap, to work on bugs that are specific to the Snap environment.

This is different from the official Canonical Snap builds, because those build everything from scratch, including LLVM/Clang; this is just a repack, so it won't be exactly the same, but it's mostly the same and a lot more convenient for development.

In addition to mach repackage snap, I've also written mach repackage snap-install to install the resulting snap, because installing an unsigned snap like this doesn't auto-connect its plugs (ranging from optional hardware access features to the distinctly non-optional :browser-support) and that was getting annoying to do by hand. Also, there's mach repackage snap --install to run both commands in sequence.

The main problem that I've seen people run into so far is that snapcraft (the snap build tool) currently wants to run itself inside a VM (using multipass), which can cause problems if building Firefox under a VM monitor that doesn't support nested VMs. However, snapcraft can also use LXD containers, and that will become the default once we migrate our snap to use core22, so that will eventually stop being a problem.

The mach repackage snap command creates a Snap named firefox-devel
(currently only Firefox is supported), in order not to interfere with
the official package. We ignore the SNAP_NAME env var if it names
a different app (assuming it was an unconfined Snap that launched a
non-Snap Firefox as a helper), so we need to recognize our own name with
the "-devel" suffix to avoid potential odd behavior (see bug 1825181 for
an example).

We already have a snapcraft.yaml to repack a Firefox build, but
mach repackage snap will want the resulting Snap to use the name
firefox-devel to avoid interfering with an install of the real Firefox
snap, so this patch allows changing it.

This adds the command mach repackage snap, which packages the current
build as a Snap (with the app name firefox-devel, to not interfere with
installs of the normal firefox package). It can also accept a tar file
as input, for example to repack a build from Taskcluster.

It also adds mach repackage snap-install, which installs the package
and connects its plugs with snap connect (normally done by default,
but not for an unsigned package like this).

Building a Snap package requires the snapcraft command, which is
available as a Snap (and maybe from other package managers). Currently,
by default snapcraft runs itself inside a VM, which can cause problems
if building under a VM monitor that doesn't support nested VMs, but that
may change in the future.

Attachment #9342015 - Attachment description: Bug 1841370 - widget/gtk: handle the snap name having the "-devel" suffix. → WIP: Bug 1841370 - widget/gtk: handle the snap name having the "-devel" suffix.
Attachment #9402475 - Attachment description: WIP: Bug 1841370 - WIP new repackage → WIP: Bug 1841370 - Add `mach repackage snap` and `snap-install` for testing development builds under Snap.
Attachment #9402475 - Attachment is obsolete: true
Attachment #9402475 - Attachment is obsolete: false
Assignee: jld → lissyx+mozillians
Attachment #9342017 - Attachment description: Bug 1841370: Add `mach repackage snap` and `snap-install` for testing development builds under Snap. → WIP: Bug 1841370 - Add `mach repackage snap` and `snap-install` for testing development builds under Snap.
Attachment #9402475 - Attachment is obsolete: true
Attachment #9342015 - Attachment description: WIP: Bug 1841370 - widget/gtk: handle the snap name having the "-devel" suffix. → Bug 1841370 - widget/gtk: handle the snap name having the "-devel" suffix. r?stransky!
Attachment #9342017 - Attachment description: WIP: Bug 1841370 - Add `mach repackage snap` and `snap-install` for testing development builds under Snap. → Bug 1841370 - Add `mach repackage snap` and `snap-install` for testing development builds under Snap. r?#build!
Attachment #9342016 - Attachment is obsolete: true
Blocks: 1896374
Pushed by alissy@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/170705f2b5ba
widget/gtk: handle the snap name having the "-devel" suffix. r=stransky
https://hg.mozilla.org/integration/autoland/rev/051187f2c76e
Add `mach repackage snap` and `snap-install` for testing development builds under Snap. r=firefox-build-system-reviewers,sergesanspaille
https://hg.mozilla.org/integration/autoland/rev/4580ec06b018
apply code formatting via Lando
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: