Hello community,

here is the log from the commit of package dnf-plugins-extras for 
openSUSE:Factory checked in at 2020-12-10 15:59:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/dnf-plugins-extras (Old)
 and      /work/SRC/openSUSE:Factory/.dnf-plugins-extras.new.2328 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "dnf-plugins-extras"

Thu Dec 10 15:59:00 2020 rev:7 rq:853459 version:4.0.13

Changes:
--------
--- /work/SRC/openSUSE:Factory/dnf-plugins-extras/dnf-plugins-extras.changes    
2020-10-28 11:26:22.338909700 +0100
+++ 
/work/SRC/openSUSE:Factory/.dnf-plugins-extras.new.2328/dnf-plugins-extras.changes
  2020-12-10 15:59:01.582904643 +0100
@@ -1,0 +2,9 @@
+Sun Dec  6 16:33:42 UTC 2020 - Neal Gompa <ngomp...@gmail.com>
+
+- Update to version 4.0.13
+  + system-upgrade: Use Transaction Store/Replay
+  + system-upgrade: Pretty-print the state json
+- Backport fix for system-upgrade tests
+  + Patch: 0001-test_system_upgrade-Set-installroot-in-the-mocked-cl.patch
+
+-------------------------------------------------------------------

Old:
----
  dnf-plugins-extras-4.0.12.tar.gz

New:
----
  0001-test_system_upgrade-Set-installroot-in-the-mocked-cl.patch
  dnf-plugins-extras-4.0.13.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ dnf-plugins-extras.spec ++++++
--- /var/tmp/diff_new_pack.OrShbz/_old  2020-12-10 15:59:02.282905301 +0100
+++ /var/tmp/diff_new_pack.OrShbz/_new  2020-12-10 15:59:02.286905305 +0100
@@ -17,25 +17,32 @@
 #
 
 
-%{!?dnf_lowest_compatible: %global dnf_lowest_compatible 4.2.19}
+%{!?dnf_lowest_compatible: %global dnf_lowest_compatible 4.4.3}
 %global dnf_plugins_extra_obsolete 2.0.0
+
 # YUM v3 has been removed from openSUSE Tumbleweed as of 20191119
 %if 0%{?sle_version} && 0%{?sle_version} < 160000
 %bcond_with as_yum
 %else
 %bcond_without as_yum
 %endif
+
 # openSUSE does not have tracer
 %bcond_with tracer
 %bcond_without tests
+
 Name:           dnf-plugins-extras
-Version:        4.0.12
+Version:        4.0.13
 Release:        0
 Summary:        Extras Plugins for DNF
 License:        GPL-2.0-or-later
 Group:          System/Packages
 URL:            https://github.com/rpm-software-management/%{name}
 Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz
+
+# Backports from upstream
+Patch0001:      0001-test_system_upgrade-Set-installroot-in-the-mocked-cl.patch
+
 BuildRequires:  cmake
 BuildRequires:  gettext
 BuildRequires:  python3-Sphinx

++++++ 0001-test_system_upgrade-Set-installroot-in-the-mocked-cl.patch ++++++
From d51c3efb2dce70c4ae45c11139c5f04191e4cac5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhra...@redhat.com>
Date: Wed, 25 Nov 2020 18:45:49 +0100
Subject: [PATCH] test_system_upgrade: Set installroot in the mocked cli

Fixes running tests on Fedora 31.

Sets the installroot to the default "/" in the mocked cli.base.conf. The
whole object is mocked and on Fedora 31 the mocked installroot object wasn't
resulting in anything the command could use. Since all the directories
are already changed to temporary locations, we don't need to set the
installroot to anything special.
---
 tests/test_system_upgrade.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/test_system_upgrade.py b/tests/test_system_upgrade.py
index a6b1495..04f9ced 100644
--- a/tests/test_system_upgrade.py
+++ b/tests/test_system_upgrade.py
@@ -253,6 +253,7 @@ class CommandTestCaseBase(unittest.TestCase):
         self.datadir = tempfile.mkdtemp(prefix="system_upgrade_test_datadir-")
         system_upgrade.SystemUpgradeCommand.DATADIR = self.datadir
         self.cli = mock.MagicMock()
