Kaydet (Commit) e09a912e authored tarafından Fatih Aşıcı's avatar Fatih Aşıcı

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.
üst 0a947fbd
......@@ -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)
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):
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):
......
......@@ -226,12 +226,19 @@ class RepoDB(lazydb.LazyDB):
def get_distribution(self, 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):
doc = self.get_repo_doc(name)
return doc.getTag("Distribution").getTagData("Version")
def check_distribution(self, name):
return self.get_distribution(name) == ctx.config.values.general.distribution and \
self.get_distribution_release(name) == ctx.config.values.general.distribution_release
dist_name = self.get_distribution(name)
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment