From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A896A138359 for ; Sat, 31 Oct 2020 21:24:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CE202E0833; Sat, 31 Oct 2020 21:24:58 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B14B6E0833 for ; Sat, 31 Oct 2020 21:24:58 +0000 (UTC) Date: Sat, 31 Oct 2020 17:24:33 -0400 From: Brian Dolbec To: gentoo-catalyst@lists.gentoo.org Subject: Re: [gentoo-catalyst] Re: [PATCH 2/2] Move from PORTDIR_OVERLAY to repos.conf Message-ID: <20201031172433.22881e93@rogue1> In-Reply-To: References: <914cce4739709511771f27bed773c7e4e01c3c9a.camel@rohde-schwarz.com> X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archives-Salt: 3ee278b1-37bd-48e3-8c7b-44018dc31419 X-Archives-Hash: eeae387d05cbc0fbf0c934843b805a2e On Fri, 30 Oct 2020 12:07:56 -0400 Matt Turner wrote: > On Sun, Oct 18, 2020 at 11:15 AM Felix Bier > wrote: > > > > This commit fixes the following issues: > > > > * The PORTDIR_OVERLAY variable has been deprecated by Gentoo. > > > > With this commit, the variable is no longer written to the > > generated make.conf. Instead, a config file > > /etc/portage/repos.conf/.conf > > is generated for each overlay. The repo name is read from the > > overlay using the portage API. Internally, portage parses > > metadata/layout.conf and profiles/repo_name to obtain the name. > > > > References: > > https://wiki.gentoo.org/wiki//etc/portage/make.conf > > https://wiki.gentoo.org/wiki//etc/portage/repos.conf > > > > * All overlays were copied into the same target directory. If the > > same file name occurred in multiple overlays, the last overlay > > would overwrite all previous files with this name. In > > particular, only the metadata/layout.conf of the last overlay was > > retained, so it was not possible to reference the other overlays > > e.g. via the masters entry in the layout.conf or the portage-2 > > syntax for specifying a parent profile from another overlay. Also, > > this created problems when the overlays contained ebuilds > > for the same package, but with differing versions, because > > after copying, the target directory contained both versions of > > the ebuild but only the manifest file of the last overlay. > > > > With this commit, each overlay is copied into a separate > > sub-directory, e.g. /var/gentoo/repos/local//. > > I see this /var/gentoo/repos path used as an example in a few places > but not actually in any code. I think our example should match the > default structure these days, e.g., /var/db/repos/. > > > This directory is referenced via the location entry in the > > generated /etc/portage/repos.conf/.conf. > > --- > > catalyst/base/stagebase.py | 72 > > ++++++++++++++++++++++++++++---------- catalyst/defaults.py | > > + > > + def get_overlay_location(self, repo_name): > > + """ Construct overlay repo path: > > /var/gentoo/repos/local/{name} """ > > + return > > normpath(os.path.join(self.settings['local_overlay'], repo_name)) + > > + def write_repo_conf(self, repo_name, config): > > + """ Write ConfigParser to > > {chroot}/etc/portage/repo.conf/{name}.conf """ > > + repo_conf = self.get_repo_conf_path(repo_name) > > + chroot_repo_conf = self.settings['chroot_path'] + repo_conf > > + log.info('Creating repo config %s.', chroot_repo_conf) > > + ensure_dirs(os.path.dirname(chroot_repo_conf)) > > Same thing: I'd rather use pathlib and use Path.mkdir and not add new > uses of ensure_dirs. > > > + > > + try: > > + with open(chroot_repo_conf, 'w') as myf: > > Let's rename myf. The 'my' prefix pattern in catalyst is not a good > one. Even just 'f' or 'file' would be better, IMO. > file is a python reserved word, use _file or some other variant to not re-assign the python file definition.