Commit Graph

9708 Commits

Author SHA1 Message Date
Evan Goode 63972e1e73 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:42:51 +00:00
Evan Goode fe9467870b Copr Makefile: correctly set TAG 2025-02-04 20:20:13 +00:00
Evan Goode 942e9421ab dnf-bootc depends on python3-dnf = %{version}-%{release} 2025-02-04 14:23:50 -05:00
Evan Goode 5cf17d4a7a Remove unused `bootc_unlock_requested` variable 2025-02-04 14:22:50 -05:00
Evan Goode 5c30896035 dnf-bootc depends on ostree, util-linux-core 2025-02-04 08:37:34 -05:00
Evan Goode 960b2f4ba0 spec: Add dnf-bootc subpackage
dnf-bootc's only job is to Require python3-gobject-base and ostree-libs,
which are needed to check the unlock status on 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-01-31 17:48:16 -05:00
Evan Goode 4304f2bf33 bootc: "Re-locking": use ostree admin unlock --transient
To keep /usr read-only after DNF is finished with a transient
transaction, we call `ostree admin unlock --transient` to mount the /usr
overlay as read-only by default. Then, we create a private mount
namespace for DNF and its child processes and remount the /usr overlayfs
as read/write in the private mountns.

os.unshare is unfortunately only available in Python >= 3.12, so we have
to call libc.unshare via Python ctypes here and hardcode the CLONE_NEWNS
flag that we need to pass.
2025-01-27 16:57:02 -05:00
Evan Goode 337795f471 bootc: Use ostree GObject API to get deployment status
Using libostree gives us more detail about the current state of the
deployment than only checking whether /usr is writable.
2025-01-27 16:57:02 -05:00
Evan Goode 742f1cd74b doc: Note transient transactions will appear in history 2025-01-20 10:40:21 +01:00
Evan Goode 77696a90ac bootc: Document `--transient` and `persistence`
Documents the new `--transient` command-line argument and `persistence`
configuration option. I tried to use a table for listing the valid
options for `persistence`, but RST does not automatically wrap table
cells containing long lines, so a list was much easier.
2025-01-15 13:50:01 -05:00
Evan Goode 0e71e95f3c Add support for --transient
Adds support for the --transient option on all transactions. Passing
--transient on a bootc system will call `bootc usr-overlay` to create a
transient writeable /usr and continue the transaction.

Specifying --transient on a non-bootc system will throw an error; we
don't want to mislead users to thinking this feature works on non-bootc
systems.

If --transient is not specified and the bootc system is in a locked
state, the operation will be aborted and a message will be printed
suggesting to try again with --transient.
2024-11-21 15:46:48 -05:00
David Cantrell 6bbe920a5c copr: Small Copr build file improvements
Text alignment and formatting in the spec file.
2024-11-19 15:05:04 -05:00
David Cantrell 877a8f2f5c copr: Add Copr build files
Support automatic builds on git commits.  Used to generate up to date
RPMs of dnf for testing and development purposes.
2024-11-14 13:34:17 -05:00
Alioth Null e54fcd4ddd Fix display issue of a code snippet. 2024-11-04 10:58:09 +01:00
Kenneth Finnegan 8d9ef3b51e Updated conf_ref to reflect change in fastestmirror behavior 2024-10-31 11:11:22 +01:00
Marek Blaha 13ecc3921f automatic: Check availability of config file
If a configuration file is explicitly specified on the command line,
ensure that it exists and is readable. If the file is not found, notify
the user immediately and terminate the process.

This resolves issues where users may run dnf-automatic with unrecognized
positional arguments, such as `dnf-automatic install`.

The most natural approach to handle a non-existing config file would be
by catching the exception thrown by the `read()` method of the
`libdnf.conf.ConfigParser` class. Unfortunately, the Python bindings
override the `read()` method at the SWIG level, causing it to suppress any
potentially raised IOError.
For details see this section of the commit
8f1fedf855

def ConfigParser__newRead(self, filenames):
    parsedFNames = []
    try:
        if isinstance(filenames, str) or isinstance(filenames, unicode):
            filenames = [filenames]
    except NameError:
        pass
    for fname in filenames:
        try:
            self.readFileName(fname)
            parsedFNames.append(fname)
        except IOError:
            pass
        except Exception as e:
            raise RuntimeError("Parsing file '%s' failed: %s" % (fname, str(e)))
    return parsedFNames
ConfigParser.read = ConfigParser__newRead

