View previous topic :: View next topic |
Author |
Message |
midnite Guru


Joined: 09 Apr 2006 Posts: 453 Location: Hong Kong
|
Posted: Thu May 15, 2025 11:23 pm Post subject: Keep the old sources and possibility to rollback? |
|
|
For packages like sys-kernel/gentoo-sources which have slots that allow multiple versions to coexist in a system, we can add different :slots into the @world file in order to keep the "compiled" packages. There are a few inconveniences.
- Whenever a new version of sys-kernel/gentoo-sources is emerged, we need to manually add the new slot into the @world file.
- For most of the other packages, they do not support slotting. This solution is not possible for them.
As the DISTDIR, /var/cache/distfiles, which contains all the source codes, by default, will not be automatically deleted while emerge --sync or emerge -avuND @world, all the source codes of the previously emerged packages are already available in the system. But we cannot simply compile those old versions because the ebuilds and the dependency information are missing. They are missing because whenever an old ebuild is deleted from the Gentoo repository, it will also be deleted locally during emerge --sync.
It is because the --delete option is in the PORTAGE_RSYNC_OPTS variable.
portageq envvar PORTAGE_RSYNC_OPTS: | --recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git |
What if adding --no-delete to PORTAGE_RSYNC_EXTRA_OPTS in the /etc/portage/make.conf file:
/etc/portage/make.conf: | PORTAGE_RSYNC_EXTRA_OPTS="${PORTAGE_RSYNC_EXTRA_OPTS} --no-delete" |
the ebuild files in the repository (local) location, /var/db/repos/gentoo, will not be deleted while emerge --sync.
Take sys-kernel/gentoo-sources as an example. In the directory /var/db/repos/gentoo/sys-kernel/gentoo-sources/, other than ebuild files, there are also a metadata.xml and a Manifest file. The metadata.xml file seems never change. But the Manifest file contains the checksums of the only available ebuilds.
To keep old checksums in the local Manifest file, we need backup the overwritten Manifest files.
/etc/portage/make.conf: | PORTAGE_RSYNC_EXTRA_OPTS="${PORTAGE_RSYNC_EXTRA_OPTS} --no-delete --backup-dir=/var/db/repos/gentoo_bak" |
Then use a script to merge the new and old Manifest files. In case an ebuild file changes (e.g. from ~amd64 to stable), the checksum in the Manifest changes also. While merging the Manifest files, in case there are different checksums of the same file, the new checksum takes precedence.
After merging, the backup directory can be deleted.
When we want to rollback to a previous installed version, simply, for example the version 5.4.3 is no long available in the Gentoo repository, it only available locally,
Code: | emerge -av sys-kernel/gentoo-sources-5.4.3 |
and its depending packages, in case any previous versions are needed, will be also rolled back also. (Of course sys-kernel/gentoo-sources does not have any depending packages. It just serves as an example.)
Is this solution possible? Are there any problems (other than source codes and ebuilds occupying storage spaces in DISTDIR and /var/db/repos/gentoo)? _________________ - midnite. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3650
|
Posted: Fri May 16, 2025 12:36 am Post subject: |
|
|
Distfiles remain in cache until you delete them yourself. If you need old ebuilds, you can use gentoo git repo and pull the whole history, and either checkout an older version of the whole tree or just a single directory (or even file). Git even allows you to create multiple, independent workdirs now, so you can checkout old files directly to a different location (maybe even your local overlay), where they will remain until you delete them yourself.
It does look like you're trying to overcomplicate your life, but if you really need it, doing something along those lines might be worth it.
Anyway, don't edit files in the main tree yourself. Use an overlay instead. You can have as many overlays as you want, which makes it easy to pull community-maintained stuff as well.
If you don't know where to start, see eselect-repository. _________________ Make Computing Fun Again |
|
Back to top |
|
 |
midnite Guru


Joined: 09 Apr 2006 Posts: 453 Location: Hong Kong
|
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3650
|
Posted: Fri May 16, 2025 11:10 am Post subject: |
|
|
That's a wall of text you _probably_ don't need for what you want to do.
Eselect-repository's main purpose is to make enabling community overlays, but there is also local overlay on the list and it creates a template for your own, private overlay. You _can_ create local overlay completely by yourself, but there's nothing wrong with using a single command that hides the boring complexity from you.
Once done, copy the <cathegory>/<package>/{<ebuild>,<manifest>} from ::gentoo to ::local. Congratulations, you have your first package in your local overlay.
You might want to modify priority of your overlay, or maybe emerge some stuff using extended atom, like category/package::overlay, but I think that's pretty much enough to get you started.
When you get to patching ebuilds or making your own, you'll need ebuild command (already a part of any gentoo system), and I suggest getting familiar with git, though you can live without it most of the time. _________________ Make Computing Fun Again |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 55256 Location: 56N 3W
|
Posted: Fri May 16, 2025 2:24 pm Post subject: |
|
|
midnite,
There are old squshfs portage snapshots. About a month apart online too, they go back to 2016.
With git, you can get back to 2002, which is when Gentoo started with CVS.
I have all the distfiles I have downloaded since June 2006 too. That's about 800G now.
The last year or so is not there deliberately, as I don't want people to use that as an every day GENTOO_MIRROR.
If you need old sources, help yourself, if they are there. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|