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 57C92138350 for ; Sat, 2 May 2020 23:28:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7BAD6E08F7; Sat, 2 May 2020 23:28:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 4C1A0E08F7 for ; Sat, 2 May 2020 23:28:56 +0000 (UTC) Date: Sat, 2 May 2020 16:28:42 -0700 From: Brian Dolbec To: gentoo-catalyst@lists.gentoo.org Subject: Re: [gentoo-catalyst] [PATCH 8/8] catalyst: Replace target_portdir with repo_basedir+repo_name Message-ID: <20200502162842.372ab7ea@storm> In-Reply-To: <20200502014036.1039317-8-mattst88@gentoo.org> References: <20200502014036.1039317-1-mattst88@gentoo.org> <20200502014036.1039317-8-mattst88@gentoo.org> X-Mailer: Claws Mail 3.17.5 (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: c630369a-7732-4f50-98c9-23573e9bfc1e X-Archives-Hash: d1ae3fcf79120188e6cf4ada998b4d9a On Fri, 1 May 2020 18:40:36 -0700 Matt Turner wrote: > Signed-off-by: Matt Turner > --- Thank you for revesing that. I have been trying to get away from legacy use of/meaning of portdir. Plus I would like to get catlyst code as bullet-proof/future-proof as possible. In this way, it would become easy and logical for derivative distros to re-use and even contribute back to it's maintenance. I would also like to change the use of 'portdir' as the variable name in self.mount and other locations in the future. There are too many legacy references with different meanings that go along with it. looks good :) > catalyst/base/stagebase.py | 12 +++++++++--- > catalyst/defaults.py | 2 +- > doc/catalyst-config.5.txt | 10 +++++----- > targets/stage2/chroot.sh | 2 +- > targets/support/livecdfs-update.sh | 2 +- > 5 files changed, 17 insertions(+), 11 deletions(-) > > diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py > index 7c82029a..ee57d2de 100644 > --- a/catalyst/base/stagebase.py > +++ b/catalyst/base/stagebase.py > @@ -192,7 +192,7 @@ class StageBase(TargetBase, ClearBase, GenBase): > self.mount = MOUNT_DEFAULTS.copy() > > self.mount['portdir']['source'] = self.snapshot > - self.mount['portdir']['target'] = > self.settings['target_portdir'] > + self.mount['portdir']['target'] = > self.settings['repo_basedir'] + '/' + self.settings['repo_name'] > self.mount['distdir']['source'] = self.settings['distdir'] > self.mount["distdir"]['target'] = self.settings['target_distdir'] > @@ -803,7 +803,8 @@ class StageBase(TargetBase, ClearBase, GenBase): > make_profile = Path(self.settings['chroot_path'] + > self.settings['port_conf'], 'make.profile') > make_profile.unlink() > - make_profile.symlink_to(Path('../..' + > self.settings['target_portdir'], > + make_profile.symlink_to(Path('../..' + > self.settings['repo_basedir'], > + self.settings['repo_name'], > 'profiles', > self.settings['target_profile']), > target_is_directory=True) > @@ -1056,7 +1057,12 @@ class StageBase(TargetBase, ClearBase, > GenBase): ' '.join(myuseexpandvars[hostuseexpand]) + '"\n') > > # Write non-default PORTDIR/DISTDIR/PKGDIR settings to > make.conf > - for x in ['target_portdir', 'target_distdir', > 'target_pkgdir']: > + if (self.settings['repo_basedir'], > self.settings['repo_name']) != \ > + (confdefaults['repo_basedir'], > confdefaults['repo_name']): > + myf.write('PORTDIR="%s/%s"\n' % > (self.settings['repo_basedir'], > + > self.settings['repo_name'])) + > + for x in ['target_distdir', 'target_pkgdir']: > if self.settings[x] != confdefaults[x]: > varname = x.split('_')[1].upper() > myf.write(f'{varname}="{self.settings[x]}"\n') > diff --git a/catalyst/defaults.py b/catalyst/defaults.py > index bbefa3a8..9d5771d5 100644 > --- a/catalyst/defaults.py > +++ b/catalyst/defaults.py > @@ -65,6 +65,7 @@ confdefaults = { > "pkgdir": "/var/cache/binpkgs", > "port_tmpdir": "/var/tmp/portage", > "PythonDir": "./catalyst", > + "repo_basedir": "/var/db/repos", > "repo_name": "gentoo", > "repos": "%(storedir)s/repos", > "sharedir": "/usr/share/catalyst", > @@ -73,7 +74,6 @@ confdefaults = { > "storedir": "/var/tmp/catalyst", > "target_distdir": "/var/cache/distfiles", > "target_pkgdir": "/var/cache/binpkgs", > - "target_portdir": "/var/db/repos/gentoo", > } > > DEFAULT_CONFIG_FILE = '/etc/catalyst/catalyst.conf' > diff --git a/doc/catalyst-config.5.txt b/doc/catalyst-config.5.txt > index 11b27d90..d5444b38 100644 > --- a/doc/catalyst-config.5.txt > +++ b/doc/catalyst-config.5.txt > @@ -108,6 +108,11 @@ Defaults to the host's DISTDIR. > The directory in which git repositories exist for use by the > snapshot target. Defaults to `${storedir}/repos`. > > +*repo_basedir*:: > +The target repository directory to contain the primary repo (e.g., > +gentoo repo) and any overlays. The default location is > +`/var/db/repos`. > + > *repo_name*:: > The name of the main repository (e.g. gentoo). The git repository at > `${repos}/${repo_name}.git` will be used to produce the portdir sqfs > @@ -123,11 +128,6 @@ Defines the location of binary packages in the > target. This will be written to the target's make.conf if it is not > the default value of `/var/cache/binpkgs`. > > -*target_portdir*:: > -Defines the location of the main ebuild repository in the target. > -This will be written to the target's make.conf if it is not the > -default value of `/var/db/repos/gentoo`. > - > Other settings > ~~~~~~~~~~~~~~ > > diff --git a/targets/stage2/chroot.sh b/targets/stage2/chroot.sh > index aac9a92d..bf98d328 100755 > --- a/targets/stage2/chroot.sh > +++ b/targets/stage2/chroot.sh > @@ -9,7 +9,7 @@ export CONFIG_PROTECT="-* /etc/locale.gen" > echo "$locales" > /etc/locale.gen > > ## START BUILD > -${clst_target_portdir}/scripts/bootstrap.sh ${bootstrap_opts} || > exit 1 +${clst_repo_basedir}/${clst_repo_name}/scripts/bootstrap.sh > ${bootstrap_opts} || exit 1 > # Replace modified /etc/locale.gen with default > etc-update --automode -5 > diff --git a/targets/support/livecdfs-update.sh > b/targets/support/livecdfs-update.sh index 8297e60d..b1049671 100755 > --- a/targets/support/livecdfs-update.sh > +++ b/targets/support/livecdfs-update.sh > @@ -257,7 +257,7 @@ case ${clst_livecd_type} in > USE="-* $(cat /var/db/pkg/sys-libs/glibc*/USE)" > emerge -eqp @system | grep -e '^\[ebuild' | sed -e 's:^\[ebuild .\+\] > ::' -e 's: .\+$::' > /usr/livecd/systempkgs.txt # This is my hack to > reduce tmpfs usage > - cp -r ${clst_target_portdir}/{profiles,eclass} > /usr/livecd > + cp -r > ${clst_repo_basedir}/${clst_repo_name}/{profiles,eclass} /usr/livecd > rm -rf > /usr/livecd/profiles/{co*,default-{1*,a*,b*,d*,h*,i*,m*,p*,s*,x*},g*,hardened-*,n*,x*} > mv -f /etc/gconf /usr/livecd ln -sf /usr/livecd/gconf /etc/gconf