9 packageDir = os.path.dirname(path).replace(base,
"")
10 outPackageDir = os.path.join(outDir, packageDir)
11 if not os.path.isdir(outPackageDir):
12 os.makedirs(outPackageDir)
17 parser = argparse.ArgumentParser(
""" 18 Take two release directories and analyze the contents to find differences. 19 Input: later release, earlier release, output directory 20 Output: A directory structure in --out which contains directories for packages 21 which have differences. Sub-directory structure is maintained. Three types of 22 files will exist in the structure. The later type is _diff.txt which shows 23 the differences in unified diff format. The other two types end with _added and 24 _removed for files which were added/removed between the earlier and later 27 parser.add_argument(
'--later',
'-L', type=str, required=
True, help=
""" 28 "Later" of the two releases, files in this release but not the earlier 29 will show up as _added""")
30 parser.add_argument(
'--earlier',
'-E', type=str, required=
True, help=
""" 31 "Earlier" of the two releases, files in this release but not the earlier 32 will show up as _removed.""")
33 parser.add_argument(
'--out',
'-o', type=str, required=
True, help=
""" 34 Output directory for all differences. Output will mirror release directory 38 ignoreStrings = [
"CMakeLists.txt",
"_dict.cc"]
40 args = parser.parse_args()
43 later = os.path.join(args.later,
"")
44 earlier = os.path.join(args.earlier,
"")
48 laterBase = os.path.basename(os.path.dirname(later))
49 earlierBase = os.path.basename(os.path.dirname(earlier))
52 for directory
in [later,earlier]:
53 if not os.path.isdir(directory):
54 raise Exception(
"Error -- directory not found: " + directory)
56 for root, dirs, files
in os.walk(later, topdown=
True):
59 if "Linux2.6" in root:
64 for string
in ignoreStrings:
65 if string
in name: ignore =
True 69 laterPath = os.path.join(root, name)
70 earlierPath = laterPath.replace(later, earlier)
71 if not os.path.isfile(earlierPath):
73 outFilePath = os.path.join(outPackageDir, name +
"_added")
77 laterLines =
open(laterPath,
'r').readlines() 78 earlierLines = open(earlierPath, 'r').readlines() 80 diff = list(difflib.unified_diff(earlierLines, laterLines, 81 fromfile=earlierBase, tofile=laterBase)) 84 outFilePath = os.path.join(outPackageDir, name +
"_diff")
85 open(outFilePath,
'w').writelines(diff)
91 for root, dirs, files
in os.walk(earlier, topdown=
True):
94 if "Linux2.6" in root:
100 for string
in ignoreStrings:
101 if string
in name: ignore =
True 105 earlierPath = os.path.join(root, name)
106 laterPath = earlierPath.replace(earlier, later)
107 if not os.path.isfile(laterPath):
109 outFilePath = os.path.join(outPackageDir, name +
"_removed")
def getPackageDirAndMake(path, base, outDir)
procfile open("FD_BRL_v0.txt")
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception