diff options
Diffstat (limited to 'update_gentoo_profiles.php')
-rwxr-xr-x | update_gentoo_profiles.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/update_gentoo_profiles.php b/update_gentoo_profiles.php index c01b455..e9f3ead 100755 --- a/update_gentoo_profiles.php +++ b/update_gentoo_profiles.php @@ -4,14 +4,26 @@ require_once(dirname(__FILE__).'/shared/include/includes.php'); // USE __DIR__ i require_once(SHARED.'/config.php'); require_once(SHARED.'/include/dbinit.php'); $pdo=&$S['pdo']; +$profiles=array(); $r=$pdo->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)) { - $p=new sql_gentoo_profile($p); - echo "Updating from {$conf['pkgdir_root']}/$p->pkgdir/Packages...\n"; - list($new, $updated, $deleted, $total)=$p->read_Packages(true, true); + $profiles[$p['id']]=new sql_gentoo_profile($p); + $profile=&$profiles[$p['id']]; + echo "Updating from {$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...'; - $p->read_pkgsets(true); + $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"; +} ?> |