[Yum-devel] [PATCH] yumdownloader: enable/disable source repos before reposetup. BZ 819064.
James Antill
james.antill at redhat.com
Thu May 17 19:15:25 UTC 2012
On Thu, 2012-05-17 at 14:30 +0200, Zdeněk Pavlas wrote:
> Quite a hack, but seems to work fine and fixes the BZ.
> --{enable,disable}repo options tested and work as expected.
I guess this is probably fine, ACK.
I do wonder though if we should just leave enabled any source repos
that are already enabled ... which will help a couple of weird RHEL
cases (where the src. repo's are named something completely different
from the bin. repos).
I can't think why we were disabling them ... I guess it was to do with
people leaving them enabled, for Eg. updates-testing, when they'd
disabled updates-testing. But I'm guessing that problem is a better
failure than the current ones where people can't work out how to have
them enabled.
Note to everyone else that _removeEnabledSourceRepos() is just dead
code.
> ---
> yumdownloader.py | 21 +++------------------
> 1 files changed, 3 insertions(+), 18 deletions(-)
>
> diff --git a/yumdownloader.py b/yumdownloader.py
> index d37f15d..5942956 100755
> --- a/yumdownloader.py
> +++ b/yumdownloader.py
> @@ -94,9 +94,6 @@ class YumDownloader(YumUtilBase):
>
> # Setup yum (Ts, RPM db, Repo & Sack)
> self.doUtilYumSetup(opts)
> - # Setup source repos
> - if opts.source:
> - self.setupSourceRepos()
> # Do the real action
> self.exit_code = self.downloadPackages(opts)
>
> @@ -143,14 +140,6 @@ class YumDownloader(YumUtilBase):
> if not repo.isEnabled() and src_repos[repo.id]:
> self.logger.info('Enabling %s repository' % repo.id)
> repo.enable()
> - # Setup the repo, without a cache
> - repo.setup(0)
> - try:
> - # Setup pkgSack with 'src' in the archlist
> - self._getSacks(archlist=archlist, thisrepo=repo.id)
> - except yum.Errors.YumBaseError, msg:
> - self.logger.critical(str(msg))
> - sys.exit(1)
>
> def downloadPackages(self,opts):
>
> @@ -291,6 +280,9 @@ class YumDownloader(YumUtilBase):
> """do a default setup for all the normal/necessary yum components,
> really just a shorthand for testing"""
> try:
> + # Setup source repos
> + if opts.source:
> + self.setupSourceRepos()
> self._getRepos(doSetup = True)
> # if '--source' is used the add src to the archlist
> if opts.source:
> @@ -306,13 +298,6 @@ class YumDownloader(YumUtilBase):
> self.logger.critical(str(msg))
> sys.exit(1)
>
> - def _removeEnabledSourceRepos(self):
> - ''' Disable all enabled *-source repos.'''
> - for repo in self.repos.listEnabled():
> - if repo.id.endswith('-source'):
> - repo.close()
> - self.repos.disableRepo(repo.id)
> -
> def addCmdOptions(self):
> # this if for compability with old API (utils.py from yum < 3.2.23)
> if hasattr(self,'getOptionGroup'): # check if the group option API is available
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
URL: <http://lists.baseurl.org/pipermail/yum-devel/attachments/20120517/4f9a6b6f/attachment.asc>
More information about the Yum-devel
mailing list