|
Packit Service |
21c75c |
# -*- coding: utf-8 -*-
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
# transaction.py
|
|
Packit Service |
21c75c |
# Managing the transaction to be passed to RPM.
|
|
Packit Service |
21c75c |
#
|
|
Packit Service |
21c75c |
# Copyright (C) 2013-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 |
from __future__ import absolute_import
|
|
Packit Service |
21c75c |
from __future__ import unicode_literals
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
import libdnf.transaction
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
from dnf.i18n import _, C_
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
# :api - all action constants are considered an API
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
# per-package actions - from libdnf
|
|
Packit Service |
21c75c |
PKG_DOWNGRADE = libdnf.transaction.TransactionItemAction_DOWNGRADE
|
|
Packit Service |
21c75c |
PKG_DOWNGRADED = libdnf.transaction.TransactionItemAction_DOWNGRADED
|
|
Packit Service |
21c75c |
PKG_INSTALL = libdnf.transaction.TransactionItemAction_INSTALL
|
|
Packit Service |
21c75c |
PKG_OBSOLETE = libdnf.transaction.TransactionItemAction_OBSOLETE
|
|
Packit Service |
21c75c |
PKG_OBSOLETED = libdnf.transaction.TransactionItemAction_OBSOLETED
|
|
Packit Service |
21c75c |
PKG_REINSTALL = libdnf.transaction.TransactionItemAction_REINSTALL
|
|
Packit Service |
21c75c |
PKG_REINSTALLED = libdnf.transaction.TransactionItemAction_REINSTALLED
|
|
Packit Service |
21c75c |
PKG_REMOVE = libdnf.transaction.TransactionItemAction_REMOVE
|
|
Packit Service |
21c75c |
PKG_UPGRADE = libdnf.transaction.TransactionItemAction_UPGRADE
|
|
Packit Service |
21c75c |
PKG_UPGRADED = libdnf.transaction.TransactionItemAction_UPGRADED
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
# compatibility
|
|
Packit Service |
21c75c |
PKG_ERASE = PKG_REMOVE
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
# per-package actions - additional
|
|
Packit Service |
21c75c |
PKG_CLEANUP = 101
|
|
Packit Service |
21c75c |
PKG_VERIFY = 102
|
|
Packit Service |
21c75c |
PKG_SCRIPTLET = 103
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
# transaction-wide actions
|
|
Packit Service |
21c75c |
TRANS_PREPARATION = 201
|
|
Packit Service |
21c75c |
TRANS_POST = 202
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
# packages that appeared on the system
|
|
Packit Service |
21c75c |
FORWARD_ACTIONS = [
|
|
Packit Service |
21c75c |
libdnf.transaction.TransactionItemAction_INSTALL,
|
|
Packit Service |
21c75c |
libdnf.transaction.TransactionItemAction_DOWNGRADE,
|
|
Packit Service |
21c75c |
libdnf.transaction.TransactionItemAction_OBSOLETE,
|
|
Packit Service |
21c75c |
libdnf.transaction.TransactionItemAction_UPGRADE,
|
|
Packit Service |
21c75c |
libdnf.transaction.TransactionItemAction_REINSTALL,
|
|
Packit Service |
21c75c |
]
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
# packages that got removed from the system
|
|
Packit Service |
21c75c |
BACKWARD_ACTIONS = [
|
|
Packit Service |
21c75c |
libdnf.transaction.TransactionItemAction_DOWNGRADED,
|
|
Packit Service |
21c75c |
libdnf.transaction.TransactionItemAction_OBSOLETED,
|
|
Packit Service |
21c75c |
libdnf.transaction.TransactionItemAction_UPGRADED,
|
|
Packit Service |
21c75c |
libdnf.transaction.TransactionItemAction_REMOVE,
|
|
Packit Service |
21c75c |
# TODO: REINSTALLED may and may not belong here; the same NEVRA is in FORWARD_ACTIONS already
|
|
Packit Service |
21c75c |
# libdnf.transaction.TransactionItemAction_REINSTALLED,
|
|
Packit Service |
21c75c |
]
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
ACTIONS = {
|
|
Packit Service |
21c75c |
# TRANSLATORS: This is for a single package currently being downgraded.
|
|
Packit Service |
21c75c |
PKG_DOWNGRADE: C_('currently', 'Downgrading'),
|
|
Packit Service |
21c75c |
PKG_DOWNGRADED: _('Cleanup'),
|
|
Packit Service |
21c75c |
# TRANSLATORS: This is for a single package currently being installed.
|
|
Packit Service |
21c75c |
PKG_INSTALL: C_('currently', 'Installing'),
|
|
Packit Service |
21c75c |
PKG_OBSOLETE: _('Obsoleting'),
|
|
Packit Service |
21c75c |
PKG_OBSOLETED: _('Obsoleting'),
|
|
Packit Service |
21c75c |
# TRANSLATORS: This is for a single package currently being reinstalled.
|
|
Packit Service |
21c75c |
PKG_REINSTALL: C_('currently', 'Reinstalling'),
|
|
Packit Service |
21c75c |
PKG_REINSTALLED: _('Cleanup'),
|
|
Packit Service |
21c75c |
# TODO: 'Removing'?
|
|
Packit Service |
21c75c |
PKG_REMOVE: _('Erasing'),
|
|
Packit Service |
21c75c |
# TRANSLATORS: This is for a single package currently being upgraded.
|
|
Packit Service |
21c75c |
PKG_UPGRADE: C_('currently', 'Upgrading'),
|
|
Packit Service |
21c75c |
PKG_UPGRADED: _('Cleanup'),
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
PKG_CLEANUP: _('Cleanup'),
|
|
Packit Service |
21c75c |
PKG_VERIFY: _('Verifying'),
|
|
Packit Service |
21c75c |
PKG_SCRIPTLET: _('Running scriptlet'),
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
TRANS_PREPARATION: _('Preparing'),
|
|
Packit Service |
21c75c |
# TODO: TRANS_POST
|
|
Packit Service |
21c75c |
}
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
# untranslated strings, logging to /var/log/dnf/dnf.rpm.log
|
|
Packit Service |
21c75c |
FILE_ACTIONS = {
|
|
Packit Service |
21c75c |
PKG_DOWNGRADE: 'Downgrade',
|
|
Packit Service |
21c75c |
PKG_DOWNGRADED: 'Downgraded',
|
|
Packit Service |
21c75c |
PKG_INSTALL: 'Installed',
|
|
Packit Service |
21c75c |
PKG_OBSOLETE: 'Obsolete',
|
|
Packit Service |
21c75c |
PKG_OBSOLETED: 'Obsoleted',
|
|
Packit Service |
21c75c |
PKG_REINSTALL: 'Reinstall',
|
|
Packit Service |
21c75c |
PKG_REINSTALLED: 'Reinstalled',
|
|
Packit Service |
21c75c |
# TODO: 'Removed'?
|
|
Packit Service |
21c75c |
PKG_REMOVE: 'Erase',
|
|
Packit Service |
21c75c |
PKG_UPGRADE: 'Upgrade',
|
|
Packit Service |
21c75c |
PKG_UPGRADED: 'Upgraded',
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
PKG_CLEANUP: 'Cleanup',
|
|
Packit Service |
21c75c |
PKG_VERIFY: 'Verified',
|
|
Packit Service |
21c75c |
PKG_SCRIPTLET: 'Running scriptlet',
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
TRANS_PREPARATION: 'Preparing',
|
|
Packit Service |
21c75c |
# TODO: TRANS_POST
|
|
Packit Service |
21c75c |
}
|