summaryrefslogtreecommitdiff
blob: 413235f46afa7f6d786b9fd459ef852331455d94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
diff -Nur catalyst-2.0.12.1.orig/arch/x86.py catalyst-2.0.12.1/arch/x86.py
--- catalyst-2.0.12.1.orig/arch/x86.py	2012-11-02 09:27:51.000000000 +0900
+++ catalyst-2.0.12.1/arch/x86.py	2012-11-23 21:27:15.000000000 +0900
@@ -7,9 +7,12 @@
 	def __init__(self,myspec):
 		builder.generic.__init__(self,myspec)
 		if self.settings["buildarch"]=="amd64":
-			if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"):
-					raise CatalystError,"required executable linux32 not found (\"emerge setarch\" to fix.)"
-			self.settings["CHROOT"]="linux32 chroot"
+			if os.uname()[0] == "Linux":
+				if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"):
+						raise CatalystError,"required executable linux32 not found (\"emerge setarch\" to fix.)"
+				self.settings["CHROOT"]="linux32 chroot"
+			else:
+				self.settings["CHROOT"]="chroot"
 			self.settings["crosscompile"] = False;
 		else:
 			self.settings["CHROOT"]="chroot"
diff -Nur catalyst-2.0.12.1.orig/modules/catalyst_support.py catalyst-2.0.12.1/modules/catalyst_support.py
--- catalyst-2.0.12.1.orig/modules/catalyst_support.py	2012-11-02 09:27:51.000000000 +0900
+++ catalyst-2.0.12.1/modules/catalyst_support.py	2012-11-23 21:37:39.000000000 +0900
@@ -108,7 +108,7 @@
 	#"find"		:[calc_contents,"find %(path)s"],
 	"tar-tv":[calc_contents,"tar tvf %(file)s"],
 	"tar-tvz":[calc_contents,"tar tvzf %(file)s"],
-	"tar-tvj":[calc_contents,"tar -I lbzip2 -tvf %(file)s"],
+	"tar-tvj":[calc_contents,"tar tvjf %(file)s"],
 	"isoinfo-l":[calc_contents,"isoinfo -l -i %(file)s"],
 	# isoinfo-f should be a last resort only
 	"isoinfo-f":[calc_contents,"isoinfo -f -i %(file)s"],
diff -Nur catalyst-2.0.12.1.orig/modules/generic_stage_target.py catalyst-2.0.12.1/modules/generic_stage_target.py
--- catalyst-2.0.12.1.orig/modules/generic_stage_target.py	2012-11-02 09:27:51.000000000 +0900
+++ catalyst-2.0.12.1/modules/generic_stage_target.py	2012-11-23 21:34:08.000000000 +0900
@@ -649,7 +649,8 @@
 					self.settings["source_path"]+"\nto "+\
 					self.settings["chroot_path"]+\
 						" (This may take some time) ...\n"
-				if "bz2" == self.settings["chroot_path"][-3:]:
+				if "bz2" == self.settings["chroot_path"][-3:] \
+					and os.uname()[0] == "Linux":
 					unpack_cmd="tar -I lbzip2 -xpf "+self.settings["source_path"]+" -C "+\
 						self.settings["chroot_path"]
 				else:
@@ -664,7 +665,8 @@
 				self.settings["source_path"]+"\nto "+\
 				self.settings["chroot_path"]+\
 				" (This may take some time) ...\n"
-			if "bz2" == self.settings["chroot_path"][-3:]:
+			if "bz2" == self.settings["chroot_path"][-3:] \
+				and os.uname()[0] == "Linux":
 				unpack_cmd="tar -I lbzip2 -xpf "+self.settings["source_path"]+" -C "+\
 					self.settings["chroot_path"]
 			else:
@@ -766,7 +768,8 @@
 				read_from_clst(self.settings["snapshot_cache_path"]+\
 				"catalyst-hash")
 			destdir=self.settings["snapshot_cache_path"]
-			if "bz2" == self.settings["chroot_path"][-3:]:
+			if "bz2" == self.settings["chroot_path"][-3:] \
+				and os.uname()[0] == "Linux":
 				unpack_cmd="tar -I lbzip2 -xpf "+self.settings["snapshot_path"]+" -C "+destdir
 			else:
 				unpack_cmd="tar xpf "+self.settings["snapshot_path"]+" -C "+destdir
