You are not logged in.

#1 2010-02-19 10:37:40

pressh
Developer/TU
From: Netherlands
Registered: 2005-08-14
Posts: 1,719

doing pacman -Qm the hard way :lol:

seems this was all a bit overkill.... 'pacman -Qm' does the same.

either way, for those that are still interested, here you go...

#!/usr/bin/python

from ftplib import FTP
from heapq import merge
import re
import string
import sys
import subprocess

def create_unsupported_list(architecture):
  repos=['core','extra','community','testing']

  ftp = FTP('ftp.archlinux.org')
  ftp.login()

  location=[] # initialize directory list on server
  for repo in repos:
    location.append(repo+'/os/'+architecture)

  filelist=[] # initialize filelist
  for directory in location:
    filelist.append(ftp.nlst(directory))
  [list1,list2,list3,list4]=merge(filelist)
  CompleteList=list(merge(list1,list2,list3,list4))
  string_list=' '.join(CompleteList)

  p = subprocess.Popen('pacman -Q', shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True) 
  (fin, fout) = (p.stdout, p.stdin) 
  result = fin.read()
  Local=string.split(result,'\n')
  LocalPackages=[]
  for entry in Local:
    tmp=re.split(" ", entry)
    LocalPackages.append(tmp[0]+'-')


  Official=[] # initialize lists
  NonOfficial=[]

  for i in LocalPackages:
    if i in string_list:
      Official.append(i)
    else:
      NonOfficial.append(i)

  print "list of non official packages installed:"
  print ""
  for entry in NonOfficial:
    print entry[0:len(entry)-1]
  print ""

if __name__ == '__main__':
  if len(sys.argv) == 2:
    if sys.argv[1] == 'i686':
      architecture='i686'
      create_unsupported_list(architecture)
      sys.exit()
    if sys.argv[1] == 'x86_64':
      architecture='x86_64'
      create_unsupported_list(architecture)
      sys.exit()
    else:
      print ""
      print "Not a valid architecture passed to the program."
      print "Use either i686 or x86_64 as argument to the program."
      print ""
      sys.exit()
  else:
      print ""
      print "Not a valid architecture passed to the program."
      print "Use either i686 or x86_64 as argument to the program."
      print ""
      sys.exit()

Last edited by pressh (2010-02-19 11:16:53)

Offline

#2 2010-02-19 11:02:52

Gigamo
Member
Registered: 2008-01-19
Posts: 394

Re: doing pacman -Qm the hard way :lol:

Isn't that what "pacman -Qm" does? smile

Offline

#3 2010-02-19 11:10:10

pressh
Developer/TU
From: Netherlands
Registered: 2005-08-14
Posts: 1,719

Re: doing pacman -Qm the hard way :lol:

Gigamo wrote:

Isn't that what "pacman -Qm" does? smile

crap... why didn't I know that... big_smile

wasted a good half an hour of my time lol

[edit] changed topic title to reflect my stupidity

Last edited by pressh (2010-02-19 11:11:31)

Offline

#4 2010-02-19 11:14:28

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,405
Website

Re: doing pacman -Qm the hard way :lol:

Nah - it is a combination of "pacman -Qm"  + "paclist <unofficial repo>".

Offline

#5 2010-02-19 11:25:12

sHyLoCk
Member
From: /dev/null
Registered: 2009-06-19
Posts: 1,197

Re: doing pacman -Qm the hard way :lol:

pressh

Saved and using your script, pacman -Qm is bloated. tongue


~ Regards,
sHy
ArchBang: Yet another Distro for Allan to break.
Blog | GIT | Forum (。◕‿◕。)

Offline

Board footer

Powered by FluxBB