Skip to content

Commit

Permalink
bug 1490119: Add build system bits for building dep updater. r=firefo…
Browse files Browse the repository at this point in the history
…x-build-system-reviewers,mshal,rstrong

This patch gets us building an updater binary that always embeds the dep certificates (instead of release or nightly), and builds a new tests package that includes it.

I had a lot of trouble getting the test package generated correctly due to the fact that things in "_tests" won't be included for test packages that aren't "common". My fix for that isn't ideal - I'm open to something better.

Differential Revision: https://phabricator.services.mozilla.com/D5900
  • Loading branch information
bhearsum committed Sep 19, 2018
1 parent ebf7f5b commit daf7b02
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 2 deletions.
2 changes: 2 additions & 0 deletions build/gen_test_packages_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'raptor',
'awsy',
'gtest',
'updater-dep'
]

PACKAGE_SPECIFIED_HARNESSES = [
Expand All @@ -32,6 +33,7 @@
'talos',
'raptor',
'awsy',
'updater-dep',
]

# These packages are not present for every build configuration.
Expand Down
18 changes: 17 additions & 1 deletion python/mozbuild/mozbuild/action/test_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
'awsy/**',
'web-platform/**',
'xpcshell/**',
'updater-dep/**',
],
},
{
Expand Down Expand Up @@ -519,6 +520,21 @@
'dest': 'xpcshell',
},
],
'updater-dep': [
{
'source': buildconfig.topobjdir,
'base': '_tests/updater-dep',
'pattern': '**',
'dest': 'updater-dep',
},
# Required by the updater on Linux
{
'source': buildconfig.topobjdir,
'base': 'config/external/sqlite',
'pattern': 'libmozsqlite3.so',
'dest': 'updater-dep',
},
],
}

if buildconfig.substs.get('MOZ_CODE_COVERAGE'):
Expand Down Expand Up @@ -626,7 +642,7 @@ def find_files(archive):
'**/*.pyc',
])

if archive != 'common' and base.startswith('_tests'):
if archive not in ('common', 'updater-dep') and base.startswith('_tests'):
# We may have generated_harness_files to exclude from this entry.
for path in generated_harness_files:
if path.startswith(base):
Expand Down
1 change: 1 addition & 0 deletions testing/testsuite-targets.mk
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ TEST_PKGS_TARGZ := \
awsy \
xpcshell \
web-platform \
updater-dep \
$(NULL)

ifdef LINK_GTEST_DURING_COMPILE
Expand Down
8 changes: 8 additions & 0 deletions toolkit/mozapps/update/updater/archivereader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#ifdef MOZ_VERIFY_MAR_SIGNATURE
#ifdef TEST_UPDATER
#include "../xpcshellCert.h"
#elif DEP_UPDATER
#include "../dep1Cert.h"
#include "../dep2Cert.h"
#else
#include "primaryCert.h"
#include "secondaryCert.h"
Expand Down Expand Up @@ -87,6 +90,11 @@ ArchiveReader::VerifySignature()
#else
#ifdef TEST_UPDATER
int rv = VerifyLoadedCert(mArchive, xpcshellCertData);
#elif DEP_UPDATER
int rv = VerifyLoadedCert(mArchive, dep1CertData);
if (rv != OK) {
rv = VerifyLoadedCert(mArchive, dep2CertData);
}
#else
int rv = VerifyLoadedCert(mArchive, primaryCertData);
if (rv != OK) {
Expand Down
9 changes: 9 additions & 0 deletions toolkit/mozapps/update/updater/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ else:

updater_rel_path = ''
include('updater-common.build')
DIRS += ['updater-dep']
if CONFIG['ENABLE_TESTS']:
DIRS += ['updater-xpcshell']

Expand All @@ -25,6 +26,8 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
SRCDIR + '/Launchd.plist']

GENERATED_FILES = [
'dep1Cert.h',
'dep2Cert.h',
'primaryCert.h',
'secondaryCert.h',
'xpcshellCert.h',
Expand All @@ -37,10 +40,14 @@ secondary_cert = GENERATED_FILES['secondaryCert.h']
# have to regenerate it.
# ./certutil -L -d modules/libmar/tests/unit/data -n mycert -r > xpcshellCertificate.der
xpcshell_cert = GENERATED_FILES['xpcshellCert.h']
dep1_cert = GENERATED_FILES['dep1Cert.h']
dep2_cert = GENERATED_FILES['dep2Cert.h']

primary_cert.script = 'gen_cert_header.py:create_header'
secondary_cert.script = 'gen_cert_header.py:create_header'
xpcshell_cert.script = 'gen_cert_header.py:create_header'
dep1_cert.script = 'gen_cert_header.py:create_header'
dep2_cert.script = 'gen_cert_header.py:create_header'

if CONFIG['MOZ_UPDATE_CHANNEL'] in ('beta', 'release', 'esr'):
primary_cert.inputs += ['release_primary.der']
Expand All @@ -54,6 +61,8 @@ else:
primary_cert.inputs += ['dep1.der']
secondary_cert.inputs += ['dep2.der']

dep1_cert.inputs += ['dep1.der']
dep2_cert.inputs += ['dep2.der']
xpcshell_cert.inputs += ['xpcshellCertificate.der']

if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
Expand Down
20 changes: 20 additions & 0 deletions toolkit/mozapps/update/updater/updater-dep/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# vim:set ts=8 sw=8 sts=8 noet:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# For changes here, also consider ../Makefile.in

include $(topsrcdir)/config/rules.mk

tools::
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
# Copy for xpcshell tests
$(NSINSTALL) -D $(FINAL_TARGET)/updater-dep.app
rsync -a -C --exclude '*.in' $(srcdir)/../macbuild/Contents $(FINAL_TARGET)/updater-dep.app
sed -e 's/%APP_NAME%/$(MOZ_APP_DISPLAYNAME)/' $(srcdir)/../macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | \
iconv -f UTF-8 -t UTF-16 > $(FINAL_TARGET)/updater-dep.app/Contents/Resources/English.lproj/InfoPlist.strings
$(NSINSTALL) -D $(FINAL_TARGET)/updater-dep.app/Contents/MacOS
$(NSINSTALL) $(FINAL_TARGET)/updater-dep $(FINAL_TARGET)/updater-dep.app/Contents/MacOS
mv $(FINAL_TARGET)/updater-dep.app/Contents/MacOS/updater-dep $(FINAL_TARGET)/updater-dep.app/Contents/MacOS/org.mozilla.updater
endif
14 changes: 14 additions & 0 deletions toolkit/mozapps/update/updater/updater-dep/moz.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

FINAL_TARGET = '_tests/updater-dep'

Program('updater-dep')

updater_rel_path = '../'
DEFINES['DEP_UPDATER'] = True
include('../updater-common.build')

2 changes: 1 addition & 1 deletion toolkit/mozapps/update/updater/updater.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Microsoft Visual C++ generated resource script.
//
#ifdef TEST_UPDATER
#if defined(TEST_UPDATER) || defined(DEP_UPDATER)
#include "../resource.h"
#define MANIFEST_PATH "../updater.exe.manifest"
#define COMCTL32_MANIFEST_PATH "../updater.exe.comctl32.manifest"
Expand Down

0 comments on commit daf7b02

Please sign in to comment.