compress flatpak tars with xz instead of gzip
Categories
(Release Engineering :: Release Automation: Other, enhancement)
Tracking
(firefox75 fixed, firefox76 fixed)
People
(Reporter: mtabara, Assigned: MaxPham99, Mentored)
References
Details
(Keywords: good-first-bug)
Attachments
(3 files)
We currently package flatpaks as tar.gz
format. While that's totally fine, we should use xz
compression instead to comply with the standard we have in-tree.
This requires changes in:
- run.me - when we create the archive
- pushflatpakscript - when we unpack the archive
Happy to provide more details for those interested in grabbing this bug.
Hi there,
I would love to take on this bug !
I did some initial research on the rationale of the standard that was set. And it seems that LZMA has greater compression rate than gzip, but slower in compression and decompression time. But through my Firefox builds, it would make sense to try to minimize the size of the files since it does already take some time to compile the app.
I would love to hear your feedbacks on my intuition that makes this bug, a bug. As it provides me with some rationale on the expected results of this change.
Reporter | ||
Comment 3•4 years ago
|
||
(In reply to Max from comment #1)
Hi there,
I would love to take on this bug !
First of all, thank you for voluteering to work on this!
(In reply to Max from comment #2)
I did some initial research on the rationale of the standard that was set. And it seems that LZMA has greater compression rate than gzip, but slower in compression and decompression time. But through my Firefox builds, it would make sense to try to minimize the size of the files since it does already take some time to compile the app.
I would love to hear your feedbacks on my intuition that makes this bug, a bug. As it provides me with some rationale on the expected results of this change.
You're raising a very good point. Frankly, I don't know the rationale behind the standardization of this, but I can surely dig in to find more details. Tangently related, I remember seeing some benchmarks (unrelated to this bug) present in https://github.com/facebook/zstd#benchmarks regarding LZMA compressions.
Reporter | ||
Comment 4•4 years ago
|
||
The main idea that drives this change is that we want to use the xz
compression to be consistent with the way we archive sourceballs in-tree (for example https://archive.mozilla.org/pub/firefox/candidates/75.0b2-candidates/build1/source/firefox-75.0b2.source.tar.xz)
What needs to change?
-
in
run.me
script from here we use tar andgzip()
to archive therepo
folder. We should instead create anxz()
counterpart. -
in
pushflatpakscript
we uncompress this tar to read its contents - a) we first check if it's valid archive type in here and then we extract all in here. Left to be seen whether we actually need to make any change there or iftarfile
complies withxz
compression function too. At the very least, it's worth updating the comment from here to mention that we're using thexz
instead.
(In reply to Mihai Tabara [:mtabara]⌚️GMT from comment #4)
The main idea that drives this change is that we want to use the
xz
compression to be consistent with the way we archive sourceballs in-tree (for example https://archive.mozilla.org/pub/firefox/candidates/75.0b2-candidates/build1/source/firefox-75.0b2.source.tar.xz)What needs to change?
in
run.me
script from here we use tar andgzip()
to archive therepo
folder. We should instead create anxz()
counterpart.in
pushflatpakscript
we uncompress this tar to read its contents - a) we first check if it's valid archive type in here and then we extract all in here. Left to be seen whether we actually need to make any change there or iftarfile
complies withxz
compression function too. At the very least, it's worth updating the comment from here to mention that we're using thexz
instead.
- Considering the
tar
library, it does support compression inxz
format. Of which, I propose the following changes:
# line 20 should be changed to:
TARGET_TAR_XZ_FULL_PATH="$ARTIFACTS_DIR/target.flatpak.tar.xz"
# line 125 should be changed to:
tar cvfJ flatpak.tar.xz repo
# line 127 should be changed to:
mv -- flatpak.tar.xz "$TARGET_TAR_XZ_FULL_PATH"
- is_tarfile I think is fine to keep since it doesn't seem to require a specifier in params. Similarly for extractall as well.
For the comment, I also agree to update the comment.
I'll try to build it and test around to see if the compression is lossy enough. Will keep you updated.
Reporter | ||
Comment 6•4 years ago
|
||
All of this sounds great! Thank you!
(more comments inline)
(In reply to Max from comment #5)
- Considering the
tar
library, it does support compression inxz
format. Of which, I propose the following changes:# line 20 should be changed to: TARGET_TAR_XZ_FULL_PATH="$ARTIFACTS_DIR/target.flatpak.tar.xz" # line 125 should be changed to: tar cvfJ flatpak.tar.xz repo # line 127 should be changed to: mv -- flatpak.tar.xz "$TARGET_TAR_XZ_FULL_PATH"
Precisely!
- is_tarfile I think is fine to keep since it doesn't seem to require a specifier in params. Similarly for extractall as well.
For the comment, I also agree to update the comment.I'll try to build it and test around to see if the compression is lossy enough. Will keep you updated.
Sounds good! FTR, we use Python 3.8 in the pushflatpakscript.
Reporter | ||
Updated•4 years ago
|
Is it fine that moz-phab created 2 different revisions ? I wasn't sure how to commit to the same one. It's been quite a learning curve to get use to Hg.
Reporter | ||
Comment 10•4 years ago
|
||
(In reply to Max from comment #9)
Is it fine that moz-phab created 2 different revisions ? I wasn't sure how to commit to the same one. It's been quite a learning curve to get use to Hg.
Firstly, I know your pain. I've been using it for years and still don't grasp it completely :)
Ideally we have one single patch, let me see if I can bake them together or chain them as connected revisions.
Reporter | ||
Comment 11•4 years ago
|
||
(In reply to Mihai Tabara [:mtabara]⌚️GMT from comment #10)
(In reply to Max from comment #9)
Is it fine that moz-phab created 2 different revisions ? I wasn't sure how to commit to the same one. It's been quite a learning curve to get use to Hg.
Firstly, I know your pain. I've been using it for years and still don't grasp it completely :)
Ideally we have one single patch, let me see if I can bake them together or chain them as connected revisions.
Hm, wanted to land them at once, since I saw you already chained them together as parent-child. Hitting some Phabricator issues, will get back to you once #lando team replies to my question.
Reporter | ||
Comment 12•4 years ago
|
||
Thanks for your contribution again, once this lands and gets on beta, we should be good to go! I'll close the bug once we have a successful beta pushed, likely early next week.
Assignee | ||
Comment 13•4 years ago
|
||
(In reply to Mihai Tabara [:mtabara]⌚️GMT from comment #11)
(In reply to Mihai Tabara [:mtabara]⌚️GMT from comment #10)
(In reply to Max from comment #9)
Is it fine that moz-phab created 2 different revisions ? I wasn't sure how to commit to the same one. It's been quite a learning curve to get use to Hg.
Firstly, I know your pain. I've been using it for years and still don't grasp it completely :)
Ideally we have one single patch, let me see if I can bake them together or chain them as connected revisions.Hm, wanted to land them at once, since I saw you already chained them together as parent-child. Hitting some Phabricator issues, will get back to you once #lando team replies to my question.
Ah no worries, just let me know if there's anything I can help with.
(In reply to Mihai Tabara [:mtabara]⌚️GMT from comment #12)
Thanks for your contribution again, once this lands and gets on beta, we should be good to go! I'll close the bug once we have a successful beta pushed, likely early next week.
That's awesome. Can't remember the last time I got my code pushed to production that fast haha. Thanks for your articulate explanations and help !
Comment 14•4 years ago
|
||
Pushed by mozilla@hocat.ca: https://hg.mozilla.org/integration/autoland/rev/ef2412788c58 Compress flatpak tars with xz instead of gzip. r=mtabara
Comment 15•4 years ago
|
||
bugherder |
Reporter | ||
Comment 16•4 years ago
|
||
Comment on attachment 9133056 [details]
Bug 1621066 - Compress flatpak tars with xz instead of gzip.
Beta/Release Uplift Approval Request
- User impact if declined: None for user, this concernes flatpaks internals. Switching to
xz()
compression for flatpaks internally in order to comply with the source archive format. - Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky):
- String changes made/needed:
Reporter | ||
Comment 17•4 years ago
|
||
[Tracking Requested - why for this release]:
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Comment 18•4 years ago
|
||
Once this patch is being upifted to beta, we can also land the scriptworker side - https://github.com/mozilla-releng/scriptworker-scripts/pull/176
Reporter | ||
Comment 19•4 years ago
|
||
Comment 20•4 years ago
|
||
Comment on attachment 9133056 [details]
Bug 1621066 - Compress flatpak tars with xz instead of gzip.
flatpak tweak, approved for 75.0b5
Comment 21•4 years ago
|
||
bugherder uplift |
Reporter | ||
Comment 22•4 years ago
|
||
Worked like a charm in 75.0b5: repackaged job generating the xz
archive - https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/SKMCWGe5TceEvRI-OxRCHw/runs/0/artifacts/public/build/target.flatpak.tar.xz and the push
job successfully unpacking the tarball, see logs here
Thank you again for your contribution! \o/
Reporter | ||
Updated•4 years ago
|
Assignee | ||
Comment 23•4 years ago
|
||
(In reply to Mihai Tabara [:mtabara]⌚️GMT from comment #22)
Worked like a charm in 75.0b5: repackaged job generating the
xz
archive - https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/SKMCWGe5TceEvRI-OxRCHw/runs/0/artifacts/public/build/target.flatpak.tar.xz and thepush
job successfully unpacking the tarball, see logs hereThank you again for your contribution! \o/
Yay !!!! No problemo :D
Updated•4 years ago
|
Description
•