On Thu, 2013-02-21 at 12:57 +0100, Zdenek Pavlas wrote:
> Add the "presto" bool config option, document it.
> Add hooks to downloadPkgs().
> ---
>  docs/yum.conf.5 |  12 +++++
>  yum/__init__.py |  18 ++++++++
>  yum/config.py   |   2 +
>  yum/presto.py   | 135 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 167 insertions(+)
>  create mode 100644 yum/presto.py
> 
> diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
> index 62b76f8..93cb297 100644
> --- a/docs/yum.conf.5
> +++ b/docs/yum.conf.5
> @@ -372,6 +372,13 @@ default of 5 connections.  Note that there are also 
> implicit per-mirror limits
>  and the downloader honors these too.
>  
>  .IP
> +\fBpresto\fR
> +
> +Either `0' or `1'. Set this to `1' to use delta-RPM files, if available.
> +This reduces the download size of updates significantly, but local rebuild
> +is CPU intensive.  Default is `1' (on).
> +
> +.IP
>  \fBsslcacert \fR
>  Path to the directory containing the databases of the certificate authorities
>  yum should use to verify SSL certificates. Defaults to none - uses system
> @@ -930,6 +937,11 @@ repository.
>  Overrides the \fBip_resolve\fR option from the [main] section for this
>  repository.
>  
> +.IP
> +\fBpresto\fR
> +
> +Overrides the \fBpresto\fR option from the [main] section for this
> +repository.

 Might want to name the option something more generic at this point,
like "deltas" or "deltarebuild" or something.

>  .IP
>  \fBsslcacert \fR
> diff --git a/yum/__init__.py b/yum/__init__.py
> index 8766c95..c04b871 100644
> --- a/yum/__init__.py
> +++ b/yum/__init__.py
> @@ -90,6 +90,7 @@ from packages import YumUrlPackage, YumNotFoundPackage
>  from constants import *
>  from yum.rpmtrans import RPMTransaction,SimpleCliCallBack
>  from yum.i18n import to_unicode, to_str, exception2msg
> +from yum.presto import Presto
>  
>  import string
>  import StringIO
> @@ -2236,6 +2237,7 @@ much more problems).
>                  po.basepath # prefetch now; fails when repos are closed
>              return False
>  
> +        pkgs = []
>          for po in pkglist:
>              if hasattr(po, 'pkgtype') and po.pkgtype == 'local':
>                  continue
> @@ -2243,8 +2245,21 @@ much more problems).
>                  continue
>              if errors:
>                  return errors
> +            pkgs.append(po)
> +
> +        # download presto metadata
> +        presto = Presto(self, pkgs)
> +        for po in pkgs:
> +            if presto.to_drpm(po) and verify_local(po):
> +                # there's .drpm already, use it
> +                presto.rebuild(po, adderror)
> +                continue

[...]

> +    def to_drpm(self, po):
> +        try: size, remote, csum = self.deltas[po]
> +        except KeyError: return False
> +        self._rpmsave[po] = po.packagesize, po.relativepath, po.localpath
> +
> +        # update stats
> +        self.rpmsize += po.packagesize
> +        self.deltasize += size
> +
> +        # update size/path/checksum to drpm values
> +        po.packagesize = size
> +        po.relativepath = remote
> +        po.localpath = os.path.dirname(po.localpath) +'/'+ 
> os.path.basename(remote)
> +        po.returnIdSum = lambda: csum
> +        return True

 This is pretty magic, and it seems like a bad idea to convert the
package into a special delta-package do the download/verify/rebuild and
then convert it back.
 Also why give to_rpm a return value ... just so we can put it in the if
statement?

 Along with 1/5 patch ... what does this do on file:// repos? I assume
the first cleanup patch didn't break it, but we still create the .rpms
from the .drpms here and thus. break copy_local?
 I guess we have to break the layering for copy_local here, which sucks.


 I'm probably just being stupid, but I don't see how pkg.rebuild() is
being called when not in --downloadonly mode.
_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to