summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dibb <beandog@gentoo.org>2009-12-18 05:56:38 +0000
committerSteve Dibb <beandog@gentoo.org>2009-12-18 05:56:38 +0000
commit80a889bb3bc5c614de2c6e9591eba271a4f431e9 (patch)
tree40e19f98d6b69c6265d5d7456f40e6977cde108c
parentgit-svn-id: file:///var/svn/portage@2 3218660a-b0cf-4799-a991-8ddcc5b9e0f3 (diff)
downloadznurt-org-backend-80a889bb3bc5c614de2c6e9591eba271a4f431e9.tar.gz
znurt-org-backend-80a889bb3bc5c614de2c6e9591eba271a4f431e9.tar.bz2
znurt-org-backend-80a889bb3bc5c614de2c6e9591eba271a4f431e9.zip
updates
git-svn-id: file:///var/svn/portage@3 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
-rw-r--r--class.portage.tree.php2
-rw-r--r--class.portage.use_flag.php82
-rw-r--r--import.all.php6
-rw-r--r--import.arches.php2
-rw-r--r--import.bugzilla.php33
-rw-r--r--import.categories.php2
-rw-r--r--import.ebuild_arch.php8
-rw-r--r--import.ebuild_homepage.php8
-rw-r--r--import.ebuild_license.php8
-rw-r--r--import.ebuild_mask.php8
-rw-r--r--import.ebuild_metadata.php8
-rw-r--r--import.ebuild_use.php22
-rw-r--r--import.ebuilds.php8
-rw-r--r--import.eclasses.php2
-rw-r--r--import.functions.php1
-rw-r--r--import.herds.php2
-rw-r--r--import.licenses.php2
-rw-r--r--import.package_mask.php12
-rw-r--r--import.packages.php6
-rw-r--r--import.use_expand.php55
-rw-r--r--import.use_flags.php97
-rw-r--r--import.use_global.php42
-rw-r--r--import.use_local.php49
-rw-r--r--use.php11
24 files changed, 404 insertions, 72 deletions
diff --git a/class.portage.tree.php b/class.portage.tree.php
index 4cb17da..c9ba655 100644
--- a/class.portage.tree.php
+++ b/class.portage.tree.php
@@ -102,7 +102,7 @@
* @param filename filename of use flags
* @return array
*/
- protected function arrUseFlags($filename) {
+ public function arrUseFlags($filename) {
$arr_file = file($filename, FILE_IGNORE_NEW_LINES);
diff --git a/class.portage.use_flag.php b/class.portage.use_flag.php
index 9be0497..3572660 100644
--- a/class.portage.use_flag.php
+++ b/class.portage.use_flag.php
@@ -9,28 +9,84 @@
private $arr_use_flags;
- function __construct($str = null) {
+ function __construct($type = 'global', $name = "") {
parent::__construct();
- $this->arr_use_flags = $this->arrUseFlags($this->getTree()."/profiles/use.desc");
+ $dir = $this->getTree()."/profiles/";
- if($str)
- $this->setFlag($str);
+ switch($type) {
+
+ case 'global':
+ $this->type = $type;
+ $this->filename = $dir."use.desc";
+ break;
+
+ case 'local':
+ $this->type = $type;
+ $this->filename = $dir."use.local.desc";
+ break;
+
+ case 'expand':
+ $this->type = $type;
+ $name = basename($name);
+ $this->filename = $dir."desc/$name.desc";
+
+ if(file_exists($this->filename)) {
+ $this->prefix = $name;
+ }
+
+ break;
+
+ }
- }
- private function setFlag($str) {
- if($this->arr_use_flags[$str])
- $this->name = $str;
}
-
- public function getName() {
- return $this->name;
+
+ public function getUseFlags() {
+
+ return $this->arrUseFlags($this->filename);
+
}
- public function getDescription() {
- return $this->arr_use_flags[$this->getName()];
+ public function arrUseFlags($filename) {
+
+ $arr_file = file($filename, FILE_IGNORE_NEW_LINES);
+
+ $arr_file = preg_grep('/^.+\s+\-\s+/', $arr_file);
+
+ sort($arr_file);
+
+ foreach($arr_file as $str) {
+
+ if($this->type == 'local') {
+
+ $tmp = explode(":", $str);
+ $package = array_shift($tmp);
+ $str = implode(":", $tmp);
+
+ }
+
+// $arr = explode(" - ", $str);
+ $arr = preg_split("/\s+-\s+/", $str);
+
+ $name = array_shift($arr);
+ $description = implode(" - ", $arr);
+
+ if($this->prefix) {
+ $name = $this->prefix."_$name";
+ $arr_use_flags[$name]['prefix'] = $this->prefix;
+ }
+
+ if($package) {
+ $arr_use_flags[$package][$name]['description'] = $description;
+ } else {
+ $arr_use_flags[$name]['description'] = $description;
+ }
+
+ }
+
+ return $arr_use_flags;
}
diff --git a/import.all.php b/import.all.php
index 337c6cc..3627200 100644
--- a/import.all.php
+++ b/import.all.php
@@ -8,11 +8,13 @@
$packages = true;
$ebuilds = true;
$metadata = true;
+ $use = true;
- $arr_import['base'] = array('arches', 'eclasses', 'herds', 'licenses', 'use_flags');
+ $arr_import['base'] = array('arches', 'eclasses', 'herds', 'licenses');
$arr_import['packages'] = array('categories', 'packages');
$arr_import['ebuilds'] = array('ebuilds');
- $arr_import['metadata'] = array('ebuild_metadata', 'ebuild_arch', 'ebuild_homepage', 'ebuild_license', 'package_mask', 'ebuild_mask', 'ebuild_ev');
+ $arr_import['metadata'] = array('ebuild_metadata', 'ebuild_arch', 'ebuild_homepage', 'ebuild_license', 'package_mask', 'ebuild_mask', 'ebuild_ev', 'use_global', 'use_local', 'use_expand', 'ebuild_use');
+
$arr_import['final'] = array('final');
diff --git a/import.arches.php b/import.arches.php
index 7ef209b..d0a9d80 100644
--- a/import.arches.php
+++ b/import.arches.php
@@ -1,7 +1,7 @@
<?
require_once 'header.php';
- require_once '../class.portage.tree.php';
+ require_once 'class.portage.tree.php';
$tree = new PortageTree();
diff --git a/import.bugzilla.php b/import.bugzilla.php
new file mode 100644
index 0000000..0a03c46
--- /dev/null
+++ b/import.bugzilla.php
@@ -0,0 +1,33 @@
+<?
+
+ $verbose = true;
+ $qa = true;
+
+ require_once 'header.php';
+
+ $url = "http://bugs.gentoo.org/buglist.cgi?bug_file_loc=&bug_file_loc_type=allwordssubstr&bug_id=&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bugidtype=include&chfieldfrom=&chfieldto=Now&chfieldvalue=&component=Ebuilds&email1=&email2=&emailtype1=exact&emailtype2=substring&field-1-0-0=bug_status&field-1-1-0=component&field-1-2-0=product&field-1-3-0=short_desc&field0-0-0=assigned_to&field0-1-0=assigned_to&field0-2-0=short_desc&keywords=&keywords_type=allwords&long_desc=&long_desc_type=allwordssubstr&product=Gentoo%20Linux&query_format=advanced&remaction=&short_desc=%2F&short_desc_type=allwordssubstr&status_whiteboard=&status_whiteboard_type=allwordssubstr&type-1-0-0=anyexact&type-1-1-0=anyexact&type-1-2-0=anyexact&type-1-3-0=allwordssubstr&type0-0-0=notequals&type0-1-0=notequals&type0-2-0=notsubstring&value-1-0-0=UNCONFIRMED%2CNEW%2CASSIGNED%2CREOPENED&value-1-1-0=Ebuilds&value-1-2-0=Gentoo%20Linux&value-1-3-0=%2F&value0-0-0=maintainer-wanted%40gentoo.org&value0-1-0=maintainer-needed%40gentoo.org&value0-2-0=new%20package&votes=&ctype=csv";
+
+ $ch = curl_init($url);
+ $fp = fopen("/tmp/bugs.csv", "w");
+
+ curl_setopt($ch, CURLOPT_FILE, $fp);
+ curl_setopt($ch, CURLOPT_HEADER, 0);
+
+ curl_exec($ch);
+ curl_close($ch);
+ fclose($fp);
+
+
+ die;
+
+ $url = urlencode($url);
+
+ $arr = file_get_contents($url);
+
+ print_r($arr);
+
+ $sql = "INSERT INTO package_bugs (bug, package, description, status) select b.bug_id AS bug, p.id AS package, b.short_short_desc, 1 FROM package p INNER JOIN category c ON p.category = c.id INNER JOIN bugzilla b ON b.short_short_desc LIKE ('%' || c.name || '/' || p.name || '%');";
+
+
+
+?> \ No newline at end of file
diff --git a/import.categories.php b/import.categories.php
index a0fd341..d9325cf 100644
--- a/import.categories.php
+++ b/import.categories.php
@@ -1,7 +1,7 @@
<?
require_once 'header.php';
- require_once '../class.portage.tree.php';
+ require_once 'class.portage.tree.php';
$tree = new PortageTree();
$table = 'category';
diff --git a/import.ebuild_arch.php b/import.ebuild_arch.php
index 4380d80..9f3d9f8 100644
--- a/import.ebuild_arch.php
+++ b/import.ebuild_arch.php
@@ -5,10 +5,10 @@
require_once 'header.php';
- require_once '../class.portage.tree.php';
- require_once '../class.portage.category.php';
- require_once '../class.portage.package.php';
- require_once '../class.portage.ebuild.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.category.php';
+ require_once 'class.portage.package.php';
+ require_once 'class.portage.ebuild.php';
// Get the arches
$tree = new PortageTree();
diff --git a/import.ebuild_homepage.php b/import.ebuild_homepage.php
index fad0537..0a73070 100644
--- a/import.ebuild_homepage.php
+++ b/import.ebuild_homepage.php
@@ -5,10 +5,10 @@
require_once 'header.php';
- require_once '../class.portage.tree.php';
- require_once '../class.portage.category.php';
- require_once '../class.portage.package.php';
- require_once '../class.portage.ebuild.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.category.php';
+ require_once 'class.portage.package.php';
+ require_once 'class.portage.ebuild.php';
// Find all the ebuilds that are missing ebuild arch
$sql = "SELECT id, metadata FROM missing_homepage;";
diff --git a/import.ebuild_license.php b/import.ebuild_license.php
index c214ccf..c227adf 100644
--- a/import.ebuild_license.php
+++ b/import.ebuild_license.php
@@ -5,10 +5,10 @@
require_once 'header.php';
- require_once '../class.portage.tree.php';
- require_once '../class.portage.category.php';
- require_once '../class.portage.package.php';
- require_once '../class.portage.ebuild.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.category.php';
+ require_once 'class.portage.package.php';
+ require_once 'class.portage.ebuild.php';
// Get the arches
$tree = new PortageTree();
diff --git a/import.ebuild_mask.php b/import.ebuild_mask.php
index d54bb87..c94309c 100644
--- a/import.ebuild_mask.php
+++ b/import.ebuild_mask.php
@@ -6,10 +6,10 @@
require_once 'header.php';
require_once 'import.functions.php';
- require_once '../class.portage.tree.php';
- require_once '../class.portage.category.php';
- require_once '../class.portage.package.php';
- require_once '../class.portage.ebuild.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.category.php';
+ require_once 'class.portage.package.php';
+ require_once 'class.portage.ebuild.php';
$sql = "DELETE FROM ebuild_mask;";
$db->query($sql);
diff --git a/import.ebuild_metadata.php b/import.ebuild_metadata.php
index 7192995..94c677f 100644
--- a/import.ebuild_metadata.php
+++ b/import.ebuild_metadata.php
@@ -6,10 +6,10 @@
// $debug = true;
require_once 'header.php';
- require_once '../class.portage.tree.php';
- require_once '../class.portage.category.php';
- require_once '../class.portage.package.php';
- require_once '../class.portage.ebuild.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.category.php';
+ require_once 'class.portage.package.php';
+ require_once 'class.portage.ebuild.php';
// Find all the ebuilds that are missing ebuild arch
$sql = "SELECT * FROM missing_metadata;";
diff --git a/import.ebuild_use.php b/import.ebuild_use.php
new file mode 100644
index 0000000..783fe9d
--- /dev/null
+++ b/import.ebuild_use.php
@@ -0,0 +1,22 @@
+<?
+
+ $verbose = true;
+ $qa = true;
+
+ require_once 'header.php';
+
+ $sql = "DROP TABLE IF EXISTS tmp_ebuild_use;";
+ $db->query($sql);
+
+ $sql = "CREATE TEMP TABLE tmp_ebuild_use AS SELECT eu.id AS ebuild, REGEXP_SPLIT_TO_TABLE(metadata, E'\\\\s+') AS name FROM missing_use eu;";
+ $db->query($sql);
+
+ $sql = "UPDATE tmp_ebuild_use SET name = SUBSTR(name, 2) WHERE SUBSTR(name, 1, 1) = '+' OR SUBSTR(name, 1, 1) = '-';";
+ $db->query($sql);
+
+ $sql = "INSERT INTO ebuild_use SELECT DISTINCT eu.ebuild, u.id FROM tmp_ebuild_use eu INNER JOIN use u ON u.name = eu.name;";
+ $db->query($sql);
+
+
+
+?> \ No newline at end of file
diff --git a/import.ebuilds.php b/import.ebuilds.php
index 3fa6978..5975516 100644
--- a/import.ebuilds.php
+++ b/import.ebuilds.php
@@ -17,10 +17,10 @@
}
require_once 'header.php';
- require_once '../class.portage.tree.php';
- require_once '../class.portage.category.php';
- require_once '../class.portage.package.php';
- require_once '../class.portage.ebuild.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.category.php';
+ require_once 'class.portage.package.php';
+ require_once 'class.portage.ebuild.php';
// Delete any that were previously getting inserted or deleted
$sql = "DELETE FROM ebuild WHERE status > 0;";
diff --git a/import.eclasses.php b/import.eclasses.php
index 1fbaf34..b7fd142 100644
--- a/import.eclasses.php
+++ b/import.eclasses.php
@@ -1,7 +1,7 @@
<?
require_once 'header.php';
- require_once '../class.portage.tree.php';
+ require_once 'class.portage.tree.php';
$tree = new PortageTree();
$table = 'eclass';
diff --git a/import.functions.php b/import.functions.php
index d5407b7..6c7d762 100644
--- a/import.functions.php
+++ b/import.functions.php
@@ -1,6 +1,5 @@
<?
-
/**
* Create the 'extended version' of the original versions,
* which is basically numerical version schemes padded
diff --git a/import.herds.php b/import.herds.php
index e89be0c..9f06f2c 100644
--- a/import.herds.php
+++ b/import.herds.php
@@ -1,7 +1,7 @@
<?
require_once 'header.php';
- require_once '../class.portage.tree.php';
+ require_once 'class.portage.tree.php';
$tree = new PortageTree();
$table = 'herd';
diff --git a/import.licenses.php b/import.licenses.php
index dccb612..983d8d9 100644
--- a/import.licenses.php
+++ b/import.licenses.php
@@ -1,7 +1,7 @@
<?
require_once 'header.php';
- require_once '../class.portage.tree.php';
+ require_once 'class.portage.tree.php';
$tree = new PortageTree();
$table = 'license';
diff --git a/import.package_mask.php b/import.package_mask.php
index 5352bd7..b439b4e 100644
--- a/import.package_mask.php
+++ b/import.package_mask.php
@@ -4,12 +4,12 @@
$qa = true;
require_once 'header.php';
- require_once '../class.portage.tree.php';
- require_once '../class.portage.category.php';
- require_once '../class.portage.package.php';
- require_once '../class.portage.ebuild.php';
- require_once '../class.portage.atom.php';
- require_once '../class.portage.package.mask.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.category.php';
+ require_once 'class.portage.package.php';
+ require_once 'class.portage.ebuild.php';
+ require_once 'class.portage.atom.php';
+ require_once 'class.portage.package.mask.php';
$pmask = new PackageMask();
diff --git a/import.packages.php b/import.packages.php
index f3f08a9..6d74703 100644
--- a/import.packages.php
+++ b/import.packages.php
@@ -1,9 +1,9 @@
<?
require_once 'header.php';
- require_once '../class.portage.tree.php';
- require_once '../class.portage.category.php';
- require_once '../class.portage.package.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.category.php';
+ require_once 'class.portage.package.php';
$sql = "SELECT id, name FROM category ORDER BY name;";
$arr_categories = $db->getAssoc($sql);
diff --git a/import.use_expand.php b/import.use_expand.php
new file mode 100644
index 0000000..59a942e
--- /dev/null
+++ b/import.use_expand.php
@@ -0,0 +1,55 @@
+<?
+
+ require_once 'header.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.use_flag.php';
+ require_once 'class.portage.ebuild.php';
+ require_once 'class.portage.atom.php';
+ require_once '/home/steve/svn/znurt/class.db.mtime.php';
+ require_once '/home/steve/svn/znurt/class.db.use.php';
+ require_once 'File/Find.php';
+
+ $tree = new PortageTree();
+
+ // Expand use flags
+ $type = 'expand';
+ $arr_new[$type] = $arr_delete[$type] = $arr_use_flags[$type] = array();
+
+ $arr_find = File_Find::search('desc$', $tree->getTree().'/profiles/desc/');
+
+ foreach($arr_find as $filename) {
+
+ $basename = $prefix = basename($filename);
+ $prefix = str_replace(".desc", "", $prefix);
+
+ $u = new PortageUseFlag($type, $prefix);
+ $filemtime = filemtime($u->filename);
+ $arr_use_flags[$type] = array_merge($arr_use_flags[$type], $u->getUseFlags());
+ $keys = array_keys($u->getUseFlags());
+ $where = "prefix = ".$db->quote($prefix);
+
+ $dbmtime = new DBMtime($u->filename);
+
+ $sql = "SELECT COUNT(1) FROM use WHERE $where;";
+ $db_count = $db->getOne($sql);
+
+ if(is_null($dbmtime->mtime)) {
+ $dbmtime->mtime = $dbmtime->filemtime;
+ } elseif($filemtime > $dbmtime->mtime) {
+ $dbmtime->mtime = $filemtime;
+ }
+
+ }
+
+ foreach($arr_use_flags[$type] as $name => $arr) {
+
+ extract($arr);
+
+ $dbuse = new DBUse($name, 'expand', $prefix);
+ if($dbuse->description != $description)
+ $dbuse->description = $description;
+ if($dbuse->prefix != $prefix)
+ $dbuse->prefix = $prefix;
+ }
+
+?> \ No newline at end of file
diff --git a/import.use_flags.php b/import.use_flags.php
index 48635dd..1b42e25 100644
--- a/import.use_flags.php
+++ b/import.use_flags.php
@@ -1,27 +1,90 @@
<?
require_once 'header.php';
- require_once '../class.portage.tree.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.use_flag.php';
+ require_once 'class.portage.ebuild.php';
+ require_once 'class.portage.atom.php';
+ require_once '/home/steve/svn/znurt/class.db.mtime.php';
+ require_once '/home/steve/svn/znurt/class.db.use.php';
+ require_once 'File/Find.php';
$tree = new PortageTree();
- $table = 'use';
- $arr = $tree->getUseFlags();
-
- $arr_diff = importDiff($table, $arr);
-
- if(count($arr_diff['delete'])) {
- foreach($arr_diff['delete'] as $name) {
- $sql = "DELETE FROM $table WHERE name = ".$db->quote($name).";";
- $db->query($sql);
+ // Local use flags
+ $type = 'local';
+ $u = new PortageUseFlag($type);
+ $filemtime = filemtime($u->filename);
+ $arr_use_flags[$type] = $u->getUseFlags();
+ $keys = array_keys($arr_use_flags[$type]);
+
+ $dbmtime = new DBMtime($u->filename);
+
+
+
+ foreach($arr_use_flags[$type] as $cp => $arr_package_use_flags) {
+ shell::msg($cp);
+
+ print_r($arr_package_use_flags);
+ die;
+
+ $sql = "SELECT package FROM view_package WHERE cp = ".$db->quote($cp);
+ $package = $db->getOne($sql);
+
+ foreach($arr_package_use_flags as $name => $arr) {
+ $where = "package = $package";
+
+ $sql = "SELECT COUNT(1) FROM use WHERE $where;";
+ $db_count = $db->getOne($sql);
+
+ if(is_null($dbmtime->mtime)) {
+
+
+
+ }
}
- }
+
+ }
+
+
+
+
+
+
+
+
+ $arr_new[$type] = $arr_delete[$type] = array();
+
+ if(is_null($dbmtime->mtime)) {
+
+ $arr_new[$type] = $keys;
+
+ $dbmtime->mtime = $dbmtime->filemtime;
+
+ } elseif(($filemtime > $db_mtime) || ($db_count != count($keys))) {
+
+ $arr_import = importDiff('use', $keys, $where);
+
+ $arr_new[$type] = $arr_import['insert'];
+ $arr_delete[$type] = $arr_import['delete'];
+
+ $dbmtime->mtime = $filemtime;
+
+ }
+
- if(count($arr_diff['insert'])) {
- foreach($arr_diff['insert'] as $name) {
- $arr_insert = array('name' => $name);
- $db->autoExecute($table, $arr_insert, MDB2_AUTOQUERY_INSERT);
- }
- }
+// if(count($arr_diff['delete'])) {
+// foreach($arr_diff['delete'] as $name) {
+// $sql = "DELETE FROM $table WHERE name = ".$db->quote($name).";";
+// $db->query($sql);
+// }
+// }
+//
+// if(count($arr_diff['insert'])) {
+// foreach($arr_diff['insert'] as $name) {
+// $arr_insert = array('name' => $name);
+// $db->autoExecute($table, $arr_insert, MDB2_AUTOQUERY_INSERT);
+// }
+// }
?> \ No newline at end of file
diff --git a/import.use_global.php b/import.use_global.php
new file mode 100644
index 0000000..e192d0c
--- /dev/null
+++ b/import.use_global.php
@@ -0,0 +1,42 @@
+<?
+
+ require_once 'header.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.use_flag.php';
+ require_once 'class.portage.ebuild.php';
+ require_once 'class.portage.atom.php';
+ require_once '/home/steve/svn/znurt/class.db.mtime.php';
+ require_once '/home/steve/svn/znurt/class.db.use.php';
+ require_once 'File/Find.php';
+
+ $tree = new PortageTree();
+
+ // Global use flags
+ $type = 'global';
+ $u = new PortageUseFlag($type);
+ $filemtime = filemtime($u->filename);
+ $arr_use_flags[$type] = $u->getUseFlags();
+ $keys = array_keys($arr_use_flags[$type]);
+
+ $where = "prefix = ''";
+
+ $dbmtime = new DBMtime($u->filename);
+
+ $sql = "SELECT COUNT(1) FROM use WHERE $where;";
+ $db_count = $db->getOne($sql);
+
+ $arr_new[$type] = $arr_delete[$type] = array();
+
+ if(is_null($dbmtime->mtime)) {
+ $dbmtime->mtime = $dbmtime->filemtime;
+ } elseif($filemtime > $dbmtime->mtime) {
+ $dbmtime->mtime = $filemtime;
+ }
+
+ foreach($arr_use_flags[$type] as $name => $arr) {
+
+ $dbuse = new DBUse($name, $type);
+ if($dbuse->description != $arr['description'])
+ $dbuse->description = $arr['description'];
+ }
+ ?> \ No newline at end of file
diff --git a/import.use_local.php b/import.use_local.php
new file mode 100644
index 0000000..36db97e
--- /dev/null
+++ b/import.use_local.php
@@ -0,0 +1,49 @@
+<?
+
+ require_once 'header.php';
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.use_flag.php';
+ require_once 'class.portage.ebuild.php';
+ require_once 'class.portage.atom.php';
+ require_once '/home/steve/svn/znurt/class.db.mtime.php';
+ require_once '/home/steve/svn/znurt/class.db.use.php';
+ require_once '/home/steve/svn/znurt/class.db.package_use.php';
+ require_once 'File/Find.php';
+
+ $tree = new PortageTree();
+
+ // Local use flags
+ $type = 'local';
+ $u = new PortageUseFlag($type);
+ $filemtime = filemtime($u->filename);
+ $arr_use_flags[$type] = $u->getUseFlags();
+ $keys = array_keys($arr_use_flags[$type]);
+
+ $dbmtime = new DBMtime($u->filename);
+
+ if(is_null($dbmtime->mtime)) {
+ $dbmtime->mtime = $dbmtime->filemtime;
+ } elseif($filemtime > $dbmtime->mtime) {
+ $dbmtime->mtime = $filemtime;
+ }
+
+ foreach($arr_use_flags[$type] as $cp => $arr_package_use_flags) {
+
+ $sql = "SELECT package FROM view_package WHERE cp = ".$db->quote($cp).";";
+ $package = $db->getOne($sql);
+
+ foreach($arr_package_use_flags as $name => $arr) {
+ extract($arr);
+
+ $dbuse = new DBUse($name, 'local', $cp);
+
+ $dbpackage_use = new DBPackageUse($package, $dbuse->id);
+
+ if($dbpackage_use->description != $description)
+ $dbpackage_use->description = $description;
+
+
+ }
+ }
+
+?> \ No newline at end of file
diff --git a/use.php b/use.php
new file mode 100644
index 0000000..d08fb20
--- /dev/null
+++ b/use.php
@@ -0,0 +1,11 @@
+<?
+
+ require_once 'class.portage.tree.php';
+ require_once 'class.portage.use_flag.php';
+ require_once '/home/steve/php/inc/class.shell.php';
+
+ $u = new PortageUseFlag('local');
+
+ print_r($u->getUseFlags());
+
+?>