Skip to content

Commit

Permalink
Merge branch 'rpm-software-management:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
dcantrell committed Sep 27, 2023
2 parents 67cb50e + 552e61e commit 426154d
Show file tree
Hide file tree
Showing 74 changed files with 37,400 additions and 19,129 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ DNF CONTRIBUTORS
Christopher Meng <[email protected]>
Daniel Mach <[email protected]>
Dave Johansen <[email protected]>
Dominik Mierzejewski <[email protected]>
Dylan Pindur <[email protected]>
Eduard Cuba <[email protected]>
Evan Goode <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion VERSION.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set (DEFAULT_DNF_VERSION "4.16.2")
set (DEFAULT_DNF_VERSION "4.17.1")

if(DEFINED DNF_VERSION)
if(NOT ${DEFAULT_DNF_VERSION} STREQUAL ${DNF_VERSION})
Expand Down
40 changes: 25 additions & 15 deletions dnf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%define __cmake_in_source_build 1

# default dependencies
%global hawkey_version 0.66.0
%global hawkey_version 0.71.1
%global libcomps_version 0.1.8
%global libmodulemd_version 2.9.3
%global rpm_version 4.14.0
Expand All @@ -12,6 +12,8 @@
%global conflicts_dnf_plugins_extras_version 4.0.4
%global conflicts_dnfdaemon_version 0.3.19

%bcond dnf5_obsoletes_dnf %[0%{?fedora} > 40 || 0%{?rhel} > 10]

# override dependencies for rhel 7
%if 0%{?rhel} == 7
%global rpm_version 4.11.3-32
Expand Down Expand Up @@ -65,7 +67,7 @@
It supports RPMs, modules and comps groups & environments.

