Many commands take a <package-spec>
parameter that selects a
package for the operation. The <package-spec>
argument is matched
against package NEVRAs, provides and file provides.
<package-file-spec>
is similar to <package-spec>
, except provides
matching is not performed. Therefore, <package-file-spec>
is
matched only against NEVRAs and file provides.
<package-name-spec>
is matched against NEVRAs only.
Globs
Package specification supports the same glob pattern matching
that shell does, in all three above mentioned packages it matches
against (NEVRAs, provides and file provides).
The following patterns are supported:
*
Matches any number of characters.
?
Matches any single character.
[]
Matches any one of the enclosed characters. A pair of
characters separated by a hyphen denotes a range
expression; any character that falls between those two
characters, inclusive, is matched. If the first character
following the [
is a !
or a ^
then any character not
enclosed is matched.
Note: Curly brackets ({}
) are not supported. You can still use
them in shells that support them and let the shell do the
expansion, but if quoted or escaped, dnf will not expand them.
NEVRA Matching
When matching against NEVRAs, partial matching is supported. DNF
tries to match the spec against the following list of NEVRA forms
(in decreasing order of priority):
• name-[epoch:]version-release.arch
• name.arch
• name
• name-[epoch:]version-release
• name-[epoch:]version
Note that name
can in general contain dashes (e.g.
package-with-dashes
).
The first form that matches any packages is used and the
remaining forms are not tried. If none of the forms match any
packages, an attempt is made to match the <package-spec>
against
full package NEVRAs. This is only relevant if globs are present
in the <package-spec>
.
<package-spec>
matches NEVRAs the same way <package-name-spec>
does, but in case matching NEVRAs fails, it attempts to match
against provides and file provides of packages as well.
You can specify globs as part of any of the five NEVRA
components. You can also specify a glob pattern to match over
multiple NEVRA components (in other words, to match across the
NEVRA separators). In that case, however, you need to write the
spec to match against full package NEVRAs, as it is not possible
to split such spec into NEVRA forms.
Specifying NEVRA Matching Explicitly
Some commands (autoremove
, install
, remove
and repoquery
) also
have aliases with suffixes -n
, -na
and -nevra
that allow to
explicitly specify how to parse the arguments:
• Command install-n
only matches against name
.
• Command install-na
only matches against name.arch
.
• Command install-nevra
only matches against
name-[epoch:]version-release.arch
.