]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/policy.cc:
authorJulian Andres Klode <jak@debian.org>
Fri, 15 Apr 2011 10:52:45 +0000 (12:52 +0200)
committerJulian Andres Klode <jak@debian.org>
Fri, 15 Apr 2011 10:52:45 +0000 (12:52 +0200)
  - Allow pinning by glob() expressions, and regular expressions
    surrounded by slashes (the "/" character).

apt-pkg/policy.cc
debian/changelog
doc/apt_preferences.5.xml

index 94c7fd4afca7834ec4d43358524caf56eddaa538..3d6ec1cdc4387b9e026c5645569c61d8af0d469d 100644 (file)
@@ -216,6 +216,21 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name,
       P->Data = Data;
       return;
    }
+   
+   // Allow pinning by wildcards
+   // TODO: Maybe we should always prefer specific pins over non-
+   // specific ones.
+   if (Name.find("*") != string::npos || Name.find("[") != string::npos
+       || Name.find("?") != string::npos || Name[0] == '/') {
+         pkgVersionMatch match(Data, Type);
+         for (pkgCache::PkgIterator P = Cache->PkgBegin();
+              P != Cache->PkgEnd(); P++) {
+                 if (match.ExpressionMatches(Name, P.Name())) {
+                       CreatePin(Type, P.Name(), Data, Priority);
+                 }  
+      }
+      return;
+   }
 
    // Get a spot to put the pin
    pkgCache::GrpIterator Grp = Cache->FindGrp(Name);
index 15dd0c6484ab2ccd4f15f9537897a2c91c5ff73e..79bc4dea547d87518f27560cc9a9105b1d8da233 100644 (file)
@@ -1,4 +1,4 @@
-apt (0.8.13.3) UNRELEASED; urgency=low
+apt (0.8.14) UNRELEASED; urgency=low
 
   [ Julian Andres Klode ]
   * apt-pkg/indexcopy.cc:
@@ -10,6 +10,9 @@ apt (0.8.13.3) UNRELEASED; urgency=low
     - Do not install recommends for build-dep (Closes: #454479) (LP: #245273)
   * apt-pkg/deb/deblistparser.cc:
     - Handle no space before "[" in build-dependencies (LP: #72344)
+  * apt-pkg/policy.cc:
+    - Allow pinning by glob() expressions, and regular expressions
+      surrounded by slashes (the "/" character).
   
   [ Michael Vogt ]
   * mirror method:
index 219da7cd1ee2bc8289682655b8d4eb99e8a35b30..55504f3e5e8a9794e99c7d0fb900dd41fabf7411 100644 (file)
@@ -259,6 +259,49 @@ Pin-Priority: 500
 
 </refsect2>
 
+<refsect2><title>Regular expressions and glob() syntax</title>
+<para>
+APT also supports pinning by glob() expressions and regular
+expressions surrounded by /. For example, the following
+example assigns the priority 500 to all packages from
+experimental where the name starts with gnome (as a glob()-like
+expression or contains the word kde (as a POSIX extended regular
+expression surrounded by slashes).
+</para>
+
+<programlisting>
+Package: gnome* /kde/
+Pin: release n=experimental
+Pin-Priority: 500
+</programlisting>
+
+<para>
+The rule for those expressions is that they can occur anywhere
+where a string can occur. Those, the following pin assigns the
+priority 990 to all packages from a release starting with karmic.
+</para>
+
+<programlisting>
+Package: *
+Pin: release n=karmic*
+Pin-Priority: 990
+</programlisting>
+
+If a regular expression occurs in a <literal>Package</literal> field,
+the behavior is the same as if this regular expression were replaced
+with a list of all package names it matches. It is undecided whether
+this will change in the future, thus you should always list wild-card
+pins first, so later specific pins override it.
+
+The pattern "<literal>*</literal>" in a Package field is not considered
+a glob() expression in itself.
+
+</refsect2>
+
+
+
+
+
 <refsect2>
 <title>How APT Interprets Priorities</title>