Your message dated Sat, 11 Feb 2012 18:29:00 +0800
with message-id 
<can3verfzq+6ifbc-pvkh+csrujts7v9rs_zjc1mnkht5b6g...@mail.gmail.com>
and subject line Bug#340444: aptitude: "midclean" already possible
has caused the Debian Bug report #340444,
regarding aptitude: midclean required -- somewhere between autoclean and clean
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
340444: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=340444
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: aptitude
Version: 0.4.0-3
Severity: wishlist
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

For keeping /var/cache/apt/archives sweetly small, I would like
to have a command to keep all package files for packages which
are installed and remove everything else. autoclean does too
little for me (leaving package files which are not installed) and
obviously clean does too much (I am quite often on dial-up so
I would love to have my package files for additional security).
Just to explain better what I mean I hacked together simple (and
dirty) script in Python to illustrate it. See attached.

Thanks,

Matej

- -- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (600, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13.3
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)

Versions of packages aptitude depends on:
ii  apt [libapt-pkg-libc6.3-6-3.1 0.6.42.3   Advanced front-end for dpkg
ii  libc6                         2.3.5-8    GNU C Library: Shared libraries an
ii  libgcc1                       1:4.0.2-4  GCC support library
ii  libncursesw5                  5.5-1      Shared libraries for terminal hand
ii  libsigc++-2.0-0c2             2.0.16-1   type-safe Signal Framework for C++
ii  libstdc++6                    4.0.2-4    The GNU Standard C++ Library v3

Versions of packages aptitude recommends:
ii  aptitude-doc-cs [aptitude-doc 0.4.0-3    Czech manual for aptitude, a termi

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDhHor4J/vJdlkhKwRAp29AJ4/r/d6KWNOvRHjsbObRHvViPxi2QCfePFQ
lNAUpFAtiM4+osJkt8qYVkQ=
=ae8I
-----END PGP SIGNATURE-----
#!/usr/bin/python
"""Program to clean /var/cache/apt/archives folder from files for packages
which are not installed. It doesn't take any arguments.
USE AT YOUR OWN RISK, THIS MAY HURT YOU!!!"""
# $Id: midclean.py,v 1.2 2005-11-23 06:00:36 matej Exp $
import os,re,sys

currentlyInstalledRaw = os.popen("aptitude search -F '%p %V' '~i'",
    "r").readlines()
currentlyInstalled = [line.split() for line in currentlyInstalledRaw]
# currentlyInstalled is list of lists looking like this:
# [...,['zoem', '05-154-1']]
currNames = tuple([x[0] for x in currentlyInstalled])
currVersions = tuple([x[1] for x in currentlyInstalled])
currDir = os.getcwd()
os.chdir("/var/cache/apt/archives/")
packagesStoredNamesRaw = os.popen("ls *.deb").readlines()
packagesStoredNames = [[line.strip().split("_",2)[:2],line.strip()] \
    for line in packagesStoredNamesRaw]
# packagesStoredNames is again list of lists looking like this:
# [...,[['zoem', '05-154-1'], 'zoem_05-154-1_i386.deb']]
for item in packagesStoredNames:
    if not(item[0][0] in currNames) and not(item[0][1] in currVersions):
        print "Removing %s." % item[1]
        os.remove(item[1])

--- End Message ---
--- Begin Message ---
As mentioned in a previous message, this is already possible.

Vasilis Vasaitis <[email protected]> wrote:
>   This can be achieved by adding the following line to
> /etc/apt/apt.conf:
>
>         APT::Clean-Installed "false";
>
>   Then "aptitude autoclean" does what the person that reported the bug
> is asking for.

Otherwise, if you only want this behaviour occasionally:

# aptitude -o APT::Clean-Installed=false autoclean


--- End Message ---
_______________________________________________
Aptitude-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/aptitude-devel

Reply via email to