Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] [PATCH 8/8] catalyst: Replace target_portdir with repo_basedir+repo_name
Date: Sat, 02 May 2020 23:28:57
Message-Id: 20200502162842.372ab7ea@storm
In Reply to: [gentoo-catalyst] [PATCH 8/8] catalyst: Replace target_portdir with repo_basedir+repo_name by Matt Turner
1 On Fri, 1 May 2020 18:40:36 -0700
2 Matt Turner <mattst88@g.o> wrote:
3
4 > Signed-off-by: Matt Turner <mattst88@g.o>
5 > ---
6
7
8
9 Thank you for revesing that. I have been trying to get away from
10 legacy use of/meaning of portdir. Plus I would like to get catlyst
11 code as bullet-proof/future-proof as possible. In this way, it would
12 become easy and logical for derivative distros to re-use and even
13 contribute back to it's maintenance.
14
15 I would also like to change the use of 'portdir' as the variable name
16 in self.mount and other locations in the future. There are too many
17 legacy references with different meanings that go along with it.
18
19 looks good :)
20
21
22 > catalyst/base/stagebase.py | 12 +++++++++---
23 > catalyst/defaults.py | 2 +-
24 > doc/catalyst-config.5.txt | 10 +++++-----
25 > targets/stage2/chroot.sh | 2 +-
26 > targets/support/livecdfs-update.sh | 2 +-
27 > 5 files changed, 17 insertions(+), 11 deletions(-)
28 >
29 > diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
30 > index 7c82029a..ee57d2de 100644
31 > --- a/catalyst/base/stagebase.py
32 > +++ b/catalyst/base/stagebase.py
33 > @@ -192,7 +192,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
34 > self.mount = MOUNT_DEFAULTS.copy()
35 >
36 > self.mount['portdir']['source'] = self.snapshot
37 > - self.mount['portdir']['target'] =
38 > self.settings['target_portdir']
39 > + self.mount['portdir']['target'] =
40 > self.settings['repo_basedir'] + '/' + self.settings['repo_name']
41 > self.mount['distdir']['source'] = self.settings['distdir']
42 > self.mount["distdir"]['target'] = self.settings['target_distdir']
43 > @@ -803,7 +803,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
44 > make_profile = Path(self.settings['chroot_path'] +
45 > self.settings['port_conf'], 'make.profile')
46 > make_profile.unlink()
47 > - make_profile.symlink_to(Path('../..' +
48 > self.settings['target_portdir'],
49 > + make_profile.symlink_to(Path('../..' +
50 > self.settings['repo_basedir'],
51 > + self.settings['repo_name'],
52 > 'profiles',
53 > self.settings['target_profile']),
54 > target_is_directory=True)
55 > @@ -1056,7 +1057,12 @@ class StageBase(TargetBase, ClearBase,
56 > GenBase): ' '.join(myuseexpandvars[hostuseexpand]) + '"\n')
57 >
58 > # Write non-default PORTDIR/DISTDIR/PKGDIR settings to
59 > make.conf
60 > - for x in ['target_portdir', 'target_distdir',
61 > 'target_pkgdir']:
62 > + if (self.settings['repo_basedir'],
63 > self.settings['repo_name']) != \
64 > + (confdefaults['repo_basedir'],
65 > confdefaults['repo_name']):
66 > + myf.write('PORTDIR="%s/%s"\n' %
67 > (self.settings['repo_basedir'],
68 > +
69 > self.settings['repo_name'])) +
70 > + for x in ['target_distdir', 'target_pkgdir']:
71 > if self.settings[x] != confdefaults[x]:
72 > varname = x.split('_')[1].upper()
73 > myf.write(f'{varname}="{self.settings[x]}"\n')
74 > diff --git a/catalyst/defaults.py b/catalyst/defaults.py
75 > index bbefa3a8..9d5771d5 100644
76 > --- a/catalyst/defaults.py
77 > +++ b/catalyst/defaults.py
78 > @@ -65,6 +65,7 @@ confdefaults = {
79 > "pkgdir": "/var/cache/binpkgs",
80 > "port_tmpdir": "/var/tmp/portage",
81 > "PythonDir": "./catalyst",
82 > + "repo_basedir": "/var/db/repos",
83 > "repo_name": "gentoo",
84 > "repos": "%(storedir)s/repos",
85 > "sharedir": "/usr/share/catalyst",
86 > @@ -73,7 +74,6 @@ confdefaults = {
87 > "storedir": "/var/tmp/catalyst",
88 > "target_distdir": "/var/cache/distfiles",
89 > "target_pkgdir": "/var/cache/binpkgs",
90 > - "target_portdir": "/var/db/repos/gentoo",
91 > }
92 >
93 > DEFAULT_CONFIG_FILE = '/etc/catalyst/catalyst.conf'
94 > diff --git a/doc/catalyst-config.5.txt b/doc/catalyst-config.5.txt
95 > index 11b27d90..d5444b38 100644
96 > --- a/doc/catalyst-config.5.txt
97 > +++ b/doc/catalyst-config.5.txt
98 > @@ -108,6 +108,11 @@ Defaults to the host's DISTDIR.
99 > The directory in which git repositories exist for use by the
100 > snapshot target. Defaults to `${storedir}/repos`.
101 >
102 > +*repo_basedir*::
103 > +The target repository directory to contain the primary repo (e.g.,
104 > +gentoo repo) and any overlays. The default location is
105 > +`/var/db/repos`.
106 > +
107 > *repo_name*::
108 > The name of the main repository (e.g. gentoo). The git repository at
109 > `${repos}/${repo_name}.git` will be used to produce the portdir sqfs
110 > @@ -123,11 +128,6 @@ Defines the location of binary packages in the
111 > target. This will be written to the target's make.conf if it is not
112 > the default value of `/var/cache/binpkgs`.
113 >
114 > -*target_portdir*::
115 > -Defines the location of the main ebuild repository in the target.
116 > -This will be written to the target's make.conf if it is not the
117 > -default value of `/var/db/repos/gentoo`.
118 > -
119 > Other settings
120 > ~~~~~~~~~~~~~~
121 >
122 > diff --git a/targets/stage2/chroot.sh b/targets/stage2/chroot.sh
123 > index aac9a92d..bf98d328 100755
124 > --- a/targets/stage2/chroot.sh
125 > +++ b/targets/stage2/chroot.sh
126 > @@ -9,7 +9,7 @@ export CONFIG_PROTECT="-* /etc/locale.gen"
127 > echo "$locales" > /etc/locale.gen
128 >
129 > ## START BUILD
130 > -${clst_target_portdir}/scripts/bootstrap.sh ${bootstrap_opts} ||
131 > exit 1 +${clst_repo_basedir}/${clst_repo_name}/scripts/bootstrap.sh
132 > ${bootstrap_opts} || exit 1
133 > # Replace modified /etc/locale.gen with default
134 > etc-update --automode -5
135 > diff --git a/targets/support/livecdfs-update.sh
136 > b/targets/support/livecdfs-update.sh index 8297e60d..b1049671 100755
137 > --- a/targets/support/livecdfs-update.sh
138 > +++ b/targets/support/livecdfs-update.sh
139 > @@ -257,7 +257,7 @@ case ${clst_livecd_type} in
140 > USE="-* $(cat /var/db/pkg/sys-libs/glibc*/USE)"
141 > emerge -eqp @system | grep -e '^\[ebuild' | sed -e 's:^\[ebuild .\+\]
142 > ::' -e 's: .\+$::' > /usr/livecd/systempkgs.txt # This is my hack to
143 > reduce tmpfs usage
144 > - cp -r ${clst_target_portdir}/{profiles,eclass}
145 > /usr/livecd
146 > + cp -r
147 > ${clst_repo_basedir}/${clst_repo_name}/{profiles,eclass} /usr/livecd
148 > rm -rf
149 > /usr/livecd/profiles/{co*,default-{1*,a*,b*,d*,h*,i*,m*,p*,s*,x*},g*,hardened-*,n*,x*}
150 > mv -f /etc/gconf /usr/livecd ln -sf /usr/livecd/gconf /etc/gconf