[gs-cvs] rev 7830 - / tools tools/build tools/python tools/regression tools/search tools/testfiles

thomasd at ghostscript.com thomasd at ghostscript.com
Fri Apr 6 13:47:15 PDT 2007


Author: thomasd
Date: 2007-04-06 13:47:10 -0700 (Fri, 06 Apr 2007)
New Revision: 7830

Added:
   tools/
   tools/build/
   tools/build/all.py
   tools/build/analyze_baseline.py
   tools/build/build_baseline_dict.py
   tools/build/build_testfile_dict.py
   tools/build/check_many.py
   tools/build/compare.py
   tools/build/compare_nocleanup.py
   tools/build/comparelist.py
   tools/build/convert_pdf.py
   tools/build/convertlist.py
   tools/build/dump_dict.py
   tools/build/dump_revisions_dict.py
   tools/build/extract_compare.py
   tools/build/fetch.py
   tools/build/fetch_one.py
   tools/build/fetchlist.py
   tools/build/find_transisitions.py
   tools/build/fix_daily.py
   tools/build/fix_product.py
   tools/build/general.py
   tools/build/get_revision_for_testfile.py
   tools/build/link.py
   tools/build/link_many.py
   tools/build/link_one.py
   tools/build/lookup_dict.py
   tools/build/make.py
   tools/build/make_many.py
   tools/build/opt.py
   tools/build/put_file_status.py
   tools/build/run.py
   tools/build/run_cleanup.py
   tools/build/run_nocleanup.py
   tools/build/runlist.py
   tools/build/search.py
   tools/build/searchall.py
   tools/build/searchlist.py
   tools/build/searchlist_nocleanup.py
   tools/build/svn-get-log.py
   tools/build/svn-summary.py
   tools/build/svn-update.py
   tools/build/syssupport.py
   tools/build/testdate.py
   tools/build/testpath.py
   tools/build/try.py
   tools/compare/
   tools/python/
   tools/python/main.py
   tools/python/myoptparse.py
   tools/regression/
   tools/regression/check_all.py
   tools/regression/check_comments.py
   tools/regression/check_dirs.py
   tools/regression/check_docrefs.py
   tools/regression/check_source.py
   tools/regression/collate.py
   tools/regression/compare_checksums.py
   tools/regression/dump_checksum.py
   tools/regression/dump_checksum_plus.py
   tools/regression/find_unique_file.py
   tools/regression/get_baseline_log.py
   tools/regression/get_baselines.py
   tools/regression/gscheck_all.py
   tools/regression/gscheck_fuzzypdf.py
   tools/regression/gscheck_pdfwrite.py
   tools/regression/gscheck_raster.py
   tools/regression/gsconf.py
   tools/regression/gsparamsets.py
   tools/regression/gssum.py
   tools/regression/gstestgs.py
   tools/regression/gstestutils.py
   tools/regression/gsutil.py
   tools/regression/gsvalidate.py
   tools/regression/make_baselinedb.py
   tools/regression/python.py
   tools/regression/rasterdb.py
   tools/regression/regen_baseline.py
   tools/regression/repair_baseline.py
   tools/regression/run_nightly.py
   tools/regression/run_regression.py
   tools/regression/test.py
   tools/regression/test_nightly.py
   tools/regression/testdiff.py
   tools/regression/testexec.py
   tools/regression/testing.cfg
   tools/regression/testing.cfg.peeves
   tools/regression/testmatch.py
   tools/regression/time_exec.py
   tools/regression/update_baseline.py
   tools/regression/updatelist.py
   tools/search/
   tools/search/check_many.py
   tools/search/compare.py
   tools/search/compare_two.py
   tools/search/comparelist.py
   tools/search/comparelist_two.py
   tools/search/comparepdflist.py
   tools/search/convert_pdf.py
   tools/search/convertlist.py
   tools/search/extract_compare.py
   tools/search/fetch.py
   tools/search/fetchlist.py
   tools/search/filter.py
   tools/search/find_transisitions.py
   tools/search/fix_product.py
   tools/search/general.py
   tools/search/link.py
   tools/search/link_many.py
   tools/search/list.py
   tools/search/make.py
   tools/search/make_many.py
   tools/search/opt.py
   tools/search/put_file_status.py
   tools/search/run.py
   tools/search/run_cleanup.py
   tools/search/run_test.py
   tools/search/runlist.py
   tools/search/runplp.py
   tools/search/search.py
   tools/search/searchlist.py
   tools/search/svn_support.py
   tools/search/test.py
   tools/search/try.py
   tools/search/updatelist.py
   tools/search/updatelistpdf.py
   tools/testfiles/
   tools/testfiles/analyze_baseline.py
   tools/testfiles/analyze_baseline_history.py
   tools/testfiles/baseline_filter.py
   tools/testfiles/build_testfile_dict.py
   tools/testfiles/dump_dict.py
   tools/testfiles/dump_revisions_dict.py
   tools/testfiles/get_raster_times.py
   tools/testfiles/get_revision_for_testfile.py
   tools/testfiles/lookup_dict.py
   tools/testfiles/svn-summary.py
Log:
Put many new tools for testing and analysis to svn control.


Added: tools/build/all.py
===================================================================
--- tools/build/all.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/all.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,287 @@
+#!/usr/bin/python
+# -* Mode: python -*-
+#
+# USAGE: all.py [reportfilename [reportfilename1 ...]
+# prepare a summary of difference failures and segmentation faults
+# write summary of all dates to stdout
+#
+# read regression.log
+# write a file reportfilename.day.month.year for each date
+#
+
+import sys, datetime, re
+from types import *
+
+today="unknown"
+
+myname="all.py "
+
+monthmap={'Jan':1,'Feb':2,'Mar':3,'Apr':4,'May':5,'Jun':6,'Jul':7,'Aug':8,'Sep':9,'Oct':10,'Nov':11,'Dec':12}
+newCount=0
+newPDFCount=0
+diffCount=0
+faultCount=0
+
+def appendtofile(datefile,string):
+	if datefile != NoneType:
+		datefile.write(string+"\n")				
+
+def two_columns(one,two,file):
+	align=" "
+	align_at=50 #spaces-1.  always at least one space
+	onelen=len(one)
+	while onelen < align_at:
+		align=align+" "
+		onelen=onelen+1
+	testline = one + align + two
+	appendtofile(file,testline)		
+	print testline
+
+def finddate(line,previous):
+	dateline=0
+	leadstring="SVN checkout for this report started at "
+	if line.startswith(leadstring):
+		reportlead="checkout"
+		line = line.replace(leadstring,"")
+		dateline=1
+	leadstring="From gs-regression at ghostscript.com"
+	if line.startswith(leadstring):
+		reportlead="gs-regression"
+		line = line.replace(leadstring,"")
+		dateline=1
+	leadstring="From regression at rain.thaumas.net"
+	if line.startswith(leadstring):
+		reportlead="thaumas"
+		line = line.replace(leadstring,"")
+		dateline=1
+
+	if dateline:
+		line = line.split()
+		dayofweek,day,monthname,year=line[0:4]
+		daystring = day
+		if len(day) == 1:
+			daystring = "0" + day
+		else:
+			daystring = day
+		try:
+			month = str(monthmap[monthname])
+		except KeyError:
+			print "Key Error" + monthname
+			sys.exit(1)
+			print abort-now
+		if len(month) == 1:
+			monthstring = "0" + month
+		else:
+			monthstring = month
+		datestring = year + "." + monthstring + "." + daystring
+		print ""
+		print datestring + " " + reportlead
+		return datestring
+	return previous
+
+def findrevision(line,previous):
+	leadstring="Testing"
+	if line.startswith(leadstring):
+		line = line.split()
+		revision=line[2]
+		revisionline = revision + "\t\t<revision>"
+		return revision
+	return previous
+
+################ changes since yesterday
+def startNewChanges(line,changes,datefile):
+	if not changes:
+		cmatch=re.compile(".*regression changes")
+		if cmatch.match(line):
+			print "changes"
+			appendtofile(datefile,"changes")
+			return 1
+	return changes
+
+def finishNewChanges(datefile,historyfile):
+	global newCount,newPDFCount,diffCount,faultCount
+	print "changes end"
+	print "\tnew "+str(newCount)
+	print "\tnew PDF "+str(newPDFCount)
+	appendtofile(datefile,"\tnew "+str(newCount))
+	appendtofile(datefile,"\tnew PDF "+str(newPDFCount))
+
+def findComplete(line,complete,datefile):
+	if not complete:
+		cmatch=re.compile(".*complete list")
+		if cmatch.match(line):
+			appendtofile(datefile,"complete list")
+			return 1
+	return complete
+
+def findNormal(line,previous,revision,datefile):
+# ignore lines with pdfwrite errors
+	global newCount,newPDFCount,diffCount,faultCount
+	linelist = line.split()
+	if linelist[0] == "pdfwrite":
+		newPDFCount+=1
+	if linelist[0] == "normal":
+		testfile=""
+		for token in linelist:
+			if token == "normal":
+				discard=1
+			elif token[0] == "\(":
+				print ">>> " + token
+				break
+			else:
+				if len(testfile) > 0:
+					pad=" "
+				else:
+					pad=""
+					testfile = testfile + pad + token
+		if testfile != previous:
+			newCount+=1
+			two_columns(testfile,revision+"\tnew difference",datefile)
+			return testfile
+	return previous
+
+##################### all differences
+def findDIFFER(line,previous,revision,changes,complete,datefile):
+	global newCount,newPDFCount,diffCount,faultCount
+	discardReference=re.compile(".*must reference all relevant files")
+	if discardReference.match(line):
+		return ""
+	discardRelevant=re.compile("All relevant files must have")
+	if discardRelevant.match(line):
+		return ""
+
+	DIFFER=re.compile(".*DIFFER")
+	ERROR=re.compile(".*ERROR")
+	if DIFFER.match(line) or ERROR.match(line):
+		linelist = line.split()
+		testfile=""
+		if linelist[0] == "Checking":
+			for token in linelist:
+				if token == "Checking":
+					testfile=""
+				elif token[0] == "(":
+					break
+				else:
+					if len(testfile) > 0:
+						pad=" "
+					else:
+						pad=""
+					testfile = testfile + pad + token
+		if testfile != previous and changes:
+			diffCount+=1
+			two_columns(testfile,revision,datefile)
+			return testfile
+	return previous
+
+def finishDIFFER(datefile):
+	print "finish Complete all differences "+str(diffCount)
+
+##################### faults
+def findSegfault(line,previous,revision,changes,complete,datefile):
+	global newCount,newPDFCount,diffCount,faultCount
+	differ=re.compile(".*Segmentation fault")
+	if differ.match(line):
+		line=line.split()
+		location=line[2]
+		location=location.replace("."," ")
+		location=location.split()
+		try:
+			location,extension=location[0:2]
+			location = location + "." + extension
+			if location != previous:
+				locationline = location + "\t<segmentation fault>" + "\t\t" + revision
+				print "\t" + locationline
+				locationline = location + "\t<segmentation fault>"+ "\t\t" + revision
+				appendtofile(datefile,locationline)
+				faultCount+=1
+				return location
+		except ValueError: # parsing failed
+				location = location[0]
+				print "\t" + location + "\t<segmentation fault>"
+				return previous		
+	return previous
+
+def finishSegfault(datefile):
+	global newCount,newPDFCount,diffCount,faultCount
+	print "finish Seg faults "+str(faultCount)
+
+######################################## read the file
+def linesall(filed,filename,historyfile):
+	global newCount,newPDFCount,diffCount,faultCount
+	global today
+	date=""
+	revision=""
+	daterevision=""
+	previousdaterevision=""
+	normal=""
+	difference=""
+	location=""
+	datefile=NoneType
+	changes=0
+	complete=0
+
+	newCount=0
+	newPDFCount=0
+	diffCount=0
+	faultCount=0
+
+	alllines = filed.readlines()
+	for line in alllines:
+		line = line.strip("\n")
+		if line != "":
+			date = finddate(line,date)
+			revision = findrevision(line,revision)
+			if date != "" and revision != "":
+				daterevision = date + "." + revision
+				if daterevision != previousdaterevision:
+					print daterevision
+					previousdaterevision = daterevision
+					if datefile != NoneType:
+						datefile.close
+					datefilename = date + "." + revision + "." + "regression" #filename?
+					try:
+						print "datefile " + filename
+						datefile=open(datefilename,"w")
+						sortleader = "> test summary   "
+						appendtofile(datefile,today)
+						appendtofile(datefile,sortleader + filename + "   " + date + "   " + revision + "   " + datefilename)
+						appendtofile(historyfile,today)
+						appendtofile(historyfile,date + " " + revision)
+					except IOError:
+						print myname + "cannot open date file " + datefilename
+
+			if revision != "":
+				changesOld=changes
+				changes=startNewChanges(line,changes,datefile)
+				completeOld=complete
+				complete=findComplete(line,complete,datefile)
+				if changes and not complete:
+					normal=findNormal(line,normal,revision,datefile)
+				if changes and complete and not completeOld: # we just went to the complete list
+					finishNewChanges(datefile,historyfile)
+				if complete:
+					difference = findDIFFER(line,difference,revision,changes,complete,datefile)
+					location = findSegfault(line,location,revision,changes,complete,datefile)
+	finishDIFFER(datefile)
+	finishSegfault(datefile)
+
+def readall(filename,historyfile):
+	try:
+		filed = open(filename,'r')
+		print filename
+		linesall(filed,filename,historyfile)
+		filed.close()	
+	except IOError:
+		print myname + "cannot open " + filename
+
+today=str(datetime.date.today())
+print today
+
+filenames = sys.argv[1:]
+historyfilename="regression.history"
+historyfile=open(historyfilename,"w")
+for arg in filenames:
+	filenamearg = arg
+	readall(filenamearg,historyfile)
+	print " "
+historyfile.close()


Property changes on: tools/build/all.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/analyze_baseline.py
===================================================================
--- tools/build/analyze_baseline.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/analyze_baseline.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,88 @@
+#!/usr/bin/python
+
+import sys, pickle, datetime
+
+
+monthsize={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}
+
+# map a number string to a two-digit number string
+remap={
+	 '1':'01', '2':'02', '3':'03', '4':'04', '5':'05', '6':'06', '7':'07', '8':'08', '9':'09','10':'10',
+	'11':'11','12':'12','13':'13','14':'14','15':'15','16':'16','17':'17','18':'18','19':'19','20':'20',
+	'21':'21','22':'22','23':'23','24':'24','25':'25','26':'26','27':'27','28':'28','29':'29','30':'30',
+	'31':'31'
+	 }
+
+def find_revision(date,dates_dict):  # find a revision in the dictionary, decrement date until found, try for 10 decrements
+	count=10
+	while count > 0:
+		try:
+			revisionlist=dates_dict[date]
+			break
+		except:
+			count-=1
+			# decrement date by one day
+			datesep=date.replace("-"," ")
+			datelist=datesep.split()
+			year,month,day=datelist
+			if (day > 1):
+				day=int(day)
+				day-=1
+				day=remap[str(day)]
+			elif month > 1:
+				month=int(month)
+				month-=1
+				day=str(monthsize[month])
+				month=remap[str(month)]
+			else:
+				year-=1
+				month=12
+				day=str(monthsize[month])
+			date=year+'-'+month+'-'+day
+
+	return date
+	
+
+args=sys.argv[:]
+myself=args.pop(0)
+
+dates_filename="dates.dict"
+dates_file=open(dates_filename,'r')
+dates_dict=pickle.loads(pickle.load(dates_file))
+dates_file.close()
+
+testfiles_filename="testfiles.dict"
+testfiles_file=open(testfiles_filename,'r')
+testfiles_dict=pickle.loads(pickle.load(testfiles_file))
+testfiles_file.close()
+
+testfiles=testfiles_dict.keys()
+testfiles.sort()
+
+testfile_revision_filename="testfile_revisions.dict"
+
+print myself,"analyzing testfile dictionary",testfiles_filename,"to find matching revisions in",dates_filename
+print myself,"producing dictionary testfile:revision in",testfile_revision_filename
+
+testfile_dict={}
+
+for testfile in testfiles:
+	# get the date of the testfile
+	date,testfile,pdfwrite,revision_maybe=testfiles_dict[testfile]
+	# attempt to get the revision corresponding to the date
+	date=find_revision(date,dates_dict)
+	try:
+		revisionlist=dates_dict[date]
+		revision,person=revisionlist[0:2]
+		testfile_dict[testfile]=revision
+	except KeyError:
+		revision="no revision"
+		person=""
+
+	print "%35s  %12s  %20s %20s" % (testfile,revision,date,person)
+
+testfile_file=open(testfile_revision_filename,'w')
+pickle.dump(pickle.dumps(testfile_dict),testfile_file)
+testfile_file.close()
+
+sys.exit(0)


Property changes on: tools/build/analyze_baseline.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/build_baseline_dict.py
===================================================================
--- tools/build/build_baseline_dict.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/build_baseline_dict.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+
+# build_baseline_dict.py filename
+
+import os, sys, re, pickle
+
+def parse_revision(line):
+	line = line.split()
+	revision,discard0,name,discard1,date,time,offset,ld1,ld2,ld3,ld4,discard3,count,line_count=line
+	return [revision,name,date,time]
+
+def build_dict(filename):
+	monthmap={
+		'Jan':'01','Feb':'02','Mar':'03','Apr':'04','May':'05','Jun':'06',
+		'Jul':'07','Aug':'08','Sep':'09','Oct':'10','Nov':'11','Dec':'12'}
+	daymap={
+		 '1':'01', '2':'02', '3':'03', '4':'04', '5':'05', '6':'06', '7':'07', '8':'08', '9':'09','10':'10',
+		'11':'11','12':'12','13':'13','14':'14','15':'15','16':'16','17':'17','18':'18','19':'19','20':'20',
+		'21':'21','22':'22','23':'23','24':'24','25':'25','26':'26','27':'27','28':'28','29':'29','30':'30',
+		'31':'31'
+		}
+	f=open(filename,'r')
+	all_lines = f.readlines()
+	date_dict={}
+	testfile_dict={}
+	for line in all_lines:
+		line=line.strip('\n')
+		line = line.split()
+		if len(line) == 0:
+			discard=1
+		elif len(line) == 7:
+			day_of_week,month,day,time,year,testfile,discard1=line[:]
+			pdfwrite=0
+			revision=""
+		elif len(line) == 8:
+			day_of_week,monthname,day,time,year,testfile,discard1,pdfwrite=line[:]
+			revision=""
+			pdfwrite=1
+		elif len(line) == 9:
+			day_of_week,monthname,day,time,year,testfile,discard1,pdfwrite,revision=line[:]
+			pdfwrite=1
+		else:
+			print line
+		
+# convert date to nnnn-nn-nn
+
+		testfile=testfile.replace("../comparefiles/","")
+
+
+		monthnumber=monthmap[monthname]
+		daynumber=daymap[day]
+		date=year+"-"+monthnumber+"-"+daynumber
+		date_dict[date]=(date,testfile,pdfwrite,revision)
+		testfile_dict[testfile]=(date,testfile,pdfwrite,revision)
+
+	f.close
+
+	testfile_file=open("testfiles.dict",'w')
+	pickle.dump(pickle.dumps(testfile_dict),testfile_file)
+	testfile_file.close()
+	
+	date_file=open("dates_of_testfiles.dict",'w')
+	pickle.dump(pickle.dumps(date_dict),date_file)
+	date_file.close()
+	
+	return 0
+
+args=sys.argv[:]
+
+myself=args.pop(0)
+if len(args) == 0:
+	print "USAGE: "+myself+" filename"
+	sys.exit(1)
+
+filename=args.pop(0)
+
+result=build_dict(filename)
+sys.exit(result)


Property changes on: tools/build/build_baseline_dict.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/build_testfile_dict.py
===================================================================
--- tools/build/build_testfile_dict.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/build_testfile_dict.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,71 @@
+#!/usr/bin/python
+
+import os, sys, re, pickle
+
+def parse_revision(line):
+	line = line.split()
+	revision,discard0,name,discard1,date,time,offset,ld1,ld2,ld3,ld4,discard3,count,line_count=line
+	return [revision,name,date,time]
+
+def build_dict(filename):
+	monthmap={
+		'Jan':'01','Feb':'02','Mar':'03','Apr':'04','May':'05','Jun':'06',
+		'Jul':'07','Aug':'08','Sep':'09','Oct':'10','Nov':'11','Dec':'12'}
+	daymap={
+		 '1':'01', '2':'02', '3':'03', '4':'04', '5':'05', '6':'06', '7':'07', '8':'08', '9':'09','10':'10',
+		'11':'11','12':'12','13':'13','14':'14','15':'15','16':'16','17':'17','18':'18','19':'19','20':'20',
+		'21':'21','22':'22','23':'23','24':'24','25':'25','26':'26','27':'27','28':'28','29':'29','30':'30',
+		'31':'31'
+		}
+	f=open(filename,'r')
+	all_lines = f.readlines()
+	testfile_dict={}
+	for line in all_lines:
+		line=line.strip('\n')
+		line = line.split()
+		if len(line) == 0:
+			discard=1
+		elif len(line) == 7:
+			day_of_week,month,day,time,year,testfile,discard1=line[:]
+			pdfwrite=0
+			revision=""
+		elif len(line) == 8:
+			day_of_week,monthname,day,time,year,testfile,discard1,pdfwrite=line[:]
+			revision=""
+			pdfwrite=1
+		elif len(line) == 9:
+			day_of_week,monthname,day,time,year,testfile,discard1,pdfwrite,revision=line[:]
+			pdfwrite=1
+		else:
+			print "incomprehensible line discarded",line
+		
+# convert date to nnnn-nn-nn
+
+		testfile=testfile.replace("../comparefiles/","")
+
+
+		monthnumber=monthmap[monthname]
+		daynumber=daymap[day]
+		date=year+"-"+monthnumber+"-"+daynumber
+		testfile_dict[testfile]=(date,testfile,pdfwrite,revision)
+
+	f.close
+
+	testfile_file=open("testfiles.dict",'w')
+	pickle.dump(pickle.dumps(testfile_dict),testfile_file)
+	testfile_file.close()
+	
+	return 0
+
+args=sys.argv[:]
+
+myself=args.pop(0)
+if len(args) == 0:
+	print "USAGE: "+myself+" filename"
+	sys.exit(1)
+
+filename=args.pop(0)
+
+print myself,filename,"build testfiles.dict"
+result=build_dict(filename)
+sys.exit(result)


Property changes on: tools/build/build_testfile_dict.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/check_many.py
===================================================================
--- tools/build/check_many.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/check_many.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+import sys, os
+
+args=sys.argv
+myself=args.pop(0)
+
+if len(args) < 2:
+	print "USAGE: "+myself+" low-version high-version"
+	print "check all versions for product name from low to high"
+	sys.exit(1)
+
+low,high=args[:]
+
+print low, high
+for revision in range(int(low),int(high)+1):
+	command="gs."+str(revision)+"/bin/gs -q -dBATCH -sDEVICE=nullpage -sOutputFile=/dev/null get.ps"
+	os.system(command)
+	print " " +str(revision)
+
+sys.exit(0)


Property changes on: tools/build/check_many.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/compare.py
===================================================================
--- tools/build/compare.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/compare.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,151 @@
+#!/usr/bin/python
+#
+# general compare script
+# USAGE: compare compare revision testfile
+#
+myname="compare.py"
+
+import sys, os
+
+def exitReturn(value,message):
+	print myname+": ""exit error " + str(value) + " " + message
+	sys.exit(value)
+
+def testResult(command,window,result,testfile,revision):
+	print command,window,result,testfile,revision
+	if result == 0:
+		match="match"
+	else:
+		match="no match"
+	print testfile,"***",revision,window,match
+
+#####################################################################
+
+if __name__ == '__main__':
+
+	import optparse
+
+	args=sys.argv
+	myself=args[0]
+	
+	p=optparse.OptionParser()
+	p.add_option('--verbose','-v',action='store_true')
+	p.add_option('--nocleanup','-k',action='store_true')
+	p.add_option('--nosvn','-u',action='store_true')
+	options,arguments=p.parse_args()
+	options.myself=myself
+
+	print arguments
+	if len(arguments) == 0:
+		print 'USAGE: '+str(myself)+' testfile revision [device [resolution [banding [compare:baseline]]]]'
+		sys.exit(1)
+
+	if len(arguments) > 0:
+		testfile=arguments.pop(0)
+	else:
+		testfile="testfile"
+
+	if len(arguments) > 0:
+		revision=arguments.pop(0)
+	else:
+		revision="HEAD"
+
+	if len(arguments) > 0:
+		device=arguments.pop(0)
+	else:
+		device="ppmraw"
+
+	if len(arguments) > 0:
+		resolution=arguments.pop(0)
+	else:
+		resolution="300"
+
+	if len(arguments) > 0:
+		banding=arguments.pop(0)
+	else:
+		banding="0"
+
+	if len(arguments) > 0:
+		compare=arguments.pop(0)
+	else:
+		compare="baseline"
+
+	print myself,testfile,revision,device,resolution,banding
+
+	filesuffix='.'+device+'.'+resolution+'.'+banding+'.pnm'
+
+	if compare == "baseline":
+		revision_infix=''
+	else:
+		revision_infix='.'+compare
+		
+	compare_outputname=testfile+revision_infix+filesuffix
+	compare_outputnamepath="pnm/"+compare_outputname
+	if not os.path.exists(compare_outputnamepath):
+		print "cannot find compare output: "+compare_outputnamepath
+		sys.exit(2)
+	
+	revision_infix='.'+revision
+	revision_outputname=testfile+revision_infix+filesuffix
+	revision_outputnamepath="pnm/"+revision_outputname
+	if not os.path.exists(revision_outputnamepath):
+		print "cannot find revision output: "+revision_outputnamepath
+		sys.exit(2)
+	
+	diffname=testfile+'.diff'+filesuffix
+	diffnamepath="pnm/"+diffname
+	diffnamepath="\""+diffnamepath+"\""
+	
+	#command="sum "+revision_outputnamepath
+	#print myname+": "+command
+	#result=os.system(command)
+	
+	command="cmp "+compare_outputnamepath+" "+revision_outputnamepath
+	print myname+": "+command
+	result=os.system(command)
+	if result > 0:
+		print testfile,"*** cmp baseline no match"
+	testResult(command,"",result,testfile,revision)
+	
+	command="compare "+compare_outputnamepath+" "+revision_outputnamepath+" "+diffnamepath+" >/dev/null"
+	print myname+": "+command
+	result=os.system(command)
+	
+	window="-w1"
+	command="./fuzzy -w1 "+compare_outputnamepath+" "+revision_outputnamepath
+	print myname+": "+command
+	result=os.system(command)
+	testResult(command,window,result,testfile,revision)
+	final=result
+	
+	window="-w3"
+	command="./fuzzy -w3 "+compare_outputnamepath+" "+revision_outputnamepath
+	print myname+": "+command
+	result=os.system(command)
+	testResult(command,window,result,testfile,revision)
+	result=testResult
+	
+	window="-w5"
+	command="./fuzzy -w5 "+compare_outputnamepath+" "+revision_outputnamepath
+	print myname+": "+command
+	result=os.system(command)
+	testResult(command,window,result,testfile,revision)
+	
+	#command="rm "+revision_outputnamepath
+	#os.system(command)
+	
+	# do not do this work, but print a line that is useful to run interactively
+	print "gimp-remote "+diffnamepath
+	
+	command="cmpi -w0 "+compare_outputnamepath+" "+revision_outputnamepath
+	print command
+	command="cmpi -w1 "+compare_outputnamepath+" "+revision_outputnamepath
+	print command
+	command="cmpi -w2 "+compare_outputnamepath+" "+revision_outputnamepath
+	print command
+	
+	if final > 1:
+		final=1
+	
+	print myname,"final:",final
+	sys.exit(final)


Property changes on: tools/build/compare.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/compare_nocleanup.py
===================================================================
--- tools/build/compare_nocleanup.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/compare_nocleanup.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,95 @@
+#!/usr/bin/python
+#
+# general compare script
+# USAGE: compare compare revision testfile
+#
+myname="compare.py"
+
+import sys
+import os
+
+def exitReturn(value,message):
+	print myname+": ""exit error " + str(value) + " " + message
+	sys.exit(value)
+
+def testResult(command,window,result,testfile,revision):
+	print command,window,result,testfile,revision
+	if result == 0:
+		match="match"
+	else:
+		match="no match"
+	print testfile,"***",revision,window,match
+
+#####################################################################
+
+if len(sys.argv) != 4:
+	print "USAGE: compare.py compare revision testfile"
+	sys.exit(2)
+
+myself,compare,revision,testfile = sys.argv[0:]
+
+filesuffix='.ppmraw.300.0.pnm'
+
+compare_outputname=testfile+filesuffix
+compare_outputnamepath="pnm/"+compare_outputname
+if not os.path.exists(compare_outputnamepath):
+	print "cannot find compare output: "+compare_outputnamepath
+	sys.exit(2)
+compare_outputnamepath='\"'+compare_outputnamepath+'\"'
+
+revision_outputname=testfile+'.'+revision+filesuffix
+revision_outputnamepath="pnm2/"+revision_outputname
+if not os.path.exists(revision_outputnamepath):
+	print "cannot find revision output: "+revision_outputnamepath
+	sys.exit(2)
+revision_outputnamepath='\"'+revision_outputnamepath+'\"'
+
+diffname=testfile+'.diff'+filesuffix
+diffnamepath="pnm2/"+diffname
+diffnamepath="\""+diffnamepath+"\""
+
+#command="sum "+revision_outputnamepath
+#print myname+": "+command
+#result=os.system(command)
+
+command="compare "+compare_outputnamepath+" "+revision_outputnamepath+" "+diffnamepath+" >/dev/null"
+print myname+": "+command
+result=os.system(command)
+
+window="-w1"
+command="./fuzzy -w1 "+compare_outputnamepath+" "+revision_outputnamepath
+print myname+": "+command
+result=os.system(command)
+testResult(command,window,result,testfile,revision)
+
+window="-w3"
+command="./fuzzy -w3 "+compare_outputnamepath+" "+revision_outputnamepath
+print myname+": "+command
+result=os.system(command)
+testResult(command,window,result,testfile,revision)
+result=testResult
+
+window="-w5"
+command="./fuzzy -w5 "+compare_outputnamepath+" "+revision_outputnamepath
+print myname+": "+command
+result=os.system(command)
+testResult(command,window,result,testfile,revision)
+
+command="rm "+revision_outputnamepath
+#os.system(command)
+
+command="gimp-remote "+diffnamepath
+print command
+
+command="cmpi -w0 "+compare_outputnamepath+" "+revision_outputnamepath
+print command
+command="cmpi -w1 "+compare_outputnamepath+" "+revision_outputnamepath
+print command
+command="cmpi -w2 "+compare_outputnamepath+" "+revision_outputnamepath
+print command
+
+if result > 1:
+	result=1
+
+print myself,"result",result
+sys.exit(result)


