cli/addrepo: Change the distro check behaviour as in 2.2 branch
It looks for a DistributionName tag to check distro name. If it does not exist, the check is ignored.
This commit is contained in:
+9
-1
@@ -55,8 +55,16 @@ NB: We support only local files (e.g., /a/b/c) and http:// URIs at the moment
|
|||||||
pisi.api.remove_repo(repo)
|
pisi.api.remove_repo(repo)
|
||||||
|
|
||||||
def check_distro(self, repo):
|
def check_distro(self, repo):
|
||||||
|
if not self.repodb.get_distribution(repo):
|
||||||
|
ctx.ui.warning(
|
||||||
|
_("Unable to check compatibility of this repository as "
|
||||||
|
"it does not have information about the distribution."))
|
||||||
|
return
|
||||||
|
|
||||||
if not self.repodb.check_distribution(repo):
|
if not self.repodb.check_distribution(repo):
|
||||||
self.warn_and_remove(_("Repository distribution does not match. Removing %s from system.") % repo, repo)
|
self.warn_and_remove(
|
||||||
|
_("Repository distribution does not match. "
|
||||||
|
"Removing %s from system.") % repo, repo)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
|||||||
+10
-3
@@ -226,12 +226,19 @@ class RepoDB(lazydb.LazyDB):
|
|||||||
|
|
||||||
def get_distribution(self, name):
|
def get_distribution(self, name):
|
||||||
doc = self.get_repo_doc(name)
|
doc = self.get_repo_doc(name)
|
||||||
return doc.getTag("Distribution").getTagData("SourceName")
|
return doc.getTag("Distribution").getTagData("DistributionName")
|
||||||
|
|
||||||
def get_distribution_release(self, name):
|
def get_distribution_release(self, name):
|
||||||
doc = self.get_repo_doc(name)
|
doc = self.get_repo_doc(name)
|
||||||
return doc.getTag("Distribution").getTagData("Version")
|
return doc.getTag("Distribution").getTagData("Version")
|
||||||
|
|
||||||
def check_distribution(self, name):
|
def check_distribution(self, name):
|
||||||
return self.get_distribution(name) == ctx.config.values.general.distribution and \
|
dist_name = self.get_distribution(name)
|
||||||
self.get_distribution_release(name) == ctx.config.values.general.distribution_release
|
dist_release = self.get_distribution_release(name)
|
||||||
|
|
||||||
|
if not dist_name:
|
||||||
|
# If distribution info is not available, ignore for now.
|
||||||
|
return True
|
||||||
|
|
||||||
|
return dist_name == ctx.config.values.general.distribution and \
|
||||||
|
dist_release == ctx.config.values.general.distribution_release
|
||||||
|
|||||||
Reference in New Issue
Block a user