+        self.cli.base.conf.installroot = "/"
         self.command = system_upgrade.SystemUpgradeCommand(cli=self.cli)
         self.command.base.conf.cachedir = os.path.join(self.datadir, "cache")
         self.command.base.conf.destdir = None
@@ -403,7 +404,6 @@ class DownloadCommandTestCase(CommandTestCase):
         self.command.opts.repos_ed = []
         self.cli.demands.allow_erasing = "allow_erasing"
         self.command.base.conf.best = True
-        self.command.base.conf.installroot = self.datadir
         self.command.base.conf.releasever = "35"
         self.command.base.conf.gpgcheck = True
         self.command.opts.destdir = self.datadir
@@ -431,7 +431,6 @@ class DownloadCommandTestCase(CommandTestCase):
         self.command.opts.repos_ed = []
         self.cli.demands.allow_erasing = "allow_erasing"
         self.command.base.conf.best = True
-        self.command.base.conf.installroot = self.datadir
         self.command.base.conf.releasever = "35"
         self.command.base.conf.gpgcheck = True
         self.command.opts.destdir = self.datadir
-- 
2.28.0

++++++ dnf-plugins-extras-4.0.12.tar.gz -> dnf-plugins-extras-4.0.13.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dnf-plugins-extras-4.0.12/dnf-plugins-extras.spec 
new/dnf-plugins-extras-4.0.13/dnf-plugins-extras.spec
--- old/dnf-plugins-extras-4.0.12/dnf-plugins-extras.spec       2020-10-06 
19:04:16.000000000 +0200
+++ new/dnf-plugins-extras-4.0.13/dnf-plugins-extras.spec       2020-11-23 
18:01:07.000000000 +0100
@@ -1,10 +1,10 @@
-%{!?dnf_lowest_compatible: %global dnf_lowest_compatible 4.2.19}
+%{!?dnf_lowest_compatible: %global dnf_lowest_compatible 4.4.3}
 %global dnf_plugins_extra_obsolete 2.0.0
 
 %undefine __cmake_in_source_build
 
 Name:           dnf-plugins-extras
-Version:        4.0.12
+Version:        4.0.13
 Release:        1%{?dist}
 Summary:        Extras Plugins for DNF
 License:        GPLv2+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dnf-plugins-extras-4.0.12/doc/release_notes.rst 
new/dnf-plugins-extras-4.0.13/doc/release_notes.rst
--- old/dnf-plugins-extras-4.0.12/doc/release_notes.rst 2020-10-06 
19:04:16.000000000 +0200
+++ new/dnf-plugins-extras-4.0.13/doc/release_notes.rst 2020-11-23 
18:01:07.000000000 +0100
@@ -5,6 +5,16 @@
 .. contents::
 
 ====================
+4.0.13 Release Notes
+====================
+
+- system-upgrade: Use Transaction Store/Replay
+- system-upgrade: Pretty-print the state json
+
+Bugs fixed in 4.0.13:
+
+
+====================
 4.0.12 Release Notes
 ====================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dnf-plugins-extras-4.0.12/plugins/system_upgrade.py 
new/dnf-plugins-extras-4.0.13/plugins/system_upgrade.py
--- old/dnf-plugins-extras-4.0.12/plugins/system_upgrade.py     2020-10-06 
19:04:16.000000000 +0200
+++ new/dnf-plugins-extras-4.0.13/plugins/system_upgrade.py     2020-11-23 
18:01:07.000000000 +0100
@@ -37,6 +37,7 @@
 from dnf.cli import CliError
 from dnf.i18n import ucd
 import dnf.transaction
+from dnf.transaction_sr import serialize_transaction, TransactionReplay
 
 import libdnf.conf
 
@@ -54,8 +55,6 @@
 DNFVERSION = StrictVersion(dnf.const.VERSION)
 
 PLYMOUTH = '/usr/bin/plymouth'
-DEFAULT_DATADIR = '/var/lib/dnf/system-upgrade'
-MAGIC_SYMLINK = '/system-update'
 
 RELEASEVER_MSG = _(
     "Need a --releasever greater than the current system version.")
