#!/usr/bin/python import os import re import struct acdir = "/home/ftp/pub/Linux/PLD/dists/ac/PLD/SRPMS/SRPMS" thdir = "/home/ftp/pub/Linux/PLD/dists/th/PLD/SRPMS/RPMS/" thpkg = [] acpkg = [] ign = '^(xorg-.*|X11-.*|XcursorTheme-.*)$' re_c = re.compile(ign) re_n = re.compile('^(.*)-([^-]*)-([^-]*)$') def getname(file): #f = os.popen('rpm --nomd5 --nodigest --nosignature -qp --queryformat "%{NAME}" ' + file, "r") #name = f.read() #f.close() #f = open(file, 'rb') #rpmlead = f.read(96) #f.close() #data = struct.unpack("6B2h66s2h16s", rpmlead) #name = data[8].strip() #print name m = re_n.match(file) name = m.group(1).strip() return name for rpm in os.listdir(acdir): if re_c.match(rpm): continue acpkg.append(getname(rpm)) for rpm in os.listdir(thdir): if re_c.match(rpm): continue thpkg.append(getname(rpm)) thpkg.sort() acpkg.sort() print "*****************************************************" print "Packages in AC repo that are not in TH repo:" for pkg in acpkg: if pkg not in thpkg: print pkg print print print "*****************************************************" print "Packages in TH repo that are not in AC repo:" for pkg in thpkg: if pkg not in acpkg: print pkg