149 from optparse
import OptionParser
151 parser = OptionParser(
152 description=
"Produce a patch file from a CMT project. "
153 "The patch contains the changes with respect "
154 "to the CVS repository, including new files "
155 "that are present only locally. Run the script "
156 "from the cmt directory of a package."
165 help=
"Pattern to exclude new files from the patch",
172 help=
"Name of the file to send the output to. Standard "
173 "output is used if not specified",
179 help=
"Print some progress information on standard error",
182 "--debug", action=
"store_true", help=
"Print debug information on standard error"
184 parser.set_defaults(exclusions=[])
186 opts, args = parser.parse_args()
189 logging.basicConfig(level=logging.DEBUG)
191 logging.basicConfig(level=logging.INFO)
204 "cmt/install*.history",
213 "i686-slc[34567]-[ig]cc*",
214 "i686-slc[34567]-clang*",
215 "x86_64-slc[34567]-[ig]cc*",
216 "x86_64-slc[34567]-clang*",
219 if "CMTCONFIG" in os.environ:
220 opts.exclusions.append(os.environ[
"CMTCONFIG"])
223 if not (os.path.basename(os.getcwd()) ==
"cmt" and os.path.exists(
"requirements")):
225 "This script must be executed from the cmt directory of a package."
234 for name, path
in pkgs:
237 "Processing %s from %s (%d/%d)",
239 os.path.dirname(path),
243 patch +=
diff_pkg(name, path, opts.exclusions)
245 if sys.platform.startswith(
"win"):
247 patch = patch.replace(
"\r",
"")
250 logging.info(
"Writing patch file %r", opts.output)
251 open(opts.output,
"w").write(patch)
253 sys.stdout.write(patch)