Property changes on: tools/build/compare_nocleanup.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/comparelist.py
===================================================================
--- tools/build/comparelist.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/comparelist.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+import sys, os
+args=sys.argv[:]
+myself=args.pop(0)
+
+if len(args) < 2:
+	print "USAGE: ",myself,"filename revision"
+	print "	for all testfiles in <filename>"
+	print "	compare revision output with the baseline"
+	print "	assumes that the revision tree has been made"
+	print
+	sys.exit(1)
+
+filename=args.pop(0)
+revision=args.pop(0)
+
+file=open(filename,'r')
+
+for name in file.readlines():
+	testfile=name.strip('\n')
+	command="./searchall.sh"+" "+low
+	command="./compare.py baseline"+" "+revision+"\""+testfile+"\""
+	print command
+	os.system(command)
+
+file.close()
+sys.exit(0)


Property changes on: tools/build/comparelist.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/convert_pdf.py
===================================================================
--- tools/build/convert_pdf.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/convert_pdf.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,108 @@
+#!/usr/bin/python
+#
+# convert a pdf file into the requested device, by running gs
+# USAGE: run revision inputfile device
+#
+myname="run.py"
+
+import sys
+import os
+
+def exitReturn(value,message):
+	if value != 0:
+		print myname+": ""exit error " + str(value) + " " + message
+		raise RuntimeError
+	sys.exit(value)
+
+def runCommand(command,ignore):
+	print myname+": "+command
+	result=os.system(command)
+	if not ignore and result!= 0: # pay attention to some error returns
+		exitReturn(1,"run error: " + command)
+	return 0
+
+#####################################################################
+
+if len(sys.argv) < 3:
+	print "USAGE: run.py inputfile revision [device:ppmraw [resolution:300  [banding:0]]]"
+	print "name might be baseline or HEAD or revision etc."
+	print "example: run.py 7750 12-01.ps"
+	sys.exit(1)
+
+arguments=sys.argv[:]
+myself=arguments.pop(0)
+inputfile=arguments.pop(0)
+
+if len(arguments) > 0:
+	revision=arguments.pop(0)
+else:
+	revision="HEAD"
+if len(arguments) > 0:
+	device=arguments.pop(0)
+else:
+	device="ppmraw"
+if len(arguments) > 0:
+	resolution=arguments.pop(0)
+else:
+	resolution="300"
+if len(arguments) > 0:
+	banding=arguments.pop(0)
+else:
+	banding="0"
+
+run='gs.'+revision+'/bin/gs'
+
+if not os.path.exists(run):
+	print myname,"executable does not exist",run
+	sys.exit(2)
+
+inputbase=os.path.basename(inputfile)
+inputname=inputbase+'.'+revision
+
+inputfilepath='pdf/'+inputname+'.pdfwrite.'+resolution+'.'+banding+'.pdf'
+print inputfilepath
+if not os.path.exists(inputfilepath):
+	print "cannot find inputfile: "+inputfilepath
+	sys.exit(1)
+
+pdfinputname=inputname+'.pdfwrite'
+outputfilepath='\"'+'pnm/'+pdfinputname+'.'+device+'.'+resolution+'.'+banding+'.pnm'+'\"'
+print outputfilepath
+if os.path.exists(outputfilepath):
+	print "found existing outputfile: "+outputfilepath
+	sys.exit(0)
+
+gs_init="ps_init.ps " # you could do this
+gs_init=""
+gs_fonts='-I/home/regression/fonts/ '
+gs_job='-dQUIET -dNOPAUSE -dBATCH -K1000000 '
+
+gs_resolution='-r'+resolution+' '
+gs_device='-sDEVICE='+device+' '
+gs_banding=' '
+
+gs_output_device='-dMaxBitmap=30000000 '+gs_resolution+gs_device+gs_banding
+gs_ps='-dNOOUTERSAVE -dJOBSERVER -c false 0 startjob pop -f '
+gs_ps=''
+
+gs_input= '\"'+inputfilepath              +'\"'+' '
+gs_stdout='\"'+'logs/'+inputname+'.stdout'+'\"'
+gs_stderr='\"'+'logs/'+inputname+'.stderr'+'\"'
+
+gs_output_file='-sOutputFile='+outputfilepath+' '
+gs_capture=' >>'+gs_stdout+' 2>>'+gs_stderr
+gs_capture=''
+
+gs_options=gs_fonts + gs_job + gs_output_device + gs_ps + gs_output_file + gs_init + gs_input + gs_capture
+
+command='rm -f '+gs_stdout+' '+gs_stderr
+runCommand(command,0)
+
+command=run + ' ' + gs_options
+runCommand(command,1)
+
+# if not os.path.exists(outputfilepath):
+# 	print myname,"*** output file does not exist after gs run",outputfilepath
+# 	sys.exit(2)
+
+exitReturn(0,'normal')


Property changes on: tools/build/convert_pdf.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/convertlist.py
===================================================================
--- tools/build/convertlist.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/convertlist.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+
+import sys, os
+
+args=sys.argv[:]
+myself=args.pop(0)
+
+if len(args) < 1:
+	print "USAGE: ",myself,"filename revision"
+	print "	for all testfiles in <filename>"
+	print "	using revision, convert pdf files in pdf/ to images in /pnm"
+	print
+	sys.exit(1)
+
+filename=args.pop(0)
+revision=args.pop(0)
+
+file=open(filename,'r')
+
+lines=file.readlines()
+listlines=lines
+
+for name in listlines:
+	testfile=name.strip('\n')
+	testfile=testfile.replace("[ \t]+","")
+	testfile=testfile.replace("#.*","")
+	print "\t\""+testfile+"\""
+
+for name in lines:
+	testfile=name.strip('\n')
+	testfile=testfile.replace(" +$","")
+# on line after "#" ignore it
+	testfile=testfile.replace("[ \t]+#.*","")
+	testfile="\""+testfile+"\""
+	if len(testfile) > 0:
+		command="./convert_pdf.py "+testfile+" "+revision
+		print command
+		os.system(command)
+
+file.close()
+sys.exit(0)


Property changes on: tools/build/convertlist.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/dump_dict.py
===================================================================
--- tools/build/dump_dict.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/dump_dict.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+import sys, pickle, optparse
+
+def two_columns(one,two,max):
+	align=" "
+	align_at=max+4
+	onelen=len(one)
+	while onelen < align_at:
+		align=align+" "
+		onelen=onelen+1
+	testline = one + align + two
+	print testline
+
+args=sys.argv[:]
+myself=args.pop(0)
+
+while len(args) > 0:
+	dict_file=args.pop(0)
+	print myself,"dumping dictionary file",dict_file
+
+	dict_file=open(dict_file,'r')
+	dict_dict=pickle.loads(pickle.load(dict_file))
+	dict_file.close()
+	
+	keys=dict_dict.keys()
+	max=1
+	for key in keys:
+		if len(key) > max:
+			max = len(key)
+
+	keys.sort()
+	
+	for key in keys:
+		values=dict_dict[key]
+		two_columns(key,str(values),max+1)
+


Property changes on: tools/build/dump_dict.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/dump_revisions_dict.py
===================================================================
--- tools/build/dump_revisions_dict.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/dump_revisions_dict.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+
+import sys, pickle, optparse
+
+def two_columns(one,two,max):
+	align=" "
+	align_at=max+4
+	onelen=len(one)
+	while onelen < align_at:
+		align=align+" "
+		onelen=onelen+1
+	testline = one + align + two
+	print testline
+
+def numeric(x,y):
+	x=int(x)
+	y=int(y)
+	if x < y:
+		value=-1
+	elif x > y:
+		value=1
+	else:
+		value=0
+	return value
+
+args=sys.argv[:]
+myself=args.pop(0)
+
+
+while len(args) > 0:
+	dict_file=args.pop(0)
+	print myself,"dumping dictionary file",dict_file
+
+	dict_file=open(dict_file,'r')
+	dictionary=pickle.loads(pickle.load(dict_file))
+	dict_file.close()
+	
+	keys=dictionary.keys()
+
+	max=1
+	for key in keys:
+		if len(key) > max:
+			max = len(key)
+
+	keys.sort(cmp=numeric)
+	
+	for key in keys:
+		all_values=dictionary[key]
+		values=all_values[1:]
+		two_columns(key,str(values),max+1)


Property changes on: tools/build/dump_revisions_dict.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/extract_compare.py
===================================================================
--- tools/build/extract_compare.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/extract_compare.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+#
+
+import sys, os, re, optparse
+
+p=optparse.OptionParser()
+p.add_option('--verbose','-v',action='store_true')
+p.add_option('--match','-m',action='store_true')
+p.add_option('--revisions','-r',action='store_true')
+p.add_option('--testfiles','-t',action='store_true')
+
+options,arguments=p.parse_args()
+
+filenames=arguments
+
+for filename in filenames:
+	print "	",filename
+
+for filename in filenames:
+	if not os.path.exists(filename):
+		print
+		print "cannot open",filename
+		continue
+
+	f=open(filename,'r')
+	lines=f.readlines()
+	f.close()
+
+	lines_revisions=lines
+	if options.revisions:
+		print "options.revisions"
+		make=re.compile("^make_one.sh")
+		for line in lines_revisions:
+			if make.match(line):
+				line=line.strip('\n')
+				line=line.replace("make_one.sh ","")
+				print line
+
+	lines_testfiles=lines
+	if options.testfiles:
+		print "options.testfiles"
+		make=re.compile("^sum:")
+		for line in lines_testfiles:
+			if make.match(line):
+				line=line.strip('\n')
+				print line


Property changes on: tools/build/extract_compare.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/fetch.py
===================================================================
--- tools/build/fetch.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/fetch.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,73 @@
+#!/usr/bin/python
+
+# fetch_one.py testfile [dev:ppmraw [resolution:300 [banding:0]]]
+
+myname="fetch.py"
+
+import sys,os,gzip
+
+def exitReturn(value,message):
+	if value != 0:
+		print myname+": ""exit error " + str(value) + " " + message
+		raise RuntimeError
+	sys.exit(value)
+
+def runCommand(command,ignore):
+	print myname+": ""runCommand: "+command
+	result=os.system(command)
+	if not ignore and result!= 0: # pay attention to some error returns
+		exitReturn(1,"run error: " + command)
+	return 0
+
+#####################################################################
+
+testfile_directory="pnm/"
+compressedfiles="/home/regression/regression/raster/"
+
+args = sys.argv[0:]
+if len(args) == 1:
+	print "USAGE: fetch_one.py testfile [dev:ppmraw [resolution:300 [banding:0]]]"
+	sys.exit(1)
+
+if len(args) > 0:
+	myself=args.pop(0)
+if len(args) > 0:
+	testfile = args.pop(0)
+
+# default values
+device="ppmraw"
+resolution="300"
+banding="0"
+
+if len(args) > 0:
+	device = args.pop(0)
+if len(args) > 0:
+	resolution = args.pop(0)
+if len(args) > 0:
+	banding = args.pop(0)
+
+testfilename_base=testfile+"."+device+"."+resolution+"."+banding
+testfilename=testfilename_base+".pnm"
+testfilepath=testfile_directory+testfilename
+testfilepathquoted='\"'+testfilepath+'\"'
+
+if os.path.exists(testfilepath):
+	print myname,"found compare file: "+testfilepathquoted
+else:
+	print myname,"not found compare file: "+testfilepathquoted
+	compressed_filepath=compressedfiles+testfilename_base
+	compressed_filepath_gz=compressed_filepath+".gz"
+
+	if not os.path.exists(compressed_filepath_gz):
+		print "cannot find: "+compressed_filepath_gz
+		sys.exit(1)
+
+	print "found: "+compressed_filepath_gz
+
+	test=open(testfilepath,'wb')
+	gz=gzip.open(compressed_filepath_gz,'rb')
+	data=gz.read(-1)
+	test.write(data)
+	gz.close()
+	test.close()
+	


Property changes on: tools/build/fetch.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/fetch_one.py
===================================================================
--- tools/build/fetch_one.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/fetch_one.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+
+# fetch_one.py testfile [dev:ppmraw [resolution:300 [banding:0]]]
+
+myname="fetch_one.py"
+
+import sys,os,gzip
+
+def exitReturn(value,message):
+    if value != 0:
+        print myname+": ""exit error " + str(value) + " " + message
+        raise RuntimeError
+    sys.exit(value)
+
+def runCommand(command,ignore):
+    print myname+": ""runCommand: "+command
+    result=os.system(command)
+    if not ignore and result!= 0: # pay attention to some error returns
+        exitReturn(1,"run error: " + command)
+    return 0
+
+#####################################################################
+
+device="ppmraw"
+resolution="300"
+banding="0"
+
+testfiles="pnm/"
+compressedfiles="/home/regression/regression/raster/"
+
+args = sys.argv[0:]
+if len(args) == 1:
+    print "USAGE: fetch_one.py testfile [dev:ppmraw [resolution:300 [banding:0]]]"
+    sys.exit(1)
+
+if len(args) > 0:
+	myself=args.pop(0)
+if len(args) > 0:
+	testfile = args.pop(0)
+if len(args) > 0:
+	device = args.pop(0)
+if len(args) > 0:
+	resolution = args.pop(0)
+if len(args) > 0:
+	banding = args.pop(0)
+
+testfilename_base=testfile+"."+device+"."+resolution+"."+banding
+testfilename=testfilename_base+".pnm"
+testfilepath=testfiles+testfilename
+
+if os.path.exists(testfilepath):
+    print myname,"found compare file: "+testfilepath
+else:
+	compressed_filepath=compressedfiles+testfilename_base
+	compressed_filepath_gz=compressed_filepath+".gz"
+
+	if not os.path.exists(compressed_filepath_gz):
+		print "cannot find: "+compressed_filepath_gz
+		sys.exit(1)
+
+	print "found: "+compressed_filepath_gz
+
+	test=open(testfilepath,'wb')
+	gz=gzip.open(compressed_filepath_gz,'rb')
+	data=gz.read(-1)
+	test.write(data)
+	gz.close()
+	test.close()
+	


Property changes on: tools/build/fetch_one.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/fetchlist.py
===================================================================
--- tools/build/fetchlist.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/fetchlist.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+
+import sys, os
+
+args=sys.argv[:]
+myself=args.pop(0)
+
+if len(args) == 0:
+	print "USAGE: ",myself,"filename"
+	print "	for all testfiles in <filename>"
+	print "	fetch from compressed raster files"
+	print
+	sys.exit(1)
+
+filename=args.pop(0)
+
+file=open(filename,'r')
+lines=file.readlines()
+listlines=lines
+
+print "all files: "
+for name in listlines:
+	testfile=name.strip('\n')
+	print "\t\""+testfile+"\""
+
+print "fetch all files: "
+for name in lines:
+	testfile=name.strip('\n')
+	testfile='\"'+testfile+'\"'
+	command="./fetch.py"+" "+testfile
+	print myself,command
+	os.system(command)
+
+file.close()
+sys.exit(0)


Property changes on: tools/build/fetchlist.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/find_transisitions.py
===================================================================
--- tools/build/find_transisitions.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/find_transisitions.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+
+import sys
+
+args=sys.argv[:]
+myself=args.pop(0)
+
+if len(args) < 1:
+	print "USAGE:",myself,"filename of summary file"
+	print "\tlines like this:"
+	print "\tKozukaB-ILEmbed.pdf 7580 and RASTER do not match"
+	print
+	sys.exit(1)
+
+filename=args.pop(0)
+
+file=open(filename,'r')
+filename_old=""
+match_old=0
+revision_old=""
+map={0:"match",1:"no match"}
+for line in file.readlines():
+	line=line.split()
+	if len(line) > 0:
+		filename=line.pop(0)
+		revision=line.pop(0)
+		try:
+			choice=line.pop(0)
+		except IndexError:
+			print line
+			continue
+		if choice == "match":
+			match=1
+		else:
+			match=0
+
+	if filename_old != filename:
+		print filename_old,revision_old,map[match_old]
+		print
+		print filename
+		print filename,revision,map[match]
+	elif match_old != match:
+		print filename,revision_old,map[match_old]
+		print filename,revision,map[match]
+
+	filename_old = filename
+	revision_old = revision
+	match_old = match
+
+print filename,revision_old,map[match_old]
+
+file.close()
+


Property changes on: tools/build/find_transisitions.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/fix_daily.py
===================================================================
--- tools/build/fix_daily.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/fix_daily.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,291 @@
+#!/usr/bin/python
+# -* Mode: python -*-
+#
+# USAGE: fix_daily.py reportfilename
+# SAMPLE: fix_daily.py regression.log
+# SAMPLE: fix_daily.py 07.03.02.regression
+#
+# prepare a summary of difference failures and segmentation faults
+# write summary of all dates to stdout
+#
+# read regression.log
+# write a file reportfilename.day.month.year for each date
+# append to regression.history
+
+import sys, datetime, re
+from types import *
+
+today="unknown"
+
+monthmap={'Jan':1,'Feb':2,'Mar':3,'Apr':4,'May':5,'Jun':6,'Jul':7,'Aug':8,'Sep':9,'Oct':10,'Nov':11,'Dec':12}
+newCount=0
+newPDFCount=0
+diffCount=0
+faultCount=0
+
+def appendtofile(datefile,string):
+	if datefile != NoneType:
+		datefile.write(string+"\n")				
+
+def two_columns(one,two,file):
+	align=" "
+	align_at=50 #spaces-1.  always at least one space
+	onelen=len(one)
+	while onelen < align_at:
+		align=align+" "
+		onelen=onelen+1
+	testline = one + align + two
+	appendtofile(file,testline)		
+	print testline
+
+def finddate(line,previous):
+	dateline=0
+	leadstring="SVN checkout for this report started at "
+	if line.startswith(leadstring):
+		reportlead="checkout"
+		line = line.replace(leadstring,"")
+		dateline=1
+	leadstring="From gs-regression at ghostscript.com"
+	if line.startswith(leadstring):
+		reportlead="gs-regression"
+		line = line.replace(leadstring,"")
+		dateline=1
+	leadstring="From regression at rain.thaumas.net"
+	if line.startswith(leadstring):
+		reportlead="thaumas"
+		line = line.replace(leadstring,"")
+		dateline=1
+
+	if dateline:
+		line = line.split()
+		dayofweek,day,monthname,year=line[0:4]
+		daystring = day
+		if len(day) == 1:
+			daystring = "0" + day
+		else:
+			daystring = day
+		try:
+			month = str(monthmap[monthname])
+		except KeyError:
+			print "Key Error" + monthname
+			sys.exit(1)
+			print abort-now
+		if len(month) == 1:
+			monthstring = "0" + month
+		else:
+			monthstring = month
+		datestring = year + "." + monthstring + "." + daystring
+		print ""
+		print datestring + " " + reportlead
+		return datestring
+	return previous
+
+def findrevision(line,previous):
+	leadstring="Testing"
+	if line.startswith(leadstring):
+		line = line.split()
+		revision=line[2]
+		revisionline = revision + "\t\t<revision>"
+		return revision
+	return previous
+
+################ changes since yesterday
+def startNewChanges(line,changes,datefile):
+	if not changes:
+		cmatch=re.compile(".*regression changes")
+		if cmatch.match(line):
+			print "changes"
+			appendtofile(datefile,"changes")
+			return 1
+	return changes
+
+def finishNewChanges(datefile,historyfile):
+	global newCount,newPDFCount,diffCount,faultCount
+	print "changes end"
+	print "\tnew "+str(newCount)
+	print "\tnew PDF "+str(newPDFCount)
+	appendtofile(datefile,"\tnew "+str(newCount))
+	appendtofile(datefile,"\tnew PDF "+str(newPDFCount))
+
+def findComplete(line,complete,datefile):
+	if not complete:
+		cmatch=re.compile(".*complete list")
+		if cmatch.match(line):
+			appendtofile(datefile,"complete list")
+			return 1
+	return complete
+
+def findNormal(line,previous,revision,datefile):
+# ignore lines with pdfwrite errors
+	global newCount,newPDFCount,diffCount,faultCount
+	linelist = line.split()
+	if linelist[0] == "pdfwrite":
+		newPDFCount+=1
+	if linelist[0] == "normal":
+		testfile=""
+		for token in linelist:
+			if token == "normal":
+				discard=1
+			elif token[0] == "\(":
+				print ">>> " + token
+				break
+			else:
+				if len(testfile) > 0:
+					pad=" "
+				else:
+					pad=""
+					testfile = testfile + pad + token
+		if testfile != previous:
+			newCount+=1
+			two_columns(testfile,revision+"\tnew difference",datefile)
+			return testfile
+	return previous
+
+##################### all differences
+def findDIFFER(line,previous,revision,changes,complete,datefile):
+	global newCount,newPDFCount,diffCount,faultCount
+	discardReference=re.compile(".*must reference all relevant files")
+	if discardReference.match(line):
+		return ""
+	discardRelevant=re.compile("All relevant files must have")
+	if discardRelevant.match(line):
+		return ""
+
+	DIFFER=re.compile(".*DIFFER")
+	ERROR=re.compile(".*ERROR")
+	if DIFFER.match(line) or ERROR.match(line):
+		linelist = line.split()
+		testfile=""
+		if linelist[0] == "Checking":
+			for token in linelist:
+				if token == "Checking":
+					testfile=""
+				elif token[0] == "(":
+					break
+				else:
+					if len(testfile) > 0:
+						pad=" "
+					else:
+						pad=""
+					testfile = testfile + pad + token
+		if testfile != previous and changes:
+			diffCount+=1
+			two_columns(testfile,revision,datefile)
+			return testfile
+	return previous
+
+def finishDIFFER(datefile):
+	print "finish Complete all differences "+str(diffCount)
+
+##################### faults
+def findSegfault(line,previous,revision,changes,complete,datefile):
+	global newCount,newPDFCount,diffCount,faultCount
+	differ=re.compile(".*Segmentation fault")
+	if differ.match(line):
+		line=line.split()
+		location=line[2]
+		location=location.replace("."," ")
+		location=location.split()
+		try:
+			location,extension=location[0:2]
+			location = location + "." + extension
+			if location != previous:
+				locationline = location + "\t<segmentation fault>" + "\t\t" + revision
+				print "\t" + locationline
+				locationline = location + "\t<segmentation fault>"+ "\t\t" + revision
+				appendtofile(datefile,locationline)
+				faultCount+=1
+				return location
+		except ValueError: # parsing failed
+				location = location[0]
+				print "\t" + location + "\t<segmentation fault>"
+				return previous		
+	return previous
+
+def finishSegfault(datefile):
+	global newCount,newPDFCount,diffCount,faultCount
+	print "finish Seg faults "+str(faultCount)
+
+######################################## read the file
+def linesall(filed,filename,historyfile):
+	global newCount,newPDFCount,diffCount,faultCount
+	global today
+	date=""
+	revision=""
+	daterevision=""
+	previousdaterevision=""
+	normal=""
+	difference=""
+	location=""
+	datefile=NoneType
+	changes=0
+	complete=0
+
+	newCount=0
+	newPDFCount=0
+	diffCount=0
+	faultCount=0
+
+	alllines = filed.readlines()
+	for line in alllines:
+		line = line.strip("\n")
+		if line != "":
+			date = finddate(line,date)
+			revision = findrevision(line,revision)
+			if date != "" and revision != "":
+				daterevision = date + "." + revision
+				if daterevision != previousdaterevision:
+					print daterevision
+					previousdaterevision = daterevision
+					if datefile != NoneType:
+						datefile.close
+					datefilename = date + "." + revision + "." + "regression" #filename?
+					try:
+						print "datefile " + filename
+						datefile=open(datefilename,"w")
+						sortleader = "> test summary   "
+						appendtofile(datefile,today)
+						appendtofile(datefile,sortleader + filename + "   " + date + "   " + revision + "   " + datefilename)
+						appendtofile(historyfile,today)
+						appendtofile(historyfile,date + " " + revision)
+					except IOError:
+						print myname + "cannot open date file " + datefilename
+
+			if revision != "":
+				changesOld=changes
+				changes=startNewChanges(line,changes,datefile)
+				completeOld=complete
+				complete=findComplete(line,complete,datefile)
+				if changes and not complete:
+					normal=findNormal(line,normal,revision,datefile)
+				if changes and complete and not completeOld: # we just went to the complete list
+					finishNewChanges(datefile,historyfile)
+				if complete:
+					difference = findDIFFER(line,difference,revision,changes,complete,datefile)
+					location = findSegfault(line,location,revision,changes,complete,datefile)
+	finishDIFFER(datefile)
+	finishSegfault(datefile)
+
+def readall(filename,historyfile):
+	try:
+		filed = open(filename,'r')
+		print filename
+		linesall(filed,filename,historyfile)
+		filed.close()	
+	except IOError:
+		print myname + "cannot open " + filename
+
+today=str(datetime.date.today())
+print today
+
+args=sys.argv[0:]
+myself=args.pop(0)
+filename=args.pop(0)
+
+historyfilename="regression.history"
+historyfile=open(historyfilename,"w")
+
+readall(filename,historyfile)
+print " "
+
+historyfile.close()


Property changes on: tools/build/fix_daily.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/fix_product.py
===================================================================
--- tools/build/fix_product.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/fix_product.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+
+myname="fix_product.py"
+
+import sys
+import os
+import re
+
+def change_gsproduct(file):
+	tmpfile = "%s.tmp" % (file,)
+
+	startre = re.compile("^#ifndef\ GS_PRODUCT$")
+	changere = re.compile("^.*?\"[A-Za-z -]+\".*?$")
+	endre = re.compile("^$")
+
+	old = open(file, "r")
+	new = open(tmpfile, "w")
+
+	state = 0
+	for line in old.readlines():
+		if state == 0:
+			m = startre.search(line)
+			if m:
+				state = 1
+				
+			new.write(line)
+		elif state == 1:
+			m = changere.search(line)
+			if m:
+				state = 2
+				new.write("\t\"AFPL Ghostscript\"\n")
+			else:
+				new.write(line)
+		elif state == 2:
+			m = endre.search(line)
+			if m:
+				state = 0
+
+			new.write(line)
+
+
+	old.close()
+	new.close()
+
+	os.unlink(file)
+	os.rename(tmpfile, file)
+
+if len(sys.argv) != 2:
+	print "USAGE: fix_product.py revision"
+	sys.exit(1)
+
+myself,revision = sys.argv[0:]
+
+gspath='gs.'+revision
+return_value=change_gsproduct(gspath+"/src/gscdef.c")
+sys.exit(return_value)


Property changes on: tools/build/fix_product.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/general.py
===================================================================
--- tools/build/general.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/general.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+# make.py revision
+#
+import sys, os, optparse
+
+def exitError(result,message,options):
+	print myself,message,result
+	sys.exit(result)
+
+def runCommand(command,options):
+	if options.verbose:
+		print command
+	result=os.system(command)
+	if result != 0:
+		exitError(result,command,options)
+	
+if __name__ == '__main__':
+
+	args=sys.argv[0:]
+	print args
+	myself=args.pop(0)
+	print args
+	if len(args) == 0:
+		print 'USAGE: '+myself+' testfile [low:HEAD [high:HEAD]]'
+		sys.exit(1)
+
+	p=optparse.OptionParser()
+	p.add_option('--verbose','-v',action='store_true')
+	p.add_option('--nocleanup','-k',action='store_true')
+	p.add_option('--nosvn','-u',action='store_true')
+	p.add_option('--noautogen','-a',action='store_true')
+	options,arguments=p.parse_args()
+	options.myself=myself
+
+	if len(arguments) > 0:
+		testfile=arguments.pop(0)
+	else:
+		testfile="testfile"
+	if len(arguments) > 0:
+		low=arguments.pop(0)
+	else:
+		low="HEAD"
+	if len(arguments) > 0:
+		hight=arguments.pop(0)
+	else:
+		hight="HEAD"
+	
+	if options.verbose:
+		print "options.verbose: "+revision
+	else:
+		# capture all output to logs/
+		
+


Property changes on: tools/build/general.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/get_revision_for_testfile.py
===================================================================
--- tools/build/get_revision_for_testfile.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/get_revision_for_testfile.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+import sys, pickle, optparse
+
+args=sys.argv[0:]
+myself=args.pop(0)
+
+p=optparse.OptionParser()
+p.add_option('--usage','-u',action='store_true')
+p.add_option('--verbose','-v',action='store_true')
+options,arguments=p.parse_args()
+options.myself=myself
+
+if options.usage:
+	print "USAGE:",myself,"[dates_of_testfiles.dict [testfiles.dict]]"
+	print "print the date for all testfiles"
+	print "get the revision of svn ps that was used to update the baseline of testfiles"
+	print "not completely reliable, since the information is not always present"
+	sys.exit(1)
+
+if len(args) > 0:
+	dates_of_revisions_file=args.pop(0)
+else:
+	dates_of_revisions_file="dates_of_testfiles.dict"
+	
+if len(args) > 0:
+	testfiles=args.pop(0)
+else:
+	testfiles="testfiles.dict"
+
+dates_of_revisions_file=open(dates_of_revisions_file,'r')
+dates_of_revisions_dict=pickle.loads(pickle.load(dates_of_revisions_file))
+dates_of_revisions_file.close()
+
+testfiles_file=open(testfiles,'r')
+testfiles_dict=pickle.loads(pickle.load(testfiles_file))
+testfiles_file.close()
+
+value=list()
+for testfile in testfiles_dict:
+	date,file,pdfwrite,revision_maybe=testfiles_dict[testfile]
+	try:
+		print date,"\t",file,"\t",pdfwrite
+	except KeyError:
+		print date,file,pdfwrite,"---","cannot find date"


Property changes on: tools/build/get_revision_for_testfile.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/link.py
===================================================================
--- tools/build/link.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/link.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+
+rm -rf gs.$revision/bin/gs
+
+rm -rf gs.$revision/doc gs.$revision/obj gs.$revision/man gs.$revision/examples gs.$revision/bin
+
+echo -e "fix_product $revision"
+python fix_product.py gs.$revision
+
+echo -e "make "
+make >> ../logs/$revision.make.log	2>&1
+status=$?
+if [ $status -ne 0 ] ; then
+	echo -e "make failed"
+	exit 1
+fi


Property changes on: tools/build/link.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/link_many.py
===================================================================
--- tools/build/link_many.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/link_many.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+
+import sys, os
+
+args=sys.argv
+if len(args) < 3:
+	print "USAGE: link_many.py low-version high-version"
+	print "link:make all versions from low to high"
+	sys.exit(1)
+
+myself,low,high=args[:]
+
+for revision in range(int(low),int(high)+1):
+	command="sh link_one.sh "+str(revision)
+	os.system(command)
+
+sys.exit(0)


Property changes on: tools/build/link_many.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/link_one.py
===================================================================
--- tools/build/link_one.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/link_one.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+revision=$1
+if [ $revision == "" ];then
+    print "line_one.sh revision"
+    exit 1
+fi
+
+if [ $revision == "7606" ]; then
+	echo "cannot line revision $revision"
+	exit 1
+fi
+
+rm -rf gs.$revision/bin/gs
+
+rm -rf gs.$revision/doc gs.$revision/obj gs.$revision/man gs.$revision/examples gs.$revision/bin
+
+echo -e "fix_product $revision"
+python fix_product.py gs.$revision
+
+echo -e "make "
+make >> ../logs/$revision.make.log	2>&1
+status=$?
+if [ $status -ne 0 ] ; then
+	echo -e "make failed"
+	exit 1
+fi
+
+# rm -rf gs.$revision/obj gs.$revision/src
+
+exit 0


Property changes on: tools/build/link_one.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/lookup_dict.py
===================================================================
--- tools/build/lookup_dict.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/lookup_dict.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+import sys, pickle
+
+args=sys.argv[:]
+myself=args.pop(0)
+
+if len(args) == 0:
+	print "USAGE:",myself,"dictionary-file key [keys...]"
+	sys.exit(1)
+
+dict_file=args.pop(0)
+
+dict_file=open(dict_file,'r')
+dict_dict=pickle.loads(pickle.load(dict_file))
+dict_file.close()
+
+while len(args) > 0:
+	key=args.pop(0)
+	print dict_dict[key]
+


Property changes on: tools/build/lookup_dict.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/make.py
===================================================================
--- tools/build/make.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/make.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+# make.py revision
+#
+import sys, os, optparse
+
+def exitError(result,message,options):
+	print myself,message,result
+	sys.exit(result)
+
+def runCommand(command,options):
+	if options.verbose:
+		print command
+	result=os.system(command)
+	if result != 0:
+		exitError(result,command,options)
+	
+def export_svn(revision,options):
+	if not options.nosvn:
+		host="svn+ssh://thomasd@svn.ghostscript.com/svn/ghostscript/trunk/gs"
+		command='svn export -q --force -r'+revision+' '+host+' '+options.gs_revision
+		command=command+options.svn_log
+		runCommand(command,options)
+		if not options.nocleanup:
+			dir=options.gs_revision
+			command='rm -rf'
+			command=command+' '+dir+'/doc '+dir+'/obj '+dir+'/man'
+			command=command+' '+dir+'/examples '+dir+'/bin'
+			runCommand(command,options)
+	
+def build_gs(revision,options):
+	runCommand('./fix_product.py '+revision,options)
+	if not options.noautogen:
+		runCommand('cd '+options.gs_revision+'; '+'./autogen.sh'+options.autogen_log,options)
+	runCommand('cd '+options.gs_revision+'; '+'make '+options.make_log,options)
+
+if __name__ == '__main__':
+
+	args=sys.argv[0:]
+	myself=args.pop(0)
+	if len(args) == 0:
+		print 'USAGE:',myself,'[--nocleanup:cleanup] [--nosvn:export svn] [revision:HEAD]'
+		sys.exit(1)
+
+	p=optparse.OptionParser()
+	p.add_option('--verbose','-v',action='store_true')
+	p.add_option('--nocleanup','-k',action='store_true')
+	p.add_option('--nosvn','-u',action='store_true')
+	p.add_option('--noautogen','-a',action='store_true')
+	options,arguments=p.parse_args()
+	options.myself=myself
+
+	if len(arguments) > 0:
+		revision=arguments.pop(0)
+	else:
+		revision="HEAD"
+	
+	options.gs_revision='gs.'+revision
+
+	if options.verbose:
+		print "options.verbose: "+revision
+		options.svn_log=''
+		options.autogen_log=''
+		options.make_log=''
+	else:
+		# capture all output to logs/
+		options.svn_log=    ' > logs/'+revision+'.svn.log'
+		options.autogen_log=' > ../logs/'+revision+'.autogen.log'
+		options.make_log=   ' > ../logs/'+revision+'.make.log 2>&1'
+		
+	if options.nocleanup:
+		print "options.nocleanup"
+	if options.nosvn:
+		print "options.nosvn"
+
+	export_svn(revision,options)
+	build_gs(revision,options)
+		
+


Property changes on: tools/build/make.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/make_many.py
===================================================================
--- tools/build/make_many.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/make_many.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+
+import sys, os
+
+args=sys.argv
+if len(args) < 3:
+	print "USAGE: make_many.py low-version high-version"
+	print "make all versions from low to high"
+	sys.exit(1)
+
+myself,low,high=args[:]
+
+for revision in range(int(low),int(high)+1):
+	command="./make.py "+str(revision)
+	print command
+	os.system(command)
+
+sys.exit(0)


Property changes on: tools/build/make_many.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/opt.py
===================================================================
--- tools/build/opt.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/opt.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+#
+
+import sys, optparse
+
+args=sys.argv[:]
+
+p=optparse.OptionParser()
+p.add_option('--verbose','-v',action='store_true')
+p.add_option('--match','-m',action='store_true')
+p.add_option('--revisions','-r',action='store_true')
+p.add_option('--testfiles','-t',action='store_true')
+
+options,arguments=p.parse_args(args)
+
+filenames=arguments


Property changes on: tools/build/opt.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/put_file_status.py
===================================================================
--- tools/build/put_file_status.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/put_file_status.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+
+import sys, pickle, optparse
+
+#!/usr/bin/python
+#
+
+import sys, optparse
+
+args=sys.argv[:]
+
+p=optparse.OptionParser()
+p.add_option('--verbose','-v',action='store_true')
+p.add_option('--get','-g',action='store_true')
+
+options,arguments=p.parse_args(args)
+
+dict_filename="testfiles_status.dict"
+
+dict_file=open(dict_filename,'r')
+my_dict=pickle.loads(pickle.load(dict_file))
+dict_file.close()
+
+while len(arguments) > 0:
+	testfile=arguments.pop(0)
+	if options.get:
+		status=my_dict[testfile]
+		print dict_file,testfile,status
+	else
+		status=arguments.pop(0)
+		print dict_file,testfile,status
+
+if options.get:
+	pass
+else:
+	dict_file=open(dict_filename,'w')
+	pickle.dump(pickle.dumps(my_dict),dict_file)
+	dict_file.close()


Property changes on: tools/build/put_file_status.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/run.py
===================================================================
--- tools/build/run.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/run.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,112 @@
+#!/usr/bin/python
+#
+# general run script
+# USAGE: run command revision testfile
+#
+myname="run.py"
+
+import sys
+import os
+
+def exitReturn(value,message):
+	if value != 0:
+		print myname+": ""exit error " + str(value) + " " + message
+		raise RuntimeError
+	sys.exit(value)
+
+def runCommand(command,ignore):
+	print myname+": "+command
+	result=os.system(command)
+	if not ignore and result!= 0: # pay attention to some error returns
+		exitReturn(1,"run error: " + command)
+	return 0
+
+#####################################################################
+
+if len(sys.argv) < 3:
+	print "USAGE: run.py testfile revision [device:ppmraw [resolution:300  [banding:0]]]"
+	print "name might be baseline or HEAD or revision etc."
+	print "example: run.py 7750 12-01.ps"
+	print "if the device if pdfwrite, put the output file in pdf/*.pdf"
+	sys.exit(1)
+
+arguments=sys.argv[:]
+myself=arguments.pop(0)
+testfile=arguments.pop(0)
+
+if len(arguments) > 0:
+	revision=arguments.pop(0)
+else:
+	revision="HEAD"
+if len(arguments) > 0:
+	device=arguments.pop(0)
+else:
+	device="ppmraw"
+if len(arguments) > 0:
+	resolution=arguments.pop(0)
+else:
+	resolution="300"
+if len(arguments) > 0:
+	banding=arguments.pop(0)
+else:
+	banding="0"
+
+run='gs.'+revision+'/bin/gs'
+if not os.path.exists(run):
+	print myname,"executable does not exist",run
+	sys.exit(2)
+
+testbase=os.path.basename(testfile)
+testname=testbase+'.'+revision
+testfilepath='/home/regression/comparefiles/'+testfile
+print testfilepath
+if not os.path.exists(testfilepath):
+	print "cannot find testfile: "+testfilepath
+	sys.exit(1)
+
+if device == "pdfwrite":
+	outputdirectory='pdf/'
+	outputfilepath='\"'+outputdirectory+testname+'.'+device+'.'+resolution+'.'+banding+'.pdf'+'\"'
+else:
+	outputdirectory='pnm/'
+	outputfilepath='\"'+outputdirectory+testname+'.'+device+'.'+resolution+'.'+banding+'.pnm'+'\"'
+
+print outputfilepath
+if os.path.exists(outputfilepath):
+	print "found existing outputfile: "+outputfilepath
+	sys.exit(0)
+
+gs_init="ps_init.ps " # you could do this
+gs_init=""
+gs_fonts='-I/home/regression/fonts/ '
+gs_job='-dQUIET -dNOPAUSE -dBATCH -K1000000 '
+
+gs_resolution='-r'+resolution+' '
+gs_device='-sDEVICE='+device+' '
+gs_banding=' '
+
+gs_output_device='-dMaxBitmap=30000000 '+gs_resolution+gs_device+gs_banding
+gs_ps='-dNOOUTERSAVE -dJOBSERVER -c false 0 startjob pop -f '
+gs_ps=''
+
+gs_input= '\"'+testfilepath               +'\"'+' '
+gs_stdout='\"'+'logs/'+testname+'.stdout'+'\"'
+gs_stderr='\"'+'logs/'+testname+'.stderr'+'\"'
+
+gs_output_file='-sOutputFile='+outputfilepath+' '
+gs_capture=' >>'+gs_stdout+' 2>>'+gs_stderr
+gs_capture=''
+
+gs_options=gs_fonts + gs_job + gs_output_device + gs_ps + gs_output_file + gs_init + gs_input + gs_capture
+
+command='rm -f '+gs_stdout+' '+gs_stderr
+runCommand(command,0)
+
+command=run + ' ' + gs_options
+runCommand(command,1)
+
+# if not os.path.exists(outputfilepath):
+# 	print myname,"*** output file does not exist after gs run",outputfilepath
+# 	sys.exit(2)
+
+exitReturn(0,'normal')


Property changes on: tools/build/run.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/run_cleanup.py
===================================================================
--- tools/build/run_cleanup.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/run_cleanup.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+#
+# general run script
+# USAGE: run command revision testfile
+#
+myname="run_cleanup.py"
+
+import sys
+import os
+
+def exitReturn(value,message):
+	if value != 0:
+		print myname+": ""exit error " + str(value) + " " + message
+		raise RuntimeError
+	sys.exit(value)
+
+def runCommand(command,ignore,doprint):
+	if doprint:
+		print command
+	result=os.system(command)
+	if not ignore and result!= 0: # pay attention to some error returns
+		exitReturn(1,"run error: " + command)
+	return 0
+
+#####################################################################
+
+if len(sys.argv) != 3:
+	print "USAGE: run_cleanup.py revision testfile"
+	sys.exit(1)
+
+myself,revision,testfile = sys.argv[0:]
+
+device="ppmraw"
+
+testbase=os.path.basename(testfile)
+testname=testbase+'.'+revision
+
+diffname=testbase+'.diff'
+
+doprint=1
+noprint=0
+
+outputfilepath='pnm/'+testname+'.'+device+'.300.0.pnm'
+if os.path.exists(outputfilepath):
+	command="rm -f "+outputfilepath
+	runCommand(command,1,noprint)
+
+difffilepath='pnm/'+diffname+'.'+device+'.300.0.pnm'
+if os.path.exists(difffilepath):
+	command="rm -f "+difffilepath
+	runCommand(command,1,noprint)
+
+exitReturn(0,'normal')


Property changes on: tools/build/run_cleanup.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/run_nocleanup.py
===================================================================
--- tools/build/run_nocleanup.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/run_nocleanup.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+#
+# general run script
+# USAGE: run command revision testfile
+#
+myname="run.py"
+
+import sys
+import os
+
+def exitReturn(value,message):
+	if value != 0:
+		print myname+": ""exit error " + str(value) + " " + message
+		raise RuntimeError
+	sys.exit(value)
+
+def runCommand(command,ignore):
+	print myname+": "+command
+	result=os.system(command)
+	if not ignore and result!= 0: # pay attention to some error returns
+		exitReturn(1,"run error: " + command)
+	return 0
+
+#####################################################################
+
+if len(sys.argv) != 4:
+	print "USAGE: run.py path-to-gs revision testfile" # add device resolution banding
+	print "name might be baseline or HEAD or revision etc."
+	sys.exit(1)
+
+myself,run,revision,testfile = sys.argv[0:]
+
+if not os.path.exists(run):
+	print myname,"executable does not exist",run
+	sys.exit(2)
+
+device="ppmraw"
+resolution="300"
+banding="0"
+
+testbase=os.path.basename(testfile)
+testname=testbase+'.'+revision
+
+testfilepath='/home/regression/comparefiles/'+testfile
+if not os.path.exists(testfilepath):
+	print "cannot find testfile: "+testfilepath
+	sys.exit(1)
+
+device="ppmraw"
+outputfilepath='\"'+'pnm2/'+testname+'.ppmraw.300.0.pnm'+'\"'
+
+if os.path.exists(outputfilepath):
+	print "found existing outputfile: "+outputfilepath
+	sys.exit(0)
+
+gs_init="ps_init.ps " # you could do this
+gs_init=""
+gs_env='-I/home/regression/fonts/ '
+gs_job='-dQUIET -dNOPAUSE -dBATCH -K1000000 '
+gs_output_device='-r300 -dMaxBitmap=30000000 -sDEVICE=ppmraw '
+gs_ps='-dNOOUTERSAVE -dJOBSERVER -c false 0 startjob pop -f '
+gs_ps=''
+
+gs_input= '\"'+testfilepath               +'\"'+' '
+gs_stdout='\"'+'logs2/'+testname+'.stdout'+'\"'
+gs_stderr='\"'+'logs2/'+testname+'.stderr'+'\"'
+
+gs_output_file='-sOutputFile='+outputfilepath+' '
+gs_capture=' >>'+gs_stdout+' 2>>'+gs_stderr
+gs_capture=''
+
+gs_options=gs_env + gs_job + gs_output_device + gs_ps + gs_output_file + gs_init + gs_input + gs_capture
+
+filesuffix='.pbmraw.300.pnm'
+
+command='rm -f '+gs_stdout+' '+gs_stderr
+runCommand(command,0)
+
+command=run + ' ' + gs_options
+runCommand(command,1)
+
+# if not os.path.exists(outputfilepath):
+# 	print myname,"*** output file does not exist after gs run",outputfilepath
+# 	sys.exit(2)
+
+exitReturn(0,'normal')


Property changes on: tools/build/run_nocleanup.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/runlist.py
===================================================================
--- tools/build/runlist.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/runlist.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,58 @@
+#!/usr/bin/python
+
+import sys, os
+
+args=sys.argv[:]
+myself=args.pop(0)
+
+if len(args) < 2:
+	print "USAGE: ",myself,"filename revision"
+	print "	for all testfiles in <filename>"
+	print "	using revision, run pdf files in pdf/ to images in /pnm"
+	print
+	sys.exit(1)
+
+filename=args.pop(0)
+if len(args) > 0:
+	revision=args.pop(0)
+else:
+	revision="HEAD"
+if len(args) > 0:
+	device=args.pop(0)
+else:
+	device="ppmraw"
+if len(args) > 0:
+	resolution=args.pop(0)
+else:
+	resolution="300"
+if len(args) > 0:
+	banding=args.pop(0)
+else:
+	banding="0"
+
+file=open(filename,'r')
+
+lines=file.readlines()
+listlines=lines
+
+for name in listlines:
+	testfile=name.strip('\n')
+	testfile=testfile.replace("[ \t]+","")
+	testfile=testfile.replace("#.*","")
+	print "\t\""+testfile+"\""
+
+for name in lines:
+	print
+	print "------------------------------ start testfile ---------------------------------"
+	testfile=name.strip('\n')
+	testfile=testfile.replace(" +$","")
+# on line after "#" ignore it
+	testfile=testfile.replace("[ \t]+#.*","")
+	testfile="\""+testfile+"\""
+	if len(testfile) > 0:
+		command="./run.py "+testfile+" "+revision+" "+device+" "+resolution+" "+banding
+		print command
+		os.system(command)
+
+file.close()
+sys.exit(0)


Property changes on: tools/build/runlist.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/search.py
===================================================================
--- tools/build/search.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/search.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,83 @@
+#!/usr/bin/python
+# make.py revision
+#
+import sys, os, optparse
+
+def exitError(result,message,options):
+	print myself,message,result
+	sys.exit(result)
+
+def runCommand(command,options):
+	if options.verbose:
+		print command
+	print command
+	result=os.system(command)
+	return result
+	
+if __name__ == '__main__':
+
+	args=sys.argv[0:]
+	myself=args.pop(0)
+	if len(args) == 0:
+		print 'USAGE: '+myself+' testfile [low:HEAD [high:HEAD [device:ppmraw [resolution:300 [banding:0]]]'
+		sys.exit(1)
+
+	p=optparse.OptionParser()
+	p.add_option('--verbose','-v',action='store_true')
+	p.add_option('--nocleanup','-k',action='store_true')
+	options,arguments=p.parse_args()
+	options.myself=myself
+
+	if len(arguments) > 0:		testfile=arguments.pop(0)
+	else:						testfile='testfile'
+	testfile='\"'+testfile+'\"'
+
+	if len(arguments) > 0:
+		low=int(arguments.pop(0))
+	else:
+		low='HEAD'
+	if len(arguments) > 0:
+		high=int(arguments.pop(0))+1
+	else:
+		high='HEAD'
+	if len(arguments) > 0:
+		device=arguments.pop(0)
+	else:
+		device='ppmraw'
+
+	if len(arguments) > 0:
+		resolution=arguments.pop(0)
+	else:
+		resolution='300'
+
+	if len(arguments) > 0:
+		banding=arguments.pop(0)
+	else:
+		banding='0'
+
+	if options.verbose:
+		print 'options.verbose: '+revision
+	else:
+		# capture all output to logs/
+		pass
+		
+	print testfile,device,resolution,banding
+
+	for revision in range(low,high):
+		command='./make.py '+str(revision)
+#		runCommand(command,options)
+
+		command='./try.py '+testfile+' '+str(revision)+' '+device+' '+resolution+' '+banding
+		result=runCommand(command,options)
+		print myself,"result from try.py",result
+		if result == 256:
+			result=1
+		print myself,"result from try.py",result
+		if result == 0:
+			match_message='and baseline match'
+		elif result == 1:
+			match_message='and baseline nomatch'
+		else:
+			match_message='and baseline cannot be compared'
+
+		print myself,testfile,'*** ',revision,match_message


Property changes on: tools/build/search.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/searchall.py
===================================================================
--- tools/build/searchall.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/searchall.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+
+import sys, os, optparse
+
+args=sys.argv[:]
+myself=args.pop(0)
+
+if len(args) < 3:
+	print "USAGE: ",myself,"[--nocleanup] testfile [low-revision:HEAD [high-revision:low]]"
+	print "	for testfile"
+	print "	for each revision in the range low:high"
+	print "	compare output with the baseline"
+	print
+	sys.exit(1)
+
+
+p=optparse.OptionParser()
+p.add_option('--verbose','-v',action='store_true')
+p.add_option('--nocleanup','-n',action='store_true')
+options,arguments=p.parse_args()
+
+if options.nocleanup:
+	print "options.nocleanup"
+
+testfile=arguments.pop(0)
+
+low="HEAD"
+if len(arguments) > 0:
+	low=args.pop(0)
+if len(arguments) > 0:
+	high=args.pop(0)
+else:
+	high=low
+
+testfile="/home/regression/comparefiles/"+testfile
+file=open(testfile,'r')
+
+lines=file.readlines()
+listlines=lines
+
+for name in listlines:
+	testfile=name.strip('\n')
+	print "\t\""+testfile+"\""
+
+for name in lines:
+	print
+	print "******************************** start testfile ******************************"
+	testfile=name.strip('\n')
+	testfile=testfile.replace(" $","")
+	testfile="\""+testfile+"\""
+	command="./search.py "+testfile+" "+low+" "+high+" "
+	print command
+	os.system(command)
+	print
+
+file.close()
+sys.exit(0)


Property changes on: tools/build/searchall.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/searchlist.py
===================================================================
--- tools/build/searchlist.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/searchlist.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+import sys, os
+
+args=sys.argv[:]
+myself=args.pop(0)
+
+if len(args) < 3:
+	print "USAGE: ",myself,"filename low-revision high-revision"
+	print "	for all testfiles in <filename>"
+	print "	for each revision in the range low:high"
+	print "	compare output with the baseline"
+	print
+	sys.exit(1)
+
+filename=args.pop(0)
+low=args.pop(0)
+high=args.pop(0)
+
+file=open(filename,'r')
+
+lines=file.readlines()
+listlines=lines
+
+for name in listlines:
+	testfile=name.strip('\n')
+	testfile=testfile.replace("[ \t]+","")
+	testfile=testfile.replace("#.*","")
+	print "\t\""+testfile+"\""
+
+for name in lines:
+	print
+	print "------------------------------ start testfile ---------------------------------"
+	testfile=name.strip('\n')
+	testfile=testfile.replace(" +$","")
+# on line after "#" ignore it
+	testfile=testfile.replace("[ \t]+#.*","")
+	testfile="\""+testfile+"\""
+	if len(testfile) > 0:
+		command="./search.py "+testfile+" "+low+" "+high
+		print command
+		os.system(command)
+
+file.close()
+sys.exit(0)


Property changes on: tools/build/searchlist.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/searchlist_nocleanup.py
===================================================================
--- tools/build/searchlist_nocleanup.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/searchlist_nocleanup.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+import sys, os
+
+args=sys.argv[:]
+myself=args.pop(0)
+
+if len(args) < 3:
+	print "USAGE: ",myself,"filename low-revision high-revision"
+	print "	for all testfiles in <filename>"
+	print "	for each revision in the range low:high"
+	print "	compare output with the baseline"
+	print
+	sys.exit(1)
+
+filename=args.pop(0)
+low=args.pop(0)
+high=args.pop(0)
+
+file=open(filename,'r')
+
+lines=file.readlines()
+listlines=lines
+
+for name in listlines:
+	testfile=name.strip('\n')
+	print "\t\""+testfile+"\""
+
+for name in lines:
+	print
+	print "******************************** start testfile ******************************"
+	testfile=name.strip('\n')
+	testfile=testfile.replace(" $","")
+	command="./searchall_nocleanup.sh"+" "+low+" "+high+" "+"\""+testfile+"\""+" baseline"
+	print command
+	os.system(command)
+	print
+
+file.close()
+sys.exit(0)


Property changes on: tools/build/searchlist_nocleanup.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/svn-get-log.py
===================================================================
--- tools/build/svn-get-log.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/svn-get-log.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+# -*- Mode: python -*-
+# svn-get-log.py
+
+#	 Copyright (C) 2001-2007 Artifex Software Inc.
+# 
+# This software is provided AS-IS with no warranty, either express or
+# implied.
+# 
+# This software is distributed under license and may not be copied,
+# modified or distributed except as expressly authorized under the terms
+# of the license contained in the file LICENSE in this distribution.
+# 
+# For more information about licensing, please refer to
+# http://www.ghostscript.com/licensing/. For information on
+# commercial licensing, go to http://www.artifex.com/licensing/ or
+# contact Artifex Software, Inc., 101 Lucas Valley Road #110,
+# San Rafael, CA  94903, U.S.A., +1(415)492-9861.
+
+# 
+
+import sys, os, optparse
+from popen2 import Popen4
+
+if __name__ == "__main__":
+	myname="svn-get-log.py"
+
+# class svn(host,path)
+# methods: test, get-log, filter-log, checkout, update
+# use popen to run the command and to collect the output, return as list, (returnvalue,returnmessage,list of output,other)
+
+
+def svn_run_command(command):
+	mypipe = os.popen(command)
+	lines=[]
+	for line in mypipe:
+		line=line.strip('\n')
+		if len(line) > 0:
+			lines=lines+[line]
+	mypipe.close()
+	return lines
+
+# return a list = [return_value (0=success), list of lines from svn(partially cleaned-yp)]
+def do_svn_command(db="ps",tags=False,revision="HEAD",svn_command="log"):
+
+	if revision and revision != "-":	   # "-" means do not specify a revision
+		options="-r"+revision+" "
+	else:
+		options=""
+
+	protocol="svn+ssh://"
+	host="svn.ghostscript.com"
+
+	svnpath_pcl="/var/lib/svn-private/ghostpcl/trunk/ghostpcl"
+	svnpath_ps_trunk="/svn/ghostscript/trunk/gs"
+	svnpath_ps_tags="/svn/ghostscript/tags"
+
+	if db == "pcl":
+		svnpath=svnpath_pcl
+	elif db == "ps":
+		if tags:
+			svnpath=svnpath_ps_tags
+		else:
+			svnpath=svnpath_ps_trunk
+	else:
+		print myname+" invalid database: "+db
+		print myname+" for database, choose ps or pcl"
+		return(1,[])
+
+	command="svn log "+options+protocol+host+svnpath
+	print command
+	lines=svn_run_command(command)
+	return (0,lines)
+
+###################################################################################
+
+if __name__ == "__main__":
+
+	optionsParser=optparse.OptionParser()
+
+	optionsParser.add_option('--pcl','-p',action='store',help="use pcl repository: default ps")
+
+	optionsParser.add_option('--tags','-t',action='store_true',help="default: trunk, tags (releases) if selected")
+	optionsParser.add_option('--release','-v',action='store',help="release version:8.56 for ps")
+	optionsParser.add_option('--revision',action='store',help="revision:HEAD")
+
+	optionsParser.add_option('--command','-c',action='store',help="svn command",default="log")
+
+	options,arguments=optionsParser.parse_args()
+
+	if options.pcl: db='pcl'
+	else:		db='ps'
+
+	tags=options.tags
+	revision=options.revision
+	svn_command=options.command
+
+	return_value,line_list=do_svn_command(db,tags,revision,svn_command)
+
+	if return_value == 0:
+		for line in line_list:
+			print line