Resolves: https://issues.redhat.com/browse/RHEL-46030
2024-10-18 10:39:24 +02:00
Petr Písař c2bc7041c4 doc: Example send_error_messages in /etc/dnf/automatic.conf
The option was documented in a manual page, but it wasn't mentioned in
the default configuration file.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2318136
2024-10-16 11:04:48 +02:00
Klaas Demter 193e3f4e21 Update need_reboot for dnf-automatic
The need_reboot from dnf-automatic did not match NEED_REBOOT from
needs-restarting.
2024-10-16 08:59:39 +02:00
Woomymy 8f8b29c765 AUTHORS: Add myself
Signed-off-by: Woomymy <woomy@woomy.be>
2024-10-15 17:37:24 +02:00
Woomymy 07ad361f18 base: Add kernel-core to reboot_needed list
Some variants like Fedora Cloud ship only kernel-core without
kernel-modules and the kernel metapackage
2024-10-15 17:37:24 +02:00
Petr Písař 8d888d26e6 Allow --downloadonly on read-only bootc system
"dnf install --downloadonly" failed on read-only bootc system despite
not running the transaction. The downloaded packages are stored under
writable /var or to a directory explicitly choosen by a user.

This patch suppresses the bootc read-only bailout if --downloadonly
option is used.

https://issues.redhat.com/browse/RHEL-61745
2024-10-15 11:44:42 +02:00
Petr Písař d50a6b2a63 spec: If DNF5 obsoletes DNF, do not build dnf-automatic
Fedora CI rpmdeplint test failed for dnf-automic in Fedora 42 because
dnf5-plugin-automatic package obsoletes dnf-automatic package there:

    Upgrade problems:
    dnf-automatic-4.21.1-1.fc42.noarch would be obsoleted by dnf5-plugin-automatic-5.2.5.0-2.fc41.x86_64 from repo fedora-42-x86_64

This patch fixes it by not building dnf-automatic package if a macro
for obsoleting dnf by dnf5 is set. (Similar to a previous
f519e602a7 commit.)
2024-09-23 15:28:10 +02:00
Marek Blaha 7b27428d3f package: remote_location() takes basedir into account
If the package location in the repodata contains basedir, it needs to be
taken into account when calculating the package's remote_location.

Resolves: https://github.com/rpm-software-management/dnf/issues/2130

= changelog =
msg:           Fix package location if baseurl is present in the metadata
type:          bugfix
resolves:      https://github.com/rpm-software-management/dnf/issues/2130
2024-09-20 14:16:54 +02:00
Marek Blaha 920688ae9f Print rpm unpack errors to the user (RhBug:2312906)
DNF currently prints RPM errors that occur during scriptlet execution or
during package installation/removal.
This patch adds error handling for issues that arise during RPM package
unpacking as well.

= changelog =
msg:           Print rpm package unpack errors to the user
type:          enhancement
resolves:      https://bugzilla.redhat.com/show_bug.cgi?id=2312906
2024-09-20 11:30:03 +02:00
Petr Písař f519e602a7 spec: If DNF5 obsoletes DNF, do not build dnf and yum packages
Fedora CI installability and rpmdeplint tests failed on Fedoras where
dnf5 obsoletes dnf and yum packages because the tests attempt to
install just built dnf and yum packages, but DNF5 refuses installing
them because they are obsoleted by an already installed dnf5:

     --------------------------------------------------------
    |                                                        |
    |   Running install test for dnf-0:4.21.0-3.fc41.noarch  |
    |                                                        |
    --------------------------------------------------------
    Updating and loading repositories:
     Repo for 121841198 Brew build          100% |   4.7 MiB/s |   4.8 KiB |  00m00s
    Repositories loaded.
    Failed to resolve the transaction:
    Problem: problem with installed package
      - installed package dnf5-5.2.5.0-2.fc41.x86_64 obsoletes dnf < 5 provided by dnf-4.21.0-3.fc41.noarch from brew-121841198
      - package dnf5-5.2.5.0-2.fc41.x86_64 from fedora obsoletes dnf < 5 provided by dnf-4.21.0-3.fc41.noarch from brew-121841198
      - package dnf5-5.2.5.0-2.fc41.x86_64 from updates obsoletes dnf < 5 provided by dnf-4.21.0-3.fc41.noarch from brew-121841198
      - package dnf5-5.2.5.0-2.fc41.x86_64 from rawhide obsoletes dnf < 5 provided by dnf-4.21.0-3.fc41.noarch from brew-121841198
      - package dnf5-5.2.5.0-2.fc41.x86_64 from fedora-41-buildroot obsoletes dnf < 5 provided by dnf-4.21.0-3.fc41.noarch from brew-121841198
      - package dnf5-5.2.5.0-2.fc41.x86_64 from testing-farm-tag-repository obsoletes dnf < 5 provided by dnf-4.21.0-3.fc41.noarch from brew-121841198
      - conflicting requests

   (The same happesn for yum package.)

