[Yum-devel] [PATCH] drpm retry: add RPM sizes to total size. BZ 959786
Zdenek Pavlas
zpavlas at redhat.com
Thu May 16 08:25:39 UTC 2013
> Seems like it should solve the problem, but might be worth changing
> some variable names to make it clearer (10+ yr maintenance ftw :).
> Added some comments inline you might want to look at, but ACK anyway.
Added a comment, and fixed beg_download time setting, too.
> > + all_tries = remote_pkgs
>
> Maybe all_remote_pkgs and use remote_pkgs[:], so we don't accidentally
> do anything to it?
callback_total() is the only user, and it definitely should not modify it.
And when we modify remote_pkgs, it's a new copy anyway.
> > # there were drpm related errors *only*
> > remote_pkgs = []
> > - remote_size = 0
>
> Having these with the "same" name but different scope lifetimes is kind
> of annoying, but then renaming the later seems like some decent code
> churn too :(.
I see. Looking at it some more, we seem to need the original semantic
of remote_pkgs at least there:
elif not (i == 1 and not local_size[0] and remote_size == po.size):
So, I've kept remote_size and added all_remote_size instead.
beg_download = time.time()
all_remote_pkgs = remote_pkgs
+ all_remote_size = remote_size
while True:
remote_pkgs.sort(mediasort)
# This is kind of a hack and does nothing in non-Fedora versions,
@@ -2408,16 +2409,18 @@ much more problems).
# there were drpm related errors *only*
remote_pkgs = []
+ remote_size = 0
for po in errors:
po = po.rpm
remote_pkgs.append(po)
remote_size += po.size
# callback_total needs the total pkg count
all_remote_pkgs.extend(remote_pkgs)
+ all_remote_size += remote_size
errors.clear()
self.verbose_logger.warn(_('Some delta RPMs failed to download or rebuild. Retrying..'))
if callback_total and not errors:
- callback_total(all_remote_pkgs, remote_size, beg_download)
+ callback_total(all_remote_pkgs, all_remote_size, beg_download)
if not downloadonly:
# XXX: Run unlocked? Skip this for now..
More information about the Yum-devel
mailing list