- sys.stderr.write("E: need at least one package name as an argument.\n");
- sys.exit(1);
- if Cnf["Melanie::Options::Architecture"] and Cnf["Melanie::Options::Source-Only"]:
- sys.stderr.write("E: can't use -a/--architecutre and -S/--source-only options simultaneously.\n");
- sys.exit(1);
- if Cnf["Melanie::Options::Binary-Only"] and Cnf["Melanie::Options::Source-Only"]:
- sys.stderr.write("E: can't use -b/--binary-only and -S/--source-only options simultaneously.\n");
- sys.exit(1);
- if Cnf["Melanie::Options::Architecture"] and not Cnf["Melanie::Options::Partial"]:
- sys.stderr.write("W: -a/--architecture implies -p/--partial.\n");
- Cnf["Melanie::Options::Partial"] = "true";
+ utils.fubar("need at least one package name as an argument.");
+ if Options["Architecture"] and Options["Source-Only"]:
+ utils.fubar("can't use -a/--architecutre and -S/--source-only options simultaneously.");
+ if Options["Binary-Only"] and Options["Source-Only"]:
+ utils.fubar("can't use -b/--binary-only and -S/--source-only options simultaneously.");
+ if Options.has_key("Carbon-Copy") and not Options.has_key("Done"):
+ utils.fubar("can't use -C/--carbon-copy without also using -d/--done option.");
+ if Options["Architecture"] and not Options["Partial"]:
+ utils.warn("-a/--architecture implies -p/--partial.");
+ Options["Partial"] = "true";
+
+ # Process -C/--carbon-copy
+ #
+ # Accept 3 types of arguments (space separated):
+ # 1) a number - assumed to be a bug number, i.e. nnnnn@bugs.debian.org
+ # 2) the keyword 'package' - cc's $arch@packages.debian.org for every argument
+ # 3) contains a '@' - assumed to be an email address, used unmofidied
+ #
+ carbon_copy = ""
+ for copy_to in string.split(Options.get("Carbon-Copy")):
+ if utils.str_isnum(copy_to):
+ carbon_copy = carbon_copy + copy_to + "@" + Cnf["Dinstall::BugServer"] + ", "
+ elif copy_to == 'package':
+ for package in arguments:
+ carbon_copy = carbon_copy + package + "@" + Cnf["Dinstall::PackagesServer"] + ", "
+ elif '@' in copy_to:
+ carbon_copy = carbon_copy + copy_to + ", "
+ else:
+ utils.fubar("Invalid -C/--carbon-copy argument '%s'; not a bug number, 'package' or email address." % (copy_to));
+ # Make it a real email header
+ if carbon_copy != "":
+ carbon_copy = "Cc: " + carbon_copy[:-2] + '\n'