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 2/7] catalyst: Remove set_dest_path()
Date: Sun, 20 Dec 2020 02:28:56
Message-Id: 20201220022848.249207-2-mattst88@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 1/7] catalyst: Set stage_path = chroot_path + root_path by Matt Turner
1 root_path is always set, so half of this function was dead. The other
2 half set the same thing as set_stage_path().
3
4 Signed-off-by: Matt Turner <mattst88@g.o>
5 ---
6 catalyst/base/stagebase.py | 20 ++++++--------------
7 targets/support/target_image_setup.sh | 4 ++--
8 2 files changed, 8 insertions(+), 16 deletions(-)
9
10 diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
11 index ba6b1a1b..ed4d1227 100644
12 --- a/catalyst/base/stagebase.py
13 +++ b/catalyst/base/stagebase.py
14 @@ -154,7 +154,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
15 self.set_source_path()
16 self.set_chroot_path()
17 self.set_autoresume_path()
18 - self.set_dest_path()
19 self.set_stage_path()
20 self.set_target_path()
21
22 @@ -426,13 +425,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
23 self.generate_hash(self.settings["source_path"], "sha1")
24 log.notice('Source path set to %s', self.settings['source_path'])
25
26 - def set_dest_path(self):
27 - if "root_path" in self.settings:
28 - self.settings["destpath"] = normpath(self.settings["chroot_path"] +
29 - self.settings["root_path"])
30 - else:
31 - self.settings["destpath"] = normpath(self.settings["chroot_path"])
32 -
33 def set_cleanables(self):
34 self.settings['cleanables'] = [
35 "/etc/resolv.conf",
36 @@ -845,7 +837,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
37 "/root_overlay"]:
38 if os.path.exists(x):
39 log.info('Copying root_overlay: %s', x)
40 - cmd(['rsync', '-a', x + '/', self.settings['destpath']],
41 + cmd(['rsync', '-a', x + '/', self.settings['stage_path']],
42 env=self.env)
43
44 def bind(self):
45 @@ -1095,7 +1087,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
46 else:
47 for x in self.settings["cleanables"]:
48 log.notice('Cleaning chroot: %s', x)
49 - clear_path(normpath(self.settings["destpath"] + x))
50 + clear_path(normpath(self.settings["stage_path"] + x))
51
52 # Put /etc/hosts back into place
53 hosts_file = self.settings['chroot_path'] + '/etc/hosts'
54 @@ -1119,14 +1111,14 @@ class StageBase(TargetBase, ClearBase, GenBase):
55 log.debug("clean(), portage_preix = %s, no sticky-config",
56 self.settings["portage_prefix"])
57 for _dir in "package.accept_keywords", "package.keywords", "package.mask", "package.unmask", "package.use", "package.env", "env":
58 - target = pjoin(self.settings["destpath"],
59 + target = pjoin(self.settings["stage_path"],
60 "etc/portage/%s" % _dir,
61 self.settings["portage_prefix"])
62 log.notice("Clearing portage_prefix target: %s", target)
63 clear_path(target)
64
65 # Remove hacks that should *never* go into stages
66 - target = pjoin(self.settings["destpath"], "etc/portage/patches")
67 + target = pjoin(self.settings["stage_path"], "etc/portage/patches")
68 if os.path.exists(target):
69 log.warning("You've been hacking. Clearing target patches: %s", target)
70 clear_path(target)
71 @@ -1172,7 +1164,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
72 self.settings[self.settings["spec_prefix"] +
73 "/empty"].split()
74 for x in self.settings[self.settings["spec_prefix"] + "/empty"]:
75 - myemp = self.settings["destpath"] + x
76 + myemp = self.settings["stage_path"] + x
77 if not os.path.isdir(myemp) or os.path.islink(myemp):
78 log.warning('not a directory or does not exist, '
79 'skipping "empty" operation: %s', x)
80 @@ -1192,7 +1184,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
81 # We're going to shell out for all these cleaning
82 # operations, so we get easy glob handling.
83 log.notice('%s: removing %s', self.settings["spec_prefix"], x)
84 - clear_path(self.settings["destpath"] + x)
85 + clear_path(self.settings["stage_path"] + x)
86 try:
87 if os.path.exists(self.settings["controller_file"]):
88 cmd([self.settings['controller_file'], 'clean'],
89 diff --git a/targets/support/target_image_setup.sh b/targets/support/target_image_setup.sh
90 index fdc4a234..f9427eaf 100755
91 --- a/targets/support/target_image_setup.sh
92 +++ b/targets/support/target_image_setup.sh
93 @@ -7,11 +7,11 @@ mkdir -p "${1}"
94 echo "Creating ${clst_fstype} filesystem"
95 case ${clst_fstype} in
96 squashfs)
97 - gensquashfs -D "${clst_destpath}" -q ${clst_fsops} "${1}/image.squashfs" \
98 + gensquashfs -D "${clst_stage_path}" -q ${clst_fsops} "${1}/image.squashfs" \
99 || die "Failed to create squashfs filesystem"
100 ;;
101 jffs2)
102 - mkfs.jffs2 --root="${clst_destpath}" --output="${1}/image.jffs" "${clst_fsops}" \
103 + mkfs.jffs2 --root="${clst_stage_path}" --output="${1}/image.jffs" "${clst_fsops}" \
104 || die "Failed to create jffs2 filesystem"
105 ;;
106 esac
107 --
108 2.26.2