On Wed, 2012-03-28 at 17:06 +0200, Zdeněk Pavlas wrote:
> ---
> yum/yumRepo.py | 14 +++++++-------
> 1 files changed, 7 insertions(+), 7 deletions(-)
ACK, I think. Minor comments below:
> diff --git a/yum/yumRepo.py b/yum/yumRepo.py
> index 188a9ed..5a91fcd 100644
> --- a/yum/yumRepo.py
> +++ b/yum/yumRepo.py
> @@ -1577,7 +1577,7 @@ Insufficient space in download directory %s
> mdtype can be 'primary', 'filelists', 'other' or 'group'."""
> return self._retrieveMD(mdtype)
>
> - def _retrieveMD(self, mdtype, retrieve_can_fail=False):
> + def _retrieveMD(self, mdtype, retrieve_can_fail=False, **kwargs):
> """ Internal function, use .retrieveMD() from outside yum. """
> # Note that this can raise Errors.RepoMDError if mdtype doesn't
> exist
> # for this repo.
> @@ -1615,7 +1615,9 @@ Insufficient space in download directory %s
> return local # it's the same return the local one
>
> try:
> - checkfunc = (self.checkMD, (mdtype,), {})
> + def checkfunc(obj):
> + self.checkMD(obj, mdtype)
> + self.retrieved[mdtype] = 1
This should probably have a comment. And it somewhat worries me that we
now have a boolean for retrieved, but we can be in three states (no
started download; started download; finished download).
Not sure what we want to goto the expense of making it all work though,
instead of just blaming our callers :).
> text = "%s/%s" % (self.id, mdtype)
> if thisdata.size is None:
> reget = None
> @@ -1624,14 +1626,15 @@ Insufficient space in download directory %s
> if os.path.exists(local):
> if os.stat(local).st_size >= int(thisdata.size):
> misc.unlink_f(local)
> - local = self._getFile(relative=remote,
> + return self._getFile(relative=remote,
> local=local,
> copy_local=1,
> reget=reget,
> checkfunc=checkfunc,
> text=text,
> cache=self.http_caching == 'all',
> - size=thisdata.size)
> + size=thisdata.size,
> + **kwargs)
> except Errors.RepoError:
> if retrieve_can_fail:
> return None
> @@ -1641,9 +1644,6 @@ Insufficient space in download directory %s
> return None
> raise Errors.RepoError, \
> "Could not retrieve %s matching remote checksum from %s" %
> (local, self)
> - else:
> - self.retrieved[mdtype] = 1
> - return local
Just delete the retrieved line here, and the diff will save 3- and 1+.
_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel