rawhide report: 20040217 changes

Bill Nottingham notting at redhat.com
Tue Feb 17 17:55:56 UTC 2004


Gregory Leblanc (gleblanc at linuxweasel.com) said: 
> Hmm, can I get the code that generates this email, somehow?  I'd like to 
> see about writing one that does the formatting a bit nicer.

It's pretty stupid. Attached.

'Package' is an old rpm abstraction... it's really not worth pushing.

Bill
-------------- next part --------------
#!/usr/bin/python

# Generates a changelog between build trees.
#
# Usage: treediff [--html] tree1 tree2

import getopt
import string
import glob
import sys
sys.path.append('/home/devel/notting/prog/prospector')
import os
from stat import *

from Package import Package

args = sys.argv[1:]

if not args or not args[0] or not args[1]:
   print "Usage: treediff tree1 tree2\n"
   sys.exit(-1)
tree1 = args[0]
tree2 = args[1]

new = []
axed = []
changed = []

filelist = os.listdir('%s/SRPMS/' % tree1)
filelist.sort()
for file in filelist:
   if file[-4:] != '.rpm': continue
   p = Package('%s/SRPMS/%s' % (tree1,file))
   # is same version in old tree?
   try:
      oldname = '%s/SRPMS/%s' % (tree2, file)
      foo=open(oldname,'r')
      foo.close()
   except:
      oldversion = glob.glob('%s/SRPMS/%s*' % (tree2, p.getName()) )
      if not oldversion:
	 new.append('New package %s\n\t%s\n' % (p.getName(),p.getSummary()))
      else:
	 oldp = Package(oldversion[0])
	 newCL = string.split(p.getChangeLog(3),'\n')
	 oldCL = string.split(oldp.getChangeLog(3),'\n')
	 clist = []
	 if newCL and oldCL:
	    while (newCL[0] != oldCL[0]):
	       clist.append(newCL[0])
	       newCL=newCL[1:]
	       if not newCL:
		  break
	 elif newCL:
	    clist = newCL
         nvr = "%s-%s-%s" % (p.getName(), p.getVersion(), p.getRelease())
	 hashes = "-" * len(nvr)
	 changed.append("%s\n%s\n%s" % (nvr,hashes,string.join(clist,'\n')))

for file in os.listdir('%s/SRPMS/' % tree2):
   if file[-4:] != '.rpm': continue
   p = Package('%s/SRPMS/%s' % (tree2, file))
   if not glob.glob('%s/SRPMS/%s*' % (tree1, p.getName())):
      axed.append('Removed package %s\n' % p.getName());

print string.join(new,'\n'),'\n\n',string.join(axed,'\n'),'\nUpdated Packages:\n\n',string.join(changed,'\n')


More information about the devel mailing list