Add Comment

You are not currently logged in. If you do not have a user account then please consider creating one and logging in before you post your comment. This will allow you to track replies to your comment, and take part in the site much more freely.

To add your comment, fill in all the boxes below and then preview it to make sure you're happy with the way that it looks.

This is the comment you were replying to, attached to the article Question: Tracking the installation and removal of packages.:


Re: Question: Tracking the installation and remova
Posted by jcn (195.212.xx.xx) on Fri 10 Jun 2005 at 09:58

This script doesn't answer exactly to the question asked but proved to be useful. It extracts the version and installed time of all the installed packages.

#!/usr/bin/python
# get version and install time of installed packages
# Jean-Marc Chaton
import apt_pkg
import os
import time

apt_pkg.init()
cache = apt_pkg.GetCache()
packages = cache.Packages
for package in packages:
 if package.CurrentState==6:
  installtime=os.path.getmtime("/var/lib/dpkg/info/"+ package.Name + ".list")
  installtimestr=time.strftime("%Y-%m-%d %H:%M",time.localtime(installtime))
  print "%s %35s %s" % (installtimestr, package.Name, package.CurrentVer.VerStr)


Username:Anonymous
Title:
Your Comment:

Posting Format:

 

Inappropriate comments will be removed.

Some help on entry formatting is available

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search