1 |
On Fri, 30 Oct 2020 12:07:56 -0400 |
2 |
Matt Turner <mattst88@g.o> wrote: |
3 |
|
4 |
> On Sun, Oct 18, 2020 at 11:15 AM Felix Bier |
5 |
> <Felix.Bier@×××××××××××××.com> wrote: |
6 |
> > |
7 |
> > This commit fixes the following issues: |
8 |
> > |
9 |
> > * The PORTDIR_OVERLAY variable has been deprecated by Gentoo. |
10 |
> > |
11 |
> > With this commit, the variable is no longer written to the |
12 |
> > generated make.conf. Instead, a config file |
13 |
> > /etc/portage/repos.conf/<repo-name>.conf |
14 |
> > is generated for each overlay. The repo name is read from the |
15 |
> > overlay using the portage API. Internally, portage parses |
16 |
> > metadata/layout.conf and profiles/repo_name to obtain the name. |
17 |
> > |
18 |
> > References: |
19 |
> > https://wiki.gentoo.org/wiki//etc/portage/make.conf |
20 |
> > https://wiki.gentoo.org/wiki//etc/portage/repos.conf |
21 |
> > |
22 |
> > * All overlays were copied into the same target directory. If the |
23 |
> > same file name occurred in multiple overlays, the last overlay |
24 |
> > would overwrite all previous files with this name. In |
25 |
> > particular, only the metadata/layout.conf of the last overlay was |
26 |
> > retained, so it was not possible to reference the other overlays |
27 |
> > e.g. via the masters entry in the layout.conf or the portage-2 |
28 |
> > syntax for specifying a parent profile from another overlay. Also, |
29 |
> > this created problems when the overlays contained ebuilds |
30 |
> > for the same package, but with differing versions, because |
31 |
> > after copying, the target directory contained both versions of |
32 |
> > the ebuild but only the manifest file of the last overlay. |
33 |
> > |
34 |
> > With this commit, each overlay is copied into a separate |
35 |
> > sub-directory, e.g. /var/gentoo/repos/local/<repo-name>/. |
36 |
> |
37 |
> I see this /var/gentoo/repos path used as an example in a few places |
38 |
> but not actually in any code. I think our example should match the |
39 |
> default structure these days, e.g., /var/db/repos/<repo-name>. |
40 |
> |
41 |
> > This directory is referenced via the location entry in the |
42 |
> > generated /etc/portage/repos.conf/<repo-name>.conf. |
43 |
> > --- |
44 |
> > catalyst/base/stagebase.py | 72 |
45 |
> > ++++++++++++++++++++++++++++---------- catalyst/defaults.py | |
46 |
> > + |
47 |
> > + def get_overlay_location(self, repo_name): |
48 |
> > + """ Construct overlay repo path: |
49 |
> > /var/gentoo/repos/local/{name} """ |
50 |
> > + return |
51 |
> > normpath(os.path.join(self.settings['local_overlay'], repo_name)) + |
52 |
> > + def write_repo_conf(self, repo_name, config): |
53 |
> > + """ Write ConfigParser to |
54 |
> > {chroot}/etc/portage/repo.conf/{name}.conf """ |
55 |
> > + repo_conf = self.get_repo_conf_path(repo_name) |
56 |
> > + chroot_repo_conf = self.settings['chroot_path'] + repo_conf |
57 |
> > + log.info('Creating repo config %s.', chroot_repo_conf) |
58 |
> > + ensure_dirs(os.path.dirname(chroot_repo_conf)) |
59 |
> |
60 |
> Same thing: I'd rather use pathlib and use Path.mkdir and not add new |
61 |
> uses of ensure_dirs. |
62 |
> |
63 |
> > + |
64 |
> > + try: |
65 |
> > + with open(chroot_repo_conf, 'w') as myf: |
66 |
> |
67 |
> Let's rename myf. The 'my' prefix pattern in catalyst is not a good |
68 |
> one. Even just 'f' or 'file' would be better, IMO. |
69 |
> |
70 |
|
71 |
file is a python reserved word, use _file or some other variant to not |
72 |
re-assign the python file definition. |