139 from optparse
import OptionParser
140 parser = OptionParser(
141 description=
"Produce a patch file from a CMT project. " 142 "The patch contains the changes with respect " 143 "to the CVS repository, including new files " 144 "that are present only locally. Run the script " 145 "from the cmt directory of a package.")
153 help=
"Pattern to exclude new files from the patch")
159 help=
"Name of the file to send the output to. Standard " 160 "output is used if not specified")
165 help=
"Print some progress information on standard error")
169 help=
"Print debug information on standard error")
170 parser.set_defaults(exclusions=[])
172 opts, args = parser.parse_args()
175 logging.basicConfig(level=logging.DEBUG)
177 logging.basicConfig(level=logging.INFO)
190 "cmt/install*.history",
199 "i686-slc[34567]-[ig]cc*",
200 "i686-slc[34567]-clang*",
201 "x86_64-slc[34567]-[ig]cc*",
202 "x86_64-slc[34567]-clang*",
205 if "CMTCONFIG" in os.environ:
206 opts.exclusions.append(os.environ[
"CMTCONFIG"])
209 if not (os.path.basename(os.getcwd()) ==
"cmt" 210 and os.path.exists(
"requirements")):
212 "This script must be executed from the cmt directory of a package." 221 for name, path
in pkgs:
223 logging.info(
"Processing %s from %s (%d/%d)", name,
224 os.path.dirname(path), count, num_pkgs)
225 patch +=
diff_pkg(name, path, opts.exclusions)
227 if sys.platform.startswith(
"win"):
229 patch = patch.replace(
"\r",
"")
232 logging.info(
"Writing patch file %r", opts.output)
233 open(opts.output,
"w").write(patch)
235 sys.stdout.write(patch)
def diff_pkg(name, cmtdir, exclusions=[])