summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'import.ebuilds.php')
-rw-r--r--import.ebuilds.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/import.ebuilds.php b/import.ebuilds.php
index 9abd8e1..8dcdedd 100644
--- a/import.ebuilds.php
+++ b/import.ebuilds.php
@@ -80,6 +80,12 @@
}
}
+ // If no ebuilds, reset the sequence
+ if($count === "0") {
+ $sql = "ALTER SEQUENCE ebuild_id_seq RESTART WITH 1;";
+ $db->query($sql);
+ }
+
$categories = $tree->getCategories();
$arr_import = array();
@@ -186,7 +192,7 @@
$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
+ // Next, look at the hashes and see if any need to be updated
if(count($arr_fs_ebuilds)) {
foreach($arr_fs_ebuilds as $ebuild_name) {
@@ -198,13 +204,14 @@
if($ebuild) {
$db_ebuild = new DBEbuild($ebuild);
- if(($e->portage_mtime != $db_ebuild->portage_mtime) || ($e->cache_mtime != $db_ebuild->cache_mtime)) {
+ if($db_ebuild->hash != $e->hash) {
$arr_update[] = $ebuild_name;
$arr_insert[] = $ebuild_name;
+
// Normally I'd add this here, but instead, just go ahead and mark it
// right away, and avoid having it run twice.
- $db_ebuild->status = 2;
+ $db_ebuild->status = 2;
if($verbose) {
shell::msg("[update] $category_name/$ebuild_name");
@@ -269,6 +276,8 @@
'status' => 1,
'udate' => $udate,
'source' => $e->source,
+ 'filesize' => $e->filesize,
+ 'hash' => $e->hash,
);
$db->autoExecute('ebuild', $arr, MDB2_AUTOQUERY_INSERT);
@@ -284,10 +293,7 @@
}
- unset($e);
- unset($p);
- unset($db_ebuild);
- unset($db_package);
+ unset($e, $p, $db_ebuild, $db_package, $arr, $arr_insert, $arr_update);
// Update the package_recent entries
$sql = "DELETE FROM package_recent WHERE status = 1;";