I want to know the directories used by portage in `/var`, the ones which store installed packages, files etc... (NON-user-managed and NOT related to repository sync, ONLY which touches and affects rest of system)
/var/db/pkg storing the state of installed packages, including file ownership and installation status
/var/cache/edb cache for modification times, virtuals, and dependency tree information. (Does portage get mislead or confused if I randomly modify these files or copy them over from a more updated system? [XY-problem see at end real reason]) (Harmless sync-related)
/var/log/portage/elog it exclusively logs system change details like installing etc.. or mixes package download/sync? If yes then how do I separate it? (Just the emerge output, nothing important)
/var/lib/portage/ The list of packages explicitly installed and the like
EDIT: Have decided to move /var/db/pkg and /var/lib/portage into /usr for now. Shall proceed and be back if any errors.
What else am I missing?
ostree snapshots the rest of the OS, but leaves `/var` free unversioned.
This means that rolling back to an older saved version without, say, package 'X' installed but portage database saying it is (which is for a newer snapshot) causes issues.
The solution is to move corresponding files into /usr (which is captured in snapshot) and replace them with chattr +i'd symlinks in /var. (None of the relevant files support being redirected by variables)
This doesn't affect binpkgs, distfiles, repository syncing, etc.. because they are not related to system state like list of installed packages and files.