Commit Graph

9760 Commits

Author SHA1 Message Date
Petr Písař b7eb2e399c automatic: Fix detecting releasever_minor
When running dnf-automatic in RHEL 10.0 where releasever_minor should
default to "0", releasever_minor variable was incorrectly detected as
undefined. That led to expanding a metalink for an EPEL repository to
a wrong URL.

The cause was a bad logic in updating the release, releasever_major,
and releasever_minor triplet in dnf.cli.cli.Cli._read_conf_file():
Setting release invalidates releasever_major and releasever_minor. At
the same time for backward compatibilty detected release only contains
the major number.

This bug did not manifest in "dnf upgrade" command because "dnf"
program does not explicitly construct dnf.Base() before calling
_read_conf_file(). That is dnf-automtic first detected releasever=10
and releasever_minor=0 when calling _setup_default_conf() via
dnf.Base(). But then _read_conf_file() called by dnf-automatic set
releasever again to 10, that rewrote releasever_minor to None and
then _read_conf_file() set releasever_minor to releasever_minor, i.e
to None.

This patch does not change the code flow to minimize regressions.
Instead it saves the original releasever_minor value to be able to
default to it again.

Resolve: #2259
2025-07-28 14:52:15 -04:00
Evan Goode 2a5873202f Add modularity deprecation warning to doc pages 2025-07-16 20:14:33 -04:00
Evan Goode dfeab1efb2 Add deprecation warning for module commands
For: https://issues.redhat.com/browse/RHEL-89940
2025-07-16 20:14:33 -04:00
Petr Písař aa1ba2d156 automatic: Expand email_to in command_email emitter to individual arguments
If /etc/dnf/automatic.conf has:

    [emitters]
    emit_via = command_email
    [command_email]
    email_to = root,test

a command incompatible with s-nail-14.9.25, a "mail" command
implementation, was executed:

    execve("/usr/bin/mail", ["mail", "-Ssendwait", "-s", "Updates available on 'fedora-43'.", "-r", "root", "root test"], ...) = 0

The cause was that s-nail does not support multiple recipients in
a single argument.

This patch changes how "{email_to}" expands in command_format
formatting string. Now it expands into multiple, space separated arguments.
The new syntax is also accepted by mailx tool.

Implementation detail: A list of email_to recipients passed in
CommandEmitterMixIn does not inherit from "list" Python class or any
other iterator. It's libdnf.module.VectorString class generated by
Swig without. There the custom ShellQuotedLists formatting dictionary
needs to refer to libdnf.module.VectorString type and include "libdnf"
Python module explicitly.

A test will be added to ci-dnf-stack repository.

Resolve: #2241
2025-07-03 14:36:54 +02:00
Aleš Matěj b1a44beed3 Switch `centos-stream-9-x86_64` copr-builds to `centos-stream+epel-next-9-x86_64`
This is required because rpmsoftwaremanagement/dnf-nightly switched to
it as well.

We keep the `tests` job as `centos-stream-9-x86_64` because `Testing
Farm` doesn't recognize `centos-stream+epel-next-9-x86_64`.
2025-06-20 10:42:59 +02:00
Aleš Matěj 4bcc9d961f Add nightly to bootc tests
It it likely needed here even more because the centos builds are not
updated as frequently as fedora builds.
2025-06-20 10:42:59 +02:00
Aleš Matěj cb16429427 Enable packit copr-builds and testing
It includes dnf-nightly because when we increase the minimal required
version it might not be released yet.
2025-06-20 10:42:59 +02:00
Evan Goode 360a97acd5 Load filelists if there are any usr_drift_protected_paths 2025-06-18 09:06:58 +02:00
Evan Goode 644ddd65d9 doc: Document `usr_drift_protected_paths` 2025-06-18 09:06:58 +02:00
Evan Goode aeb975e548 Support globs in usr_drift_protected_paths 2025-06-18 09:06:58 +02:00
Evan Goode d63e9f00eb spec: package /etc/dnf/usr_drift_protected_paths.d 2025-06-18 09:06:58 +02:00
Evan Goode f2843f8985 bootc: Check whether protected paths will be modified
For https://github.com/rpm-software-management/dnf/issues/2199.

