man-pages/man7/apt-patterns.7.html
2021-03-31 01:06:50 +01:00

468 lines
8.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of APT-PATTERNS</TITLE>
</HEAD><BODY>
<H1>APT-PATTERNS</H1>
Section: APT (7)<BR>Updated: 04&nbsp;February&nbsp;2020<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
apt-patterns - Syntax and semantics of apt search patterns
<A NAME="lbAC">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
Starting with version 2.0,
<B>APT</B>
provides support for patterns, which can be used to query the apt cache for packages.
<A NAME="lbAD">&nbsp;</A>
<H2>LOGIC PATTERNS</H2>
<P>
These patterns provide the basic means to combine other patterns into more complex expressions, as well as
?true
and
?false
patterns.
<P>
?and(PATTERN, PATTERN, ...), PATTERN PATTERN ...
<DL COMPACT><DT id="1"><DD>
Selects objects where all specified patterns match.
</DL>
<P>
?false, ~F
<DL COMPACT><DT id="2"><DD>
Selects nothing.
</DL>
<P>
?not(PATTERN), !PATTERN
<DL COMPACT><DT id="3"><DD>
Selects objects where PATTERN does not match.
</DL>
<P>
?or(PATTERN, PATTERN, ...), PATTERN | PATTERN | ...
<DL COMPACT><DT id="4"><DD>
Selects objects where at least one of the specified patterns match.
</DL>
<P>
?true, ~T
<DL COMPACT><DT id="5"><DD>
Selects all objects.
</DL>
<P>
(PATTERN)
<DL COMPACT><DT id="6"><DD>
Selects the same as
PATTERN, can be used to work around precedence, for example,
(~ramd64|~ri386)~nfoo
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>NARROWING PATTERNS</H2>
<P>
<P>
<P>
?all-versions(PATTERN)
<DL COMPACT><DT id="7"><DD>
Selects packages where all versions match PATTERN. When matching versions instead, same as PATTERN.
</DL>
<P>
?any-version(PATTERN)
<DL COMPACT><DT id="8"><DD>
Selects any version where the pattern matches on the version.
<P>
For example, while
?and(?<A HREF="/cgi-bin/man/man2html?1+version">version</A>(1),?<A HREF="/cgi-bin/man/man2html?2+version">version</A>(2))
matches a package which has one version containing 1 and one version containing 2,
?any-version(?and(?<A HREF="/cgi-bin/man/man2html?1+version">version</A>(1),?<A HREF="/cgi-bin/man/man2html?2+version">version</A>(2)))
restricts the
?and
to act on the same version.
</DL>
<P>
?narrow(PATTERN...)
<DL COMPACT><DT id="9"><DD>
Selects any version matching all PATTERNs, short for
?any-version(?and(PATTERN...)).
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>PACKAGE PATTERNS</H2>
<P>
These patterns select specific packages.
<P>
?architecture(WILDCARD), ~rWILDCARD
<DL COMPACT><DT id="10"><DD>
Selects packages matching the specified architecture, which may contain wildcards using any.
</DL>
<P>
?automatic, ~M
<DL COMPACT><DT id="11"><DD>
Selects packages that were installed automatically.
</DL>
<P>
?broken, ~b
<DL COMPACT><DT id="12"><DD>
Selects packages that have broken dependencies.
</DL>
<P>
?config-files, ~c
<DL COMPACT><DT id="13"><DD>
Selects packages that are not fully installed, but have solely residual configuration files left.
</DL>
<P>
?essential, ~E
<DL COMPACT><DT id="14"><DD>
Selects packages that have Essential: yes set in their control file.
</DL>
<P>
?exact-name(NAME)
<DL COMPACT><DT id="15"><DD>
Selects packages with the exact specified name.
</DL>
<P>
?garbage, ~g
<DL COMPACT><DT id="16"><DD>
Selects packages that can be removed automatically.
</DL>
<P>
?installed, ~i
<DL COMPACT><DT id="17"><DD>
Selects packages that are currently installed.
</DL>
<P>
?name(REGEX), ~nREGEX
<DL COMPACT><DT id="18"><DD>
Selects packages where the name matches the given regular expression.
</DL>
<P>
?obsolete, ~o
<DL COMPACT><DT id="19"><DD>
Selects packages that no longer exist in repositories.
</DL>
<P>
?upgradable, ~U
<DL COMPACT><DT id="20"><DD>
Selects packages that can be upgraded (have a newer candidate).
</DL>
<P>
?virtual, ~v
<DL COMPACT><DT id="21"><DD>
Selects all virtual packages; that is packages without a version. These exist when they are referenced somewhere in the archive, for example because something depends on that name.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>VERSION PATTERNS</H2>
<P>
These patterns select specific versions of a package.
<P>
?archive(REGEX), ~AREGEX
<DL COMPACT><DT id="22"><DD>
Selects versions that come from the archive that matches the specified regular expression. Archive, here, means the values after
a=
in
<B>apt-cache policy</B>.
</DL>
<P>
?origin(REGEX), ~OREGEX
<DL COMPACT><DT id="23"><DD>
Selects versions that come from the origin that matches the specified regular expression. Origin, here, means the values after
o=
in
<B>apt-cache policy</B>.
</DL>
<P>
?section(REGEX), ~sREGEX
<DL COMPACT><DT id="24"><DD>
Selects versions where the section matches the specified regular expression.
</DL>
<P>
?source-package(REGEX), ~eREGEX
<DL COMPACT><DT id="25"><DD>
Selects versions where the source package name matches the specified regular expression.
</DL>
<P>
?source-version(REGEX)
<DL COMPACT><DT id="26"><DD>
Selects versions where the source package version matches the specified regular expression.
</DL>
<P>
?version(REGEX), ~VREGEX
<DL COMPACT><DT id="27"><DD>
Selects versions where the version string matches the specified regular expression.
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>EXAMPLES</H2>
<P>
apt remove ?garbage
<DL COMPACT><DT id="28"><DD>
Remove all packages that are automatically installed and no longer needed - same as apt autoremove
</DL>
<P>
apt purge ?config-files
<DL COMPACT><DT id="29"><DD>
Purge all packages that only have configuration files left
</DL>
<P>
apt list '~i !~M (~slibs|~sperl|~spython)'
<DL COMPACT><DT id="30"><DD>
List all manually-installed packages in sections matching libs, perl, or python.
</DL>
<A NAME="lbAI">&nbsp;</A>
<H2>MIGRATING FROM APTITUDE</H2>
<P>
Patterns in apt are heavily inspired by patterns in aptitude, but with some tweaks:
<P>
<DL COMPACT><DT id="31"><DD>
&bull;
Syntax is uniform: If there is an opening parenthesis after a term, it is always assumed to be the beginning of an argument list.
<P>
In aptitude, a syntactic form
&quot;?foo(bar)&quot;
could mean
&quot;?and(?foo,bar)&quot;
if foo does not take an argument. In APT, this will cause an error.
</DL>
<P>
<DL COMPACT><DT id="32"><DD>
&bull;
Not all patterns are supported.
</DL>
<P>
<DL COMPACT><DT id="33"><DD>
&bull;
Some additional patterns are available, for example, for finding gstreamer codecs.
</DL>
<P>
<DL COMPACT><DT id="34"><DD>
&bull;
Escaping terms with
~
is not supported.
</DL>
<P>
<DL COMPACT><DT id="35"><DD>
&bull;
A trailing comma is allowed in argument lists
</DL>
<P>
<DL COMPACT><DT id="36"><DD>
&bull;
?narrow accepts infinite arguments
</DL>
<P>
<DL COMPACT><DT id="37"><DD>
&bull;
foo
cannot be used as a shortform for
?name(foo), as this can cause typos to go unnoticed: Consider
?and(...,~poptional): this requires the package to have
required
priority, but if you do not type the
~, it would require the package name to contain
poptional.
</DL>
<P>
<DL COMPACT><DT id="38"><DD>
&bull;
Grouping patterns with
(...)
or writing
?or(A,B)
as
A|B
are not supported. We do not believe that the use of
|
is that common, and the grouping is not necessary without it.
</DL>
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?8+apt-get">apt-get</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+apt">apt</A></B>(8)
<A NAME="lbAK">&nbsp;</A>
<H2>BUGS</H2>
<P>
m[blue]<B>APT bug page</B>m[]<FONT SIZE="-2">[1]</FONT>. If you wish to report a bug in APT, please see
/usr/share/doc/debian/bug-reporting.txt
or the
<B><A HREF="/cgi-bin/man/man2html?1+reportbug">reportbug</A></B>(1)
command.
<A NAME="lbAL">&nbsp;</A>
<H2>AUTHOR</H2>
<P>
APT was written by the APT team
&lt;<A HREF="mailto:apt@packages.debian.org">apt@packages.debian.org</A>&gt;.
<A NAME="lbAM">&nbsp;</A>
<H2>AUTHORS</H2>
<P>
<B>Jason Gunthorpe</B>
<DL COMPACT><DT id="39"><DD>
</DL>
<P>
<B>APT team</B>
<DL COMPACT><DT id="40"><DD>
</DL>
<A NAME="lbAN">&nbsp;</A>
<H2>NOTES</H2>
<DL COMPACT>
<DT id="41"> 1.<DD>
APT bug page
<DL COMPACT><DT id="42"><DD>
<A HREF="http://bugs.debian.org/src:apt">http://bugs.debian.org/src:apt</A>
</DL>
<P>
</DL>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="43"><A HREF="#lbAB">NAME</A><DD>
<DT id="44"><A HREF="#lbAC">DESCRIPTION</A><DD>
<DT id="45"><A HREF="#lbAD">LOGIC PATTERNS</A><DD>
<DT id="46"><A HREF="#lbAE">NARROWING PATTERNS</A><DD>
<DT id="47"><A HREF="#lbAF">PACKAGE PATTERNS</A><DD>
<DT id="48"><A HREF="#lbAG">VERSION PATTERNS</A><DD>
<DT id="49"><A HREF="#lbAH">EXAMPLES</A><DD>
<DT id="50"><A HREF="#lbAI">MIGRATING FROM APTITUDE</A><DD>
<DT id="51"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="52"><A HREF="#lbAK">BUGS</A><DD>
<DT id="53"><A HREF="#lbAL">AUTHOR</A><DD>
<DT id="54"><A HREF="#lbAM">AUTHORS</A><DD>
<DT id="55"><A HREF="#lbAN">NOTES</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:07 GMT, March 31, 2021
</BODY>
</HTML>