Skip to content

Commit 1118844

Browse files
committed
bug 1490119: Add build system bits for building dep updater. r=firefox-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 --HG-- extra : moz-landing-system : lando
1 parent 174ab56 commit 1118844

File tree

8 files changed

+72
-2
lines changed

8 files changed

+72
-2
lines changed

build/gen_test_packages_manifest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
'raptor',
2222
'awsy',
2323
'gtest',
24+
'updater-dep'
2425
]
2526

2627
PACKAGE_SPECIFIED_HARNESSES = [
@@ -32,6 +33,7 @@
3233
'talos',
3334
'raptor',
3435
'awsy',
36+
'updater-dep',
3537
]
3638

3739
# These packages are not present for every build configuration.

python/mozbuild/mozbuild/action/test_archive.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
'awsy/**',
111111
'web-platform/**',
112112
'xpcshell/**',
113+
'updater-dep/**',
113114
],
114115
},
115116
{
@@ -519,6 +520,21 @@
519520
'dest': 'xpcshell',
520521
},
521522
],
523+
'updater-dep': [
524+
{
525+
'source': buildconfig.topobjdir,
526+
'base': '_tests/updater-dep',
527+
'pattern': '**',
528+
'dest': 'updater-dep',
529+
},
530+
# Required by the updater on Linux
531+
{
532+
'source': buildconfig.topobjdir,
533+
'base': 'config/external/sqlite',
534+
'pattern': 'libmozsqlite3.so',
535+
'dest': 'updater-dep',
536+
},
537+
],
522538
}
523539

524540
if buildconfig.substs.get('MOZ_CODE_COVERAGE'):
@@ -626,7 +642,7 @@ def find_files(archive):
626642
'**/*.pyc',
627643
])
628644

629-
if archive != 'common' and base.startswith('_tests'):
645+
if archive not in ('common', 'updater-dep') and base.startswith('_tests'):
630646
# We may have generated_harness_files to exclude from this entry.
631647
for path in generated_harness_files:
632648
if path.startswith(base):

testing/testsuite-targets.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ TEST_PKGS_TARGZ := \
125125
awsy \
126126
xpcshell \
127127
web-platform \
128+
updater-dep \
128129
$(NULL)
129130

130131
ifdef LINK_GTEST_DURING_COMPILE

toolkit/mozapps/update/updater/archivereader.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#ifdef MOZ_VERIFY_MAR_SIGNATURE
2626
#ifdef TEST_UPDATER
2727
#include "../xpcshellCert.h"
28+
#elif DEP_UPDATER
29+
#include "../dep1Cert.h"
30+
#include "../dep2Cert.h"
2831
#else
2932
#include "primaryCert.h"
3033
#include "secondaryCert.h"
@@ -87,6 +90,11 @@ ArchiveReader::VerifySignature()
8790
#else
8891
#ifdef TEST_UPDATER
8992
int rv = VerifyLoadedCert(mArchive, xpcshellCertData);
93+
#elif DEP_UPDATER
94+
int rv = VerifyLoadedCert(mArchive, dep1CertData);
95+
if (rv != OK) {
96+
rv = VerifyLoadedCert(mArchive, dep2CertData);
97+
}
9098
#else
9199
int rv = VerifyLoadedCert(mArchive, primaryCertData);
92100
if (rv != OK) {

toolkit/mozapps/update/updater/moz.build

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ else:
1111

1212
updater_rel_path = ''
1313
include('updater-common.build')
14+
DIRS += ['updater-dep']
1415
if CONFIG['ENABLE_TESTS']:
1516
DIRS += ['updater-xpcshell']
1617

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

2728
GENERATED_FILES = [
29+
'dep1Cert.h',
30+
'dep2Cert.h',
2831
'primaryCert.h',
2932
'secondaryCert.h',
3033
'xpcshellCert.h',
@@ -37,10 +40,14 @@ secondary_cert = GENERATED_FILES['secondaryCert.h']
3740
# have to regenerate it.
3841
# ./certutil -L -d modules/libmar/tests/unit/data -n mycert -r > xpcshellCertificate.der
3942
xpcshell_cert = GENERATED_FILES['xpcshellCert.h']
43+
dep1_cert = GENERATED_FILES['dep1Cert.h']
44+
dep2_cert = GENERATED_FILES['dep2Cert.h']
4045

4146
primary_cert.script = 'gen_cert_header.py:create_header'
4247
secondary_cert.script = 'gen_cert_header.py:create_header'
4348
xpcshell_cert.script = 'gen_cert_header.py:create_header'
49+
dep1_cert.script = 'gen_cert_header.py:create_header'
50+
dep2_cert.script = 'gen_cert_header.py:create_header'
4451

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

64+
dep1_cert.inputs += ['dep1.der']
65+
dep2_cert.inputs += ['dep2.der']
5766
xpcshell_cert.inputs += ['xpcshellCertificate.der']
5867

5968
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# vim:set ts=8 sw=8 sts=8 noet:
2+
# This Source Code Form is subject to the terms of the Mozilla Public
3+
# License, v. 2.0. If a copy of the MPL was not distributed with this
4+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
5+
6+
# For changes here, also consider ../Makefile.in
7+
8+
include $(topsrcdir)/config/rules.mk
9+
10+
tools::
11+
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
12+
# Copy for xpcshell tests
13+
$(NSINSTALL) -D $(FINAL_TARGET)/updater-dep.app
14+
rsync -a -C --exclude '*.in' $(srcdir)/../macbuild/Contents $(FINAL_TARGET)/updater-dep.app
15+
sed -e 's/%APP_NAME%/$(MOZ_APP_DISPLAYNAME)/' $(srcdir)/../macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | \
16+
iconv -f UTF-8 -t UTF-16 > $(FINAL_TARGET)/updater-dep.app/Contents/Resources/English.lproj/InfoPlist.strings
17+
$(NSINSTALL) -D $(FINAL_TARGET)/updater-dep.app/Contents/MacOS
18+
$(NSINSTALL) $(FINAL_TARGET)/updater-dep $(FINAL_TARGET)/updater-dep.app/Contents/MacOS
19+
mv $(FINAL_TARGET)/updater-dep.app/Contents/MacOS/updater-dep $(FINAL_TARGET)/updater-dep.app/Contents/MacOS/org.mozilla.updater
20+
endif
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2+
# vim: set filetype=python:
3+
# This Source Code Form is subject to the terms of the Mozilla Public
4+
# License, v. 2.0. If a copy of the MPL was not distributed with this
5+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
7+
FINAL_TARGET = '_tests/updater-dep'
8+
9+
Program('updater-dep')
10+
11+
updater_rel_path = '../'
12+
DEFINES['DEP_UPDATER'] = True
13+
include('../updater-common.build')
14+

toolkit/mozapps/update/updater/updater.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// Microsoft Visual C++ generated resource script.
66
//
7-
#ifdef TEST_UPDATER
7+
#if defined(TEST_UPDATER) || defined(DEP_UPDATER)
88
#include "../resource.h"
99
#define MANIFEST_PATH "../updater.exe.manifest"
1010
#define COMCTL32_MANIFEST_PATH "../updater.exe.comctl32.manifest"

0 commit comments

Comments
 (0)