RFE: include support for partial wildcard to pin packages

Bug #399474 reported by Fr3ddie
46
This bug affects 8 people
Affects Status Importance Assigned to Milestone
apt (Debian)
Fix Released
Unknown
apt (Ubuntu)
Fix Released
Wishlist
Julian Andres Klode

Bug Description

Binary package hint: apt

Hello,
I added this PPA to my sources.list.d to upgrade my OpenSSH version to a newer one:
https://launchpad.net/~rainct/+archive/ppa

I currently use Ubuntu Hardy:
$ lsb_release -rd
Description: Ubuntu 8.04.3 LTS
Release: 8.04
$ apt-cache policy apt
apt:
  Installato: 0.7.9ubuntu17.2
  Candidato: 0.7.9ubuntu17.2
  Tabella versione:
 *** 0.7.9ubuntu17.2 0
        500 http://it.archive.ubuntu.com hardy-updates/main Packages
        500 http://it.archive.ubuntu.com hardy-security/main Packages
        100 /var/lib/dpkg/status
     0.7.9ubuntu17 0
        500 http://it.archive.ubuntu.com hardy/main Packages

So I created an /etc/apt/preferences file with the following content:

{{{
Package: openssh-*
Pin: release o=LP-PPA-rainct
Pin-Priority: 900

Package: ssh*
Pin: release o=LP-PPA-rainct
Pin-Priority: 900

Package: *
Pin: release o=LP-PPA-rainct
Pin-Priority: -10
}}}

to pin only the OpenSSH packages and to exclude all other packages coming from the repository but it doesn't work.
To effectively pin the packages I had to pin every single package name and I think this is not a correct behaviour because of the ability to exclude all other packages by the "*".
Thanks for attention

Revision history for this message
David Fraser (davidf) wrote :

I have the same problem...

Changed in apt (Ubuntu):
status: New → Confirmed
Revision history for this message
Wesley Schwengle (wesleys) wrote :

I have the same problem.

Revision history for this message
Umang Varma (umang) wrote :

Why does this affect only PPAs? Also, how is this different from LP: 270817 ? Unless this is fixed, lp:270817 can't be fixed.

Rolf Leggewie (r0lf)
summary: - Can't pin in APT with "<(partof)packagename>*"
+ RFE: apt pinning supports wildcard or complete package name only
Revision history for this message
Rolf Leggewie (r0lf) wrote : Re: RFE: apt pinning supports wildcard or complete package name only

This is currently working as designed. * works, specifying an explicit package name should work (but is currently broken, see bug 565364). Specifying part of the package name plus a wildcard is currently unsupported. There is an RFE ticket open in Debian for several years, don't hold your breath for a fix: http://bugs.debian.org/121132.

Changed in apt (Ubuntu):
importance: Undecided → Wishlist
summary: - RFE: apt pinning supports wildcard or complete package name only
+ RFE: include support for partial wildcard in apt pinning
summary: - RFE: include support for partial wildcard in apt pinning
+ RFE: include support for partial wildcard to pin packages
Changed in apt (Debian):
status: Unknown → New
Revision history for this message
Julian Andres Klode (juliank) wrote :

Well, the code is already fairly complicated. For those who want something like this and do not use graphical tools, or other tools using APT, cupt should support pinning-by-regex, AFAIK.

Revision history for this message
Julian Andres Klode (juliank) wrote :

The following fix has been committed to the debian-sid branch.
------------------------------------------------------------
revno: 2109
revision-id: <email address hidden>
parent: <email address hidden>
committer: Julian Andres Klode <email address hidden>
branch nick: debian-sid
timestamp: Fri 2011-04-15 12:52:45 +0200
message:
  * apt-pkg/policy.cc:
    - Allow pinning by glob() expressions, and regular expressions
      surrounded by slashes (the "/" character).
diff:
=== modified file 'apt-pkg/policy.cc'
--- apt-pkg/policy.cc 2011-03-08 18:32:35 +0000
+++ apt-pkg/policy.cc 2011-04-15 10:52:45 +0000
@@ -216,6 +216,21 @@
       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);

Changed in apt (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Julian Andres Klode (juliank)
Revision history for this message
Fr3ddie (fr3ddie) wrote :

Thank you very much Julian.
Is this fix scheduled to be backported to some older Ubuntu version (i.e. Lucid LTS) or it will just be inserted into the upcoming release?

Revision history for this message
Wesley Schwengle (wesleys) wrote :

@Julian, thanks for the commit to Debian sid. As I happen to run sid, if you need it tested feel free to contact me.

Revision history for this message
Julian Andres Klode (juliank) wrote :

I'd say it's scheduled for Oneiric, to be released in October; and no backports to older releases will be made available. But I'm not responsible for this.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt - 0.8.14.1ubuntu1

---------------
apt (0.8.14.1ubuntu1) oneiric; urgency=low

  [ Michael Vogt ]
  * merged from the debian-sid bzr branch

  [ Julian Andres Klode ]
  * apt-pkg/depcache.cc:
    - Really release action groups only once (Closes: #622744)
    - Make purge work again for config-files (LP: #244598) (Closes: #150831)
  * debian/apt.cron.daily:
    - Check power after wait, patch by manuel-soto (LP: #705269)
  * debian/control:
    - Move ${shlibs:Depends} to Pre-Depends, as we do not want APT
      unpacked if a library is too old and thus break upgrades
  * doc/apt-key.8.xml:
    - Document apt-key net-update (LP: #192810)

apt (0.8.14.1) unstable; urgency=low

  * apt-pkg/acquire-item.cc:
    - Only try to rename existing Release files (Closes: #622912)

apt (0.8.14) unstable; urgency=low

  [ Julian Andres Klode ]
  * apt-pkg/indexcopy.cc:
    - Use RealFileExists() instead of FileExists(), allows amongst other
      things a directory named Sources to exist on a CD-ROM (LP: #750694).
  * apt-pkg/acquire-item.cc:
    - Use Release files even if they cannot be verified (LP: #704595)
  * cmdline/apt-get.cc:
    - 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) (LP: #399474)
      (Closes: #121132)
  * debian/control:
    - Set Standards-Version to 3.9.2

  [ Michael Vogt ]
  * mirror method:
    - do not crash if the mirror file fails to download
  * apt-pkg/aptconfiguration.cc:
    - fix comparing for a empty string
  * debian/apt.cron.daily:
    - run unattended-upgrades even if there was a error during
      the apt-get update (LP: #676295)

  [ David Kalnischkies ]
  * apt-pkg/pkgcache.cc:
    - use the native Architecture stored in the cache header instead of
      loading it from configuration as suggested by Julian Andres Klode
 -- Michael Vogt <email address hidden> Fri, 29 Apr 2011 17:55:20 +0200

Changed in apt (Ubuntu):
status: In Progress → Fix Released
Changed in apt (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.