Property changes on: tools/build/svn-get-log.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/svn-summary.py
===================================================================
--- tools/build/svn-summary.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/svn-summary.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+
+# svn-summary.py filename
+# generate a nice output:  revision date person summary
+
+import os, sys, re, pickle
+
+revision_filename="revisions.dict"
+date_filename="dates.dict"
+
+def parse_revision(line):
+	line = line.split()
+	revision,discard0,name,discard1,date,time,offset,ld1,ld2,ld3,ld4,discard3,count,line_count=line
+	return [revision,name,date,time]
+
+def svn_summary(filename):
+	global revision_filename, date_filename
+	print filename
+	f=open(filename,'r')
+	revision_line=re.compile("^r[0-9]* \| ")
+	all_lines = f.readlines()
+	state=1
+	summary=list()
+	revision_dict={}
+	date_dict={}
+	for line in all_lines:
+		line=line.strip('\n')
+		if line.startswith("-----------------"):
+			state=1
+			if len(summary) > 0:
+				print revision,name,date,time
+				summary_line=''.join(summary)
+				print summary_line
+				revision_dict[revision]=(revision,name,date,time,summary_line)
+				date_dict[date]=(revision,name,date,time,summary_line)
+		if state == 2:
+			summary.append(line)
+		if revision_line.search(line):
+			(revision,name,date,time)=parse_revision(line)
+			revision=revision.replace("r","")
+			summary=list()
+			state=2
+	f.close
+
+	revision_file=open(revision_filename,'w')
+	pickle.dump(pickle.dumps(revision_dict),revision_file)
+	revision_file.close()
+	
+	date_file=open(date_filename,'w')
+	pickle.dump(pickle.dumps(date_dict),date_file)
+	date_file.close()
+	
+	return 0
+
+args=sys.argv[:]
+
+myself=args.pop(0)
+if len(args) == 0:
+	print "USAGE: "+myself+" filename"
+	print "	filename is usually the output from an \"svn log ...\" command"
+	print "	summarize svn log, and create dictionary files",revision_filename,date_filename
+	print "	dictionary files can be loaded into python, and each has the key in the name"
+	print
+	sys.exit(1)
+
+filename=args.pop(0)
+
+result=svn_summary(filename)
+sys.exit(result)


Property changes on: tools/build/svn-summary.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/svn-update.py
===================================================================
--- tools/build/svn-update.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/svn-update.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1 @@
+svn co svn+ssh://thomasd@svn.ghostscript.com/svn/ghostscript/trunk/gs <destination directory>


Property changes on: tools/build/svn-update.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/syssupport.py
===================================================================
--- tools/build/syssupport.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/syssupport.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+
+import sys
+import os
+
+def exitReturn(value,message):
+	if value != 0:
+		print myname+": ""exit error " + str(value) + " " + message
+		raise RuntimeError
+	sys.exit(value)
+
+def runCommand(command,ignore,doprint):
+	if doprint:
+		print command
+	result=os.system(command)
+	if not ignore and result!= 0: # pay attention to some error returns
+		exitReturn(1,"run error: " + command)
+	return 0


Property changes on: tools/build/syssupport.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/testdate.py
===================================================================
--- tools/build/testdate.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/testdate.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,5 @@
+#!/usr/bin/python
+import datetime
+
+print datetime.date.today()
+


Property changes on: tools/build/testdate.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/testpath.py
===================================================================
--- tools/build/testpath.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/testpath.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1 @@
+import myoptparse


Property changes on: tools/build/testpath.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/build/try.py
===================================================================
--- tools/build/try.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/build/try.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+# try.py revision
+#
+import sys, os, optparse
+
+def exitError(result,message,options):
+	global verbose
+	print myself,message,result
+	sys.exit(result)
+
+def runCommand(command,options):
+	if options.verbose:
+		print command
+	result=os.system(command)
+	return result
+	
+if __name__ == '__main__':
+
+	args=sys.argv
+	myself=args[0]
+	
+	p=optparse.OptionParser()
+	p.add_option('--verbose','-v',action='store_true')
+	p.add_option('--nocleanup','-k',action='store_true')
+	p.add_option('--nosvn','-u',action='store_true')
+	options,arguments=p.parse_args()
+	options.myself=myself
+
+	if len(arguments) == 0:
+		print 'USAGE: '+str(myself)+' testfile revision [device [resolution [banding]]]'
+		sys.exit(1)
+
+	if len(arguments) > 0:
+		testfile=arguments.pop(0)
+	else:
+		testfile="testfile"
+
+	if len(arguments) > 0:
+		revision=arguments.pop(0)
+	else:
+		revision="HEAD"
+
+	if len(arguments) > 0:
+		device=arguments.pop(0)
+	else:
+		device="ppmraw"
+
+	if len(arguments) > 0:
+		resolution=arguments.pop(0)
+	else:
+		resolution="300"
+
+	if len(arguments) > 0:
+		banding=arguments.pop(0)
+	else:
+		banding="0"
+
+	print myself,"testfile",testfile,"revision",revision,"device",device,"resolution",resolution,"banding",banding
+	if options.verbose:
+		print "options.verbose: "+revision
+		options.svn_log=''
+		options.autogen_log=''
+		options.make_log=''
+	else:
+		# capture all output to logs/
+		options.svn_log=    '> logs/'+revision+'.svn.log'
+		options.autogen_log='> logs/'+revision+'.autogen.log'
+		options.make_log=   '> logs/'+revision+'.make.log'
+		
+	testfile_and_revision=' '+testfile+' '+revision
+	print testfile_and_revision
+	
+	command="./run.py"
+	command+=testfile_and_revision
+	command+=" "+device+" "+resolution+" "+banding
+	print command
+	runCommand(command,options)
+	print "run done"
+
+	command='./compare.py'
+	command+=testfile_and_revision
+	command+=" "+device+" "+resolution+" "+banding
+	print command
+	result=runCommand(command,options)
+	print myself,"result from compare.py",result
+	if result != 0:
+		result=1
+	print myself,"result",result
+	sys.exit(result)


Property changes on: tools/build/try.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/python/main.py
===================================================================
--- tools/python/main.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/python/main.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+# -*- Mode: python -*-
+
+import sys, os
+
+if __name__ == "__main__":
+    

Added: tools/python/myoptparse.py
===================================================================
--- tools/python/myoptparse.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/python/myoptparse.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+# -*- Mode: python -*-
+
+#    Copyright (C) 2007 Artifex Software Inc.
+# 
+# This software is provided AS-IS with no warranty, either express or
+# implied.
+# 
+# This software is distributed under license and may not be copied,
+# modified or distributed except as expressly authorized under the terms
+# of the license contained in the file LICENSE in this distribution.
+# 
+# For more information about licensing, please refer to
+# http://www.ghostscript.com/licensing/. For information on
+# commercial licensing, go to http://www.artifex.com/licensing/ or
+# contact Artifex Software, Inc., 101 Lucas Valley Road #110,
+# San Rafael, CA  94903, U.S.A., +1(415)492-9861.
+
+
+import optparse
+import sys, os
+import types
+
+def parseCommandLineBasic(optionsParser=None,args=sys.argv):
+    optionsParser.add_option('--verbose','-v',action='store_true',help="noisy execution")
+
+    myself=os.path.basename(args[0])
+    options,arguments=optionsParser.parse_args()
+    options.myself=myself
+    return (options,arguments)
+
+def parseCommandLine(optionsParser=None,args=sys.argv,revisionSkip=False,testfileSkip=False,listfileSkip=False,deviceSkip=False):
+    if not optionsParser:
+        optionsParser=optparse.OptionParser()
+
+    if not testfileSkip:
+        optionsParser.add_option('--testfile','-t',action='store',help="testfile:\"test\"",default="test")
+
+    if not listfileSkip:
+        optionsParser.add_option('--listfile','-l',action='store',help="listfile:\"list\"",default="list")
+
+    if not revisionSkip:
+        optionsParser.add_option('--revision','-e',action='store',help="revision:HEAD",default="HEAD")
+
+    if not deviceSkip:
+        optionsParser.add_option('--device','-d',action='store',help="output device:ppmraw",default="ppmraw")
+        optionsParser.add_option('--resolution','-r',action='store',help="output resolution:300",default="300")
+        optionsParser.add_option('--banding','-b',action='store',help="output banding:False",default=False)
+
+    optionsParser.add_option('--quiet','-q',action='store_true',help="quiet execution")
+    optionsParser.add_option('--verbose','-v',action='store_true',help="noisy execution")
+
+    optionsParser.add_option('--nocleanup','-k',action='store_true',help="do not delete intermediate files")
+
+    myself=os.path.basename(args[0])
+    options,arguments=optionsParser.parse_args()
+    options.myself=myself
+    return (options,arguments)
+
+if __name__ == "__main__":
+
+    optionsParser=optparse.OptionParser()
+    optionsParser.add_option('--option','-o',action='store_true',help="sample additional option")
+    optionsParser.add_option('--nosvn','-s',action='store_true',help="no not update from svn")
+    optionsParser.add_option('--nomake','-m',action='store_true',help="no not make")
+
+    (options,arguments)=myoptparse.parseCommandLine(optionsParser)
+    print options.revision
+    print options.testfile
+    print arguments
+
+#   (options,arguments)=parseCommandLine(optionsParser,revisionSkip=True)
+#   (options,arguments)=parseCommandLine(optionsParser,revisionSkip=True,testfileSkip=True,listfileSkip=True,deviceSkip=True):


Property changes on: tools/python/myoptparse.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/regression/check_all.py
===================================================================
--- tools/regression/check_all.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/regression/check_all.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+#    Copyright (C) 2002 Aladdin Enterprises.  All rights reserved.
+# 
+# This software is provided AS-IS with no warranty, either express or
+# implied.
+# 
+# This software is distributed under license and may not be copied,
+# modified or distributed except as expressly authorized under the terms
+# of the license contained in the file LICENSE in this distribution.
+# 
+# For more information about licensing, please refer to
+# http://www.ghostscript.com/licensing/. For information on
+# commercial licensing, go to http://www.artifex.com/licensing/ or
+# contact Artifex Software, Inc., 101 Lucas Valley Road #110,
+# San Rafael, CA  94903, U.S.A., +1(415)492-9861.
+
+# $Id: check_all.py,v 1.6 2004/05/02 19:23:01 ray Exp $
+
+# Run all the Ghostscript 'check' tests.
+
+from gstestutils import gsRunTestsMain
+
+def addTests(suite, **args):
+    import check_dirs; check_dirs.addTests(suite, **args)
+    import check_docrefs; check_docrefs.addTests(suite, **args)
+    import check_source; check_source.addTests(suite, **args)
+    import check_comments; check_comments.addTests(suite, **args)
+    
+if __name__ == "__main__":
+    gsRunTestsMain(addTests)


Property changes on: tools/regression/check_all.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/regression/check_comments.py
===================================================================
--- tools/regression/check_comments.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/regression/check_comments.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+
+#    Copyright (C) 2003 artofcode LLC. All rights reserved.
+#
+# This software is provided AS-IS with no warranty, either express or
+# implied.
+# 
+# This software is distributed under license and may not be copied,
+# modified or distributed except as expressly authorized under the terms
+# of the license contained in the file LICENSE in this distribution.
+# 
+# For more information about licensing, please refer to
+# http://www.ghostscript.com/licensing/. For information on
+# commercial licensing, go to http://www.artifex.com/licensing/ or
+# contact Artifex Software, Inc., 101 Lucas Valley Road #110,
+# San Rafael, CA  94903, U.S.A., +1(415)492-9861.
+
+# $Id: check_comments.py 6685 2006-03-27 18:53:39Z ray $
+
+# Check for C++ style comments
+
+import os
+import re
+from glob import glob
+
+import gsconf
+from gstestutils import GSTestCase, gsRunTestsMain
+
+class GSCheckForComments(GSTestCase):
+
+    def __init__(self, root, dirName, extensions=['*'], skip=[]):
+        self.root = root
+        self.dirName = dirName
+        self.extensions = extensions
+        self.skip = skip
+        GSTestCase.__init__(self)
+
+    def shortDescription(self):
+        return "All relevant files must not have C++ style comments"\
+               " (checking %s)" % (self.dirName,)
+
+    def runTest(self):
+        d, extns, skip = self.root + self.dirName, self.extensions, self.skip
+        skip = map((lambda o,d=d: d + os.sep + o), skip)
+        incorrect = []
+        for e in extns:
+            for f in glob(d + os.sep + '*.' + e):
+                if f in skip or os.path.isdir(f):
+                    continue
+                fp = open(f, 'r')
+                text_code = fp.read()
+                fp.close()
+
+                pattern = re.compile("(\\\\.)|(\")|(')|(/\*)|(\*/)|(//)")
+                mi = pattern.finditer(text_code)
+                try:
+                    inComment = 0
+		    inString = 0
+                    inStringSq = 0	# single quoted string
+                    inStringDq = 0	# double quoted string
+                    while 1:
+                        m = mi.next()
+                        mstr = m.group()
+			if mstr[0] == '\\':		# skip quoted characters (may be ' or ")
+			    continue
+                        if mstr == '"' and not inComment and not inStringSq:
+                            inStringDq = not inStringDq
+			    inString = inStringDq
+                            continue
+                        if mstr == "'" and not inComment and not inStringDq:
+                            inStringSq = not inStringSq
+			    inString = inStringSq
+                            continue
+                        if not inString and mstr == '/*':
+                            inComment = 1
+                            continue
+                        if inComment and mstr == '*/':
+                            inComment = 0
+                            continue
+                        if not inString and not inComment and mstr == '//':
+                            incorrect.append(f)
+                            break
+                except StopIteration:
+                    continue
+                    
+        if incorrect:
+            incorrect = ['These %d files have C++ style comments:' % (len(incorrect),)] + incorrect
+
+        self.failIfMessages(incorrect)
+
+## Main stuff
+
+checkDirs = [
+    ('src', ['c', 'h'],
+     # list of exempt files
+     ['dwdll.h',
+      'dwimg.h',
+      'dwinst.h',
+      'dwsetup.h',
+      'dwtext.h',
+      'dwuninst.h',
+      'gdevhpij.c',
+      'dmmain.c',
+      'gdevmac.c',
+      'gdevmacxf.c',
+      'gdevwdib.c',
+      'gp_mac.c',
+      'gp_macio.c',
+      'macsysstat.h'
+     ])
+    ]
+
+def addTests(suite, gsroot, **args):
+    for dir, extns, skip in checkDirs:
+        suite.addTest(GSCheckForComments(gsroot, dir, extns, skip))
+
+if __name__ == "__main__":
+    gsRunTestsMain(addTests)


