With the mediaid/mediafunc bits being opt-in for API users, if there's a
repo which is media _only_, we should probably just disable it if you're
not using a media-aware frontend. Attached implements.
This will make it so that we can stick a dvd.repo on the top-level of
the Fedora DVDs which includes a mediaid line. Then, pirut will be able
to get packages off of the DVD (if it's available) and yum will just
happily fall back. And it keeps us from having to figure out when
creating dvd.repo what the actual end baseurl will be
Jeremy
commit 0cb2dd68fb268dbcdf9b7b483225580d4bd8980d
Author: Jeremy Katz <[EMAIL PROTECTED]>
Date: Tue Sep 18 13:00:00 2007 -0400
for frontends which aren't media-aware (ie, don't provide a mediafunc for
grabbing packages from media), disable any media-only repositories
diff --git a/yum/__init__.py b/yum/__init__.py
index 22d3d6a..462fec9 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -365,7 +365,7 @@ class YumBase(depsolve.Depsolve):
return self._pkgSack
if thisrepo is None:
- repos = self.repos.listEnabled()
+ repos = 'enabled'
else:
repos = self.repos.findRepos(thisrepo)
@@ -386,6 +386,8 @@ class YumBase(depsolve.Depsolve):
self._pkgSack.excludeArchs(archlist)
#FIXME - this could be faster, too.
+ if repos == 'enabled':
+ repos = self.repos.listEnabled()
for repo in repos:
self.excludePackages(repo)
self.includePackages(repo)
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index e9f6e7f..aaec73d 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -701,7 +701,9 @@ class YumRepository(Repository, config.RepoConf):
self.dirSetup()
except Errors.RepoError, e:
raise
-
+ if not self.mediafunc and self.mediaid and not self.mirrorlist and not self.baseurl:
+ verbose_logger.log(logginglevels.DEBUG_2, "Disabling media repo for non-media-aware frontend")
+ self.enabled = False
def _loadRepoXML(self, text=None):
"""retrieve/check/read in repomd.xml from the repository"""
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel