Message ID | 20250321132502.2607941-1-Deepesh.Varatharajan@windriver.com |
---|---|
State | Accepted, archived |
Commit | 26a345adc8e050657bfa0b51ea92a3d89e698d9a |
Headers | show |
Series | [1/5] rust: Fix bloat issue in recent rust updates | expand |
On Fri, Mar 21, 2025 at 6:25 AM Varatharajan, Deepesh via lists.openembedded.org <deepesh.varatharajan=windriver.com@lists.openembedded.org> wrote: > > From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > > Remove the "src/gcc" directory from the Rust source code to reduce the > filesystem build space. > > In Rust 1.83 (and 1.84), a full GCC-14 tree was included, which caused > the tar.xz archive to increase by 128 MB and the unpacked sources to > grow by 1.3 GB. This was an upstream error that has been resolved in > Rust 1.85. > > After updating to Rust 1.85 we can revert this removal of "gcc/src" > > Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > --- > meta/recipes-devtools/rust/rust_1.83.0.bb | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/meta/recipes-devtools/rust/rust_1.83.0.bb b/meta/recipes-devtools/rust/rust_1.83.0.bb > index cd470b1883..aaf35692ab 100644 > --- a/meta/recipes-devtools/rust/rust_1.83.0.bb > +++ b/meta/recipes-devtools/rust/rust_1.83.0.bb > @@ -50,6 +50,16 @@ setup_cargo_environment () { > > inherit rust-target-config > Lets add a comment here to remind us about removal with/when 1.85 is brought in. > +do_unpack:append() { > + import os > + import shutil > + > + # Remove gcc directory after unpacking > + gcc_dir = os.path.join(d.getVar('S'), 'src', 'gcc') > + if os.path.isdir(gcc_dir): > + shutil.rmtree(gcc_dir) > +} > + > do_rust_setup_snapshot () { > for installer in "${UNPACKDIR}/rust-snapshot-components/"*"/install.sh"; do > "${installer}" --prefix="${WORKDIR}/rust-snapshot" --disable-ldconfig > -- > 2.43.0 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#213451): https://lists.openembedded.org/g/openembedded-core/message/213451 > Mute This Topic: https://lists.openembedded.org/mt/111827574/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
On Fri, 2025-03-21 at 06:24 -0700, Varatharajan, Deepesh via lists.openembedded.org wrote: > From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > > Remove the "src/gcc" directory from the Rust source code to reduce the > filesystem build space. > > In Rust 1.83 (and 1.84), a full GCC-14 tree was included, which caused > the tar.xz archive to increase by 128 MB and the unpacked sources to > grow by 1.3 GB. This was an upstream error that has been resolved in > Rust 1.85. > > After updating to Rust 1.85 we can revert this removal of "gcc/src" > > Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com> > --- > meta/recipes-devtools/rust/rust_1.83.0.bb | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/meta/recipes-devtools/rust/rust_1.83.0.bb b/meta/recipes-devtools/rust/rust_1.83.0.bb > index cd470b1883..aaf35692ab 100644 > --- a/meta/recipes-devtools/rust/rust_1.83.0.bb > +++ b/meta/recipes-devtools/rust/rust_1.83.0.bb > @@ -50,6 +50,16 @@ setup_cargo_environment () { > > inherit rust-target-config > > +do_unpack:append() { > + import os > + import shutil > + > + # Remove gcc directory after unpacking > + gcc_dir = os.path.join(d.getVar('S'), 'src', 'gcc') > + if os.path.isdir(gcc_dir): > + shutil.rmtree(gcc_dir) > +} > + > do_rust_setup_snapshot () { > for installer in "${UNPACKDIR}/rust-snapshot-components/"*"/install.sh"; do > "${installer}" --prefix="${WORKDIR}/rust-snapshot" --disable-ldconfig Thanks for the patch, it is important we fix this. Unfortunately this change isn't quite enough. We need to apply it to all users of the rust source, so it needs to be in the rust-source.inc file, not in the rust recipe. Secondly, this would be better done as a postfunc for the do_unpack task, so it can be a separate function rather than a append. For example: base.bbclass:do_unpack[postfuncs] += "create_source_date_epoch_stamp" Cheers, Richard
diff --git a/meta/recipes-devtools/rust/rust_1.83.0.bb b/meta/recipes-devtools/rust/rust_1.83.0.bb index cd470b1883..aaf35692ab 100644 --- a/meta/recipes-devtools/rust/rust_1.83.0.bb +++ b/meta/recipes-devtools/rust/rust_1.83.0.bb @@ -50,6 +50,16 @@ setup_cargo_environment () { inherit rust-target-config +do_unpack:append() { + import os + import shutil + + # Remove gcc directory after unpacking + gcc_dir = os.path.join(d.getVar('S'), 'src', 'gcc') + if os.path.isdir(gcc_dir): + shutil.rmtree(gcc_dir) +} + do_rust_setup_snapshot () { for installer in "${UNPACKDIR}/rust-snapshot-components/"*"/install.sh"; do "${installer}" --prefix="${WORKDIR}/rust-snapshot" --disable-ldconfig