Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH 1/2] Add FEATURES=binpkg-multi-instance (bug 150031)
Date: Tue, 17 Feb 2015 18:42:45
Message-Id: 20150217104240.1db9be28.dolsen@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 1/2] Add FEATURES=binpkg-multi-instance (bug 150031) by Zac Medico
1 On Tue, 17 Feb 2015 00:37:12 -0800
2 Zac Medico <zmedico@g.o> wrote:
3
4 > FEATURES=binpkg-multi-instance causes an integer build-id to be
5 > associated with each binary package instance. Inclusion of the
6 > build-id in the file name of the binary package file makes it
7 > possible to store an arbitrary number of binary packages built from
8 > the same ebuild.
9 >
10 > Having multiple instances is useful for a number of purposes, such as
11 > retaining builds that were built with different USE flags or linked
12 > against different versions of libraries. The location of any
13 > particular package within PKGDIR can be expressed as follows:
14 >
15 > ${PKGDIR}/${CATEGORY}/${PN}/${PF}-${BUILD_ID}.xpak
16 >
17 > The build-id starts at 1 for the first build of a particular ebuild,
18 > and is incremented by 1 for each new build. It is possible to share a
19 > writable PKGDIR over NFS, and locking ensures that each package added
20 > to PKGDIR will have a unique build-id. It is not necessary to migrate
21 > an existing PKGDIR to the new layout, since portage is capable of
22 > working with a mixed PKGDIR layout, where packages using the old
23 > layout are allowed to remain in place.
24 >
25 > The new PKGDIR layout is backward-compatible with binhost clients
26 > running older portage, since the file format is identical, the
27 > per-package PATH attribute in the 'Packages' index directs them to
28 > download the file from the correct URI, and they automatically use
29 > BUILD_TIME metadata to select the latest builds.
30 >
31 > There is currently no automated way to prune old builds from PKGDIR,
32 > although it is possible to remove packages manually, and then run
33 > 'emaint --fix binhost' to update the ${PKGDIR}/Packages index.
34 >
35 > It is not necessary to migrate an existing PKGDIR to the new layout,
36 > since portage is capable of working with a mixed PKGDIR layout, where
37 > packages using the old layout are allowed to remain in-place.
38 >
39 > There is currently no automated way to prune old builds from PKGDIR,
40 > although it is possible to remove packages manually, and then run
41 > 'emaint --fix binhost' update the ${PKGDIR}/Packages index. Support
42 > for FEATURES=binpkg-multi-instance is planned for eclean-pkg.
43 >
44 > X-Gentoo-Bug: 150031
45 > X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=150031
46 > ---
47 > bin/quickpkg | 1 -
48 > man/make.conf.5 | 27 +
49 > pym/_emerge/Binpkg.py | 33 +-
50 > pym/_emerge/BinpkgFetcher.py | 13 +-
51 > pym/_emerge/BinpkgVerifier.py | 6 +-
52 > pym/_emerge/EbuildBinpkg.py | 9 +-
53 > pym/_emerge/EbuildBuild.py | 36 +-
54 > pym/_emerge/Package.py | 67 +-
55 > pym/_emerge/Scheduler.py | 6 +-
56 > pym/_emerge/clear_caches.py | 1 -
57 > pym/_emerge/resolver/output.py | 21 +-
58 > pym/portage/const.py | 2 +
59 > pym/portage/dbapi/__init__.py | 10 +-
60 > pym/portage/dbapi/bintree.py | 842
61 > +++++++++++----------
62 > pym/portage/dbapi/vartree.py | 8 +-
63 > pym/portage/dbapi/virtual.py | 113 ++-
64 > pym/portage/emaint/modules/binhost/binhost.py | 47 +-
65 > pym/portage/package/ebuild/config.py | 3 +-
66 > pym/portage/tests/resolver/ResolverPlayground.py | 26
67 > +- .../resolver/binpkg_multi_instance/__init__.py | 2
68 > + .../resolver/binpkg_multi_instance/__test__.py | 2
69 > + .../binpkg_multi_instance/test_rebuilt_binaries.py | 101 +++
70 > pym/portage/versions.py | 48 +- 23 files
71 > changed, 932 insertions(+), 492 deletions(-) create mode 100644
72 >
73 >
74
75
76 overall, there is no way I know the code well enough to know if you
77 screwed up. But the code looks decent, so...
78
79 My only questions are:
80
81 pym/portage/dbapi/bintree.py:
82
83 You removed several functions from the binarytree class and essentially
84 reduced prevent_collision to a warning message. Can you briefly say
85 why they are not needed please.
86
87 _populate() ==> it is some 500+ LOC nasty. From what I can see I
88 think you added slightly more loc than you deleted/changed. While I
89 don't expect a breakup of this function to be directly a part of
90 this commit.
91
92 IT IS BADLY NEEDED.
93
94 I'd like to see this function properly split into pieces and act as
95 a driver for the smaller tasks. Currently it is a mess of nested
96 if/else, for,... that is extremely difficult to keep straight and
97 make logic changes to. It's almost as bad as repomans 1000+ LOC
98 main loop. Why "if TRUE:" <== just fix the indent... At the same
99 time, I noticed _ensure_dirs, _file_permissions functions defined in
100 that class. Shouldn't these just be util functions available
101 everywhere.
102
103
104 pym/portage/versions.py
105
106 class _pkg_str(_unicode)
107
108 in __init__()
109
110 if build_time is not None:
111 try:
112 build_time = long(build_time)
113 except ValueError:
114 if build_time:
115 build_time = -1
116 else:
117 build_time = 0
118 if build_id is not None:
119 try:
120 build_id = long(build_id)
121 except ValueError:
122 if build_id:
123 build_id = -1
124 else:
125 build_id = None
126 if file_size is not None:
127 try:
128 file_size = long(file_size)
129 except ValueError:
130 if file_size:
131 file_size = -1
132 else:
133 file_size = None
134 if mtime is not None:
135 try:
136 mtime = long(mtime)
137 except ValueError:
138 if mtime:
139 mtime = -1
140 else:
141 mtime = None
142
143
144 I hate repeating code. This can be done using one universal small
145 function and will clean up the __init__()
146
147 @static_method
148 def _long(var, default):
149 if var is not None:
150 try:
151 var = long(var)
152 except ValueError:
153 if var:
154 var = -1
155 else:
156 var = default
157 return var
158
159
160
161 --
162 Brian Dolbec <dolsen>

Replies