summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dibb <beandog@gentoo.org>2010-01-05 06:06:49 +0000
committerSteve Dibb <beandog@gentoo.org>2010-01-05 06:06:49 +0000
commit94035ee59f70fa3f97dd7635546a25a9f159fff8 (patch)
tree9ee16f15b2c47dc67a75194fcf3c5f4e224381a9 /import.ebuild_arch.php
parentMuch more flexibliity on importing package masks, should be self-healing now (diff)
downloadznurt-org-backend-94035ee59f70fa3f97dd7635546a25a9f159fff8.tar.gz
znurt-org-backend-94035ee59f70fa3f97dd7635546a25a9f159fff8.tar.bz2
znurt-org-backend-94035ee59f70fa3f97dd7635546a25a9f159fff8.zip
add comments; cleanup; cosmetics
git-svn-id: file:///var/svn/portage@65 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
Diffstat (limited to 'import.ebuild_arch.php')
-rw-r--r--import.ebuild_arch.php56
1 files changed, 31 insertions, 25 deletions
diff --git a/import.ebuild_arch.php b/import.ebuild_arch.php
index 957c19f..ab9e77b 100644
--- a/import.ebuild_arch.php
+++ b/import.ebuild_arch.php
@@ -1,11 +1,16 @@
<?
require_once 'header.php';
- require_once 'class.portage.tree.php';
+
+ if(!$tree) {
+ require_once 'class.portage.tree.php';
+ $tree = new PortageTree();
+ }
+
require_once 'class.portage.category.php';
require_once 'class.portage.package.php';
require_once 'class.portage.ebuild.php';
-
+
// $verbose = true;
// $qa = true;
@@ -14,40 +19,41 @@
$arr_arches = $tree->getArches();
// Find all the ebuilds that are missing ebuild arch
- $sql = "SELECT id, metadata FROM missing_arch;";
- $arr = $db->getAssoc($sql);
+ $sql = "SELECT ebuild, metadata FROM missing_arch;";
+ $arr_missing_arch = $db->getAssoc($sql);
if($verbose)
- shell::msg(count($arr)." ebuilds to check");
+ shell::msg(count($arr_missing_arch)." ebuilds to check");
// Get the arches from the database
$db_arches = $db->getAssoc("SELECT name, id FROM arch;");
//FIXME rewrite this entire thing in SQL
- foreach($arr as $ebuild_id => $keywords) {
-
- if(!empty($keywords))
- $arr = arrKeywords($keywords, $arr_arches);
- else {
- $arr = array();
- }
-
- if(count($arr)) {
- foreach($arr as $arch => $status) {
+ if(count($arr)) {
+ foreach($arr_missing_arch as $ebuild => $keywords) {
- if($db_arches[$arch]) {
- $arr_insert = array(
- 'ebuild' => $ebuild_id,
- 'arch' => $db_arches[$arch],
- 'status' => $status,
- );
-
- $db->autoExecute('ebuild_arch', $arr_insert, MDB2_AUTOQUERY_INSERT);
+ if(!empty($keywords))
+ $arr = arrKeywords($keywords, $arr_arches);
+ else {
+ $arr = array();
+ }
+
+ // Status in this case is the keyword, not the import status
+ if(count($arr)) {
+ foreach($arr as $arch => $status) {
+
+ if($db_arches[$arch]) {
+ $arr_insert = array(
+ 'ebuild' => $ebuild,
+ 'arch' => $db_arches[$arch],
+ 'status' => $status,
+ );
+
+ $db->autoExecute('ebuild_arch', $arr_insert, MDB2_AUTOQUERY_INSERT);
+ }
}
}
}
-
-
}
/**