diff options
author | 2009-07-28 17:41:08 -0400 | |
---|---|---|
committer | 2009-07-28 17:41:08 -0400 | |
commit | 42bda2c6130984f9350b099c9ef808ab4155e5bf (patch) | |
tree | 98665d92edd85e47588d51765906fa711283104f | |
parent | Made package selector, pkglist more efficient by filtering out package metada... (diff) | |
download | ingenue-42bda2c6130984f9350b099c9ef808ab4155e5bf.tar.gz ingenue-42bda2c6130984f9350b099c9ef808ab4155e5bf.tar.bz2 ingenue-42bda2c6130984f9350b099c9ef808ab4155e5bf.zip |
Add package and init script pruning to frontend
-rw-r--r-- | frontend/modules/gentoo/step2.php | 5 | ||||
-rw-r--r-- | frontend/modules/gentoo/step3.php | 19 | ||||
-rw-r--r-- | shared/classes/gentoo_baseinit.php | 1 | ||||
-rw-r--r-- | shared/classes/gentoo_package.php | 21 |
4 files changed, 36 insertions, 10 deletions
diff --git a/frontend/modules/gentoo/step2.php b/frontend/modules/gentoo/step2.php index 2c9f769..8eed939 100644 --- a/frontend/modules/gentoo/step2.php +++ b/frontend/modules/gentoo/step2.php @@ -1,7 +1,8 @@ <?php -$this->checkbox_array('options', 'options', 'Configuration options', array('timezone' => 'Select timezone', 'dev-manager' => 'Select /dev manager')); -$profile=new sql_gentoo_profile($this->get_opt('profile')); global $S; +$profile=new sql_gentoo_profile($this->get_opt('profile')); +$this->checkbox_array('options', 'options', 'Configuration options', array('timezone' => 'Select timezone', 'dev-manager' => 'Select /dev manager', 'pruneinit' => 'Remove enabled-by-default init scripts')); +$this->select('basesystem', 'basesystem', 'Base system', array('stage3' => 'Stage3 Tarball', 'autoprune' => 'Remove all non-vital packages', 'manual' => 'Manually select packages to remove from stage3')); $pkgsets=array(); $r=$S['pdo']->query('SELECT * FROM `gentoo_pkgsets` WHERE `profile`='.$profile->id); while ($pkgset=$r->fetch(PDO::FETCH_ASSOC)) { diff --git a/frontend/modules/gentoo/step3.php b/frontend/modules/gentoo/step3.php index a4f1b30..dd2d72c 100644 --- a/frontend/modules/gentoo/step3.php +++ b/frontend/modules/gentoo/step3.php @@ -1,4 +1,5 @@ <?php +global $S; $opts=explode(' ', $this->get_opt('options')); if (in_array('timezone', $opts)) $this->select('timezone', 'timezone', 'Timezone', get_timezones()); @@ -18,6 +19,24 @@ if (strlen($pkgsets=$this->get_opt('pkgsets'))) { $this->checkbox_array('pkgset-'.$pkgset->id, 'pkgset-'.$pkgset->id, $pkgset->name, $pkgs); } } +if (in_array('pruneinit', $opts)) { + $r=$S['pdo']->query('SELECT * FROM `gentoo_baseinit` WHERE `profile`='.$profile->id.' ORDER BY `name`, `runlevel`'); + $scripts=array(); + while ($script=$r->fetch(PDO::FETCH_ASSOC)) { + $script=new sql_gentoo_baseinit($script); + $scripts["$script->name:$script->runlevel"]="$script->name ($script->runlevel)"; + } + $this->checkbox_array('pruneinit', 'pruneinit', 'Remove the following init scripts', $scripts); +} +if ($this->get_opt('basesystem') == 'manual') { + $r=$S['pdo']->query('SELECT * FROM `gentoo_basepkgs` WHERE `profile`='.$profile->id.' ORDER BY `pkg`'); + $pkgs=array(); + while ($pkg=$r->fetch(PDO::FETCH_ASSOC)) { + $pkg=$pkg['pkg']; + $pkgs[$pkg]=$pkg; + } + $this->checkbox_array('prunepkgs', 'prunepkgs', 'Remove the following packages from the base system', $pkgs); +} // 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/shared/classes/gentoo_baseinit.php b/shared/classes/gentoo_baseinit.php index 01b5dc5..03c9569 100644 --- a/shared/classes/gentoo_baseinit.php +++ b/shared/classes/gentoo_baseinit.php @@ -20,7 +20,6 @@ class sql_gentoo_baseinit extends sql_row_obj { 'not_null' => true, 'default' => '' ) - ); } ?> diff --git a/shared/classes/gentoo_package.php b/shared/classes/gentoo_package.php index e13878e..2c06a26 100644 --- a/shared/classes/gentoo_package.php +++ b/shared/classes/gentoo_package.php @@ -67,7 +67,7 @@ class sql_gentoo_package extends sql_row_obj { $heads=$this->get_profile()->get_headers(); return !count(array_intersect(explode(' ', $keywords), explode(' ', $heads['accept_keywords']))); } - public static function from_atom($atom, &$profile=null) { + public static function from_atom($atom, &$profile=null, $nomasked=true) { global $S; if (strlen($atom) == 0) return null; if (strpos($atom, '/')) { @@ -77,17 +77,24 @@ class sql_gentoo_package extends sql_row_obj { $bcat=substr($bcat, 0, strlen($bcat)-strlen($lcat)); } } else { - $bcat=$lcat=null; + $bcat=$lcat=''; $name=$atom; } $c=array(); if ($profile) $c[]='`profile`='.$profile->id; - if ($bcat) $c[]='`bcat`="'.$bcat.'"'; - if ($lcat) $c[]='`lcat`="'.$lcat.'"'; - if ($name) $c[]='`name`="'.$name.'"'; + if ($bcat) { + $c[]='`bcat`="'.$bcat.'"'; + $c[]='`lcat`="'.$lcat.'"'; + } + if ($name != '*') $c[]='`name`="'.$name.'"'; $c=implode(' AND ', $c); - $r=$S['pdo']->query('SELECT * FROM `gentoo_packages` WHERE '.$c.' LIMIT 1'); - return $r->rowCount()?new sql_gentoo_package($r->fetch(PDO::FETCH_ASSOC)):null; + $r=$S['pdo']->query('SELECT * FROM `gentoo_packages` WHERE '.$c); + while ($pkg=$r->fetch(PDO::FETCH_ASSOC)) { + $pkg=new sql_gentoo_package($pkg); + if (!$pkg->is_masked()) + return $pkg; + } + return null; } } ?> |