summaryrefslogtreecommitdiff
blob: 45b2b6ebdccc2923d65a54bda82a91b93f06d578 (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
<?php
function gentoo_catalyst_build(&$build, &$opts, &$W) {
	global $conf, $profile;
	$profile=new sql_profile($opts['profile']);
	$headers=$profile->get_headers();
	$arch=explode(' ', $headers['accept_keywords']);
	$arch=$arch[0];
	if (substr($arch, 0, 1) == '~')
		$arch=substr($arch, 1);
//	$C=$W.'/config_root';
	makedirs('catalyst_tmp', 'snapshot_cache');
	$catalyst=array(
		'digests' => '',
		'contents' => '',
		'distdir' => '',
		// 'envscript' => '',
		'hash_function' => 'crc32',
		'options' => 'pkgcache metadata_overlay seedcache snapcache',
		'portdir' => $conf['portdir'],
		'sharedir' => '/usr/lib/catalyst', // This may not work on all systems
		'snapshotcache' => "$W/snapshot_cache",
		'storedir' => "$W/catalyst_tmp"
	);
	$ctc=fopen("$W/catalyst.conf", 'w');
	foreach ($catalyst as $name => $val) {
		fputs($ctc, "$name=\"$val\"\n");
	}
	fclose($ctc);
	// TODO - stages 1-3 first, only do stage4 if we have extra packages to install
	$spec=array(
		'subarch' => $arch,
		'version_stamp' => gmdate('Ymd-His'),
		'target' => 'stage4',
		'rel_type' => 'default',
		'profile' => $headers['profile'],
		'snapshot' => gmdate('Ymd'),
		'source_subpath' => 'default', // FIXME
		'portage_confdir' => '',
		'portage_overlay' => '',
		'pkgcache_path' => "$W/pkgcache",
		'kerncache_path' => '',
		'stage4/use' => $headers['use'],
		'stage4/packages' => $opts['install_packages'],
		'stage4/fsscript' => '',
		'stage4/splash_theme' => '',
		'stage4/gk_mainargs' => '',
		'stage4/linuxrc' => '',
		'stage4/motd' => '',
//		'stage4/modblacklist' => '8139cp', // Not recognized by catalyst
		'stage4/rcadd' => '',
		'stage4/rcdel' => '',
		'stage4/root_overlay' => '',
		'stage4/xinitrc' => '',
		'stage4/users' => '',
		'boot/kernel' => '',
		'stage4/unmerge' => '',
		'stage4/empty' => '/var/tmp /var/cache /var/db /var/empty /var/lock /var/log /var/run /var/spool /var/state /tmp /usr/portage /usr/share/man /usr/share/info /usr/share/unimaps /usr/include /usr/share/zoneinfo /usr/share/dict /usr/share/doc /usr/share/ss /usr/share/state /usr/share/texinfo /usr/lib/python2.2 /usr/lib/portage /usr/share/gettext /usr/share/i18n /usr/share/rfc /usr/lib/X11/config /usr/lib/X11/etc /usr/lib/X11/doc /usr/src /usr/share/doc /usr/share/man /root/.ccache /etc/cron.daily /etc/cron.hourly /etc/cron.monthly /etc/cron.weekly /etc/logrotate.d /etc/rsync /usr/lib/awk /usr/lib/ccache /usr/lib/gcc-config /usr/lib/nfs /usr/local /usr/diet/include /usr/diet/man /usr/share/consolefonts/partialfonts /usr/share/consoletrans /usr/share/emacs /usr/share/gcc-data /usr/share/genkernel /etc/splash/gentoo /etc/splash/emergence /usr/share/gnuconfig /usr/share/lcms /usr/share/locale /etc/skel',
		'stage4/rm' => '/lib/*.a /usr/lib/*.a /usr/lib/gcc-lib/*/*/libgcj* /etc/dispatch-conf.conf /etc/etc-update.conf /etc/*- /etc/issue* /etc/make.conf /etc/man.conf /etc/*.old /root/.viminfo /usr/sbin/fb* /usr/sbin/fsck.cramfs /usr/sbin/fsck.minix /usr/sbin/mkfs.minix /usr/sbin/mkfs.bfs /usr/sbin/mkfs.cramfs /lib/security/pam_access.so /lib/security/pam_chroot.so /lib/security/pam_debug.so /lib/security/pam_ftp.so /lib/security/pam_issue.so /lib/security/pam_mail.so /lib/security/pam_motd.so /lib/security/pam_mkhomedir.so /lib/security/pam_postgresok.so /lib/security/pam_rhosts_auth.so /lib/security/pam_userdb.so /usr/share/consolefonts/1* /usr/share/consolefonts/7* /usr/share/consolefonts/8* /usr/share/consolefonts/9* /usr/share/consolefonts/A* /usr/share/consolefonts/C* /usr/share/consolefonts/E* /usr/share/consolefonts/G* /usr/share/consolefonts/L* /usr/share/consolefonts/M* /usr/share/consolefonts/R* /usr/share/consolefonts/a* /usr/share/consolefonts/c* /usr/share/consolefonts/dr* /usr/share/consolefonts/g* /usr/share/consolefonts/i* /usr/share/consolefonts/k* /usr/share/consolefonts/l* /usr/share/consolefonts/r* /usr/share/consolefonts/s* /usr/share/consolefonts/t* /usr/share/consolefonts/v* /etc/splash/livecd-2006.1/16* /etc/splash/livecd-2006.1/12* /etc/splash/livecd-2006.1/6* /etc/splash/livecd-2006.1/8* /etc/splash/livecd-2006.1/images/silent-16* /etc/splash/livecd-2006.1/images/silent-12* /etc/splash/livecd-2006.1/images/silent-6* /etc/splash/livecd-2006.1/images/silent-8* /etc/splash/livecd-2006.1/images/verbose-16* /etc/splash/livecd-2006.1/images/verbose-12* /etc/splash/livecd-2006.1/images/verbose-6* /etc/splash/livecd-2006.1/images/verbose-8* /etc/make.conf.example /etc/make.globals /etc/resolv.conf'
	);
	$specfile=fopen("$W/stage4.spec", 'w');
	foreach ($spec as $name => $val) {
		if (strlen($val))
			fputs($specfile, "$name: $val\n");
	}
	fclose($specfile);
	$pkgdir=$spec['pkgcache_path'].'/'.$spec['rel_type'].'/'.$spec['target'].'-'.$spec['version_stamp'];
	makedir(dirname($pkgdir));
	symlink($pkgdir, $profile->pkgdir);
	execute_command('Running Catalyst for build stage 4', "catalyst -c '$W/catalyst.conf' -f '$W/stage4.spec'");
}
?>