- do not cache configure pending
- do not try the get order list is there is no list
This commit is contained in:
@@ -34,10 +34,8 @@ Lists packages waiting to be configured.
|
|||||||
self.init(database = True, write = False)
|
self.init(database = True, write = False)
|
||||||
|
|
||||||
A = pisi.api.list_pending()
|
A = pisi.api.list_pending()
|
||||||
order = pisi.api.generate_pending_order(A)
|
if len(A):
|
||||||
|
for p in pisi.api.generate_pending_order(A):
|
||||||
if len(order):
|
|
||||||
for p in order:
|
|
||||||
print p
|
print p
|
||||||
else:
|
else:
|
||||||
ctx.ui.info(_('There are no packages waiting to be configured'))
|
ctx.ui.info(_('There are no packages waiting to be configured'))
|
||||||
|
|||||||
+12
-11
@@ -69,13 +69,12 @@ class InstallDB(lazydb.LazyDB):
|
|||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
self.installed_db = self.__generate_installed_pkgs()
|
self.installed_db = self.__generate_installed_pkgs()
|
||||||
self.confing_pending_db = self.__generate_config_pending()
|
|
||||||
self.rev_deps_db = self.__generate_revdeps()
|
self.rev_deps_db = self.__generate_revdeps()
|
||||||
|
|
||||||
def __generate_installed_pkgs(self):
|
def __generate_installed_pkgs(self):
|
||||||
return dict(map(lambda x:pisi.util.parse_package_name(x), os.listdir(ctx.config.packages_dir())))
|
return dict(map(lambda x:pisi.util.parse_package_name(x), os.listdir(ctx.config.packages_dir())))
|
||||||
|
|
||||||
def __generate_config_pending(self):
|
def __get_config_pending(self):
|
||||||
pending_info_path = os.path.join(ctx.config.info_dir(), ctx.const.config_pending)
|
pending_info_path = os.path.join(ctx.config.info_dir(), ctx.const.config_pending)
|
||||||
if os.path.exists(pending_info_path):
|
if os.path.exists(pending_info_path):
|
||||||
return open(pending_info_path, "r").read().split()
|
return open(pending_info_path, "r").read().split()
|
||||||
@@ -188,9 +187,10 @@ class InstallDB(lazydb.LazyDB):
|
|||||||
return metadata.package
|
return metadata.package
|
||||||
|
|
||||||
def mark_pending(self, package):
|
def mark_pending(self, package):
|
||||||
if package not in self.confing_pending_db:
|
config_pending = self.__get_config_pending()
|
||||||
self.confing_pending_db.append(package)
|
if package not in config_pending:
|
||||||
self.__write_config_pending()
|
config_pending.append(package)
|
||||||
|
self.__write_config_pending(config_pending)
|
||||||
|
|
||||||
def add_package(self, pkginfo):
|
def add_package(self, pkginfo):
|
||||||
self.installed_db[pkginfo.name] = "%s-%s" % (pkginfo.version, pkginfo.release)
|
self.installed_db[pkginfo.name] = "%s-%s" % (pkginfo.version, pkginfo.release)
|
||||||
@@ -202,17 +202,18 @@ class InstallDB(lazydb.LazyDB):
|
|||||||
self.clear_pending(package_name)
|
self.clear_pending(package_name)
|
||||||
|
|
||||||
def list_pending(self):
|
def list_pending(self):
|
||||||
return self.confing_pending_db
|
return self.__get_config_pending()
|
||||||
|
|
||||||
def clear_pending(self, package):
|
def clear_pending(self, package):
|
||||||
if package in self.confing_pending_db:
|
config_pending = self.__get_config_pending()
|
||||||
self.confing_pending_db.remove(package)
|
if package in config_pending:
|
||||||
self.__write_config_pending()
|
config_pending.remove(package)
|
||||||
|
self.__write_config_pending(config_pending)
|
||||||
|
|
||||||
def __write_config_pending(self):
|
def __write_config_pending(self, config_pending):
|
||||||
pending_info_file = os.path.join(ctx.config.info_dir(), ctx.const.config_pending)
|
pending_info_file = os.path.join(ctx.config.info_dir(), ctx.const.config_pending)
|
||||||
pending = open(pending_info_file, "w")
|
pending = open(pending_info_file, "w")
|
||||||
for pkg in set(self.confing_pending_db):
|
for pkg in set(config_pending):
|
||||||
pending.write("%s\n" % pkg)
|
pending.write("%s\n" % pkg)
|
||||||
pending.close()
|
pending.close()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user