149 from optparse
import OptionParser
150 parser = OptionParser(
151 description=
"Produce a patch file from a CMT project. "
152 "The patch contains the changes with respect "
153 "to the CVS repository, including new files "
154 "that are present only locally. Run the script "
155 "from the cmt directory of a package.")
163 help=
"Pattern to exclude new files from the patch")
169 help=
"Name of the file to send the output to. Standard "
170 "output is used if not specified")
175 help=
"Print some progress information on standard error")
179 help=
"Print debug information on standard error")
180 parser.set_defaults(exclusions=[])
182 opts, args = parser.parse_args()
185 logging.basicConfig(level=logging.DEBUG)
187 logging.basicConfig(level=logging.INFO)
200 "cmt/install*.history",
209 "i686-slc[34567]-[ig]cc*",
210 "i686-slc[34567]-clang*",
211 "x86_64-slc[34567]-[ig]cc*",
212 "x86_64-slc[34567]-clang*",
215 if "CMTCONFIG" in os.environ:
216 opts.exclusions.append(os.environ[
"CMTCONFIG"])
219 if not (os.path.basename(os.getcwd()) ==
"cmt"
220 and os.path.exists(
"requirements")):
222 "This script must be executed from the cmt directory of a package."
231 for name, path
in pkgs:
233 logging.info(
"Processing %s from %s (%d/%d)", name,
234 os.path.dirname(path), count, num_pkgs)
235 patch +=
diff_pkg(name, path, opts.exclusions)
237 if sys.platform.startswith(
"win"):
239 patch = patch.replace(
"\r",
"")
242 logging.info(
"Writing patch file %r", opts.output)
243 open(opts.output,
"w").write(patch)
245 sys.stdout.write(patch)