Gentoo Archives: gentoo-catalyst

From: Matt Turner <mattst88@g.o>
To: gentoo-catalyst@l.g.o
Cc: Matt Turner <mattst88@g.o>
Subject: [gentoo-catalyst] [PATCH 8/8] catalyst: Replace target_portdir with repo_basedir+repo_name
Date: Sat, 02 May 2020 01:41:03
Message-Id: 20200502014036.1039317-8-mattst88@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 1/8] targets: Use gensquashfs instead of mksquashfs by Matt Turner
1 Signed-off-by: Matt Turner <mattst88@g.o>
2 ---
3 catalyst/base/stagebase.py | 12 +++++++++---
4 catalyst/defaults.py | 2 +-
5 doc/catalyst-config.5.txt | 10 +++++-----
6 targets/stage2/chroot.sh | 2 +-
7 targets/support/livecdfs-update.sh | 2 +-
8 5 files changed, 17 insertions(+), 11 deletions(-)
9
10 diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
11 index 7c82029a..ee57d2de 100644
12 --- a/catalyst/base/stagebase.py
13 +++ b/catalyst/base/stagebase.py
14 @@ -192,7 +192,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
15 self.mount = MOUNT_DEFAULTS.copy()
16
17 self.mount['portdir']['source'] = self.snapshot
18 - self.mount['portdir']['target'] = self.settings['target_portdir']
19 + self.mount['portdir']['target'] = self.settings['repo_basedir'] + '/' + self.settings['repo_name']
20 self.mount['distdir']['source'] = self.settings['distdir']
21 self.mount["distdir"]['target'] = self.settings['target_distdir']
22
23 @@ -803,7 +803,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
24 make_profile = Path(self.settings['chroot_path'] + self.settings['port_conf'],
25 'make.profile')
26 make_profile.unlink()
27 - make_profile.symlink_to(Path('../..' + self.settings['target_portdir'],
28 + make_profile.symlink_to(Path('../..' + self.settings['repo_basedir'],
29 + self.settings['repo_name'],
30 'profiles',
31 self.settings['target_profile']),
32 target_is_directory=True)
33 @@ -1056,7 +1057,12 @@ class StageBase(TargetBase, ClearBase, GenBase):
34 ' '.join(myuseexpandvars[hostuseexpand]) + '"\n')
35
36 # Write non-default PORTDIR/DISTDIR/PKGDIR settings to make.conf
37 - for x in ['target_portdir', 'target_distdir', 'target_pkgdir']:
38 + if (self.settings['repo_basedir'], self.settings['repo_name']) != \
39 + (confdefaults['repo_basedir'], confdefaults['repo_name']):
40 + myf.write('PORTDIR="%s/%s"\n' % (self.settings['repo_basedir'],
41 + self.settings['repo_name']))
42 +
43 + for x in ['target_distdir', 'target_pkgdir']:
44 if self.settings[x] != confdefaults[x]:
45 varname = x.split('_')[1].upper()
46 myf.write(f'{varname}="{self.settings[x]}"\n')
47 diff --git a/catalyst/defaults.py b/catalyst/defaults.py
48 index bbefa3a8..9d5771d5 100644
49 --- a/catalyst/defaults.py
50 +++ b/catalyst/defaults.py
51 @@ -65,6 +65,7 @@ confdefaults = {
52 "pkgdir": "/var/cache/binpkgs",
53 "port_tmpdir": "/var/tmp/portage",
54 "PythonDir": "./catalyst",
55 + "repo_basedir": "/var/db/repos",
56 "repo_name": "gentoo",
57 "repos": "%(storedir)s/repos",
58 "sharedir": "/usr/share/catalyst",
59 @@ -73,7 +74,6 @@ confdefaults = {
60 "storedir": "/var/tmp/catalyst",
61 "target_distdir": "/var/cache/distfiles",
62 "target_pkgdir": "/var/cache/binpkgs",
63 - "target_portdir": "/var/db/repos/gentoo",
64 }
65
66 DEFAULT_CONFIG_FILE = '/etc/catalyst/catalyst.conf'
67 diff --git a/doc/catalyst-config.5.txt b/doc/catalyst-config.5.txt
68 index 11b27d90..d5444b38 100644
69 --- a/doc/catalyst-config.5.txt
70 +++ b/doc/catalyst-config.5.txt
71 @@ -108,6 +108,11 @@ Defaults to the host's DISTDIR.
72 The directory in which git repositories exist for use by the snapshot target.
73 Defaults to `${storedir}/repos`.
74
75 +*repo_basedir*::
76 +The target repository directory to contain the primary repo (e.g.,
77 +gentoo repo) and any overlays. The default location is
78 +`/var/db/repos`.
79 +
80 *repo_name*::
81 The name of the main repository (e.g. gentoo). The git repository at
82 `${repos}/${repo_name}.git` will be used to produce the portdir sqfs
83 @@ -123,11 +128,6 @@ Defines the location of binary packages in the target. This will be
84 written to the target's make.conf if it is not the default value of
85 `/var/cache/binpkgs`.
86
87 -*target_portdir*::
88 -Defines the location of the main ebuild repository in the target.
89 -This will be written to the target's make.conf if it is not the
90 -default value of `/var/db/repos/gentoo`.
91 -
92 Other settings
93 ~~~~~~~~~~~~~~
94
95 diff --git a/targets/stage2/chroot.sh b/targets/stage2/chroot.sh
96 index aac9a92d..bf98d328 100755
97 --- a/targets/stage2/chroot.sh
98 +++ b/targets/stage2/chroot.sh
99 @@ -9,7 +9,7 @@ export CONFIG_PROTECT="-* /etc/locale.gen"
100 echo "$locales" > /etc/locale.gen
101
102 ## START BUILD
103 -${clst_target_portdir}/scripts/bootstrap.sh ${bootstrap_opts} || exit 1
104 +${clst_repo_basedir}/${clst_repo_name}/scripts/bootstrap.sh ${bootstrap_opts} || exit 1
105
106 # Replace modified /etc/locale.gen with default
107 etc-update --automode -5
108 diff --git a/targets/support/livecdfs-update.sh b/targets/support/livecdfs-update.sh
109 index 8297e60d..b1049671 100755
110 --- a/targets/support/livecdfs-update.sh
111 +++ b/targets/support/livecdfs-update.sh
112 @@ -257,7 +257,7 @@ case ${clst_livecd_type} in
113 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
114
115 # This is my hack to reduce tmpfs usage
116 - cp -r ${clst_target_portdir}/{profiles,eclass} /usr/livecd
117 + cp -r ${clst_repo_basedir}/${clst_repo_name}/{profiles,eclass} /usr/livecd
118 rm -rf /usr/livecd/profiles/{co*,default-{1*,a*,b*,d*,h*,i*,m*,p*,s*,x*},g*,hardened-*,n*,x*}
119 mv -f /etc/gconf /usr/livecd
120 ln -sf /usr/livecd/gconf /etc/gconf
121 --
122 2.26.2

Replies