Solution this patch implements is not building the two obsolete
packages. At the end, they cannot be installed.
2024-09-06 09:56:33 +02:00
Petr Písař a1aa8d0e04 Allow --installroot on read-only bootc system
Some people use --installroot on a read-only bootc system to install
a system into a chroot subtree. However, current bootc check did not
take into account --installroot and rejected the operation.

This patch augments the check for the installroot being different
from /.

It's pointless to check for installroot writability here because
installroot is written before this check when updating the
repositories and computing a transaction. Moving this check sooner
would not help because some directories (/opt, /) are kept read-only
even on writable bootc.

Resolves: #2108
2024-08-22 09:59:28 +02:00
Petr Písař f29a017b00 spec: Fix ownership of /etc/yum tree
This patch fixes two mistakes:

(1) In minimal yum_compat_levels (default one) rpmbuild complained:

    RPM build warnings:
        File not found: /home/test/rpmbuild/BUILDROOT/dnf-4.21.0-4.fc40.x86_64/etc/yum/pluginconf.d
        File not found: /home/test/rpmbuild/BUILDROOT/dnf-4.21.0-4.fc40.x86_64/etc/yum/protected.d
        File not found: /home/test/rpmbuild/BUILDROOT/dnf-4.21.0-4.fc40.x86_64/etc/yum/vars

(2) In full yum_compat_levels /etc/yum directory was not owned by yum package
2024-08-19 15:05:02 +02:00
Petr Písař be7001149d spec: Simplify %files dnf section for both yum_compat_levels
Miminal level is a subset of full level.
2024-08-19 15:05:02 +02:00
Petr Písař 917a8baba0 spec: Remove preview yum_compat_level
CMake build script stopped creating yum4 executable when
Python 2 support was removed with commit
92f03d1e13 ([spec] Remove python 2).

Therefore the preview level cannot be enabled anymore and this patch
removes it to simplify the spec file.
2024-08-19 15:05:02 +02:00
Petr Písař e8ad542ea9 spec: Move /var/cache/dnf from dnf to python3-dnf
The cache directory is used by /usr/bin/dnf-3 program packaged
in python3-dnf. dnf package requires python3-dnf.
2024-08-19 15:05:02 +02:00
Pavla Kratochvilova 5f8f131842 doc: Naming of source and debug repos
Resolves: https://github.com/rpm-software-management/dnf/issues/2071
2024-08-16 09:38:51 +02:00
Evan Goode 9717c055b5 Release 4.21.1 2024-08-14 23:03:26 +00:00
Petr Písař b23e3fbd87 tests: Use PGP keys without SHA-1
Tests failed on RHEL 10 where SHA-1 is disabled in a DEFAULT crypto
policy and where librepo is configured to use rpm-sequoia which
respects the crypto policy (in contrast to gpgme):

1: ======================================================================
1: FAIL: test_rawkey2infos (tests.test_crypto.CryptoTest.test_rawkey2infos)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1:   File "/home/test/rhel/dnf/dnf-4.20.0/tests/test_crypto.py", line 75, in test_rawkey2infos
1:     self.assertEqual(info.userid, 'Dandy Fied <dnf@example.com>')
1: AssertionError: '' != 'Dandy Fied <dnf@example.com>'
1: + Dandy Fied <dnf@example.com>

The root cause was that tests/keys/key.pub used the SHA-1 digest
algorithm.

This patch replaces that key with a 4096-bit RSA key signed using
SHA-384 digest algorithm.

Resolves: https://issues.redhat.com/browse/RHEL-50218
2024-07-24 12:06:40 +02:00
Joseph Marrero e2535589ce Update bootc hosts message to point to bootc --help 2024-07-23 15:40:16 -04:00
Joseph Marrero 6120fe5251 Update ostree/bootc host system check.
This changes the is_container() func for _is_bootc_host()
and updates the logic and message. This should detect on
all ostree and bootc hosts to date that are not using
bootc usroverlay or ostree admin unlock for development
purposes.

resolves: #RHEL-49670, RHEL-49671
2024-07-22 15:28:04 -04:00
Jacek Szafarkiewicz 2beb3ef518 Fix "console" width on non real terminals (pipe)
Signed-off-by: Jacek Szafarkiewicz <szafar@linux.pl>
2024-07-03 12:32:07 +02:00
Nic dee3952a8c Allow local downloads to same `downloaddir`
Currently when `dnf download --downloaddir <dir> <package>` sources`<package>` from `<dir>` it triggers a `shutil.SameFileError` exception and aborts the entire download process.

