blob: e15e89554e4c7211ff40aceef24f412e94feabf6 (
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
|
#!/usr/bin/php
<?php
require_once(dirname(__FILE__).'/shared/include/includes.php'); // USE __DIR__ in 5.3.0
$S['conf']['debug']=false;
require_once(SHARED.'/include/dbinit.php');
$profiles=array();
$r=query('SELECT * FROM `gentoo_profiles`'.(isset($argv[1])?' WHERE `name` LIKE "%'.$argv[1].'%" OR `pkgdir` LIKE "%'.$argv[1].'%"':''));
while ($p=$r->fetch(PDO::FETCH_ASSOC)) {
$profiles[$p['id']]=new sql_gentoo_profile($p);
$profile=&$profiles[$p['id']];
echo "Updating from {$S['conf']['pkgdir_root']}/$profile->pkgdir/Packages...\n";
list($new, $updated, $deleted, $total)=$profile->read_Packages(true, true);
echo "Packages: $new new, $updated updated, $deleted deleted, $total total.\n";
echo 'Updating package sets...';
$profile->read_pkgsets(true);
echo "done\n";
}
foreach (explode("\n", trim(file_get_contents(CACHE.'/stage3/map'))) as $line) {
list($p, $file)=explode(' ', $line, 2);
if (!is_numeric($p)) continue;
$profile=&$profiles[$p];
if ($profile->stage3 == $file) continue;
$profile->stage3=$file;
$profile->write();
echo "Loading info from profile $profile->pkgdir stage3 at $file...";
echo ($profile->read_stage3(true)?'done':color('failed', 'red'))."\n";
}
?>
|