summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dibb <beandog@gentoo.org>2009-12-29 00:21:28 +0000
committerSteve Dibb <beandog@gentoo.org>2009-12-29 00:21:28 +0000
commit72de8d24d84194658878c8461a0ac4f42d446dc9 (patch)
tree26d427a023ac038bb47df472dacf492d496161f6
parentctime, mtime, new statuses (diff)
downloadznurt-org-backend-72de8d24d84194658878c8461a0ac4f42d446dc9.tar.gz
znurt-org-backend-72de8d24d84194658878c8461a0ac4f42d446dc9.tar.bz2
znurt-org-backend-72de8d24d84194658878c8461a0ac4f42d446dc9.zip
Actually delete old ebuilds
git-svn-id: file:///var/svn/portage@13 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
-rw-r--r--import.ebuilds.php24
1 files changed, 14 insertions, 10 deletions
diff --git a/import.ebuilds.php b/import.ebuilds.php
index f6c08f1..83f389e 100644
--- a/import.ebuilds.php
+++ b/import.ebuilds.php
@@ -108,7 +108,7 @@
extract($row);
$arr_db[$category_name][$package_name] = $package_id;
if($ebuild_name) {
- $arr_ids[$category_name][$package_name][$ebuild_name] = $ebuild;
+ $arr_ebuild_ids[$category_name][$package_name][$ebuild_name] = $ebuild;
}
}
}
@@ -129,28 +129,32 @@
$arr_insert = array();
$arr_delete = array();
- if(count($arr_ids[$category_name][$package_name]))
- $arr_old = array_keys($arr_ids[$category_name][$package_name]);
+ if(count($arr_ebuild_ids[$category_name][$package_name]))
+ $arr_db_ebuilds = array_keys($arr_ebuild_ids[$category_name][$package_name]);
else
- $arr_old = array();
+ $arr_db_ebuilds = array();
$obj_package = new PortagePackage($category_name, $package_name);
$package_id =& $arr_db[$category_name][$package_name];
// If there are any old ebuilds (in the DB), then compare the new (in portage)
- if(count($arr_old)) {
+ if(count($arr_db_ebuilds)) {
- $arr_new = $obj_package->getEbuilds();
+ $arr_fs_ebuilds = $obj_package->getEbuilds();
+
+ // Check old against new
+ $arr_delete = array_diff($arr_db_ebuilds, $arr_fs_ebuilds);
+ $arr_insert = array_diff($arr_fs_ebuilds, $arr_db_ebuilds);
// Next, look at the mtimes and see if any need to be updated
- if(count($arr_new)) {
+ if(count($arr_fs_ebuilds)) {
- foreach($arr_new as $ebuild_name) {
+ foreach($arr_fs_ebuilds as $ebuild_name) {
$obj_ebuild = new PortageEbuild("$category_name/$ebuild_name");
- $ebuild = $arr_ids[$category_name][$package_name][$ebuild_name];
+ $ebuild = $arr_ebuild_ids[$category_name][$package_name][$ebuild_name];
if($ebuild) {
$db_ebuild = new DBEbuild($ebuild);
@@ -180,7 +184,7 @@
if($verbose)
shell::msg("[delete] $category_name/$ebuild_name");
- $ebuild = $arr_ids[$category_name][$package_name][$ebuild_name];
+ $ebuild = $arr_ebuild_ids[$category_name][$package_name][$ebuild_name];
if($ebuild) {
$db_ebuild = new DBEbuild($ebuild);