@@ -785,7 +788,8 @@
 			cleanup_errmsg="Error removing existing snapshot directory."
 			cleanup_msg=\
 				"Cleaning up existing portage tree (This can take a long time)..."
-			if "bz2" == self.settings["chroot_path"][-3:]:
+			if "bz2" == self.settings["chroot_path"][-3:] \
+				and os.uname()[0] == "Linux":
 				unpack_cmd="tar -I lbzip2 -xpf "+self.settings["snapshot_path"]+" -C "+\
 					self.settings["chroot_path"]+"/usr"
 			else:
@@ -901,18 +905,18 @@
 			src=self.mountmap[x]
 			if self.settings.has_key("SNAPCACHE") and x == "/usr/portage":
 				self.snapshot_lock_object.read_lock()
-			if os.uname()[0] == "FreeBSD":
-				if src == "/dev":
-					retval=os.system("mount -t devfs none "+\
-						self.settings["chroot_path"]+x)
-				else:
-					retval=os.system("mount_nullfs "+src+" "+\
+			if src == "tmpfs":
+				if self.settings.has_key("var_tmpfs_portage"):
+					retval=os.system("mount -t tmpfs -o size="+\
+						self.settings["var_tmpfs_portage"]+"G "+src+" "+\
 						self.settings["chroot_path"]+x)
 			else:
-				if src == "tmpfs":
-					if self.settings.has_key("var_tmpfs_portage"):
-						retval=os.system("mount -t tmpfs -o size="+\
-							self.settings["var_tmpfs_portage"]+"G "+src+" "+\
+				if os.uname()[0] == "FreeBSD":
+					if src == "/dev":
+						retval=os.system("mount -t devfs none "+\
+							self.settings["chroot_path"]+x)
+					else:
+						retval=os.system("mount_nullfs "+src+" "+\
 							self.settings["chroot_path"]+x)
 				else:
 					retval=os.system("mount --bind "+src+" "+\
@@ -1111,9 +1115,15 @@
 		if os.path.exists(self.settings["chroot_path"]+"/usr/local/portage"):
 			cmd("rm -rf "+self.settings["chroot_path"]+"/usr/local/portage",\
 				"Could not remove /usr/local/portage",env=self.env)
-			cmd("sed -i '/^PORTDIR_OVERLAY/d' "+self.settings["chroot_path"]+\
-				"/etc/portage/make.conf",\
-				"Could not remove PORTDIR_OVERLAY from make.conf",env=self.env)
+			if os.path.exists(self.settings["chroot_path"]+"/etc/portage/make.conf"):
+				if os.path.exists("/usr/bin/gsed"):
+					cmd("gsed -i '/^PORTDIR_OVERLAY/d' "+self.settings["chroot_path"]+\
+						"/etc/portage/make.conf",\
+						"Could not remove PORTDIR_OVERLAY from make.conf",env=self.env)
+				else:
+					cmd("sed -i '/^PORTDIR_OVERLAY/d' "+self.settings["chroot_path"]+\
+						"/etc/portage/make.conf",\
+						"Could not remove PORTDIR_OVERLAY from make.conf",env=self.env)
 
 		""" Clean up old and obsoleted files in /etc """
 		if os.path.exists(self.settings["stage_path"]+"/etc"):
@@ -1207,9 +1217,14 @@
 
 			print "Creating stage tarball..."
 
-			cmd("tar -I lbzip2 -cpf "+self.settings["target_path"]+" -C "+\
-				self.settings["stage_path"]+" .",\
-				"Couldn't create stage tarball",env=self.env)
+			if os.uname()[0] == "Linux":
+				cmd("tar -I lbzip2 -cpf "+self.settings["target_path"]+" -C "+\
+					self.settings["stage_path"]+" .",\
+					"Couldn't create stage tarball",env=self.env)
+			else:
+				cmd("tar cjpf "+self.settings["target_path"]+" -C "+\
+					self.settings["stage_path"]+" .",\
+					"Couldn't create stage tarball",env=self.env)
 
 			self.gen_contents_file(self.settings["target_path"])
 			self.gen_digest_file(self.settings["target_path"])
diff -Nur catalyst-2.0.12.1.orig/modules/snapshot_target.py catalyst-2.0.12.1/modules/snapshot_target.py
--- catalyst-2.0.12.1.orig/modules/snapshot_target.py	2012-11-02 09:27:51.000000000 +0900
+++ catalyst-2.0.12.1/modules/snapshot_target.py	2012-11-23 21:35:42.000000000 +0900
@@ -50,8 +50,12 @@
 			self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure",env=self.env)
 
 		print "Compressing Portage snapshot tarball..."
-		cmd("tar -I lbzip2 -cf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\
-			"Snapshot creation failure",env=self.env)
+		if os.uname()[0] == "Linux":
+			cmd("tar -I lbzip2 -cf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\
+				"Snapshot creation failure",env=self.env)
+		else:
+			cmd("tar cjf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\
+				"Snapshot creation failure",env=self.env)
 
 		self.gen_contents_file(self.settings["snapshot_path"])
 		self.gen_digest_file(self.settings["snapshot_path"])
diff -Nur catalyst-2.0.12.1.orig/modules/stage1_target.py catalyst-2.0.12.1/modules/stage1_target.py
--- catalyst-2.0.12.1.orig/modules/stage1_target.py	2012-11-02 09:27:51.000000000 +0900
+++ catalyst-2.0.12.1/modules/stage1_target.py	2012-11-23 21:29:03.000000000 +0900
@@ -92,10 +92,15 @@
 		# stage_path/proc probably doesn't exist yet, so create it
 		if not os.path.exists(self.settings["stage_path"]+"/proc"):
 			os.makedirs(self.settings["stage_path"]+"/proc")
+		if not os.path.exists(self.settings["stage_path"]+"/dev"):
+			os.makedirs(self.settings["stage_path"]+"/dev")
 
 		# alter the mount mappings to bind mount proc onto it
 		self.mounts.append("/tmp/stage1root/proc")
 		self.mountmap["/tmp/stage1root/proc"]="/proc"
+		if os.uname()[0] == "FreeBSD":
+			self.mounts.append("/tmp/stage1root/dev")
+			self.mountmap["/tmp/stage1root/dev"]="/dev"
 
 	def set_update_seed(self):
 		if self.settings.has_key("update_seed"):
diff -Nur catalyst-2.0.12.1.orig/targets/stage3/stage3-chroot.sh catalyst-2.0.12.1/targets/stage3/stage3-chroot.sh
--- catalyst-2.0.12.1.orig/targets/stage3/stage3-chroot.sh	2012-11-02 09:27:51.000000000 +0900
+++ catalyst-2.0.12.1/targets/stage3/stage3-chroot.sh	2012-11-23 21:27:15.000000000 +0900
@@ -5,4 +5,11 @@
 ## START BUILD
 setup_pkgmgr
 
-run_merge "-e system"
+if [[ $(uname) == "FreeBSD" ]] ; then
+	# workaround fix bug 425530, 438112, 448256
+	run_merge "-e @world --exclude=sys-apps/portage"
+	run_merge "sys-apps/portage"
+else
+	run_merge "-e system"
+fi
+
diff -Nur catalyst-2.0.12.1.orig/targets/support/chroot-functions.sh catalyst-2.0.12.1/targets/support/chroot-functions.sh
--- catalyst-2.0.12.1.orig/targets/support/chroot-functions.sh	2012-11-02 09:27:51.000000000 +0900
+++ catalyst-2.0.12.1/targets/support/chroot-functions.sh	2012-11-23 21:27:15.000000000 +0900
@@ -413,5 +413,22 @@
 Icon=text-editor" > /usr/share/applications/gentoo-handbook.desktop
 }
 
+# GNU sed wrapper
+sed(){
+	if [ -e /usr/bin/gsed ]
+	then
+		/usr/bin/gsed "$@"
+	elif [ -e /bin/sed ]
+	then
+		/bin/sed "$@"
+	elif [ -e /usr/bin/sed ]
+	then
+		/usr/bin/sed "$@"
+	else
+		echo "ERROR: failed the selection of sed."
+		exit 1
+	fi
+}
+
 # We do this everywhere, so why not put it in this script
 run_default_funcs