Property changes on: tools/regression/check_comments.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/regression/check_dirs.py
===================================================================
--- tools/regression/check_dirs.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/regression/check_dirs.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+#    Copyright (C) 2002 Aladdin Enterprises.  All rights reserved.
+# 
+# This software is provided AS-IS with no warranty, either express or
+# implied.
+# 
+# This software is distributed under license and may not be copied,
+# modified or distributed except as expressly authorized under the terms
+# of the license contained in the file LICENSE in this distribution.
+# 
+# For more information about licensing, please refer to
+# http://www.ghostscript.com/licensing/. For information on
+# commercial licensing, go to http://www.artifex.com/licensing/ or
+# contact Artifex Software, Inc., 101 Lucas Valley Road #110,
+# San Rafael, CA  94903, U.S.A., +1(415)492-9861.
+
+# $Id: check_dirs.py 6441 2006-01-06 19:01:15Z giles $
+
+# Check the contents of Ghostscript directories.
+
+import os
+from gstestutils import GSTestCase, gsRunTestsMain
+
+################ Check that there are no files in the top-level directory,
+################ other than a specified list.
+
+class GSCheckEmptyTopDirectory(GSTestCase):
+
+    def __init__(self, root, allowedFiles = []):
+        self.root = root
+        self.allowedFiles = allowedFiles
+        GSTestCase.__init__(self)
+
+    def runTest(self):
+        """The top-level directory must not have extraneous files."""
+        import glob, os.path
+        messages = []
+        for f in glob.glob(os.path.join(self.root, '*')):
+            if not (os.path.isdir(f) or os.path.islink(f) or os.path.basename(f) in self.allowedFiles):
+                messages.append(f)
+	messages.sort()
+        self.failIfMessages(messages)
+
+################ Main program
+
+gsFilesInTopDirectory = ['LICENSE', 'autogen.sh', 'Makefile',
+			 'configure', 'config.log', 'config.status']
+# Add the tests defined in this file to a suite.
+
+def addTests(suite, gsroot, **args):
+    suite.addTest(GSCheckEmptyTopDirectory(gsroot, gsFilesInTopDirectory))
+
+if __name__ == "__main__":
+    gsRunTestsMain(addTests)


Property changes on: tools/regression/check_dirs.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/regression/check_docrefs.py
===================================================================
--- tools/regression/check_docrefs.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/regression/check_docrefs.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,184 @@
+#!/usr/bin/env python
+
+#    Copyright (C) 2002-2004 Aladdin Enterprises.  All rights reserved.
+# 
+# This software is provided AS-IS with no warranty, either express or
+# implied.
+# 
+# This software is distributed under license and may not be copied,
+# modified or distributed except as expressly authorized under the terms
+# of the license contained in the file LICENSE in this distribution.
+# 
+# For more information about licensing, please refer to
+# http://www.ghostscript.com/licensing/. For information on
+# commercial licensing, go to http://www.artifex.com/licensing/ or
+# contact Artifex Software, Inc., 101 Lucas Valley Road #110,
+# San Rafael, CA  94903, U.S.A., +1(415)492-9861.
+
+# $Id: check_docrefs.py,v 1.11 2004/10/26 03:38:25 giles Exp $
+
+# Check that the hrefs in an HTML document mention all of a set of files.
+# The requirement is that the union of all the docfiles must somewhere
+# reference all the files.  Usage:
+#    check_docrefs (+src | +lib | [+-]from <docfile>* | [+-]to (<directory> | <file>)*)*
+
+# +from or +to adds files; -from or -to removes them;
+# +src, +lib, or +tests execute SRC_LIST, LIB_LIST, or TEST_LIST below.
+
+# Define the Ghostscript-specific parameter lists.
+SRC_LIST = [
+    '+from', 'doc/Develop.htm',
+    '+to', 'lib', 'src',
+    '-to', '*/CVS', 'src/rinkj/CVS',
+    '-to', 'src/*.mak.tcl',
+    '-to', 'lib/*.upp',
+    '-to', 'lib/*.ps',
+    '+to', 'lib/gs_*.ps', 'lib/pdf_*.ps'
+]
+LIB_LIST = [
+    '+from', 'doc/Psfiles.htm',
+    '+to', 'examples/*.ps', 'lib/*.ps'
+]
+TEST_LIST = [
+    '+from', 'doc/Testing.htm',
+    '+to', 'toolbin/tests/*',
+    '-to', 'toolbin/tests/check_*.py', 'toolbin/tests/gscheck_*.py',
+    '-to', 'toolbin/tests/*.pyc', 'toolbin/tests/CVS/*'
+]
+
+import glob, os.path, re, sys
+from gstestutils import GSTestCase, gsRunTestsMain
+
+# Utilities
+
+# List all the files referenced from a document.
+# Note that we only count files referenced as a whole, i.e., without #.
+
+def hrefs(doc):
+    prefix = os.path.dirname(doc)
+    fp = open(doc, 'r')
+    contents = fp.read()
+    fp.close()
+    pattern = re.compile('href="([^"#]*)"', re.IGNORECASE)
+    return map(lambda match,pre=prefix:
+                 os.path.normpath(os.path.join(pre, match)),
+               re.findall(pattern, contents))
+
+# Define a class for storing to/from information.
+
+class DocRefs:
+
+    def __init__(self):
+        self.to = {}
+        self.toDir = {}
+        self.From = {}
+
+    def doTo(self, fname, adding):
+        if os.path.isdir(fname):
+            self.toDir[fname] = adding
+            for f in glob.glob(os.path.join(fname, '*')):
+                self.doTo(f, adding)
+        elif os.path.islink(fname):
+            pass
+        elif os.path.isfile(fname):
+            self.to[os.path.normpath(fname)] = adding
+
+    def doFrom(self, fname, adding):
+        self.From[os.path.normpath(fname)] = adding
+
+    def doFromDoc(self, docname, adding):
+        for f in hrefs(docname):
+            self.doFrom(f, adding)
+
+    def cleanup(self):
+        for k in self.to.keys():
+            if self.to[k] == 0: del self.to[k]
+        for k in self.From.keys():
+            if self.From[k] == 0: del self.From[k]
+
+# Process command line arguments and switches.
+
+def mainArgs(arglist, root, fromProc, toProc):
+    for arg in arglist:
+        if arg == '+src':
+            mainArgs(SRC_LIST, root, fromProc, toProc)
+        elif arg == '+lib':
+            mainArgs(LIB_LIST, root, fromProc, toProc)
+        elif arg == '+tests':
+            mainArgs(TEST_LIST, root, fromProc, toProc)
+        elif arg == '+from':
+            do, adding = fromProc, 1
+        elif arg == '-from':
+            do, adding = fromProc, 0
+        elif arg == '+to':
+            do, adding = toProc, 1
+        elif arg == '-to':
+            do, adding = toProc, 0
+        elif re.match('[+-]', arg):
+            print sys.stderr >> 'Unknown switch: ' + arg
+            exit(1)
+        elif arg.find('*') >= 0:
+            for f in glob.glob(os.path.join(root, arg)): do(f, adding)
+        else:
+            do(os.path.join(root, arg), adding)
+
+class GSCheckDocRefs(GSTestCase):
+
+    def __init__(self, root, arglist):
+        self.root = root
+        self.arglist = arglist
+        GSTestCase.__init__(self)
+
+    def _fromDocs(self):
+        refs = DocRefs()
+        mainArgs(self.arglist, self.root,
+                 lambda f,b,refs=refs: refs.doFrom(f, b),
+                 lambda f,b: None)
+        refs.cleanup()
+        return refs.From.keys()
+
+    def shortDescription(self):
+        docs = reduce(lambda a,b: a+' or '+b, self._fromDocs())
+        return docs + ' must reference all relevant files.'
+
+    def runTest(self):
+        refs = DocRefs()
+        mainArgs(self.arglist, self.root,
+                 lambda f,b,refs=refs: refs.doFromDoc(f, b),
+                 lambda f,b,refs=refs: refs.doTo(f, b))
+        refs.cleanup()
+        docs = self._fromDocs()
+        if len(docs) == 1:
+            fromFormat = docs[0] + ' fails to reference these %d files:'
+            toFormat = docs[0] + ' references these %d files that do not exist:'
+        else:
+            fromFormat = 'These %d files are not referenced:'
+            toFormat = 'These %d files are referenced but do not exist:'
+        messages = []
+        noFrom = []
+        for f in refs.to.keys():
+            if not refs.From.has_key(f):
+                noFrom.append(f)
+        if len(noFrom) > 0:
+            messages.append(fromFormat % len(noFrom))
+            noFrom.sort()
+            messages += noFrom
+        noTo = []
+        for f in refs.to.keys():
+            if not refs.to.has_key(f) and refs.toDir.has_key(os.path.dirname(f)):
+                noTo.append(f)
+        if len(noTo) > 0:
+            messages.append(toFormat % len(noTo))
+            noTo.sort()
+            messages += noTo
+        self.failIfMessages(messages)
+
+# Add the tests defined in this file to a suite.
+
+def addTests(suite, gsroot, **args):
+    suite.addTest(GSCheckDocRefs(gsroot, ['+src']))
+    suite.addTest(GSCheckDocRefs(gsroot, ['+lib']))
+    suite.addTest(GSCheckDocRefs(gsroot, ['+tests']))
+
+if __name__ == "__main__":
+    gsRunTestsMain(addTests)


Property changes on: tools/regression/check_docrefs.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/regression/check_source.py
===================================================================
--- tools/regression/check_source.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/regression/check_source.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,149 @@
+#!/usr/bin/env python
+
+#    Copyright (C) 2002-2006 artofcode LLC.  All rights reserved.
+# 
+# This software is provided AS-IS with no warranty, either express or
+# implied.
+# 
+# This software is distributed under license and may not be copied,
+# modified or distributed except as expressly authorized under the terms
+# of the license contained in the file LICENSE in this distribution.
+# 
+# For more information about licensing, please refer to
+# http://www.ghostscript.com/licensing/. For information on
+# commercial licensing, go to http://www.artifex.com/licensing/ or
+# contact Artifex Software, Inc., 101 Lucas Valley Road #110,
+# San Rafael, CA  94903, U.S.A., +1(415)492-9861.
+
+# $Id: check_source.py 6588 2006-02-15 07:30:40Z giles $
+
+# Check basic hygiene of source code.
+
+import os
+from gstestutils import GSTestCase, gsRunTestsMain
+
+################ Check that every file certain to be source has an
+################ Id or RCSfile line.
+
+class GSCheckForIdLines(GSTestCase):
+
+    def __init__(self, root, dirName, extensions = ['*'], skip = []):
+        self.root = root
+        self.dirName = dirName
+        self.extensions = extensions
+        self.skip = skip
+        GSTestCase.__init__(self)
+
+    def shortDescription(self):
+        return "All relevant files must have correct Id or RCSfile lines. (checking %s/)" % self.dirName
+
+    def runTest(self):
+        import re, glob
+        pattern = re.compile("[$][ ]*(Id|RCSfile):[ ]*([^, \t\$]+)")
+        d, extns, omit = self.root + self.dirName, self.extensions, self.skip
+        omit = map((lambda o,d=d: d+'/'+o), omit)
+        missing = []
+        incorrect = []
+        for e in extns:
+            for f in glob.glob(d + '/*.' + e):
+                if f in omit or f[-8:] == '.mak.tcl' or os.path.isdir(f):
+                    continue
+                fp = open(f, 'r')
+                contents = fp.read(10000)
+                fp.close()
+                if len(contents) < 20:  # skip very short files
+                    continue
+                found = pattern.search(contents)
+                if found == None:
+                    missing.append(f)
+                elif found.group(2) != os.path.basename(f):
+                    incorrect.append(f + ' has ' + found.group(1) + ': '+ found.group(2))                    
+        if missing:
+            missing = ['These %d files have no Id or RCSfile line:' % len(missing)] + missing
+        if incorrect:
+            incorrect = ['These %d files have an incorrect Id or RCSfile line:' % len(incorrect)] + incorrect
+        self.failIfMessages(missing + incorrect)
+
+################ Check that all .h files have Ghostscript standard
+################ double-inclusion protection.
+
+class GSCheckDoubleInclusion(GSTestCase):
+
+    def __init__(self, root, skip = []):
+        self.root = root
+        self.skip = map(lambda f,r=self.root: r+f, skip)
+        GSTestCase.__init__(self)
+
+    def runTest(self):
+        """All .h files must have double-inclusion protection."""
+        import re, glob
+        messages = []
+        for fname in glob.glob(self.root + 'src/*.h'):
+            if fname in self.skip:
+                continue
+            # Double inclusion protection is required, but the name of the
+            # preprocessor symbol doesn't have to follow the Ghostscript
+            # convention.
+            fp = open(fname, 'r')
+            found = 0
+            while 1:
+                line = fp.readline()
+                if not line:
+                    break               # EOF
+                line = line.strip()
+                if not line:
+                    continue            # skip blank lines
+                if line[:2] == '//':
+                    continue            # skip single-line comments
+                if re.match(r'\s*\/\*', line): # skip comments
+                    while not re.search(r'\*\/', line):
+                        line = fp.readline()
+                        if not line:
+                            break       # EOF
+                    if not line:
+                        break           # EOF
+                    continue
+                m = re.match(r'#[ ]*if(ndef[ ]+([a-zA-Z0-9_]+)|[ ]+!defined\(([a-zA-Z0-9_]+)\))$', line)
+                if m:
+                    # Check for #define in the next line.
+                    sym = m.group(2) or m.group(3)
+                    line = fp.readline().strip()
+                    if re.match(r'#[ ]*define[ ]+' + sym + r'[\s]*$', line):
+                        found = 1
+                        break
+                break                   # no protection
+            fp.close()
+            if not found:
+                messages.append(fname)
+        if messages:
+            messages = ['These %d files do not have double-inclusion protection:' % len(messages)] + messages
+        self.failIfMessages(messages)
+
+################ Main program
+
+gsSourceSets = [
+    ('doc', ['*'], ['Changes.htm', 'gsdoc.el', 'FTL.txt']),
+    ('lib', ['eps', 'ps'], []),
+    ('man', ['*'], []),
+    ('src', ['c', 'cpp', 'h', 'mak'], []),
+    ('toolbin', ['*'], ['pre.chk'])
+    ]
+gsDoubleInclusionOK = [
+    'src/gconf.h',
+    'src/gxdtfill.h',
+    'src/gxfillsl.h',
+    'src/gxfilltr.h',
+    'src/gxfillts.h',
+    'src/gxsamplp.h',
+    'src/gdevpdfb.h'
+    ]
+
+# Add the tests defined in this file to a suite.
+
+def addTests(suite, gsroot, **args):
+    for dir, extns, skip in gsSourceSets:
+        suite.addTest(GSCheckForIdLines(gsroot, dir, extns, skip))
+    suite.addTest(GSCheckDoubleInclusion(gsroot, gsDoubleInclusionOK))
+
+if __name__ == "__main__":
+    gsRunTestsMain(addTests)


Property changes on: tools/regression/check_source.py
___________________________________________________________________
Name: svn:executable
   + *

Added: tools/regression/collate.py
===================================================================
--- tools/regression/collate.py	2007-04-06 15:58:56 UTC (rev 7829)
+++ tools/regression/collate.py	2007-04-06 20:47:10 UTC (rev 7830)
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+import os, time
+
+command="dump_baseline_plus.py "
+
+now=time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime())
+YESTERDAY = time.strftime("%Y%m%d", time.localtime(time.time() - (24*60*60)))
+
+collate_filename='collate.'+now
+collate_sort_filename='collate.sort.'+now
+
+commandfull=command+"baseline.db >"+collate_filename
+print commandfull
+os.system(commandfull)
+
+commandfull=command+"