@@ -128,9 +127,8 @@
 
 # DNF-INTEGRATION-NOTE: basically the same thing as dnf.persistor.JSONDB
 class State(object):
-    statefile = '/var/lib/dnf/system-upgrade.json'
-
-    def __init__(self):
+    def __init__(self, statefile):
+        self.statefile = statefile
         self._data = {}
         self._read()
 
@@ -148,7 +146,7 @@
     def write(self):
         dnf.util.ensure_dir(os.path.dirname(self.statefile))
         with open(self.statefile, 'w') as outf:
-            json.dump(self._data, outf)
+            json.dump(self._data, outf, indent=4, sort_keys=True)
 
     def clear(self):
         if os.path.exists(self.statefile):
@@ -186,13 +184,7 @@
     upgrade_status = _prop("upgrade_status")
     upgrade_command = _prop("upgrade_command")
     distro_sync = _prop("distro_sync")
-    allow_erasing = _prop("allow_erasing")
     enable_disable_repos = _prop("enable_disable_repos")
-    best = _prop("best")
-    exclude = _prop("exclude")
-    install_packages = _prop("install_packages")
-    remove_packages = _prop("remove_packages")
-    install_weak_deps = _prop("install_weak_deps")
     module_platform_id = _prop("module_platform_id")
 
 # --- Plymouth output helpers -------------------------------------------------
@@ -351,9 +343,15 @@
     aliases = ('system-upgrade', 'fedup',)
     summary = _("Prepare system for upgrade to a new release")
 
+    DATADIR = 'var/lib/dnf/system-upgrade'
+
     def __init__(self, cli):
         super(SystemUpgradeCommand, self).__init__(cli)
-        self.state = State()
+        self.datadir = os.path.join(cli.base.conf.installroot, self.DATADIR)
+        self.transaction_file = os.path.join(self.datadir, 
'system-upgrade-transaction.json')
+        self.magic_symlink = os.path.join(cli.base.conf.installroot, 
'system-update')
+
+        self.state = State(os.path.join(self.datadir, 
'system-upgrade-state.json'))
 
     @staticmethod
     def set_argparser(parser):
@@ -403,7 +401,7 @@
 
     def _set_cachedir(self):
         # set download directories from json state file
-        self.base.conf.cachedir = DEFAULT_DATADIR
+        self.base.conf.cachedir = self.datadir
         self.base.conf.destdir = self.state.destdir if self.state.destdir else 
None
 
     def _get_forward_reverse_pkg_reason_pairs(self):
@@ -430,7 +428,7 @@
     # == pre_configure_*: set up action-specific demands 
==========================
     def pre_configure_download(self):
         # only download subcommand accepts --destdir command line option
-        self.base.conf.cachedir = DEFAULT_DATADIR
+        self.base.conf.cachedir = self.datadir
         self.base.conf.destdir = self.opts.destdir if self.opts.destdir else 
None
         if 'offline-distrosync' == self.opts.command and not 
