Bug 988611 - update relman scripts based on notes from first usage. r=hwine FIREFOX_24_5_0esr_BUILD1 FIREFOX_24_5_0esr_RELEASE
authorRail Aliiev <rail@mozilla.com>
Mon, 21 Apr 2014 18:03:10 -0400
changeset 4545 6bc50972c7c0d3594f3e463a2fbc6b80626e1390
parent 4544 0d2596312339cd1041e530004ed3234324ca0809
child 4546 987b5f7ed12738d789e6c6f080b47da6a692836c
push id3337
push userraliiev@mozilla.com
push dateMon, 21 Apr 2014 22:03:19 +0000
Bug 988611 - update relman scripts based on notes from first usage. r=hwine
--- a/release/beta2release.py
+++ b/release/beta2release.py
@@ -41,31 +41,48 @@ def replace(file_name, from_, to_):
 def strip_outgoing(dest):
         run_cmd(["hg", "strip", "--no-backup", "outgoing()"], cwd=dest)
     except Exception:
         log.warn("Ignoring strip error in %s", dest)
+def remove_locales(file_name, locales):
+    _, tmp_file_path = mkstemp()
+    with open(file_name) as f:
+        lines = f.readlines()
+    with open(tmp_file_path, "w") as out:
+        for line in lines:
+            locale = line.split()[0]
+            if locale not in locales:
+                out.write(line)
+            else:
+                log.warn("Removied locale: %s", locale)
+    shutil.move(tmp_file_path, file_name)
 def main():
     logging.basicConfig(format="%(asctime)s - %(message)s", level=logging.INFO)
     parser = argparse.ArgumentParser()
     parser.add_argument("--from-dir", default="mozilla-beta",
                         help="Working directory of repo to be merged from")
                         help="Repo to be merged from")
     parser.add_argument("--to-dir", default="mozilla-release",
                         help="Working directory of repo to be merged to")
         "--to-repo", default="ssh://hg.mozilla.org/releases/mozilla-release",
         help="Repo to be merged to")
     parser.add_argument("--hg-user", default="ffxbld <release@mozilla.com>",
                         help="Mercurial username to be passed to hg -u")
+    parser.add_argument("--remove-locale", dest="remove_locales", action="append",
+                        required=True,
+                        help="Locales to be removed from release shipped-locales")
     args = parser.parse_args()
     from_dir = args.from_dir
     to_dir = args.to_dir
     from_repo = args.from_repo
     to_repo = args.to_repo
     hg_user = args.hg_user
@@ -106,19 +123,22 @@ def main():
     for d in branding_dirs:
         for f in branding_files:
                 path.join(to_dir, d, f),
                 "ac_add_options --with-branding=mobile/android/branding/beta",
                 "ac_add_options --with-branding=mobile/android/branding/official")
-    log.warn("Now, go edit any mozilla-release/browser/locales/shipped-locales "
-             "file if you need to remove some beta locales (eg: mn, sw)")
-    log.warn("Also apply any manual edits, such as disabling features.")
+    if args.remove_locales:
+        log.info("Removing locales: %s", args.remove_locales)
+        remove_locales(path.join(to_dir, "browser/locales/shipped-locales"),
+                       args.remove_locales)
+    log.warn("Apply any manual changes, such as disabling features.")
     raw_input("Hit 'return' to display channel, branding, and feature diffs onscreen")
     run_cmd(["hg", "diff"], cwd=to_dir)
     raw_input("If the diff looks good hit return to commit those changes")
     commit(to_dir, user=hg_user,
            msg="Update configs. CLOSED TREE a=release")
     raw_input("Go ahead and push mozilla-release changes.")
 if __name__ == "__main__":