diff --git a/pisi/cli/addrepo.py b/pisi/cli/addrepo.py index d1f22816..e921af79 100644 --- a/pisi/cli/addrepo.py +++ b/pisi/cli/addrepo.py @@ -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): diff --git a/pisi/db/repodb.py b/pisi/db/repodb.py index 0693527c..a82a2c57 100644 --- a/pisi/db/repodb.py +++ b/pisi/db/repodb.py @@ -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