Open yarikoptic opened 6 years ago
All ebuilds that have been in the portage tree since about 2000 are at https://gitweb.gentoo.org/repo/gentoo/historical.git/. Newer 'old' ebuilds (i.e. since ~2015) can be recovered from https://gitweb.gentoo.org/repo/gentoo.git/ or the github mirror.
To confirm that you have the right source tarballs you would need to also get the old version of the Manifest, either by checking out the old version from historical.git or gentoo.git.
If the original source tarball was not archived from the start (they live in /usr/portage/distfiles/
by default), then you would have to hunt down the original since many of the original source uris may be gone (see for example line 6 from https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-analyzer/fail2ban/fail2ban-0.6.0.ebuild?hideattic=0&view=markup).
Reconstructing the full tree dependency tree can be done on the system at run time by chaining equery commands on the original system, or if you have traced every file that has been touched, then you can run equery b file1 file2 file3 file4 /path/to/file5 | cut -d' ' -f1 | sort -u
and get all the packages at once. Performance seems a little slow for this, but it works. If running equery b becomes a frequent activity it shouldn't be too hard to build a reverse index from equery -N -C f $(cat /var/lib/portage/world | grep -v gentoo-sources) > /tmp/equery-all.txt
or equery -N -C f $(eix -I -# | grep -v gentoo-sources) > /tmp/equery-all.txt
(all installed, takes a bit longer).
Also it looks like there is a cache file located at /var/cache/edb/vdb_metadata.pickle
that has most of the information (lacking environment.bz2) which can be loaded into python to avoid having to open lots of files in /var/db/pkg
.
The one thing I still can't quite find is where the gcc/clang version used for compile is stored.
NOTE: all the gentoolkit machinery can be use from python on a gentoo system via the gentoolkit module.
for the sake of it with @tgbugs we explored gentoo a bit, here is an excerpt of bash history