for repo in kickstart.get_repos(self.ks, repo_urls):
(name, baseurl, mirrorlist, inc, exc,
proxy, proxy_username, proxy_password, debuginfo,
- source, gpgkey, disable, ssl_verify) = repo
+ source, gpgkey, disable, ssl_verify, cost, priority) = repo
yr = pkg_manager.addRepository(name, baseurl, mirrorlist, proxy,
- proxy_username, proxy_password, inc, exc, ssl_verify)
+ proxy_username, proxy_password, inc, exc, ssl_verify,
+ cost, priority)
if kickstart.exclude_docs(self.ks):
rpm.addMacro("_excludedocs", "1")
ssl_verify = True
if hasattr(repo, "ssl_verify"):
ssl_verify = repo.ssl_verify == "yes"
+ cost = None
+ if hasattr(repo, "cost"):
+ cost = repo.cost
+ priority = None
+ if hasattr(repo, "priority"):
+ priority = repo.priority
repos[repo.name] = (repo.name, baseurl, mirrorlist, inc, exc,
proxy, proxy_username, proxy_password, debuginfo,
- source, gpgkey, disable, ssl_verify)
+ source, gpgkey, disable, ssl_verify, cost, priority)
return repos.values()
self.source = source
self.gpgkey = gpgkey
self.ssl_verify = ssl_verify.lower()
+ self.priority = priority
def _getArgsAsStr(self):
retval = F8_RepoData._getArgsAsStr(self)
retval += " --disable"
if self.ssl_verify:
retval += " --ssl_verify=%s" % self.ssl_verify
+ if self.priority:
+ retval += " --priority=%s" % self.priority
return retval
default=None, nargs=1)
op.add_option("--ssl_verify", type="string", action="store", dest="ssl_verify",
default="yes")
+ op.add_option("--priority", type="int", action="store", dest="priority",
+ default=None)
return op
repostr += ",debuginfo:"
if hasattr(repodata, "source") and repodata.source:
repostr += ",source:"
- if hasattr(repodata, "gpgkey") and repodata.gpgkey:
+ if hasattr(repodata, "gpgkey") and repodata.gpgkey:
repostr += ",gpgkey:" + repodata.gpgkey
if hasattr(repodata, "ssl_verify") and repodata.ssl_verify:
repostr += ",ssl_verify:" + repodata.ssl_verify
+ if hasattr(repodata, "priority") and repodata.priority:
+ repostr += ",priority:%d" % repodata.priority
kickstart_repos.append(repostr[1:])
return kickstart_repos
def addRepository(self, name, url = None, mirrorlist = None, proxy = None,
proxy_username = None, proxy_password = None,
- inc = None, exc = None, ssl_verify=True):
+ inc = None, exc = None, ssl_verify=True, cost = None,
+ priority=None):
+ # TODO: Handle priority attribute for repos
def _varSubstitute(option):
# takes a variable and substitutes like yum configs do
option = option.replace("$basearch", rpmUtils.arch.getBaseArch())
repo.enable()
repo.setup(0)
self.repos.add(repo)
+ if cost:
+ repo.cost = cost
msger.verbose('repo: %s was added' % name)
return repo
self.enabled = True
self.autorefresh = True
self.keeppackages = True
+ self.priority = None
class RepoError(CreatorError):
pass
def addRepository(self, name, url = None, mirrorlist = None, proxy = None,
proxy_username = None, proxy_password = None,
- inc = None, exc = None, ssl_verify = True):
+ inc = None, exc = None, ssl_verify = True, cost=None,
+ priority=None):
+ # TODO: Handle cost attribute for repos
if not self.repo_manager:
self.__initialize_repo_manager()
# Enable gpg check for verifying corrupt packages
repo.gpgcheck = 1
+ if priority:
+ repo.priority = priority
self.repos.append(repo)
try:
port = proxyinfo[1]
baseurl.setQueryParam ("proxyport", port)
repo_info.addBaseUrl(baseurl)
+ if repo.priority:
+ repo_info.setPriority(repo.priority)
self.repo_manager.addRepository(repo_info)
self.__build_repo_cache(name)
except RuntimeError, e: