Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] Re: [RFC] New file layout for PKGDIR and binhosts
Date: Thu, 25 Dec 2014 11:04:24
Message-Id: 549BEF34.90603@gentoo.org
In Reply to: [gentoo-portage-dev] Re: [RFC] New file layout for PKGDIR and binhosts by Duncan <1i5t5.duncan@cox.net>
1 On 12/25/2014 02:03 AM, Duncan wrote:
2 > Zac Medico posted on Wed, 24 Dec 2014 00:13:57 -0800 as excerpted:
3 >
4 >>> If there were some way to
5 >>> get all the info for the binpkgs into one file (so it could be run on
6 >>> cron or something), this could mean that I'd only have to do one file
7 >>> request for all that metadata and would be much quicker than inspecting
8 >>> all those files.
9 >>
10 >> That's what $PKGDIR/Packages is.
11 >
12 > This is a good excuse to ask a question that has bothered me for some
13 > time, plus make a request for the new eclean-pkg replacement...
14 >
15 > Normally I like to keep several old binpkgs around for troubleshooting
16 > reference or quick-install, but the combined set of kde packages, for
17 > instance, can get pretty big, and with monthly iterations, they build up
18 > pretty fast.
19 >
20 > But eclean-pkg doesn't have an easy way to say clean up /just/ kde-base/
21 > *, leaving the currently installed version and one previous version for
22 > reference, cleaning out all others. (Sure I could put /everything/ else
23 > on the exclude list, but what's really needed is an include list, plus a
24 > "keep N more" option.)
25 >
26 > So I often end up cleaning packages like that out manually by simply
27 > deleting them. My question is thus, does the remaining index/db/cache
28 > entry get cleaned properly (when?) or am I leaving uncleanable garbage
29 > behind when I do this?
30
31 You can run 'emaint --fix binhost' to sync $PKGDIR/Packages up with the
32 existing tbz2 files.
33
34 If you don't run that emaint command, the packages that you removed will
35 be pruned from $PKGDIR/Packages the next time that you run an 'emerge
36 --usepkg' command with sufficient privileges.
37
38 > Which of course translates into a couple of feature requests for the new
39 > eclean-pkg:
40 >
41 > 1) Make it possible to clean only selected pkgs or categories.
42 >
43 > 2) Have an option to clean up and/or regenerate the cache/index/db/
44 > whatever files, re-syncing them with what's actually there.
45
46 eclean-pkg calls 'emaint --fix binhost' to fix $PKGDIR/Packages after it
47 removes some tbz2 files.
48
49 > Meanwhile, another possible usage for multiple binpkgs per ebuild:
50 >
51 > I commonly run live-builds (mostly kde, tho I'm not ATM), and would
52 > /love/ to be able to keep about three generations (current plus two back)
53 > around, ideally IDed by their git-commit or the like. Running live
54 > packages can mean even more risk than usual of something not working out,
55 > but currently, if the package builds, by the time you find that out,
56 > you've obliterated your previous *9999 binpkg and even figuring out which
57 > git commit it was isn't easy, let alone doing a quick binpkg rollback,
58
59 FWIW, you can use 'cp -rl $PKGDIR $PKGDIR.backup' to make a hardlink
60 snapshot of $PKGDIR. Portage will break hardlinks whenever it needs to
61 update tbz2 files, so you don't have to worry about updates in $PKGDIR
62 affecting the files in $PKGDIR.backup.
63
64 > like you'd do with an ordinary version upgrade. Were multiple live-
65 > binpkg-versions kept around, IDed by the git-commit or at least with that
66 > info in the metadata somewhere, it'd make things /so/ much easier! =:^)
67
68 That's going to require an EAPI extension [1], in order to establish a
69 protocol for the ebuild to communicate the commit id to the package manager.
70
71 > But of course that does make having an automated cleaner that can keep
72 > just the last N package versions around while deleting the others, that
73 > much more important.
74
75 Yes, and we might integrate some on-the-fly garbage collection directly
76 into portage, or provide a hook for this purpose.
77
78 [1] https://bugs.gentoo.org/show_bug.cgi?id=182028
79 --
80 Thanks,
81 Zac

Replies

Subject Author
[gentoo-portage-dev] Re: [RFC] New file layout for PKGDIR and binhosts Duncan <1i5t5.duncan@×××.net>