aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'utils/db_init.py')
-rwxr-xr-x[-rw-r--r--]utils/db_init.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/utils/db_init.py b/utils/db_init.py
index c71a5ef..d763926 100644..100755
--- a/utils/db_init.py
+++ b/utils/db_init.py
@@ -2,6 +2,7 @@
import sys
from pkgcore.config import load_config
+from pkgcore.cache import metadata
from pkgcore.ebuild import repository
from pymongo import Connection
@@ -12,9 +13,10 @@ def main(path):
# pkgcore part to fetch all the ebuild information
conf = load_config()
- # NB! No cache is used, so this is ssslllooowwww..
eclass_cache = conf.eclass_cache['eclass stack']
- overlay_repo = repository.UnconfiguredTree(path, eclass_cache=eclass_cache)
+ cache = metadata.database(readonly=True, location=path)
+ overlay_repo = repository.UnconfiguredTree(path, cache=cache, \
+ eclass_cache=eclass_cache)
for pkg in overlay_repo:
_id = "%s/%s" % (pkg.package, pkg.category)
@@ -42,8 +44,8 @@ def main(path):
slot = pkg.slot,
eapi = pkg.eapi,
keywords = list(pkg.keywords) if pkg.keywords else [],
+ iuse = list(pkg.iuse) if pkg.iuse else [],
# TODO, need to figure out a proper queryable structure for these
-# iuse ??
# license = pkg.license,
# depends = pkg.depends,
# rdepends = pkg.rdepends
@@ -52,7 +54,7 @@ def main(path):
print "Adding: ", db.ebuilds.save(ebuild)
if __name__ == '__main__':
- if len(sys.argv) != 1:
+ if len(sys.argv) != 2:
print "Please provide path to portage directory as argument"
sys.exit()
main(sys.argv[1])