self.opts.distro_sync:
             raise CliError(
@@ -492,7 +490,6 @@
         self.cli.demands.sack_activation = True
         # use the saved value for --allowerasing, etc.
         self.opts.distro_sync = self.state.distro_sync
-        self.cli.demands.allow_erasing = self.state.allow_erasing
         if self.state.gpgcheck is not None:
             self.base.conf.gpgcheck = self.state.gpgcheck
         if self.state.gpgcheck_repos is not None:
@@ -501,11 +498,6 @@
         if self.state.repo_gpgcheck_repos is not None:
             for repo in self.base.repos.values():
                 repo.repo_gpgcheck = repo.id in self.state.repo_gpgcheck_repos
-        self.base.conf.best = self.state.best
-        if self.state.exclude is None:
-            self.state.exclude = []
-        self.base.conf.exclude = libdnf.conf.VectorString(self.state.exclude)
-        self.base.conf.install_weak_deps = self.state.install_weak_deps
         self.base.conf.module_platform_id = self.state.module_platform_id
         # don't try to get new metadata, 'cuz we're offline
         self.cli.demands.cacheonly = True
@@ -515,6 +507,7 @@
         # upgrade operation already removes all element that must be removed. 
Additional removal
         # could trigger unwanted changes in transaction.
         self.base.conf.clean_requirements_on_remove = False
+        self.base.conf.install_weak_deps = False
 
     def configure_clean(self):
         self.cli.demands.root_user = True
@@ -532,20 +525,20 @@
             msg = _("the transaction was not prepared for '{command}'. "
                     "Rerun 'dnf {command} download 
[OPTIONS]'").format(command=self.opts.command)
             raise CliError(msg)
-        if os.path.lexists(MAGIC_SYMLINK):
+        if os.path.lexists(self.magic_symlink):
             raise CliError(_("upgrade is already scheduled"))
-        dnf.util.ensure_dir(DEFAULT_DATADIR)
+        dnf.util.ensure_dir(self.datadir)
         # FUTURE: checkRPMDBStatus(self.state.download_transaction_id)
 
     def check_upgrade(self):
-        if not os.path.lexists(MAGIC_SYMLINK):
+        if not os.path.lexists(self.magic_symlink):
             logger.info(_("trigger file does not exist. exiting quietly."))
             raise SystemExit(0)
-        if os.readlink(MAGIC_SYMLINK) != DEFAULT_DATADIR:
+        if os.readlink(self.magic_symlink) != self.datadir:
             logger.info(_("another upgrade tool is running. exiting quietly."))
             raise SystemExit(0)
         # Delete symlink ASAP to avoid reboot loops
-        dnf.yum.misc.unlink_f(MAGIC_SYMLINK)
+        dnf.yum.misc.unlink_f(self.magic_symlink)
         command = self.state.upgrade_command
         if not command:
             command = self.opts.command
@@ -558,7 +551,7 @@
 
     def run_prepare(self):
         # make the magic symlink
-        os.symlink(DEFAULT_DATADIR, MAGIC_SYMLINK)
+        os.symlink(self.datadir, self.magic_symlink)
         # set upgrade_status so that the upgrade can run
         with self.state as state:
             state.upgrade_status = 'ready'
@@ -593,7 +586,6 @@
         with self.state as state:
             state.download_status = 'downloading'
             state.target_releasever = self.base.conf.releasever
-            state.exclude = list(self.base.conf.exclude)
             state.destdir = self.base.conf.destdir
 
     def run_upgrade(self):
@@ -619,41 +611,8 @@
         # disable screen blanking
         disable_blanking()
 
-        # NOTE: We *assume* that depsolving here will yield the same
-        # transaction as it did during the download, but we aren't doing
-        # anything to *ensure* that; if the metadata changed, or if depsolving
-        # is non-deterministic in some way, we could end up with a different
-        # transaction and then the upgrade will fail due to missing packages.
-        #
-        # One way to *guarantee* that we have the same transaction would be
-        # to save & restore the Transaction object, but there's no documented
-        # way to save a Transaction to disk.
-        #
-        # So far, though, the above assumption seems to hold. So... onward!
-
-        # add the downloaded RPMs to the sack
-
-        errs = []
-
-        for pkgspec in self.state.remove_packages.keys():
-            try:
-                self.base.remove(pkgspec)
-            except dnf.exceptions.MarkingError:
-                msg = _('Unable to match package: %s')
-                logger.info(msg, self.base.output.term.bold(pkgspec))
-                errs.append(pkgspec)
-
-        for repo_id, pkg_spec_dict in self.state.install_packages.items():
-            for pkgspec in pkg_spec_dict.keys():
-                try:
-                    self.base.install(pkgspec, reponame=repo_id)
-                except dnf.exceptions.MarkingError:
-                    msg = _('Unable to match package: %s')
-                    logger.info(msg, self.base.output.term.bold(pkgspec + " " 
+ repo_id))
-                    errs.append(pkgspec)
-
-        if errs:
-            raise dnf.exceptions.MarkingError(_("Unable to match some of 
packages"))
+        self.replay = TransactionReplay(self.base, self.transaction_file)
+        self.replay.run()
 
     def run_clean(self):
         logger.info(_("Cleaning up downloaded data..."))
@@ -666,8 +625,6 @@
             state.upgrade_status = None
             state.upgrade_command = None
             state.destdir = None
-            state.install_packages = {}
-            state.remove_packages = []
 
     def run_log(self):
         if self.opts.number:
@@ -679,36 +636,21 @@
 
     def resolved_upgrade(self):
         """Adjust transaction reasons according to stored values"""
-        if not self.cli.base.transaction:
-            return
-        backward_action = set(dnf.transaction.BACKWARD_ACTIONS + \
-                              
[libdnf.transaction.TransactionItemAction_REINSTALLED])
-        forward_actions = set(dnf.transaction.FORWARD_ACTIONS)
-
-        install_packages = self.state.install_packages
-        remove_packages = self.state.remove_packages
-        for tsi in self.cli.base.transaction:
-            if tsi.action in forward_actions:
-                pkg = tsi.pkg
-                try:
-                    stored_reason = 
install_packages[pkg.repo.id][str(pkg)][str(tsi.action)]
-                    if stored_reason != tsi.reason:
-                        tsi.reason = stored_reason
-                except KeyError:
-                    pass
-            elif tsi.action in backward_action:
-                pkg = tsi.pkg
-                try:
-                    stored_reason = remove_packages[str(pkg)][str(tsi.action)]
-                    if stored_reason != tsi.reason:
-                        tsi.reason = stored_reason
-                except KeyError:
-                    pass
+        self.replay.post_transaction()
 
     # == transaction_*: do stuff after a successful transaction ===============
 
     def transaction_download(self):
-        install_packages, remove_packages = 
self._get_forward_reverse_pkg_reason_pairs()
+        data = serialize_transaction(self.base.history.get_current())
+        try:
+            with open(self.transaction_file, "w") as f:
+                json.dump(data, f, indent=4, sort_keys=True)
+                f.write("\n")
+
+            print(_("Transaction saved to {}.").format(self.transaction_file))
+
+        except OSError as e:
+            raise dnf.cli.CliError(_('Error storing transaction: 
{}').format(str(e)))
 
         # Okay! Write out the state so the upgrade can use it.
         system_ver = dnf.rpm.detect_releasever(self.base.conf.installroot)
@@ -716,26 +658,21 @@
             state.download_status = 'complete'
             state.state_version = STATE_VERSION
             state.distro_sync = self.opts.distro_sync
-            state.allow_erasing = self.cli.demands.allow_erasing
             state.gpgcheck = self.base.conf.gpgcheck
             state.gpgcheck_repos = [
                 repo.id for repo in self.base.repos.values() if repo.gpgcheck]
             state.repo_gpgcheck_repos = [
                 repo.id for repo in self.base.repos.values() if 
repo.repo_gpgcheck]
-            state.best = self.base.conf.best
             state.system_releasever = system_ver
             state.target_releasever = self.base.conf.releasever
-            state.install_packages = install_packages
-            state.remove_packages = remove_packages
-            state.install_weak_deps = self.base.conf.install_weak_deps
             state.module_platform_id = self.base.conf.module_platform_id
             state.enable_disable_repos = self.opts.repos_ed
             state.destdir = self.base.conf.destdir
             state.upgrade_command = self.opts.command
+
         msg = DOWNLOAD_FINISHED_MSG.format(command=self.opts.command)
         logger.info(msg)
-        self.log_status(_("Download finished."),
-                        DOWNLOAD_FINISHED_ID)
+        self.log_status(_("Download finished."), DOWNLOAD_FINISHED_ID)
 
     def transaction_upgrade(self):
         Plymouth.message(_("Upgrade complete! Cleaning up and rebooting..."))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dnf-plugins-extras-4.0.12/tests/test_system_upgrade.py 
new/dnf-plugins-extras-4.0.13/tests/test_system_upgrade.py
--- old/dnf-plugins-extras-4.0.12/tests/test_system_upgrade.py  2020-10-06 
19:04:16.000000000 +0200
+++ new/dnf-plugins-extras-4.0.13/tests/test_system_upgrade.py  2020-11-23 
18:01:07.000000000 +0100
@@ -2,7 +2,7 @@
 
 import system_upgrade
 
-from system_upgrade import PLYMOUTH, CliError, DEFAULT_DATADIR
+from system_upgrade import PLYMOUTH, CliError
 
 import os
 import tempfile
@@ -160,7 +160,7 @@
     @classmethod
     @unittest.skip("There is no translation yet to system-upgrade")
     def setUpClass(cls):
-        cls.localedir = tempfile.mkdtemp(prefix='i18ntest')
+        cls.localedir = tempfile.mkdtemp(prefix='system_upgrade_test_i18n-')
         cls.msgdir = os.path.join(cls.localedir, TESTLANG+"/LC_MESSAGES")
         cls.msgfile = "dnf-plugins-extras" + ".mo"
         os.makedirs(cls.msgdir)
@@ -203,18 +203,17 @@
 class StateTestCase(unittest.TestCase):
     @classmethod
     def setUpClass(cls):
-        cls.statedir = tempfile.mkdtemp(prefix="state.test.")
+        cls.statedir = tempfile.mkdtemp(prefix="system_upgrade_test_state-")
         cls.StateClass = system_upgrade.State
-        cls.StateClass.statefile = os.path.join(cls.statedir, "state")
 
     def setUp(self):
-        self.state = self.StateClass()
+        self.state = self.StateClass(os.path.join(self.statedir, "state"))
 
     def test_bool_value(self):
         with self.state:
             self.state.distro_sync = True
         del self.state
-        self.state = self.StateClass()
+        self.state = self.StateClass(os.path.join(self.statedir, "state"))
         self.assertIs(self.state.distro_sync, True)
 
     @classmethod
@@ -224,7 +223,7 @@
 
 class UtilTestCase(unittest.TestCase):
     def setUp(self):
-        self.tmpdir = tempfile.mkdtemp(prefix='util.test.')
+        self.tmpdir = tempfile.mkdtemp(prefix='system_upgrade_test_util-')
         self.dirs = ["dir1", "dir2"]
         self.files = ["file1", "dir2/file2"]
         for d in self.dirs:
@@ -251,19 +250,15 @@
 
 class CommandTestCaseBase(unittest.TestCase):
     def setUp(self):
-        self.statedir = tempfile.mkdtemp(prefix="command.test.statedir.")
-        self.statefile = os.path.join(self.statedir, "state")
-        self.old_statefile = system_upgrade.State.statefile
-        system_upgrade.State.statefile = self.statefile
+        self.datadir = tempfile.mkdtemp(prefix="system_upgrade_test_datadir-")
+        system_upgrade.SystemUpgradeCommand.DATADIR = self.datadir
         self.cli = mock.MagicMock()
         self.command = system_upgrade.SystemUpgradeCommand(cli=self.cli)
-        self.command.base.conf.cachedir = os.path.join(self.statedir, "cache")
+        self.command.base.conf.cachedir = os.path.join(self.datadir, "cache")
         self.command.base.conf.destdir = None
-        system_upgrade.DEFAULT_DATADIR = os.path.join(self.statedir, 
'default_datadir')
 
     def tearDown(self):
-        shutil.rmtree(self.statedir)
-        system_upgrade.State.statefile = self.old_statefile
+        shutil.rmtree(self.datadir)
 
 
 class CommandTestCase(CommandTestCaseBase):
@@ -302,8 +297,8 @@
 class RebootCheckCommandTestCase(CommandTestCaseBase):
     def setUp(self):
         super(RebootCheckCommandTestCase, self).setUp()
-        self.MAGIC_SYMLINK = self.statedir + '/symlink'
-        self.DEFAULT_DATADIR = self.statedir + '/default_datadir'
+        self.magic_symlink = self.datadir + '/symlink'
+        self.command.magic_symlink = self.magic_symlink
 
     def test_pre_configure_reboot(self):
         with self.command.state as state:
@@ -318,8 +313,7 @@
 
     def check_reboot(self, status='complete', lexists=False, 
command='system-upgrade',
                      state_command='system-upgrade'):
-        with patch('system_upgrade.os.path.lexists') as lexists_func,\
-                patch('system_upgrade.DEFAULT_DATADIR', self.DEFAULT_DATADIR):
+        with patch('system_upgrade.os.path.lexists') as lexists_func:
             self.command.state.state_version = 2
             self.command.state.download_status = status
             self.command.opts = mock.MagicMock()
@@ -345,9 +339,8 @@
             self.check_reboot(status='complete', lexists=True)
 
     def test_run_prepare(self):
-        with patch('system_upgrade.MAGIC_SYMLINK', self.MAGIC_SYMLINK):
-            self.command.run_prepare()
-        self.assertEqual(os.readlink(self.MAGIC_SYMLINK), 
system_upgrade.DEFAULT_DATADIR)
+        self.command.run_prepare()
+        self.assertEqual(os.readlink(self.magic_symlink), self.datadir)
         self.assertEqual(self.command.state.upgrade_status, 'ready')
 
     @patch('system_upgrade.SystemUpgradeCommand.run_prepare')
@@ -380,13 +373,13 @@
         self.command.opts.destdir = None
         self.command.base.conf.destdir = None
         self.command.pre_configure_download()
-        self.assertEqual(self.command.base.conf.cachedir, 
system_upgrade.DEFAULT_DATADIR)
+        self.assertEqual(self.command.base.conf.cachedir, self.datadir)
 
     def test_pre_configure_download_destdir(self):
         self.command.opts = mock.MagicMock()
-        self.command.opts.destdir = self.statedir
+        self.command.opts.destdir = self.datadir
         self.command.pre_configure_download()
-        self.assertEqual(self.command.base.conf.destdir, self.statedir)
+        self.assertEqual(self.command.base.conf.destdir, self.datadir)
 
     def test_configure_download(self):
         self.command.opts = mock.MagicMock()
@@ -410,21 +403,19 @@
         self.command.opts.repos_ed = []
         self.cli.demands.allow_erasing = "allow_erasing"
         self.command.base.conf.best = True
-        self.command.base.conf.installroot = "/"
+        self.command.base.conf.installroot = self.datadir
         self.command.base.conf.releasever = "35"
         self.command.base.conf.gpgcheck = True
-        self.command.opts.destdir = self.statedir
+        self.command.opts.destdir = self.datadir
         self.command.base.conf.install_weak_deps = True
         self.command.base.conf.module_platform_id = ''
         self.command.pre_configure_download()
         self.command.transaction_download()
-        with system_upgrade.State() as state:
+        with system_upgrade.State(self.command.state.statefile) as state:
             self.assertEqual(state.state_version, system_upgrade.STATE_VERSION)
             self.assertEqual(state.download_status, "complete")
             self.assertEqual(state.distro_sync, True)
-            self.assertEqual(state.allow_erasing, "allow_erasing")
-            self.assertEqual(state.best, True)
-            self.assertEqual(state.destdir, self.statedir)
+            self.assertEqual(state.destdir, self.datadir)
             self.assertEqual(state.upgrade_command, "system_upgrade")
 
     def test_transaction_download_offline_upgrade(self):
@@ -440,20 +431,18 @@
         self.command.opts.repos_ed = []
         self.cli.demands.allow_erasing = "allow_erasing"
         self.command.base.conf.best = True
-        self.command.base.conf.installroot = "/"
+        self.command.base.conf.installroot = self.datadir
         self.command.base.conf.releasever = "35"
         self.command.base.conf.gpgcheck = True
-        self.command.opts.destdir = self.statedir
+        self.command.opts.destdir = self.datadir
         self.command.base.conf.install_weak_deps = True
         self.command.base.conf.module_platform_id = ''
         self.command.pre_configure_download()
         self.command.transaction_download()
-        with system_upgrade.State() as state:
+        with system_upgrade.State(self.command.state.statefile) as state:
             self.assertEqual(state.download_status, "complete")
             self.assertEqual(state.distro_sync, False)
-            self.assertEqual(state.allow_erasing, "allow_erasing")
-            self.assertEqual(state.best, True)
-            self.assertEqual(state.destdir, self.statedir)
+            self.assertEqual(state.destdir, self.datadir)
             self.assertEqual(state.upgrade_command, "offline-upgrade")
 
 
_______________________________________________
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org

Reply via email to