Package: aptitude
Version: 0.4.11.11-1~lenny1
Severity: normal

Short version:
--------------

  aptitude search '?archive(now)'

matches all packages that are in installed or removed (not purged) states.
Naturally,

  aptitude search '?archive(foobar)'

matches 0 packages and

  aptitude search '?archive(stable)'

matches (most) of the packages on this machine (not backports.org etc).

So it seems that "now" is a special, undocumented value for the archive
match. I can't see that "now" would have any use and (as below) it makes life
a little harder than it should be to do things.


Long version:
-------------

I was trying to be far too clever for my own good with an aptitude search to 
find all packages that don't have a current version in a repository. (Note:
this is a different search to ?obsolete, as packages which have either a
newer or older version in any archive are not considered obsolete, even though
the installed version is not available from any archive. I'd be happy to have
my aptitude-fu improved with suggestions on how else to do this, btw)

I was looking at ?archive() as a search term to spot packages that didn't have
an available archive.

In a squeeze chroot, I installed three packages that are not from testing (one
local package, one package from lenny, one package from sid). The search:

  aptitude search '?narrow(?archive(testing),?version(CURRENT))'

correctly finds the packages that are installed and currently available from
the testing repo and doesn't list the archive-less test packages.

Hoping to be able to match packages with no archive set, I tried ?archive(^$)
to no avail. I don't know if this is just another manifestation of ?archive(now)
or if there's some other regular expression that should be used.

So let's try negating that to find the package versions that have no repo:

  aptitude search '?narrow(?not(?archive(testing)),?version(CURRENT))'

and this correctly lists the three test packages I have in the chroot that are
not from testing (one local package, one package from lenny, one package from 
sid).

Now part of the objective here was to write a recipe that would work across all
releases, rather than having to substitute "testing" in there. This is
particularly relevant for backports.org users as you end up needing:

  aptitude search 
'?narrow(?not(?archive(~(stable~|lenny-backports~))),?version(CURRENT))'

which is starting to look like line noise, and to write an exhaustive list of
archives would be tedious. But all of these archives are just [a-z]+ as a
regular expression, so this should work:

  aptitude search '?narrow(?not(?archive([a-z]+)),?version(CURRENT))'

Except that "now" also matched [a-z]+ so this search doesn't return anything.
Perhaps one could construct various assertions against "now" for ?archive():

  aptitude search '?narrow(?not(?archive("^[^now]{3}.*$")),?version(CURRENT))'

which works, up to the point where it relies on Debian releases never having
names like "bo".

So, working around "now" seems quite difficult; there's probably an easier way
to achieve this target anyway and I'd be happy to hear suggestions.

cheers
Stuart


-- Package-specific info:
aptitude 0.4.11.11 compiled at Dec  5 2008 02:43:34
Compiler: g++ 4.3.2
Compiled against:
  apt version 4.6.0
  NCurses version 5.6
  libsigc++ version: 2.0.18
  Ept support enabled.

Current library versions:
  NCurses version: ncurses 5.7.20081213
  cwidget version: 0.5.12
  Apt version: 4.6.0
        linux-gate.so.1 =>  (0xb7ef3000)
        libapt-pkg-libc6.7-6.so.4.6 => /usr/lib/libapt-pkg-libc6.7-6.so.4.6 
(0xb7e1a000)
        libncursesw.so.5 => /lib/libncursesw.so.5 (0xb7ddc000)
        libsigc-2.0.so.0 => /usr/lib/libsigc-2.0.so.0 (0xb7dd5000)
        libcwidget.so.3 => /usr/lib/libcwidget.so.3 (0xb7d11000)
        libept.so.0 => /usr/lib/libept.so.0 (0xb7c50000)
        libxapian.so.15 => /usr/lib/libxapian.so.15 (0xb7afa000)
        libz.so.1 => /usr/lib/libz.so.1 (0xb7ae5000)
        libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7acc000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb79dd000)
        libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb79b7000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb79aa000)
        libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb784f000)
        libutil.so.1 => /lib/i686/cmov/libutil.so.1 (0xb784b000)
        libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7846000)
        /lib/ld-linux.so.2 (0xb7ef4000)
Terminal: xterm
$DISPLAY is set.
`which aptitude`: /usr/bin/aptitude
aptitude version information:

aptitude linkage:

-- System Information:
Debian Release: 5.0.4
  APT prefers stable
  APT policy: (900, 'stable'), (60, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages aptitude depends on:
ii  apt [libapt-pkg-libc6. 0.7.20.2+lenny1   Advanced front-end for dpkg
ii  libc6                  2.7-18lenny2      GNU C Library: Shared libraries
ii  libcwidget3            0.5.12-4          high-level terminal interface libr
ii  libept0                0.5.22            High-level library for managing De
ii  libgcc1                1:4.3.2-1.1       GCC support library
ii  libncursesw5           5.7+20081213-1    shared libraries for terminal hand
ii  libsigc++-2.0-0c2a     2.0.18-2          type-safe Signal Framework for C++
ii  libstdc++6             4.3.2-1.1         The GNU Standard C++ Library v3
ii  libxapian15            1.0.7-4           Search engine library
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library - runtime

Versions of packages aptitude recommends:
pn  aptitude-doc-en | aptitude-do <none>     (no description available)
ii  libparse-debianchangelog-perl 1.1.1-2    parse Debian changelogs and output

Versions of packages aptitude suggests:
ii  debtags                       1.7.8.1    Enables support for package tags
pn  tasksel                       <none>     (no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to