Requires libdnf 0.75.0 with the new `usr_drift_protected_paths` option.
2025-06-18 09:06:58 +02:00
Jan Kolarik bf07219f25 conf: Test for segfaulting iterator in ConfigParser
This is a follow-up to https://github.com/rpm-software-management/libdnf/pull/1682.

Reported bug: https://bugzilla.redhat.com/show_bug.cgi?id=2330562
2025-06-13 09:44:13 +02:00
Evan Goode aeac5ddcac ci: Remove "DNF CI" workflow
We would like to switch to exclusively using Packit for building and
testing pull requests, so we are retiring this GitHub Actions workflow.

In order to fully disable the action, this commit must be applied on
each branch in the upstream repository. Otherwise, the action might be
triggered by a pull request to some stale branch.
2025-06-12 20:39:50 +00:00
Petr Písař 5bab2fa25b spec: Fix executing ctest on RHEL < 10
Commit ab1a0d54d2 (spec: Allow to build
with ninja) broke spec parsing on RHEL 9 because %ctest macro is does
not recongize any arguments there:

$ rpm --eval '%ctest -VV'
error: Unknown option V in ctest(:-:)

This patch falls back to a manual ctest invocation on RHEL < 10.
2025-06-04 13:00:39 +02:00
Petr Písař d748a42202 spec: Remove support for RHEL <= 7
In the mean time the spec file started to use %bcond and %elif macros
and build-require cmake >= 3.5.0. None of that exists in RHEL 7.
2025-06-04 13:00:18 +02:00
Evan Goode ab1a0d54d2 spec: Allow to build with ninja
For
https://discussion.fedoraproject.org/t/f43-change-proposal-cmake-use-ninja-generator-by-default-system-wide/148867.
2025-06-03 11:11:01 +02:00
Evan Goode 2d5869b96c history: persistence for MergedTransaction 2025-05-30 07:08:23 +02:00
Evan Goode c4a7533bd5 Print "persist" or "transient" in history info 2025-05-30 07:08:23 +02:00
Evan Goode 728f30c2f4 persistence: store persist/transient in history DB
For all transactions, store whether the transaction was persistent or
transient in the history DB. Requires libdnf 0.75.0.

Moves some of the bootc logic to the `configure` phase.

For https://github.com/rpm-software-management/dnf/issues/2196.
2025-05-30 07:08:23 +02:00
Evan Goode 0364ce7322 bootc tmt testing 2025-05-30 07:08:23 +02:00
Alex Hedges 54ff0ef919 Add name and email to `AUTHORS` 2025-05-14 12:25:13 +02:00
Alex Hedges 21bfdef357 Check all versions of package for newest changelog date
The logic in `dnf.cli.cli.BaseCli.latest_changelogs()` would loop over
installed packages with the target package name to find one with
changelog times, take the newest date from that, and break out of the
loop immediately afterwards.

This behavior was presumably implemented for efficiency, but it assumes
that there is only one version of the package installed. For some
packages (e.g., `kernel`), multiple versions can be installed at once.
If the first version returned is not the latest, then the function would
calculate the date of the newest changelog entry incorrectly.

The solution is simple: loop over all versions of the package and take
the latest changelog entry from the entire set.

