Update to 2.7.2-1

This commit is contained in:
Jaroslav Mracek 2017-10-02 09:48:11 +02:00
parent 2a0d7c531d
commit 223769fd89
7 changed files with 5 additions and 384 deletions

1
.gitignore vendored
View File

@ -100,3 +100,4 @@
/dnf-2.5.1.tar.gz /dnf-2.5.1.tar.gz
/dnf-2.6.2.tar.gz /dnf-2.6.2.tar.gz
/dnf-2.6.3.tar.gz /dnf-2.6.3.tar.gz
/dnf-2.7.2.tar.gz

View File

@ -1,279 +0,0 @@
From 808afe9e41d3d79ec875cd0cc83c84846776a4f9 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Thu, 7 Sep 2017 23:16:57 -0700
Subject: [PATCH] Re-introduce dnf-automatic.{service,timer}
Per RHBZ #1489595, the way the function-specific timers were
introduced has some issues. It is unnecessarily incompatible
with the previous behaviour, so systems updated from DNF 1.x
suddenly lose dnf-automatic functionality. Also, the behaviour
of the new 'function-specific' services can still in fact be
modified by the configuration file: the 'notifyonly' service
will actually download and install updates if the configuration
file says so.
This fixes both problems. It re-introduces the dnf-automatic
service and timer units with the same behaviour as before. It
also tweaks the CLI arguments and definitions of the function-
specific timers such that they will always do what they claim
to do, regardless of what the configuration file says. Finally,
it updates the dnf-automatic documentation to correctly describe
all behaviours.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
dnf.spec | 5 +++++
dnf/automatic/main.py | 16 ++++++++++++----
doc/automatic.rst | 10 ++++++----
etc/dnf/automatic.conf | 20 +++++++++-----------
etc/systemd/CMakeLists.txt | 2 ++
etc/systemd/dnf-automatic-download.service | 2 +-
etc/systemd/dnf-automatic-notifyonly.service | 2 +-
etc/systemd/dnf-automatic.service | 12 ++++++++++++
etc/systemd/dnf-automatic.timer | 11 +++++++++++
tests/automatic/test_main.py | 14 ++++++++++++++
10 files changed, 73 insertions(+), 21 deletions(-)
create mode 100644 etc/systemd/dnf-automatic.service
create mode 100644 etc/systemd/dnf-automatic.timer
diff --git a/dnf.spec b/dnf.spec
index 53d3c898..8a94e037 100644
--- a/dnf.spec
+++ b/dnf.spec
@@ -271,16 +271,19 @@ popd
%systemd_postun_with_restart dnf-makecache.timer
%post automatic
+%systemd_post dnf-automatic.timer
%systemd_post dnf-automatic-notifyonly.timer
%systemd_post dnf-automatic-download.timer
%systemd_post dnf-automatic-install.timer
%preun automatic
+%systemd_preun dnf-automatic.timer
%systemd_preun dnf-automatic-notifyonly.timer
%systemd_preun dnf-automatic-download.timer
%systemd_preun dnf-automatic-install.timer
%postun automatic
+%systemd_postun_with_restart dnf-automatic.timer
%systemd_postun_with_restart dnf-automatic-notifyonly.timer
%systemd_postun_with_restart dnf-automatic-download.timer
%systemd_postun_with_restart dnf-automatic-install.timer
@@ -353,6 +356,8 @@ popd
%{_bindir}/%{name}-automatic
%config(noreplace) %{confdir}/automatic.conf
%{_mandir}/man8/%{name}.automatic.8*
+%{_unitdir}/%{name}-automatic.service
+%{_unitdir}/%{name}-automatic.timer
%{_unitdir}/%{name}-automatic-notifyonly.service
%{_unitdir}/%{name}-automatic-notifyonly.timer
%{_unitdir}/%{name}-automatic-download.service
diff --git a/dnf/automatic/main.py b/dnf/automatic/main.py
index 73dcdf21..9745cf00 100644
--- a/dnf/automatic/main.py
+++ b/dnf/automatic/main.py
@@ -71,15 +71,19 @@ def parse_arguments(args):
parser = argparse.ArgumentParser()
parser.add_argument('conf_path', nargs='?', default=dnf.const.CONF_AUTOMATIC_FILENAME)
parser.add_argument('--timer', action='store_true')
- parser.add_argument('--installupdates', action='store_true')
- parser.add_argument('--downloadupdates', action='store_true')
+ parser.add_argument('--installupdates', dest='installupdates', action='store_true')
+ parser.add_argument('--downloadupdates', dest='downloadupdates', action='store_true')
+ parser.add_argument('--no-installupdates', dest='installupdates', action='store_false')
+ parser.add_argument('--no-downloadupdates', dest='downloadupdates', action='store_false')
+ parser.set_defaults(installupdates=None)
+ parser.set_defaults(downloadupdates=None)
return parser.parse_args(args), parser
class AutomaticConfig(object):
- def __init__(self, filename=None, downloadupdates=False,
- installupdates=False):
+ def __init__(self, filename=None, downloadupdates=None,
+ installupdates=None):
if not filename:
filename = dnf.const.CONF_AUTOMATIC_FILENAME
self.commands = CommandsConfig()
@@ -91,8 +95,12 @@ class AutomaticConfig(object):
if downloadupdates:
self.commands.download_updates = True
+ elif downloadupdates is False:
+ self.commands.download_updates = False
if installupdates:
self.commands.apply_updates = True
+ elif installupdates is False:
+ self.commands.apply_updates = False
self.commands.imply()
self.filename = filename
diff --git a/doc/automatic.rst b/doc/automatic.rst
index b21789fb..99d84d7a 100644
--- a/doc/automatic.rst
+++ b/doc/automatic.rst
@@ -31,16 +31,18 @@
Alternative CLI to ``dnf upgrade`` with specific facilities to make it suitable to be executed automatically and regularly from systemd timers, cron jobs and similar.
-The operation of the tool is completely controlled by the configuration file and the command only accepts single optional argument pointing to it. If no configuration file is passed from the command line, ``/etc/dnf/automatic.conf`` is used.
+The operation of the tool is usually controlled by the configuration file or the function-specific timer units (see below). The command only accepts a single optional argument pointing to the config file, and some control arguments intended for use by the services that back the timer units. If no configuration file is passed from the command line, ``/etc/dnf/automatic.conf`` is used.
The tool synchronizes package metadata as needed and then checks for updates available for the given system and then either exits, downloads the packages or downloads and applies the packages. The outcome of the operation is then reported by a selected mechanism, for instance via the standard output, email or MOTD messages.
-A few default systemd units are provided to enable some standard configurations:
+The systemd timer unit ``dnf-automatic.timer`` will behave as the configuration file specifies (see below) with regard to whether to download and apply updates. Some other timer units are provided which override the configuration file with some standard behaviours:
- dnf-automatic-notifyonly
- dnf-automatic-download
- dnf-automatic-install
+Regardless of the configuration file settings, the first will only notify of available updates. The second will download, but not install them. The third will download and install them.
+
===================
Run dnf-automatic
===================
@@ -64,12 +66,12 @@ Setting the mode of operation of the program.
``apply_updates``
boolean, default: False
- Whether packages comprising the available updates should be applied, i.e. installed via RPM. Implies ``download_updates``. Note that if this is set to ``False``, downloaded packages will be left in the cache till the next successful DNF transaction.
+ Whether packages comprising the available updates should be applied by ``dnf-automatic.timer``, i.e. installed via RPM. Implies ``download_updates``. Note that if this is set to ``False``, downloaded packages will be left in the cache till the next successful DNF transaction. Note that the other timer units override this setting.
``download_updates``
boolean, default: False
- Whether packages comprising the available updates should be downloaded.
+ Whether packages comprising the available updates should be downloaded by ``dnf-automatic.timer``. Note that the other timer units override this setting.
.. _upgrade_type_automatic-label:
diff --git a/etc/dnf/automatic.conf b/etc/dnf/automatic.conf
index 62dadc4f..ef8f1697 100644
--- a/etc/dnf/automatic.conf
+++ b/etc/dnf/automatic.conf
@@ -7,17 +7,15 @@ random_sleep = 300
# To just receive updates use dnf-automatic-notifyonly.timer
-# Whether updates should be downloaded when they are available.
-#
-# To download updates automatically use dnf-automatic-download.timer
-# download_updates = yes
-
-# Whether updates should be applied when they are available.
-# Note that if this is set to no, downloaded packages will be left in the
-# cache regardless of the keepcache setting.
-#
-# To install updates automatically use dnf-automatic-install.timer
-# apply_updates = no
+# Whether updates should be downloaded when they are available, by
+# dnf-automatic.timer. notifyonly.timer, download.timer and
+# install.timer override this setting.
+download_updates = yes
+
+# Whether updates should be applied when they are available, by
+# dnf-automatic.timer. notifyonly.timer, download.timer and
+# install.timer override this setting.
+apply_updates = no
[emitters]
diff --git a/etc/systemd/CMakeLists.txt b/etc/systemd/CMakeLists.txt
index edbf994b..944670f6 100644
--- a/etc/systemd/CMakeLists.txt
+++ b/etc/systemd/CMakeLists.txt
@@ -1,4 +1,6 @@
SET (systemd_FILES
+ dnf-automatic.service
+ dnf-automatic.timer
dnf-automatic-notifyonly.service
dnf-automatic-notifyonly.timer
dnf-automatic-install.service
diff --git a/etc/systemd/dnf-automatic-download.service b/etc/systemd/dnf-automatic-download.service
index f779890b..962a0a25 100644
--- a/etc/systemd/dnf-automatic-download.service
+++ b/etc/systemd/dnf-automatic-download.service
@@ -9,4 +9,4 @@ Nice=19
IOSchedulingClass=2
IOSchedulingPriority=7
Environment="ABRT_IGNORE_PYTHON=1"
-ExecStart=/usr/bin/dnf-automatic /etc/dnf/automatic.conf --timer --downloadupdates
+ExecStart=/usr/bin/dnf-automatic /etc/dnf/automatic.conf --timer --downloadupdates --no-installupdates
diff --git a/etc/systemd/dnf-automatic-notifyonly.service b/etc/systemd/dnf-automatic-notifyonly.service
index 3f7cc364..c8a21bca 100644
--- a/etc/systemd/dnf-automatic-notifyonly.service
+++ b/etc/systemd/dnf-automatic-notifyonly.service
@@ -9,4 +9,4 @@ Nice=19
IOSchedulingClass=2
IOSchedulingPriority=7
Environment="ABRT_IGNORE_PYTHON=1"
-ExecStart=/usr/bin/dnf-automatic /etc/dnf/automatic.conf --timer
+ExecStart=/usr/bin/dnf-automatic /etc/dnf/automatic.conf --timer --no-installupdates --no-downloadupdates
diff --git a/etc/systemd/dnf-automatic.service b/etc/systemd/dnf-automatic.service
new file mode 100644
index 00000000..0b390c8a
--- /dev/null
+++ b/etc/systemd/dnf-automatic.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=dnf automatic
+# See comment in dnf-makecache.service
+ConditionPathExists=!/run/ostree-booted
+
+[Service]
+Type=oneshot
+Nice=19
+IOSchedulingClass=2
+IOSchedulingPriority=7
+Environment="ABRT_IGNORE_PYTHON=1"
+ExecStart=/usr/bin/dnf-automatic /etc/dnf/automatic.conf --timer
diff --git a/etc/systemd/dnf-automatic.timer b/etc/systemd/dnf-automatic.timer
new file mode 100644
index 00000000..62f1b70d
--- /dev/null
+++ b/etc/systemd/dnf-automatic.timer
@@ -0,0 +1,11 @@
+[Unit]
+Description=dnf-automatic timer
+# See comment in dnf-makecache.service
+ConditionPathExists=!/run/ostree-booted
+
+[Timer]
+OnBootSec=1h
+OnUnitInactiveSec=1d
+
+[Install]
+WantedBy=basic.target
diff --git a/tests/automatic/test_main.py b/tests/automatic/test_main.py
index d8789fec..c99fa38c 100644
--- a/tests/automatic/test_main.py
+++ b/tests/automatic/test_main.py
@@ -23,8 +23,22 @@ FILE = tests.support.resource_path('etc/automatic.conf')
class TestConfig(tests.support.TestCase):
def test_load(self):
+ # test values from config file take effect if no overrides
+ # note: config file specifies download = no apply = yes,
+ # test expects implication to turn download into True
conf = dnf.automatic.main.AutomaticConfig(FILE)
self.assertTrue(conf.commands.apply_updates)
self.assertTrue(conf.commands.download_updates)
self.assertEqual(conf.commands.random_sleep, 300)
self.assertEqual(conf.email.email_from, 'staring@crowd.net')
+
+ # test overriding installupdates
+ conf = dnf.automatic.main.AutomaticConfig(FILE, installupdates=False)
+ # as per above, download is set false in config
+ self.assertFalse(conf.commands.download_updates)
+ self.assertFalse(conf.commands.apply_updates)
+
+ # test overriding installupdates and downloadupdates
+ conf = dnf.automatic.main.AutomaticConfig(FILE, downloadupdates=True, installupdates=False)
+ self.assertTrue(conf.commands.download_updates)
+ self.assertFalse(conf.commands.apply_updates)
--
2.13.5

View File

@ -1,61 +0,0 @@
From 38e5c4a43d56ea48c2706e1722a504b8a1d38ca7 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Thu, 21 Sep 2017 15:47:04 +0200
Subject: [PATCH] Add pre_configuration() def for commands
It allows to set up thinks before configuration of repos (like releasever).
---
dnf/cli/cli.py | 2 +-
dnf/cli/commands/__init__.py | 5 +++++
doc/api_cli.rst | 6 ++++++
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py
index e481cc2d..641b4464 100644
--- a/dnf/cli/cli.py
+++ b/dnf/cli/cli.py
@@ -878,7 +878,7 @@ class Cli(object):
self.demands.cacheonly = True
if opts.obsoletes:
self.base.conf.obsoletes = True
-
+ self.command.pre_configure()
# with cachedir in place we can configure stuff depending on it:
self.base._activate_persistor()
diff --git a/dnf/cli/commands/__init__.py b/dnf/cli/commands/__init__.py
index 7608c851..9a40f779 100644
--- a/dnf/cli/commands/__init__.py
+++ b/dnf/cli/commands/__init__.py
@@ -124,6 +124,11 @@ class Command(object):
"""Define command specific options and arguments. #:api"""
pass
+ def pre_configure(self):
+ # :api
+ """Do any command-specific pre-configuration."""
+ pass
+
def configure(self):
# :api
"""Do any command-specific configuration."""
diff --git a/doc/api_cli.rst b/doc/api_cli.rst
index ab5863b8..71e6860d 100644
--- a/doc/api_cli.rst
+++ b/doc/api_cli.rst
@@ -90,6 +90,12 @@ When packaging your custom command, we recommend you to define a virtual provide
CLI configure phase when one of the command's aliases is parsed from `dnf`
commandline. `cli` is an instance of :class:`dnf.cli.Cli`.
+ .. method:: pre_configure()
+
+ Perform any pre-configuration on the command itself and on the CLI. Typically, the command
+ implements this call to set up releasever or enable/disable repository. This method is called
+ before configuration of repos.
+
.. method:: configure()
Perform any configuration on the command itself and on the CLI. Typically, the command implements this call to set up any :class:`demands <.DemandSheet>`, tweak the global configuration or the repository configuration. This method is called immediately after the CLI/extension is finished configuring DNF.
--
2.13.5

View File

@ -1,28 +0,0 @@
From d068279fa27d063745544bbe009d10422eae5327 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenko@redhat.com>
Date: Sun, 27 Aug 2017 22:12:36 +0200
Subject: [PATCH 35/50] base: set priority to hawkey repo as well
(RhBug:1470050)
References: https://bugzilla.redhat.com/show_bug.cgi?id=1470050
Reported-by: Pavel Raiskup <praiskup@redhat.com>
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
---
dnf/base.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/dnf/base.py b/dnf/base.py
index ab8812dd..0ea2f4d8 100644
--- a/dnf/base.py
+++ b/dnf/base.py
@@ -118,6 +118,7 @@ class Base(object):
hrepo.primary_fn = repo._primary_fn
hrepo.filelists_fn = repo._filelists_fn
hrepo.cost = repo.cost
+ hrepo.priority = repo.priority
if repo._presto_fn:
hrepo.presto_fn = repo._presto_fn
else:
--
2.13.5

View File

@ -1,7 +0,0 @@
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 077459a..ac0e365 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1 +1 @@
-ADD_TEST(test nosetests-${PYTHON_MAJOR_DOT_MINOR_VERSION} -s ${CMAKE_CURRENT_SOURCE_DIR})
+ADD_TEST(test ${PYTHON_EXECUTABLE} -m nose -s ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -1,4 +1,4 @@
%global hawkey_version 0.9.3 %global hawkey_version 0.10.1
%global librepo_version 1.7.19 %global librepo_version 1.7.19
%global libcomps_version 0.1.8 %global libcomps_version 0.1.8
%global rpm_version 4.13.0-0.rc1.29 %global rpm_version 4.13.0-0.rc1.29
@ -50,8 +50,8 @@
%global _docdir_fmt %{name} %global _docdir_fmt %{name}
Name: dnf Name: dnf
Version: 2.6.3 Version: 2.7.2
Release: 13%{?dist} Release: 1%{?dist}
Summary: Package manager forked from Yum, using libsolv as a dependency resolver Summary: Package manager forked from Yum, using libsolv as a dependency resolver
# For a breakdown of the licensing, see PACKAGE-LICENSING # For a breakdown of the licensing, see PACKAGE-LICENSING
License: GPLv2+ and GPLv2 and GPL License: GPLv2+ and GPLv2 and GPL
@ -60,11 +60,6 @@ URL: https://github.com/rpm-software-management/dnf
# cd dnf # cd dnf
# tito build --tgz --tag=dnf-2.5.1-1 # tito build --tgz --tag=dnf-2.5.1-1
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
Patch0: %{name}-nose-use-module.patch
Patch1: 0001-Re-introduce-dnf-automatic.-service-timer.patch
Patch2: 0002-Add-pre_configuration-def-for-commands.patch
Patch35: 0035-base-set-priority-to-hawkey-repo-as-well-RhBug-14700.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gettext BuildRequires: gettext

View File

@ -1 +1 @@
SHA512 (dnf-2.6.3.tar.gz) = 9926790479d61b4a3400c416cb3a06b7f5bbeb081a0be05616db8c246cf535f748de4d56983a97583d71757802d78c56fbe70f639e683158613a724d03cb6eba SHA512 (dnf-2.7.2.tar.gz) = 2f0f7197c7d034caafcf97e581b1c66997c12fab1baaa9565d09365f94dd0335bdf5411c4781566272eed638192655a9cbe39951f518950665da448a805e77ed