[Yum] [python API] add package download event
Alon Bar-Lev
alonbl at redhat.com
Fri Sep 14 20:32:15 UTC 2012
----- Original Message -----
> From: "tim lauridsen" <tim.lauridsen at gmail.com>
> To: "Yellowdog Updater, Modified" <yum at lists.baseurl.org>
> Sent: Friday, September 14, 2012 8:29:00 AM
> Subject: Re: [Yum] [python API] add package download event
>
>
>
>
>
> On Wed, Sep 12, 2012 at 9:43 PM, Alon Bar-Lev < alonbl at redhat.com >
> wrote:
>
>
> Hello,
>
> Currently we have:
> PT_DOWNLOAD - start download
> PT_DOWNLOAD_PKGS - list of packages to download.
> The void until:
> PT_GPGCHECKPT_GPGCHECK
>
> This void takes a lot of time as packages are downloaded.
>
> May I suggest adding an event before/after each package is
> downloaded?
>
> Maybe I missed this exiting functionality, but all I see is raw text
> logs that may provide this information if I parse the data.
>
> Regards,
> Alon Bar-Lev.
> _______________________________________________
> Yum mailing list
> Yum at lists.baseurl.org
> http://lists.baseurl.org/mailman/listinfo/yum
>
>
> This event is only for the mayor events, you must make a download
> callback handler for tracking the download of each file being
> download
>
>
> You can take a look at the yumex backend code of how to handle it (
> YumexDownloadCallback)
>
>
> https://github.com/timlau/yumex/blob/master/src/yumexbackend/yum_server.py
>
>
> Tim
Hello Tim
Appreciate your help!
I don't like to use the progress interface and parse the file name for such simple task....
I think that download a file is just like install or verify, it is a major event that starts, stops, and may fail.
My solution is:
---
def verifyPkg(self, fo, po, raiseError):
if self._lastpkg != po:
self._lastpkg = po
self._output.info("Download/Verify: %s" % get_package_name(po))
yum.YumBase.verifyPkg(self, fo, po, raiseError)
---
As verifyPkg() is called at least once for every package, so I can show the progress with proper package object.
Thanks,
Alon.
More information about the Yum
mailing list