Skip to content

Commit

Permalink
Bug 782784 - client.py update_nss and update_nspr should toggle the t…
Browse files Browse the repository at this point in the history
…railing whitespace line, r=glandium
  • Loading branch information
kaie committed Aug 16, 2012
1 parent 8f5728f commit f79eb1e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ def do_cvs_export(modules, tag, cvsroot, cvs):
cwd=os.path.join(topsrcdir, parent))
print "CVS export end: " + datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")

def toggle_trailing_blank_line(depname):
"""If the trailing line is empty, then we'll delete it.
Otherwise we'll add a blank line."""
lines = open(depname, "r").readlines()
if not lines:
print >>sys.stderr, "unexpected short file"
return

if not lines[-1].strip():
# trailing line is blank, removing it
open(depname, "w").writelines(lines[:-1])
else:
# adding blank line
open(depname, "a").write("\n")

o = OptionParser(usage="client.py [options] update_nspr tagname | update_nss tagname | update_libffi tagname | update_webidlparser tagname")
o.add_option("--skip-mozilla", dest="skip_mozilla",
action="store_true", default=False,
Expand Down Expand Up @@ -114,13 +129,15 @@ def do_cvs_export(modules, tag, cvsroot, cvs):
options.cvsroot = os.environ.get('CVSROOT', CVSROOT_MOZILLA)
do_cvs_export(NSPR_DIRS, tag, options.cvsroot, options.cvs)
print >>file("nsprpub/TAG-INFO", "w"), tag
toggle_trailing_blank_line("nsprpub/config/prdepend.h")
elif action in ('update_nss'):
tag, = args[1:]
if not options.cvsroot:
options.cvsroot = os.environ.get('CVSROOT', CVSROOT_MOZILLA)
do_cvs_export(NSS_DIRS, tag, options.cvsroot, options.cvs)
print >>file("security/nss/TAG-INFO", "w"), tag
print >>file("security/nss/TAG-INFO-CKBI", "w"), tag
toggle_trailing_blank_line("security/coreconf/coreconf.dep")
elif action in ('update_nssckbi'):
tag, = args[1:]
if not options.cvsroot:
Expand Down

0 comments on commit f79eb1e

Please sign in to comment.