bug 1442306 - move build info.txt generation into informulate.py. r?build draft
authorTed Mielczarek <ted@mielczarek.org>
Thu, 26 Apr 2018 15:24:02 -0400
changeset 790205 844e894d920cbb88c79187ceb9dac2765e6397a9
parent 790204 9752a07a1ddaa01cdbee3af7e8013c81614afffa
child 790206 fa5131dcb900e47ba51c09be7e59509898eb77d2
push id108449
push userbmo:ted@mielczarek.org
push dateTue, 01 May 2018 17:51:29 +0000
reviewersbuild
bugs1442306
milestone61.0a1
bug 1442306 - move build info.txt generation into informulate.py. r?build This script is already doing most of the work, so make it write the text file instead of using shell commands. MozReview-Commit-ID: HfFTlNaPSst
toolkit/mozapps/installer/informulate.py
toolkit/mozapps/installer/packager.mk
--- a/toolkit/mozapps/installer/informulate.py
+++ b/toolkit/mozapps/installer/informulate.py
@@ -11,36 +11,41 @@ from __future__ import unicode_literals
 from argparse import ArgumentParser
 import json
 import buildconfig
 import os
 
 
 def main():
     parser = ArgumentParser()
-    parser.add_argument('output', help='Output file')
+    parser.add_argument('output_json', help='Output JSON file')
+    parser.add_argument('output_txt', help='Output text file')
     # TODO: Move package-name.mk variables into moz.configure.
     parser.add_argument('pkg_platform', help='Package platform identifier')
     args = parser.parse_args()
 
     important_substitutions = [
         'target_alias', 'target_cpu', 'target_os', 'target_vendor',
         'host_alias', 'host_cpu', 'host_os', 'host_vendor',
         'MOZ_UPDATE_CHANNEL', 'MOZ_APP_VENDOR', 'MOZ_APP_NAME',
         'MOZ_APP_VERSION', 'MOZ_APP_MAXVERSION', 'MOZ_APP_ID',
         'CC', 'CXX', 'AS', 'MOZ_SOURCE_REPO',
     ]
 
     all_key_value_pairs = {x.lower(): buildconfig.substs[x]
                            for x in important_substitutions}
+    build_id = os.environ['MOZ_BUILD_DATE']
     all_key_value_pairs.update({
-        'buildid': os.environ['MOZ_BUILD_DATE'],
+        'buildid': build_id,
         'moz_source_stamp': buildconfig.substs['MOZ_SOURCE_CHANGESET'],
         'moz_pkg_platform': args.pkg_platform,
     })
 
-    with open(args.output, 'wb') as f:
+    with open(args.output_json, 'wb') as f:
         json.dump(all_key_value_pairs, f, indent=2, sort_keys=True)
         f.write('\n')
 
+    with open(args.output_txt, 'wb') as f:
+        f.write('buildID={}\n'.format(build_id))
+
 
 if __name__ == '__main__':
     main()
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -101,18 +101,17 @@ make-sourcestamp-file::
 ifdef MOZ_INCLUDE_SOURCE_INFO
 	@awk '$$2 == "MOZ_SOURCE_URL" {print $$3}' $(DEPTH)/source-repo.h >> $(MOZ_SOURCESTAMP_FILE)
 endif
 
 .PHONY: make-buildinfo-file
 make-buildinfo-file:
 ifdef MOZ_AUTOMATION
 	$(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/informulate.py \
-		$(MOZ_BUILDINFO_FILE) $(MOZ_PKG_PLATFORM)
-	echo "buildID=$(BUILDID)" > $(MOZ_BUILDID_INFO_TXT_FILE)
+		$(MOZ_BUILDINFO_FILE) $(MOZ_BUILDID_INFO_TXT_FILE) $(MOZ_PKG_PLATFORM)
 endif
 
 .PHONY: make-mozinfo-file
 make-mozinfo-file:
 	cp $(DEPTH)/mozinfo.json $(MOZ_MOZINFO_FILE)
 
 # The install target will install the application to prefix/lib/appname-version
 install:: prepare-package