= changelog =
msg: Check all installed versions of package for newest changelog date
type: bugfix
2025-05-14 12:25:13 +02:00
Alex Hedges 69b9de6203 Close file handles during tests
There were warnings about unclosed file handles in the logging logic. We
now close the file handles before removing the log handlers that opened
the files in the first place.
2025-05-14 12:25:13 +02:00
Alex Hedges 568388b206 Add missing entries `.gitignore` file
These files are automatically created while building or testing and
should therefore be ignored.
2025-05-14 12:25:13 +02:00
Aleš Matěj c00cb87d46 `--disableexcludes` and `--disableexcludepkgs` values are not optional 2025-04-30 09:10:42 +02:00
Aleš Matěj facc4ee727 Fix typo from previous commit (left over `]`) 2025-04-30 09:10:42 +02:00
Petr Písař 94f665aad5 Do not disable dnf-automatic.timer when upgrading to dnf5-plugin-automatic
Both dnf-automatic and dnf5-plugin-automatic packages deliver
dnf-automatic.timer. When upgrading from dnf to dnf5, dnf-automatic's
preun script saw that dnf-automatic package was being uninstalled and
hence disabled dnf-automatic.timer. As a result upgrading people found
the upgraded system without automatically applied updates.

It is supposed that people who have enabled dnf-automatic.timer want
to keep it enabled even after migrating to DNF5.

This patch stops disabling dnf-automatic.timer when dnf-automatic
package is uinstalled and there is dnf5-automatic.timer. Existence of
dnf5-automatic.timer means that dnf5-plugin-automatic is installed.
The new dnf-automatic.timer is a symbolic link to
dnf5-automatic.timer and both names can be used interchangably by
systemd.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2358865
2025-04-22 09:34:07 +02:00
Evan Goode d91b81ee49 README: link to #dnf instead of #yum IRC
Move the message about IRC to the top of the README so it's more
visible.

Remove dead link to the bug reporting guide.
2025-04-11 14:13:32 +02:00
Evan Goode 6e0718ff98 Fix building on CentOS 9
`CMAKE_POLICY(SET CMP0148 OLD)` fails on CMake < 3.27, when CMP0148 was
introduced. Centos 9 Stream is still on CMake 3.26.

On CMake >= 3.27, this change adds back a warning that "Policy CMP0148
is not set".

[1] https://cmake.org/cmake/help/latest/command/cmake_policy.html#setting-policies-by-cmake-version
2025-04-08 16:46:47 +02:00
Jan Kolarik 4b92ef06f6 packit: Use package version from the attached spec file
Force Packit to use the package version from the attached spec file instead of the latest git tag.
2025-03-27 13:30:40 +01:00
Jan Kolarik bb1d84bd64 cli: Allow using destdir option for the new manifest plugin 2025-03-27 13:30:40 +01:00
Evan Goode 57053b68af README: direct to Libera.Chat instead of Freenode
Freenode's #yum channel appears quite dead following the Freenode
takeover years ago. New people should be directed to Libera.Chat's #yum
instead.
2025-03-14 17:14:24 +01:00
Dane H Lim 2acf692070 Add Dane H Lim to contributors list 2025-03-14 07:54:08 +01:00
Dane H Lim ea60887d87 Add exit code change of some history subcommands
Resolves: https://github.com/rpm-software-management/dnf/issues/2213
2025-03-14 07:54:08 +01:00
Chris Riches aaa235d3a2 doc: document scriptout hook of TransactionProgress
This function was undocumented, but appears intended to be public and is
very important to anyone wanting to report on all transaction
activities.

Signed-off-by: Chris Riches <chris.riches@nutanix.com>
2025-03-12 13:46:48 +01:00
Chris Riches a70771ecfd TransactionProgress: don't call scriptout() with None
The scriptout hook receives a lot of gratuitous calls when there is no
scriptlet output, leading to it being called with a None value. This is
pointless and confusing to consumers, so skip calling the hook if
`_scriptOutput()` returns None.

