summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-07-16 14:06:40 -0400
committerEudyptula <eitan@mosenkis.net>2009-07-16 14:06:40 -0400
commit96f81d7e198146a84dfcb3d9af8f51c3924173a6 (patch)
tree1fc8b8c12cbc1b0b8ebab900539621d6d3388aca
parentDivided gentoo_portage backend into several parts; Added another config step ... (diff)
downloadingenue-96f81d7e198146a84dfcb3d9af8f51c3924173a6.tar.gz
ingenue-96f81d7e198146a84dfcb3d9af8f51c3924173a6.tar.bz2
ingenue-96f81d7e198146a84dfcb3d9af8f51c3924173a6.zip
Add dev-manager support to gentoo/portage modules
-rw-r--r--backend/modules/gentoo_portage/build.php7
-rw-r--r--backend/modules/gentoo_portage/dev-manager.php9
-rw-r--r--backend/modules/gentoo_portage/packages.php4
-rw-r--r--frontend/modules/gentoo/step3.php2
-rw-r--r--frontend/modules/gentoo/step4.php2
-rwxr-xr-xsetup.php1
-rw-r--r--shared/classes/gentoo_package.php10
7 files changed, 20 insertions, 15 deletions
diff --git a/backend/modules/gentoo_portage/build.php b/backend/modules/gentoo_portage/build.php
index fab11e2..599c9fe 100644
--- a/backend/modules/gentoo_portage/build.php
+++ b/backend/modules/gentoo_portage/build.php
@@ -14,13 +14,14 @@ function gentoo_portage_build(&$build, &$opts, &$W) {
if ($conf['debug'])
execute_command_with_env('Log portage setup', 'emerge --info', $prtg_cfgrt);
require(dirname(__FILE__).'/emerge-system.php'); // __DIR__ 5.3.0
- if (in_array('timezone', $extra)) {
+ if (in_array('timezone', $extra))
require(dirname(__FILE__).'/timezone.php'); // __DIR__ 5.3.0
- }
+ if (in_array('dev-manager', $extra))
+ require(dirname(__FILE__).'/dev-manager.php'); // __DIR__ 5.3.0
if ($opts['bundler'] == 'livecd')
execute_command_with_env('Install LiveCD utilities', 'emerge -1 livecd-tools', $prtg_cfgrt);
if (strlen($opts['install_packages'])) {
- $pkgs=explode(' ', $opts['install_packages']);
+ $pkgs=$opts['install_packages'];
require(dirname(__FILE__).'/packages.php'); // __DIR__ 5.3.0
}
return $I;
diff --git a/backend/modules/gentoo_portage/dev-manager.php b/backend/modules/gentoo_portage/dev-manager.php
new file mode 100644
index 0000000..47a95ac
--- /dev/null
+++ b/backend/modules/gentoo_portage/dev-manager.php
@@ -0,0 +1,9 @@
+<?php
+if ($opts['dev-manager'] == 'udev') {
+ $pkgs='sys-fs/udev';
+} else { // if ($opts['dev-manager'] == 'static-dev') {
+ execute_command_with_env('Uninstall udev', 'emerge -C sys-fs/udev', $prtg_cfgrt);
+ $pkgs='sys-fs/static-dev';
+}
+require(dirname(__FILE__).'/packages.php');
+?>
diff --git a/backend/modules/gentoo_portage/packages.php b/backend/modules/gentoo_portage/packages.php
index 345b425..fc76026 100644
--- a/backend/modules/gentoo_portage/packages.php
+++ b/backend/modules/gentoo_portage/packages.php
@@ -1,5 +1,7 @@
<?php
+if (!is_array($pkgs))
+ $pkgs=explode(' ', $pkgs);
foreach ($pkgs as $i => &$pkg)
$pkg=escapeshellarg($pkg);
-execute_command_with_env('Install packages', 'emerge '.implode(' ', $pkgs), $prtg_cfgrt);
+execute_command_with_env('Install '.(count($pkgs) > 1?'packages':$pkgs[0]), 'emerge '.implode(' ', $pkgs), $prtg_cfgrt);
?>
diff --git a/frontend/modules/gentoo/step3.php b/frontend/modules/gentoo/step3.php
index a420a0f..ee0cb84 100644
--- a/frontend/modules/gentoo/step3.php
+++ b/frontend/modules/gentoo/step3.php
@@ -1,3 +1,3 @@
<?php
-$this->checkbox_array('options', 'options', null, array('timezone' => 'Select timezone'));
+$this->checkbox_array('options', 'options', null, array('timezone' => 'Select timezone', 'dev-manager' => 'Select /dev manager'));
?>
diff --git a/frontend/modules/gentoo/step4.php b/frontend/modules/gentoo/step4.php
index b5edf91..3eb3e1d 100644
--- a/frontend/modules/gentoo/step4.php
+++ b/frontend/modules/gentoo/step4.php
@@ -2,6 +2,8 @@
$opts=explode(' ', $this->get_opt('options'));
if (in_array('timezone', $opts))
$this->select('timezone', 'timezone', 'Timezone', get_timezones());
+if (in_array('dev-manager', $opts))
+ $this->select('dev-manager', 'dev-manager', '/dev Manager', array('udev' => 'udev', 'static-dev' => 'Static /dev'));
// TODO This shouldn't be a step at all, it should be in wizard.php to choose between bundlers
// TODO This shouldn't be part of configurations, except possibly a default value. It should be for builds
$this->select('bundler', 'bundler', 'Image type', array(
diff --git a/setup.php b/setup.php
index 15782bd..532bf9f 100755
--- a/setup.php
+++ b/setup.php
@@ -22,7 +22,6 @@ foreach (get_declared_classes() as $class) {
$r=new ReflectionClass($class);
if (!$r->isInstantiable()) continue;
unset($r);
-// if (substr($class, 0, 4) != 'sql_') continue; // TODO FIXME BAD! Replace with real checks to avoid abstract classes in 5.3.0
$o=new $class(); // TODO this will be static once 5.3.0 is out
if (isset($opts['R'])) {
echo_and_query($o->drop_table());
diff --git a/shared/classes/gentoo_package.php b/shared/classes/gentoo_package.php
index 580312f..f16a3e1 100644
--- a/shared/classes/gentoo_package.php
+++ b/shared/classes/gentoo_package.php
@@ -64,15 +64,7 @@ class sql_gentoo_package extends sql_row_obj {
$array=$this->to_array(true);
}
$heads=$this->get_profile()->get_headers();
- $accept=explode(' ', $heads['accept_keywords']);
- foreach ($accept as $akwd) {
- foreach (explode(' ', $array['keywords']) as $kwd) {
- if ($akwd == $kwd) {
- return false;
- }
- }
- }
- return true;
+ return !count(array_intersect(explode(' ', $array['keywords']), explode(' ', $heads['accept_keywords'])));
}
}
?>