summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/cachefilter-patterns.h5
-rw-r--r--doc/apt-patterns.7.xml9
-rwxr-xr-xtest/integration/test-apt-patterns6
3 files changed, 15 insertions, 5 deletions
diff --git a/apt-pkg/cachefilter-patterns.h b/apt-pkg/cachefilter-patterns.h
index 284fcc1cf..2d48a1cc9 100644
--- a/apt-pkg/cachefilter-patterns.h
+++ b/apt-pkg/cachefilter-patterns.h
@@ -212,6 +212,11 @@ struct APT_HIDDEN PackageIsInstalled : public PackageMatcher
assert(Cache != nullptr);
return Pkg->CurrentVer != 0;
}
+ bool operator()(pkgCache::VerIterator const &Ver) override
+ {
+ assert(Cache != nullptr);
+ return Ver == Ver.ParentPkg().CurrentVer();
+ }
};
struct APT_HIDDEN PackageIsObsolete : public PackageMatcher
diff --git a/doc/apt-patterns.7.xml b/doc/apt-patterns.7.xml
index 45f2f9fd7..9d4f0a94e 100644
--- a/doc/apt-patterns.7.xml
+++ b/doc/apt-patterns.7.xml
@@ -108,7 +108,7 @@
<listitem><para>Selects packages that can be removed automatically.</para></listitem>
</varlistentry>
<varlistentry><term><code>?installed</code></term><term><code>~i</code></term>
- <listitem><para>Selects packages that are currently installed.</para></listitem>
+ <listitem><para>Selects packages that are currently installed. Since version 2.5.4, narrowing this pattern (see narrowing patterns above) makes it only match installed versions (see version patterns below).</para></listitem>
</varlistentry>
<varlistentry><term><code>?name(REGEX)</code></term><term><code>~nREGEX</code></term>
<listitem><para>Selects packages where the name matches the given regular expression.</para></listitem>
@@ -138,6 +138,9 @@
<varlistentry><term><code>?codename(REGEX)</code></term>
<listitem><para>Selects versions that come from the codename that matches the specified regular expression. Codename, here, means the values after <code>n=</code> in <command>apt-cache policy</command>.</para></listitem>
</varlistentry>
+ <varlistentry><term><code>?installed</code></term><term><code>~i</code></term>
+ <listitem><para>Selects package versions that are currently installed. Versions prior to 2.5.4 only matched at the package level, hence <code>?any-version(?installed?version(2.0))</code>matched even if 2.0 was not installed, but another version was.</para></listitem>
+ </varlistentry>
<varlistentry><term><code>?origin(REGEX)</code></term><term><code>~OREGEX</code></term>
<listitem><para>Selects versions that come from the origin that matches the specified regular expression. Origin, here, means the values after <code>o=</code> in <command>apt-cache policy</command>.</para></listitem>
</varlistentry>
@@ -233,10 +236,6 @@
if you do not type the <code>~</code>, it would require the package name to contain <code>poptional</code>.</para>
</listitem>
<listitem>
- <para>Grouping patterns with <code>(...)</code> or writing <code>?or(A,B)</code> as <code>A|B</code> are not supported. We
- do not believe that the use of <code>|</code> is that common, and the grouping is not necessary without it.</para>
- </listitem>
- <listitem>
<para>Dependency types for ~D and related operators need to be specified in the canonical case.</para>
</listitem>
</itemizedlist>
diff --git a/test/integration/test-apt-patterns b/test/integration/test-apt-patterns
index 7f202710c..85370aee8 100755
--- a/test/integration/test-apt-patterns
+++ b/test/integration/test-apt-patterns
@@ -192,6 +192,12 @@ conf-only/now 1.0 i386 [residual-config]
foreign/unstable 2.0 amd64" apt list '?not(?installed)'
testsuccessequal "Listing...
+not-obsolete/unstable 2.0 i386 [upgradable from: 1.0]
+N: There is 1 additional version. Please use the '-a' switch to see it" apt list '?installed?exact-name(not-obsolete)?version(2.0)'
+
+testsuccessequal "Listing..." apt list '?narrow(?installed?exact-name(not-obsolete)?version(2.0))'
+
+testsuccessequal "Listing...
automatic1/now 1.0 i386 [installed,local]
automatic2/now 1.0 i386 [installed,local]" apt list '?name(^automatic)'