Signed-off-by: Chris Riches <chris.riches@nutanix.com>
2025-03-12 13:46:48 +01:00
Evan Goode 8fa4bb94a9 Release 4.23.0 2025-03-07 13:59:11 -05:00
Evan Goode b6ec7d3694 Increase CMake minimal version to 3.5.0
CMake 4.0.0 has removed compatibility for CMake < 3.5.0, so we need to
bump the minimum version here.
2025-03-07 12:35:14 +01:00
Aleš Matěj f777d26ba7 Usage help: don't mark mandatory option parameters as optional
For: https://issues.redhat.com/browse/RHEL-63958
2025-02-26 14:00:00 -05:00
Jan Kolarik 6a88814dfb Enable automatic PR reviews
Create a global rule to auto-assign all PR reviews to the dnf team, which will then handle them in a round-robin fashion based on GitHub settings.
2025-02-26 07:58:21 +01:00
Evan Goode f54b86f983 Move releasever_minor setter docstring to the correct function 2025-02-10 06:38:45 +01:00
Evan Goode e931960d26 Document how --releasever, --releasever_{major,minor} affect each other 2025-02-07 06:38:40 +01:00
Evan Goode ba5ddbddf1 tests: Patch detect_releasevers, not detect_releasever 2025-02-07 06:38:40 +01:00
Evan Goode 593ab0c377 doc: Document detect_releasevers and update example
Adds dnf.rpm.detect_releasevers to the API docs and mention it is
now preferred over dnf.rpm.detect_releasever.

Updates examples/install_extension.py to use detect_releasevers and set
the releasever_major and releasever_minor substitution variables.
2025-02-07 06:38:40 +01:00
Evan Goode 017bbab0a2 Add --releasever-major and --releasever-minor options
Allows the user to override the $releasever_major and $releasever_minor
variables on the command line, like --releasever.
2025-02-07 06:38:40 +01:00
Evan Goode 75e3ff0c43 Override releasever_{major,minor} with provides
The releasever_major and releasever_minor substitution variables are
usually derived by splitting releasever on the first `.`. However, to
support EPEL 10 [1], we would like a way for distributions to override these
values. Specifically, we would like RHEL 10 to have a releasever of `10`
with a releasever_major of `10` and a releasever_minor of `0` (later
incrementing to `1`, `2`, to correspond with the RHEL minor version).

This commit adds a new API function, `detect_releasevers`, which derives
releasever, releasever_major, and releasever_minor from virtual provides
on the system-release package (any of `DISTROVERPKG`). The detection of
releasever is unchanged. releasever_major and releasever_minor are
specified by the versions of the `system-release-major` and
`system-release-minor` provides, respectively.

If the user specifies a `--releasever=X.Y` on the command line, the
distribution settings for releasever, releasever_major, and releasever_minor
will all be overridden: releasever will be set to X.Y, releasever_major will be
set to X, and releasever_minor will be set to Y, same as before.  If a user
wants to specify a custom releasever_major and releasever_minor, they have to
set all three with `--setopt=releasever=X --setopt=releasever_major=Y
--setopt=releasever_minor=z`, taking care to put `releasever_major` and
`releasever_minor` after `releasever` so they are not overridden.

[1] https://issues.redhat.com/browse/RHEL-68034
2025-02-07 06:38:40 +01:00
Evan Goode 0e283fb3b0 Derive releasever_{major,minor} in conf, not substitutions
This allows setting a releasever_major or releasever_minor
independent of releasever, which is needed by EPEL.

Related: https://issues.redhat.com/browse/RHEL-68034
2025-02-07 06:38:40 +01:00
Evan Goode 5a4f6c42e6 Require libdnf >= 0.74.0 with `persistence` option 2025-02-06 14:30:50 +01:00
Evan Goode 76a0c339eb spec: Add dnf-bootc subpackage
dnf-bootc's only job is to Require python3-gobject-base, ostree,
ostree-libs, and util-linux-core, which are needed to interact with
bootc systems. We don't want to add these dependencies on `python3-dnf`
because we don't want them on non-bootc systems, so we use a subpackage.
2025-02-06 14:30:50 +01:00