This goes against the current flow which marks locally present RPMs that match a remote RPM as `[SKIPPED] <package>.rpm: Already downloaded`.

This change allows downloads of locally sourced packages to the same file, treating it as a no-op.
2024-07-03 09:23:58 +02:00
Sten Laane b06dca11f0 doc: minor formatting and consistency fixes
This patch includes some minor consistency fixes I noticed when reading
the man page:
- A few commands had extra blank lines before starting their description
  which was causing extra whitespace to be added to the description.
- Some information relevant to commands was nested under example
  commands because of leading whitespace (mostly the information about
  `-nevra` commands).
- Some example commands followed their description, while most other
  examples have the command first and then the description. This changes
  all examples to the latter for consistency.
- Renamed the `Examples` header to `Repoquery Examples` similar to other
  example headers
- Fixed typo in repoquery examples (ligttpd -> lighttpd)
- Added parameter names to `swap` description

Also this updates the man page file name in the README (dnf.8 -> dnf4.8)
2024-07-02 08:38:49 +02:00
Evan Goode d29dfa0634 Release 4.21.0 2024-06-18 16:10:33 -04:00
Jaroslav Mracek 78e2838c62 Drop collect file for ABRT
It looks like that it is not required anymore

Resolve: https://issues.redhat.com/browse/RHEL-40382
2024-06-12 10:38:10 +02:00
Michal Domonkos a8c77bb0d8 Update the man page entry for the countme option
Make it a bit more explanatory, format the age buckets as a table and
reflect the changes from the libdnf PR #1662.
2024-06-11 10:52:58 +02:00
Jaroslav Mracek f211e1a41a [doc] Remove provide of spec definition for repoquery command
Repoquery command never matched spec with provides.
2024-05-23 12:40:18 +02:00
Jaroslav Mracek b3b9b3a48c Limit queries to nevra forms when provided by command
Command `dnf install-n <provide>` does not install only according
to package mame but still search in provides. The patch limits
searrch only to NEVRA forms for install, remove, autoremove,
and repoquery commands.

Resolves partially: https://issues.redhat.com/browse/RHEL-5747
2024-05-23 12:40:18 +02:00
Jan Kolarik 4a2b425d3f man: Improve upgrade-minimal command docs (RHEL-6417)
Making the man pages for the `upgrade-minimal` command clearer about how packages with advisories are upgraded.

Resolves: https://issues.redhat.com/browse/RHEL-6417
2024-04-30 11:29:33 +02:00
Jaroslav Rohel 22fc33c71e Allow `%py3_shebang_fix` macro to add `-P` argument to shebang lines
There was a bug in dnf and dnf-automatic that caused traceback
when running the Python interpreter with the `-P` argument.
Since the bug has been fixed, the `-P` argument can be used.
2024-04-29 12:48:30 +02:00
Jaroslav Rohel c8dbe6ea40 Fix: No traceback when Python interpreter is running with -P
There was code in dnf and dnf-automatic to support running them from
the git tree. This was a developer-oriented hack that should not exist
in production code. It assumed that when running an installed dnf,
the `sys.path[0]` contains `/usr/bin`. If not, it overwrites
the contents of `sys.path[0]`.

This is a problem when running the Python interpreter with the `-P`
parameter (meaning: Don't automatically prepend a potentially unsafe
path to sys.path such as the current directory, the script's directory
or an empty string.)

The fix removes this developer-oriented hack. Developers should instead
set PYTHONPATH in the environment.
2024-04-29 12:48:30 +02:00
David Cantrell 5c050ba232 Add detection for ostree-based systems and warn users about losing changes
On ostree-based systems, users can use dnf to customize the
environment but those changes will be lost at the next ostree-based
image update.  If you want to retain changes between ostree-updates
you need to make use of rpm-ostree right now.

Signed-off-by: David Cantrell <dcantrell@redhat.com>
2024-04-24 14:55:53 +02:00
Jan Kolarik e3cb438c0f Release 4.20.0 2024-04-24 13:16:32 +02:00
Jan Kolarik bc67d0d54e Prepare for switch of dnf5 in Rawhide 2024-04-22 09:32:19 +02:00
Jan Kolarik 24a461bec0 repoquery: Fix loading filelists when -f is used (RhBug:2276012)
When `-f` option is used, the argument is stored in the `opts.file` instead of the `opts.key`. We need to load filelists also in this case.

= changelog =
msg: repoquery: Fix loading filelists when -f is used
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2276012
2024-04-19 09:31:10 +02:00