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 /import.use_expand.php
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
Diffstat (limited to 'import.use_expand.php')
-rw-r--r--import.use_expand.php55
1 files changed, 55 insertions, 0 deletions
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