|
Packit Service |
21c75c |
..
|
|
Packit Service |
21c75c |
Copyright (C) 2014-2018 Red Hat, Inc.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
This copyrighted material is made available to anyone wishing to use,
|
|
Packit Service |
21c75c |
modify, copy, or redistribute it subject to the terms and conditions of
|
|
Packit Service |
21c75c |
the GNU General Public License v.2, or (at your option) any later version.
|
|
Packit Service |
21c75c |
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
Packit Service |
21c75c |
ANY WARRANTY expressed or implied, including the implied warranties of
|
|
Packit Service |
21c75c |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
Packit Service |
21c75c |
Public License for more details. You should have received a copy of the
|
|
Packit Service |
21c75c |
GNU General Public License along with this program; if not, write to the
|
|
Packit Service |
21c75c |
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
21c75c |
02110-1301, USA. Any Red Hat trademarks that are incorporated in the
|
|
Packit Service |
21c75c |
source code or documentation are not subject to the GNU General Public
|
|
Packit Service |
21c75c |
License and may only be used or replicated with the express permission of
|
|
Packit Service |
21c75c |
Red Hat, Inc.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
===================================
|
|
Packit Service |
21c75c |
Progress Reporting with Callbacks
|
|
Packit Service |
21c75c |
===================================
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. module:: dnf.callback
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. class:: Payload
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Represents one item (file) from the download batch.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: __str__
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Provide concise, human-readable representation of this Payload.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. attribute:: download_size
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Total size of this Payload when transferred (e.g. over network).
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. class:: DownloadProgress
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Base class providing callbacks to receive information about an ongoing download.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: start(total_files, total_size, total_drpms=0)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Report start of a download batch. `total_files` is the total number of payloads in the batch.
|
|
Packit Service |
21c75c |
`total_size` is the total number of bytes to be downloaded. `total_drpms` is the total number
|
|
Packit Service |
21c75c |
of drpms payloads in the batch.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: progress(payload, done)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Report ongoing progress on the given `payload`. `done` is the number of bytes already downloaded from `payload`.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: end(payload, status, msg)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Report finished download of a `payload`, :class:`.Payload` instance. `status` is a constant with the following meaning:
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
====================== =======================================================
|
|
Packit Service |
21c75c |
`status` value meaning
|
|
Packit Service |
21c75c |
====================== =======================================================
|
|
Packit Service |
21c75c |
STATUS_OK Download finished successfully.
|
|
Packit Service |
21c75c |
STATUS_DRPM DRPM rebuilt successfully.
|
|
Packit Service |
21c75c |
STATUS_ALREADY_EXISTS Download skipped because the local file already exists.
|
|
Packit Service |
21c75c |
STATUS_MIRROR Download failed on the current mirror, will try to use
|
|
Packit Service |
21c75c |
next mirror in the list.
|
|
Packit Service |
21c75c |
STATUS_FAILED Download failed because of another error.
|
|
Packit Service |
21c75c |
====================== =======================================================
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
`msg` is an optional string error message further explaining the `status`.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. class:: TransactionProgress
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Base class providing callbacks to receive information about an ongoing transaction.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: error(message)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Report an error that occurred during the transaction. `message` is a string which describes the error.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: progress(package, action, ti_done, ti_total, ts_done, ts_total)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Report ongoing progress on the given transaction item. `package` is the :class:`dnf.package.Package` being processed and `action` is a constant with the following meaning:
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
================== ================================================================================= ===========
|
|
Packit Service |
21c75c |
`action` value meaning Appearance*
|
|
Packit Service |
21c75c |
================== ================================================================================= ===========
|
|
Packit Service |
21c75c |
PKG_CLEANUP `package` cleanup is being performed. 3
|
|
Packit Service |
21c75c |
PKG_DOWNGRADE `package` is being installed as a downgrade. 2
|
|
Packit Service |
21c75c |
PKG_DOWNGRADED installed `package` is being downgraded. 2
|
|
Packit Service |
21c75c |
PKG_INSTALL `package` is being installed. 2
|
|
Packit Service |
21c75c |
PKG_OBSOLETE `package` is obsoleting another package. 2
|
|
Packit Service |
21c75c |
PKG_OBSOLETED installed `package` is being obsoleted. 2
|
|
Packit Service |
21c75c |
PKG_REINSTALL `package` is installed as a reinstall. 2
|
|
Packit Service |
21c75c |
PKG_REINSTALLED installed `package` is being reinstalled. 2
|
|
Packit Service |
21c75c |
PKG_REMOVE `package` is being removed. 2
|
|
Packit Service |
21c75c |
PKG_UPGRADE `package` is installed as an upgrade. 2
|
|
Packit Service |
21c75c |
PKG_UPGRADED installed `package` is being upgraded. 2
|
|
Packit Service |
21c75c |
PKG_VERIFY `package` is being verified. 5
|
|
Packit Service |
21c75c |
PKG_SCRIPTLET `package` scriptlet is being performed. Anytime
|
|
Packit Service |
21c75c |
TRANS_PREPARATION `transaction` is being prepared. 1
|
|
Packit Service |
21c75c |
TRANS_POST The post-trans phase started. In this case, all the other arguments are ``None``. 4
|
|
Packit Service |
21c75c |
================== ================================================================================= ===========
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
\*\ This is order in which state of transaction which callback action can appear. Only PKG_SCRIPTLET
|
|
Packit Service |
21c75c |
can appear anytime during transaction even before transaction starts.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
`ti_done` is the number of processed bytes of the transaction item, `ti_total` is the total number of bytes of the transaction item, `ts_done` is the number of actions processed in the whole transaction and `ts_total` is the total number of actions in the whole transaction.
|