diff options
author | Eudyptula <eitan@mosenkis.net> | 2009-07-06 16:08:33 -0400 |
---|---|---|
committer | Eudyptula <eitan@mosenkis.net> | 2009-07-06 16:08:33 -0400 |
commit | 8142c45b618eaa99f3380c2e0714e95d87e14ee2 (patch) | |
tree | ec1461d218b966307dd0239dbf362888ed600b55 /backend | |
parent | Add javascript-based searching to package adding stage (diff) | |
download | ingenue-8142c45b618eaa99f3380c2e0714e95d87e14ee2.tar.gz ingenue-8142c45b618eaa99f3380c2e0714e95d87e14ee2.tar.bz2 ingenue-8142c45b618eaa99f3380c2e0714e95d87e14ee2.zip |
Stored all data from Packages files in the db to allow frontend/backend separation; created script to update db cache of available packages; renamed profiles -> gentoo_profiles for proper modularity
Diffstat (limited to 'backend')
-rw-r--r-- | backend/functions/get_pkgdirs.php | 18 | ||||
-rw-r--r-- | backend/modules/gentoo_catalyst/build.php | 2 | ||||
-rw-r--r-- | backend/modules/gentoo_portage/build.php | 12 |
3 files changed, 22 insertions, 10 deletions
diff --git a/backend/functions/get_pkgdirs.php b/backend/functions/get_pkgdirs.php new file mode 100644 index 0000000..1f39420 --- /dev/null +++ b/backend/functions/get_pkgdirs.php @@ -0,0 +1,18 @@ +<?php +function get_pkgdirs($dir=null) { + global $conf; + if ($dir===null) { + $dir=$conf['pkgdir_root']; + } + if (is_file($dir.'/Packages')) { + // We assume that a dir with a Packages file will not contain other complete ppkgdirs + return array(substr($dir, strlen($conf['pkgdir_root'])+1)); + } else { + $return=array(); + foreach (glob ($dir.'/*', GLOB_ONLYDIR) as $subdir) { + $return=array_merge($return, get_pkgdirs($subdir)); + } + return $return; + } +} +?> diff --git a/backend/modules/gentoo_catalyst/build.php b/backend/modules/gentoo_catalyst/build.php index 45b2b6e..80746b2 100644 --- a/backend/modules/gentoo_catalyst/build.php +++ b/backend/modules/gentoo_catalyst/build.php @@ -1,7 +1,7 @@ <?php function gentoo_catalyst_build(&$build, &$opts, &$W) { global $conf, $profile; - $profile=new sql_profile($opts['profile']); + $profile=new sql_gentoo_profile($opts['profile']); $headers=$profile->get_headers(); $arch=explode(' ', $headers['accept_keywords']); $arch=$arch[0]; diff --git a/backend/modules/gentoo_portage/build.php b/backend/modules/gentoo_portage/build.php index c2d0be8..aa8e8b5 100644 --- a/backend/modules/gentoo_portage/build.php +++ b/backend/modules/gentoo_portage/build.php @@ -2,7 +2,7 @@ // This is the main function that carries out a build from start to finish function gentoo_portage_build(&$build, &$opts, &$W) { global $conf; - $profile=new sql_profile($opts['profile']); + $profile=new sql_gentoo_profile($opts['profile']); $headers=$profile->get_headers(); $I=$W.'/image'; $C=$W.'/config_root'; @@ -52,19 +52,17 @@ function gentoo_portage_build(&$build, &$opts, &$W) { if ($imgtype == 'tbz2') { execute_command('Compress finished image to tar/bzip2', "tar -p --same-owner -cjvf '$W/image.tar.bz2' -C '$I' ."); return "$W/image.tar.bz2"; -// rename($W.'/image.tar.bz2', COMPLETED.'/build-'.$build->id.'.tar.bz2') || throw_exception('rename failed'); } elseif ($imgtype == 'tgz') { execute_command('Compress finished image to tar/gz', "tar -p --same-owner -czvf '$W/image.tar.gz' -C '$I' ."); return "$W/image.tar.gz"; -// rename($W.'/image.tar.gz', COMPLETED.'/build-'.$build->id.'.tar.gz') || throw_exception('rename failed'); } elseif ($imgtype == 'livecd' || $imgtype == 'installcd') { if (strpos($headers['chost'], 'x86_64') === false) $minimaliso='/home/eitan/soc/install-x86-minimal-20090623.iso'; else $minimaliso='/home/eitan/soc/install-amd64-minimal-20090625.iso'; - execute_command_with_env('Mount minimal CD image', "mount -o loop -t iso9660 '$minimaliso' '$W/tmp'", $prtg_cfgrt); // TODO check if env is necessary (and for umount) + execute_command('Mount minimal CD image', "mount -o loop -t iso9660 '$minimaliso' '$W/tmp'"); execute_command('Copy CD image to writable temp directory', "cp -va '$W/tmp' '$W/cd'"); - execute_command_with_env('Unmount CD image', "umount '$W/tmp'", $prtg_cfgrt); + execute_command('Unmount CD image', "umount '$W/tmp'"); execute_command('Copy kernel and initrd from CD to image', "cp -va '$W/cd/isolinux/gentoo' '$W/cd/isolinux/gentoo.igz' '$I/boot/'"); file_put_contents("$W/unsquashfs-files", "/lib64/modules\n\lib\modules\n"); execute_command('Copy kernel modules from SquashFS to image', "unsquashfs -i -d '$I' -e '$W/unsquashfs-files' '$W/cd/image.squashfs'"); @@ -78,11 +76,9 @@ function gentoo_portage_build(&$build, &$opts, &$W) { // mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path} execute_command('Create ISO image', "mkisofs -J -R -l -V 'Ingenue Build $build->id' -o '$W/image.iso' -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table '$W/cd'"); return "$W/image.iso"; -// rename("$W/image.iso", COMPLETED.'/build-'.$build->id.'.iso') || throw_exception('rename failed'); } elseif ($imgtype == 'jffs2') { execute_command('Create JFFS2 image', "mkfs.jffs2 -x lzo -n -e 0x20000 -l -p -r '$I' -o '$W/image.jffs2'"); return "$W/image.jffs2"; -// rename("$W/image.jffs2", COMPLETED.'/build-'.$build->id.'.jffs2') || throw_exception ('rename failed'); } elseif ($imgtype == 'ext2') { execute_command('Make blank file for ext2 image', "dd if=/dev/zero of='$W/image.ext2' bs=1024 count=1048576"); execute_command('Make ext2 filesystem', "mke2fs -t ext2 -F '$W/image.ext2'"); @@ -92,10 +88,8 @@ function gentoo_portage_build(&$build, &$opts, &$W) { execute_command('Unmount ext2 image', "umount '$W/ext2'"); execute_command('Compress ext2 image', "gzip '$W/image.ext2'"); return "$W/image.ext2.gz"; -// rename("$W/image.ext2.gz", COMPLETED.'/build-'.$build->id.'.ext2.gz') || throw_exception('rename failed'); } else { throw_exception('invalid image type: '.$imgtype); } -// return true; } ?> |