get repo status
This commit is contained in:
+3
-2
@@ -224,11 +224,12 @@ def list_upgradable():
|
|||||||
|
|
||||||
return upgradable
|
return upgradable
|
||||||
|
|
||||||
def list_repos():
|
def list_repos(onlyActive=True):
|
||||||
"""
|
"""
|
||||||
Return a list of the repositories -> list_of_strings
|
Return a list of the repositories -> list_of_strings
|
||||||
|
@param onlyActive: return only the active repos list -> list_of_strings
|
||||||
"""
|
"""
|
||||||
return pisi.db.repodb.RepoDB().list_repos()
|
return pisi.db.repodb.RepoDB().list_repos(onlyActive)
|
||||||
|
|
||||||
def get_install_order(packages):
|
def get_install_order(packages):
|
||||||
"""
|
"""
|
||||||
|
|||||||
+17
-4
@@ -73,6 +73,17 @@ class RepoOrder:
|
|||||||
|
|
||||||
self._update(repo_doc)
|
self._update(repo_doc)
|
||||||
|
|
||||||
|
def get_status(self, repo_name):
|
||||||
|
repo_doc = self._get_doc()
|
||||||
|
for r in repo_doc.tags("Repo"):
|
||||||
|
if r.getTagData("Name") == repo_name:
|
||||||
|
status_node = r.getTag("Status")
|
||||||
|
if status_node:
|
||||||
|
status = status_node.firstChild().data()
|
||||||
|
if status in ["active", "deactive"]:
|
||||||
|
return status
|
||||||
|
return "deactive"
|
||||||
|
|
||||||
def remove(self, repo_name):
|
def remove(self, repo_name):
|
||||||
repo_doc = self._get_doc()
|
repo_doc = self._get_doc()
|
||||||
|
|
||||||
@@ -111,8 +122,7 @@ class RepoOrder:
|
|||||||
media = r.getTagData("Media")
|
media = r.getTagData("Media")
|
||||||
name = r.getTagData("Name")
|
name = r.getTagData("Name")
|
||||||
status = r.getTagData("Status")
|
status = r.getTagData("Status")
|
||||||
if status != "deactive":
|
order.setdefault(media, []).append(name)
|
||||||
order.setdefault(media, []).append(name)
|
|
||||||
|
|
||||||
return order
|
return order
|
||||||
|
|
||||||
@@ -178,8 +188,8 @@ class RepoDB(lazydb.LazyDB):
|
|||||||
repos.append(r)
|
repos.append(r)
|
||||||
return repos
|
return repos
|
||||||
|
|
||||||
def list_repos(self):
|
def list_repos(self, onlyActive=True):
|
||||||
return self.repoorder.get_order()
|
return filter(lambda x:True if not onlyActive else self.repo_active(x), self.repoorder.get_order())
|
||||||
|
|
||||||
def list_repo_urls(self):
|
def list_repo_urls(self):
|
||||||
repos = []
|
repos = []
|
||||||
@@ -200,3 +210,6 @@ class RepoDB(lazydb.LazyDB):
|
|||||||
|
|
||||||
def deactivate_repo(self, name):
|
def deactivate_repo(self, name):
|
||||||
self.repoorder.set_status(name, "deactive")
|
self.repoorder.set_status(name, "deactive")
|
||||||
|
|
||||||
|
def repo_active(self, name):
|
||||||
|
return self.repoorder.get_status(name) == "active"
|
||||||
|
|||||||
Reference in New Issue
Block a user