Name: dnf
Version: 4.16.2
Version: 4.17.1
Release: 1%{?dist}
Summary: %{pkg_summary}
# For a breakdown of the licensing, see PACKAGE-LICENSING
Expand All @@ -83,6 +85,8 @@ Requires: python3-%{name} = %{version}-%{release}
%if 0%{?rhel} && 0%{?rhel} <= 7
Requires: python-dbus
Requires: %{_bindir}/sqlite3
%elif 0%{?fedora}
Recommends: (%{_bindir}/sqlite3 if (bash-completion and python3-dnf-plugins-core))
%else
Recommends: (python3-dbus if NetworkManager)
%endif
Expand All @@ -95,7 +99,7 @@ Conflicts: python3-dnf-plugins-extras-common < %{conflicts_dnf_plugins_extr
%package data
Summary: Common data and configuration files for DNF
Requires: libreport-filesystem
%if 0%{?fedora} > 40 || 0%{?rhel} > 10
%if %{with dnf5_obsoletes_dnf}
Requires: /etc/dnf/dnf.conf
%endif
Obsoletes: %{name}-conf <= %{version}-%{release}
Expand Down Expand Up @@ -128,8 +132,6 @@ BuildRequires: python3-libcomps >= %{libcomps_version}
BuildRequires: python3-libdnf
BuildRequires: libmodulemd >= %{libmodulemd_version}
Requires: libmodulemd >= %{libmodulemd_version}
BuildRequires: python3-gpg
Requires: python3-gpg
Requires: %{name}-data = %{version}-%{release}
%if 0%{?fedora}
Recommends: deltarpm
Expand Down Expand Up @@ -235,7 +237,7 @@ ln -sr %{buildroot}%{confdir}/protected.d %{buildroot}%{_sysconfdir}/yum/protec
ln -sr %{buildroot}%{confdir}/vars %{buildroot}%{_sysconfdir}/yum/vars
%endif

%if 0%{?fedora} > 40 || 0%{?rhel} > 10
%if %{with dnf5_obsoletes_dnf}
rm %{buildroot}%{confdir}/%{name}.conf
%endif

Expand Down Expand Up @@ -290,22 +292,16 @@ popd
%dir %{confdir}/modules.d
%dir %{confdir}/modules.defaults.d
%dir %{pluginconfpath}
%if ! (0%{?fedora} > 40 || 0%{?rhel} > 10)
%if %{without dnf5_obsoletes_dnf}
%dir %{confdir}/protected.d
%dir %{confdir}/vars
%endif
%dir %{confdir}/aliases.d
%exclude %{confdir}/aliases.d/zypper.conf
%if ! (0%{?fedora} > 40 || 0%{?rhel} > 10)
%if %{without dnf5_obsoletes_dnf}
# If DNF5 does not obsolete DNF ownership of dnf.conf should be DNF's
%config(noreplace) %{confdir}/%{name}.conf
%endif

# No longer using `noreplace` here. Older versions of DNF 4 marked `dnf` as a
# protected package, but since Fedora 39, DNF needs to be able to update itself
# to DNF 5, so we need to replace the old /etc/dnf/protected.d/dnf.conf.
%config %{confdir}/protected.d/%{name}.conf
# Protect python3-dnf instead, which does not conflict with DNF 5
%config(noreplace) %{confdir}/protected.d/python3-%{name}.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%ghost %attr(644,-,-) %{_localstatedir}/log/hawkey.log
%ghost %attr(644,-,-) %{_localstatedir}/log/%{name}.log
Expand All @@ -331,10 +327,16 @@ popd
%{_mandir}/man5/yum.conf.5.*
%{_mandir}/man8/yum-shell.8*
%{_mandir}/man1/yum-aliases.1*
%if %{without dnf5_obsoletes_dnf}
# If DNF5 does not obsolete DNF, protected.d/yum.conf should be owned by DNF
%config(noreplace) %{confdir}/protected.d/yum.conf
%else
# If DNF5 obsoletes DNF
# No longer using `noreplace` here. Older versions of DNF 4 marked `yum` as a
# protected package, but since Fedora 39, DNF needs to be able to update itself
# to DNF 5, so we need to replace the old /etc/dnf/protected.d/yum.conf.
%config %{confdir}/protected.d/yum.conf
%endif
%else
%exclude %{_sysconfdir}/yum.conf
%exclude %{_sysconfdir}/yum/pluginconf.d
Expand Down Expand Up @@ -380,6 +382,14 @@ popd
%{python3_sitelib}/%{name}/automatic/

%changelog
* Fri Sep 01 2023 Jan Kolarik <[email protected]> - 4.17.0-1
- crypto: Use libdnf crypto API instead of using GnuPG/GpgME
- Reprotect dnf, unprotect python3-dnf (RhBug:2221905)
- Block signals during RPM transaction processing (RhBug:2133398)
- Fix bash completion due to sqlite changes (RhBug:2232052)
- automatic: allow use of STARTTLS/TLS
- automatic: use email_port specified in config

* Thu Jul 27 2023 Nicola Sella <[email protected]> - 4.16.2-1
- depend on /etc/dnf/dnf.conf, not libdnf5
- Update repo metadata cache pattern to include zstd
Expand Down
9 changes: 8 additions & 1 deletion dnf/automatic/emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def commit(self):
message.set_charset('utf-8')
email_from = self._conf.email_from
email_to = self._conf.email_to
email_port = self._conf.email_port
email_tls = self._conf.email_tls
message['Date'] = email.utils.formatdate()
message['From'] = email_from
message['Subject'] = subj
Expand All @@ -90,7 +92,12 @@ def commit(self):

# Send the email
try:
smtp = smtplib.SMTP(self._conf.email_host, timeout=300)
if self._conf.email_tls == 'yes':
smtp = smtplib.SMTP_SSL(self._conf.email_host, self._conf.email_port, timeout=300)
else:
smtp = smtplib.SMTP(self._conf.email_host, self._conf.email_port, timeout=300)
if self._conf.email_tls == 'starttls':
smtp.starttls()
smtp.sendmail(email_from, email_to, message.as_string())
smtp.close()
except OSError as exc:
Expand Down
1 change: 1 addition & 0 deletions dnf/automatic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def __init__(self):
self.add_option('email_from', libdnf.conf.OptionString("root"))
self.add_option('email_host', libdnf.conf.OptionString("localhost"))
self.add_option('email_port', libdnf.conf.OptionNumberInt32(25))
self.add_option('email_tls', libdnf.conf.OptionString("no"))


class CommandConfig(Config):
Expand Down
19 changes: 16 additions & 3 deletions dnf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ def _run_transaction(self, cb):

# sync up what just happened versus what is in the rpmdb
if not self._ts.isTsFlagSet(rpm.RPMTRANS_FLAG_TEST):
self._verify_transaction(cb.verify_tsi_package)
self._verify_transaction()

return tid

Expand Down Expand Up @@ -1671,7 +1671,16 @@ def trans_install(query, remove_query, comps_pkg, strict):
sltr.set(provides="({} if {})".format(comps_pkg.name, comps_pkg.requires))
else:
if self.conf.obsoletes:
query = query.union(self.sack.query().filterm(obsoletes=query))
# If there is no installed package in the pkgs_list, add only
# obsoleters of the latest versions. Otherwise behave
# consistently with upgrade and add all obsoleters.
# See https://bugzilla.redhat.com/show_bug.cgi?id=2176263
# for details of the problem.
if query.installed():
query = query.union(self.sack.query().filterm(obsoletes=query))
else:
query = query.union(self.sack.query().filterm(
obsoletes=query.filter(latest_per_arch_by_priority=True)))
sltr.set(pkg=query)
self._goal.install(select=sltr, optional=not strict)
return remove_query
Expand Down Expand Up @@ -1908,7 +1917,11 @@ def _install_multiarch(self, query, reponame=None, strict=True):
sltr = dnf.selector.Selector(self.sack)
q = self.sack.query().filterm(pkg=packages)
if self.conf.obsoletes:
q = q.union(self.sack.query().filterm(obsoletes=q))
# use only obsoletes of the latest versions
# See https://bugzilla.redhat.com/show_bug.cgi?id=2176263
# for details of the problem.
q = q.union(self.sack.query().filterm(
obsoletes=q.filter(latest_per_arch_by_priority=True)))
sltr = sltr.set(pkg=q)
if reponame is not None:
sltr = sltr.set(reponame=reponame)
Expand Down
10 changes: 6 additions & 4 deletions dnf/comps.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,9 @@ def _group_install(self, group_id, pkg_types, exclude=None, strict=True, exclude
raise CompsError(_("Group id '%s' does not exist.") % ucd(group_id))

swdb_group = self.history.group.new(group_id, comps_group.name, comps_group.ui_name, pkg_types)
for i in comps_group.packages_iter():
swdb_group.addPackage(i.name, False, Package._OPT_MAP[i.type])
for pkg in comps_group.packages_iter():
pkg_installed = self.history.swdb.getPackageCompsGroups(pkg.name) != ()
swdb_group.addPackage(pkg.name, pkg_installed, Package._OPT_MAP[pkg.type])
self.history.group.install(swdb_group)

trans = TransactionBunch()
Expand Down Expand Up @@ -699,8 +700,9 @@ def _group_upgrade(self, group_id):

# create a new record for current transaction
swdb_group = self.history.group.new(group_id, comps_group.name, comps_group.ui_name, pkg_types)
for i in comps_group.packages_iter():
swdb_group.addPackage(i.name, False, Package._OPT_MAP[i.type])
for pkg in comps_group.packages_iter():
pkg_installed = self.history.swdb.getPackageCompsGroups(pkg.name) != ()
swdb_group.addPackage(pkg.name, pkg_installed, Package._OPT_MAP[pkg.type])
self.history.group.upgrade(swdb_group)

trans = TransactionBunch()
Expand Down
Loading

0 comments on commit 426154d

Please sign in to comment.