update-maintainer: Add a --quiet option.

This commit is contained in:
Benjamin Drung 2010-07-30 03:51:33 +02:00
parent 7d53fbf9df
commit dcaab5fc47
3 changed files with 22 additions and 6 deletions

3
debian/changelog vendored
View File

@ -18,6 +18,7 @@ ubuntu-dev-tools (0.101) UNRELEASED; urgency=low
version for debian versions that contain more than one dash.
- Prepend script name to every output
- Output every executed command in verbose mode
* update-maintainer: Add a --quiet option.
[ Michael Bienia ]
* ubuntutools/lpapi/lpapicache.py: Use the new LP API method
@ -27,7 +28,7 @@ ubuntu-dev-tools (0.101) UNRELEASED; urgency=low
* requestsync: Fix bug where the variable 'hasLP' is not always set
(lp: #607874).
-- Benjamin Drung <bdrung@ubuntu.com> Fri, 30 Jul 2010 03:26:59 +0200
-- Benjamin Drung <bdrung@ubuntu.com> Fri, 30 Jul 2010 03:51:02 +0200
ubuntu-dev-tools (0.100) maverick; urgency=low

View File

@ -325,6 +325,8 @@ def sync_dsc(script_name, dscurl, debian_dist, release, name, email, bugs, keyid
# update the Maintainer field
cmd = ["update-maintainer"]
if not verbose:
cmd.append("-q")
if verbose:
print_command(script_name, cmd)
subprocess.check_call(cmd)

View File

@ -26,11 +26,20 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import optparse
import os
import re
import sys
import ubuntutools.packages
script_name = os.path.basename(sys.argv[0])
usage = "%s [options]" % (script_name)
epilog = "See %s(1) for more info." % (script_name)
parser = optparse.OptionParser(usage=usage, epilog=epilog)
parser.add_option("-q", "--quiet", help="print no informational messages",
dest="quiet", action="store_true", default=False)
(options, args) = parser.parse_args()
valid_locations = ["debian/control.in", "control.in", "debian/control", "control"]
control_file_found = False
@ -67,13 +76,15 @@ maintainer_name = maintainer_field[0][1]
maintainer_mail = maintainer_field[0][2]
if maintainer_mail.find("@ubuntu.com") != -1:
print "Maintainer email is set to an @ubuntu.com address - doing nothing."
if not options.quiet:
print "Maintainer email is set to an @ubuntu.com address - doing nothing."
sys.exit(0)
# Check if Maintainer field is as approved in TB decision.
if 'Ubuntu Developers' in maintainer_name and \
'<ubuntu-devel-discuss@lists.ubuntu.com>' in maintainer_mail:
print "Ubuntu Developers is already set as maintainer."
if not options.quiet:
print "Ubuntu Developers is already set as maintainer."
sys.exit(0)
if not (ubuntutools.packages.checkIsInDebian(package_name, 'unstable') or ubuntutools.packages.checkIsInDebian(package_name, 'experimental')):
@ -105,14 +116,16 @@ if not "lists.ubuntu.com" in original_maintainer:
original_maintainer_fields = re.findall('(.*Original-Maintainer): (.*)', file_contents)
if len(original_maintainer_fields) > 0:
for original_maintainer_field in original_maintainer_fields:
print "Removing existing %s: %s" % original_maintainer_field
if not options.quiet:
print "Removing existing %s: %s" % original_maintainer_field
file_contents = re.sub('.*Original-Maintainer: .*\n', "", file_contents)
final_addition = "Maintainer: " + target_maintainer + "\nXSBC-Original-Maintainer: " + original_maintainer
else:
final_addition = "Maintainer: " + target_maintainer
print "The original maintainer for this package is: " + original_maintainer
print "Resetting as: " + target_maintainer
if not options.quiet:
print "The original maintainer for this package is: " + original_maintainer
print "Resetting as: " + target_maintainer
# Replace text.
debian_control_file = open(control_file, "w")