Skip to content
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

src_install() shouldn't touch the live system #377

Closed
Googulator opened this issue Dec 28, 2023 · 4 comments · Fixed by #419
Closed

src_install() shouldn't touch the live system #377

Googulator opened this issue Dec 28, 2023 · 4 comments · Fixed by #419

Comments

@Googulator
Copy link
Collaborator

Googulator commented Dec 28, 2023

The following packages all touch the live system (adding, deleting or modifying files outside $DESTDIR) in their src_install:

  • bash-2.05b (deletes old bash to avoid issues with tar later)
  • bash-5.2.15 (ditto)
  • coreutils-5.0 (directly creates /bin/pwd, bypassing $DESTDIR)
  • flex-2.5.11 (removes lex from the live system)
  • flex-2.6.4 (removes yacc from the live system)
  • musl-1.1.24 (pass 3 only - removes ALL include files installed up to that point from /usr/include! This is fixed by Smaller CI intermediate tarballs (option 2) #375 as it caused a checksum inconsistency.)
  • perl5.004-05 (removes previous perl)
  • perl5.005-03 (ditto)
  • perl-5.6.2 (ditto)
  • perl-5.10.1 (ditto)
  • perl-5.32.1 (ditto)

All of these alterations to the live system will fail to be reproduced when these packages are installed from preseeded tarballs, rather than built in place.

If any of these changes is genuinely necessary, then we need to implement src_apply override support in helpers.sh, and move the relevant code there, so the proper FS changes will be made regardless of whether we're building or installing from preseed.

@stikonas
Copy link
Collaborator

stikonas commented Jan 1, 2024

Well, we need some way to remove old files. Normally distros have install manifests to keep track of files to be removed when installing upgrades.

@Googulator
Copy link
Collaborator Author

That makes sense, whenever such cleanup is actually required, and is not merely a holdover from before live-bootstrap had the package system in place. However, it should be done in the actual package install path (which is src_apply(), not src_install(), which is actually part of package generation).

Unfortunately src_apply() isn't currently overrideable - to fix that, we need to rename the current implementation to default_src_apply(), allow it to be overridden in package scripts as needed, and make sure that the package script is loaded also when installing a prebuilt package (which we currently don't do). To clear up confusion, it may also make sense to rename (default_)src_install() to (default_)src_package(), to make it clearer what it actually does.

For the rare occasion where e.g. "make install" to fakeroot depends on some file not yet existing on the live system, and such misbehavior can't just be patched out for some reason, my preferred solution would be to back up the conflicting files, generate the packages, and finally restore the affected files. If desired, the same files can then be removed for good in that package's src_apply(), when that package is installed. This is also a prerequisite if we ever want to build packages that we don't immediately want to install to the live system.

@fosslinux
Copy link
Owner

To me, what makes the most sense here is adding some kind of uninstall function;
that reads a filelist (probably generated from a tarball in the repo), and removes said files.

I'd prefer actually having removal of old files in steps/manifest now, because removal of old files isn't really tied to any specific package.
Could have two forms, one used for generated packages and one for pre-kaem, eg

uninstall: perl-5.6.2 # removes the old package perl 5.6.2
uninstall: /usr/bin/lex # removes the lex binary

@Googulator
Copy link
Collaborator Author

Maybe that can be implemented also as improve steps (e.g. "improve: cleanup-old-perl").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants