Bug 1087104 - Implement partial mar generation in make for 'mach build'; r=glandium

This commit is contained in:
Mike Shal 2014-10-24 18:24:33 -04:00
parent 97849dc7c0
commit 0ed4e53eeb
3 changed files with 38 additions and 9 deletions

View File

@ -29,14 +29,15 @@ def getFileHashAndSize(filename):
return (sha512Hash, size)
def getMarProperties(filename):
def getMarProperties(filename, partial=False):
if not os.path.exists(filename):
return {}
(complete_mar_hash, complete_mar_size) = getFileHashAndSize(filename)
(mar_hash, mar_size) = getFileHashAndSize(filename)
martype = 'partial' if partial else 'complete'
return {
'completeMarFilename': os.path.basename(filename),
'completeMarSize': complete_mar_size,
'completeMarHash': complete_mar_hash,
'%sMarFilename' % martype: os.path.basename(filename),
'%sMarSize' % martype: mar_size,
'%sMarHash' % martype: mar_hash,
}
def getUrlProperties(filename):
@ -52,6 +53,7 @@ def getUrlProperties(filename):
('robocopApkUrl', lambda m: m.endswith('apk') and 'robocop' in m),
('jsshellUrl', lambda m: 'jsshell-' in m and m.endswith('.zip')),
('completeMarUrl', lambda m: m.endswith('.complete.mar')),
('partialMarUrl', lambda m: m.endswith('.mar') and '.partial.' in m),
# packageUrl must be last!
('packageUrl', lambda m: True),
]
@ -79,12 +81,17 @@ if __name__ == '__main__':
parser.add_argument("--complete-mar-file", required=True,
action="store", dest="complete_mar_file",
help="Path to the complete MAR file, relative to the objdir.")
parser.add_argument("--partial-mar-file", required=False,
action="store", dest="partial_mar_file",
help="Path to the partial MAR file, relative to the objdir.")
parser.add_argument("--upload-output", required=True,
action="store", dest="upload_output",
help="Path to the text output of 'make upload'")
args = parser.parse_args()
json_data = getMarProperties(args.complete_mar_file)
if args.partial_mar_file:
json_data.update(getMarProperties(args.partial_mar_file, partial=True))
json_data.update(getUrlProperties(args.upload_output))
with open('mach_build_properties.json', 'w') as outfile:

View File

@ -86,7 +86,7 @@ automation/l10n-check: automation/pretty-l10n-check
automation/update-packaging: automation/pretty-update-packaging
automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS))
$(PYTHON) $(topsrcdir)/build/gen_mach_buildprops.py --complete-mar-file $(DIST)/$(COMPLETE_MAR) --upload-output $(AUTOMATION_UPLOAD_OUTPUT)
$(PYTHON) $(topsrcdir)/build/gen_mach_buildprops.py --complete-mar-file $(DIST)/$(COMPLETE_MAR) $(addprefix --partial-mar-file ,$(wildcard $(DIST)/$(PARTIAL_MAR))) --upload-output $(AUTOMATION_UPLOAD_OUTPUT)
# We need the log from make upload to grep it for urls in order to set
# properties.

View File

@ -31,7 +31,7 @@ MAR_BIN = $(LIBXUL_DIST)/host/bin/mar$(HOST_BIN_SUFFIX)
MBSDIFF_BIN = $(LIBXUL_DIST)/host/bin/mbsdiff$(HOST_BIN_SUFFIX)
OVERRIDE_DEFAULT_GOAL := full-update
full-update:: complete-patch
full-update:: complete-patch $(if $(MOZ_AUTOMATION_UPDATE_PACKAGING),automation-partial-patch)
ifeq ($(OS_TARGET), WINNT)
MOZ_PKG_FORMAT := SFX7Z
@ -61,10 +61,10 @@ ifeq ($(OS_TARGET), WINNT)
endif
MAR=$(MAR_BIN) \
$(srcdir)/make_full_update.sh \
'$(STAGE_DIR)/$(PKG_UPDATE_BASENAME).complete.mar' \
'$(DIST)/$(COMPLETE_MAR)' \
'$(PACKAGE_DIR)'
ifdef MOZ_SIGN_CMD
$(MOZ_SIGN_CMD) -f mar '$(STAGE_DIR)/$(PKG_UPDATE_BASENAME).complete.mar'
$(MOZ_SIGN_CMD) -f mar '$(DIST)/$(COMPLETE_MAR)'
endif
partial-patch:: $(dir-stage)
@ -77,3 +77,25 @@ partial-patch:: $(dir-stage)
ifdef MOZ_SIGN_CMD
$(MOZ_SIGN_CMD) -f mar '$(STAGE_DIR)/$(PKG_UPDATE_BASENAME).partial.$(SRC_BUILD_ID)-$(DST_BUILD_ID).mar'
endif
automation-partial-patch: complete-patch
rm -rf current current.work previous
mkdir current previous
latestmar=$$(ssh -l $(UPLOAD_USER) -i $(UPLOAD_SSH_KEY) $(UPLOAD_HOST) 'ls -1t $(LATEST_MAR_DIR) | grep $(MOZ_PKG_PLATFORM).complete.mar$$ | head -n 1'); \
if test -n "$$latestmar"; then \
wget -O $(STAGE_DIR)/previous.mar http://$(UPLOAD_HOST)/$(LATEST_MAR_DIR)/$$latestmar && \
(cd previous; \
MAR=$(MAR_BIN) perl $(topsrcdir)/tools/update-packaging/unwrap_full_update.pl '../$(STAGE_DIR)/previous.mar') && \
(cd current; \
MAR=$(MAR_BIN) perl $(topsrcdir)/tools/update-packaging/unwrap_full_update.pl '../$(DIST)/$(COMPLETE_MAR)') && \
find current -name \*.pgc -print -delete && \
find previous -name \*.pgc -print -delete && \
rm -f $(STAGE_DIR)/*.partial.*.mar && \
SRC_BUILD_ID=$$(python $(topsrcdir)/config/printconfigsetting.py $$(find previous -maxdepth 4 -type f -name application.ini) App BuildID) \
DST_BUILD_ID=$$(cat $(DEPTH)/config/buildid) \
SRC_BUILD=previous DST_BUILD=current \
$(MAKE) partial-patch && \
rm -f $(STAGE_DIR)/previous.mar; \
else \
echo "No previous MAR found; not creating a partial MAR"; \
fi