Fix dry run bug and change name of filesChanged variable

This commit is contained in:
Joel Sherrill 2012-03-12 08:34:29 -05:00
parent 7326d96457
commit e1da9dc5b5

View File

@ -50,7 +50,7 @@ isDiffMode = False
isEarlyExit = False isEarlyExit = False
isOnlyMakefile = False isOnlyMakefile = False
tempFile = "/tmp/tmp_FBRT" tempFile = "/tmp/tmp_FBRT"
filesChanged = 0 filesProcessed = 0
def usage(): def usage():
print "freebsd-to-rtems.py [args]" print "freebsd-to-rtems.py [args]"
@ -67,7 +67,8 @@ def usage():
# Parse the arguments # Parse the arguments
def parseArguments(): def parseArguments():
global RTEMS_DIR, FreeBSD_DIR global RTEMS_DIR, FreeBSD_DIR
global isVerbose, isForward, isEarlyExit, isOnlyMakefile, isDiffMode global isVerbose, isForward, isDryRun, isEarlyExit
global isOnlyMakefile, isDiffMode
try: try:
opts, args = getopt.getopt(sys.argv[1:], "?hdDemRr:f:v", opts, args = getopt.getopt(sys.argv[1:], "?hdDemRr:f:v",
["help", ["help",
@ -94,7 +95,7 @@ def parseArguments():
usage() usage()
sys.exit() sys.exit()
elif o in ("-d", "--dry-run"): elif o in ("-d", "--dry-run"):
isForward = False isDryRun = True
elif o in ("-D", "--diff"): elif o in ("-D", "--diff"):
isDiffMode = True isDiffMode = True
elif o in ("-e", "--early-exit"): elif o in ("-e", "--early-exit"):
@ -165,11 +166,11 @@ def mapCPUDependentPath(path):
# compare and process file only if different # compare and process file only if different
# + copy or diff depending on execution mode # + copy or diff depending on execution mode
def processIfDifferent(new, old, desc, src): def processIfDifferent(new, old, desc, src):
global filesChanged global filesProcessed
# print new + " " + old + " X" + desc + "X " + src # print new + " " + old + " X" + desc + "X " + src
if not os.path.exists(old) or \ if not os.path.exists(old) or \
filecmp.cmp(new, old, shallow=False) == False: filecmp.cmp(new, old, shallow=False) == False:
filesChanged += 1 filesProcessed += 1
if isDiffMode == False: if isDiffMode == False:
# print "Move " + new + " to " + old # print "Move " + new + " to " + old
if isDryRun == False: if isDryRun == False:
@ -1878,7 +1879,7 @@ else:
# Print a summary if changing files # Print a summary if changing files
if isDiffMode == False: if isDiffMode == False:
if filesChanged == 1: if filesProcessed == 1:
print str(filesChanged) + " file was changed." print str(filesProcessed) + " file was changed."
else: else:
print str(filesChanged) + " files were changed." print str(filesProcessed) + " files were changed."