* pisi-updateindex tool'unu implement et(meye basla)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#! /usr/bin/python
|
||||
# perform analysis on problem instances and store results in a database
|
||||
# avoiding multiple invocations of the same instance
|
||||
|
||||
import sys
|
||||
import string
|
||||
import bsddb.dbshelve as shelve
|
||||
import os
|
||||
|
||||
d = shelve.open( sys.argv[1] )
|
||||
|
||||
#print 'list serial time, db size ', len(d)
|
||||
for (k,data) in d.iteritems():
|
||||
print k, data
|
||||
|
||||
d.close()
|
||||
+6
-1
@@ -2,6 +2,7 @@
|
||||
from package import Package
|
||||
from xmlfile import XmlFile
|
||||
import metadata
|
||||
import packagedb
|
||||
from ui import ui
|
||||
import util
|
||||
from config import config
|
||||
@@ -24,7 +25,6 @@ class Index(XmlFile):
|
||||
|
||||
self.unlink()
|
||||
|
||||
|
||||
def write(self, filename):
|
||||
"""Write index file"""
|
||||
self.newDOM()
|
||||
@@ -43,6 +43,11 @@ class Index(XmlFile):
|
||||
ui.info('Adding ' + fn + ' to package index\n')
|
||||
self.add_package(join(root, fn))
|
||||
|
||||
def update_db(self):
|
||||
packagedb.clear()
|
||||
for pkg in self.packages:
|
||||
packagedb.add_package(pkg)
|
||||
|
||||
def add_package(self, path):
|
||||
package = Package(path, 'r')
|
||||
# extract control files
|
||||
|
||||
+7
-3
@@ -7,12 +7,16 @@
|
||||
# yes, we are cheap
|
||||
|
||||
import bsddb.dbshelve as shelve
|
||||
import os
|
||||
|
||||
import util
|
||||
from config import config
|
||||
|
||||
util.check_dir(config.db_dir())
|
||||
d = shelve.open(config.db_dir() + '/package.bdb')
|
||||
d = shelve.open( os.path.join(config.db_dir(), 'package.bdb') )
|
||||
|
||||
def clear():
|
||||
d.clear()
|
||||
|
||||
def has_package(name):
|
||||
name = str(name)
|
||||
@@ -22,8 +26,8 @@ def get_package(name):
|
||||
name = str(name)
|
||||
return d[name]
|
||||
|
||||
def add_package(name, package_info):
|
||||
name = str(name)
|
||||
def add_package(package_info):
|
||||
name = str(package_info.name)
|
||||
d[name] = package_info
|
||||
|
||||
def remove_package(name):
|
||||
|
||||
Reference in New Issue
Block a user