updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / pactools / pt-pacfix
blobcd128331e0c9f5490dc517e965ddc4b4730d1b66
1 #!/usr/bin/env python
3 # pacfix.py: a script by pierluigi to list all the packages currently installed according to /var/log/pacman.log
4 # 2008-07-04: Modified by Chris Giles to prevent failure when "pacman.log" has lines with only two words
7 pkg=[]
9 logfile = open("/var/log/pacman.log","r")
10 log=logfile.readlines()
11 for myline in log:
12 myarray = myline.strip("\n").split(" ")
13 if len(myarray) >= 3 :
14 if (myarray[2]=="installed" or myarray[2]=="upgraded"):
15 if (pkg.count(myarray[3])==0):
16 pkg.append(myarray[3])
17 if (myarray[2]=="removed"):
18 if (pkg.count(myarray[3])!=0):
19 pkg.remove(myarray[3])
20 pkg.sort()
21 for p in pkg:
22 print(p)