Bug 470963 - stop copying build/pgo/certs to the objdir, r=ted.mielczarek

This commit is contained in:
Honza Bambas 2009-01-18 21:39:45 +01:00
Родитель d8f1bff747
Коммит 8af80e422a
6 изменённых файлов: 30 добавлений и 111 удалений

Просмотреть файл

@ -78,13 +78,15 @@ browser_path = \"$(DIST)/bin/$(PROGRAM)\"
endif
endif
_CERTS_DIR = _profile/pgo/certs
_PROFILE_DIR = _profile/pgo
_CERTS_SRC_DIR = $(srcdir)/certs
AUTOMATION_PPARGS = \
-DBROWSER_PATH=$(browser_path) \
-DXPC_BIN_PATH=\"$(LIBXUL_DIST)/bin\" \
-DBIN_SUFFIX=\"$(BIN_SUFFIX)\" \
-DCERTS_DIR=\"../$(_CERTS_DIR)\" \
-DPROFILE_DIR=\"$(_PROFILE_DIR)\" \
-DCERTS_SRC_DIR=\"$(_CERTS_SRC_DIR)\" \
$(NULL)
ifeq ($(OS_ARCH),Darwin)

4
build/pgo/Makefile.in Normal file → Executable file
Просмотреть файл

@ -47,14 +47,12 @@ include $(DEPTH)/config/autoconf.mk
DIRS = \
blueprint \
js-input \
certs \
$(NULL)
include $(topsrcdir)/config/rules.mk
# Stuff to make a build with a profile
_PROFILE_DIR = $(DEPTH)/_profile/pgo
_CERTS_DIR = $(_PROFILE_DIR)/certs
_CERTS_SRC_DIR = $(srcdir)/certs
_PGO_FILES = \
@ -90,7 +88,7 @@ AUTOMATION_PPARGS = \
-DBROWSER_PATH=$(browser_path) \
-DXPC_BIN_PATH=\"$(LIBXUL_DIST)/bin\" \
-DBIN_SUFFIX=\"$(BIN_SUFFIX)\" \
-DCERTS_DIR=\"$(_CERTS_DIR)\" \
-DPROFILE_DIR=\"$(_PROFILE_DIR)\" \
-DCERTS_SRC_DIR=\"$(_CERTS_SRC_DIR)\" \
$(NULL)

Просмотреть файл

@ -82,7 +82,8 @@ IS_CYGWIN = False
UNIXISH = not IS_WIN32 and not IS_MAC
#expand DEFAULT_APP = "./" + __BROWSER_PATH__
#expand CERTS_DIR = __CERTS_DIR__
#expand PROFILE_DIR = __PROFILE_DIR__
#expand CERTS_SRC_DIR = __CERTS_SRC_DIR__
#expand IS_TEST_BUILD = __IS_TEST_BUILD__
#expand IS_DEBUG_BUILD = __IS_DEBUG_BUILD__
@ -398,11 +399,11 @@ def fillCertificateDB(profileDir):
pwfile.close()
# Create head of the ssltunnel configuration file
sslTunnelConfigPath = os.path.join(CERTS_DIR, "ssltunnel.cfg")
sslTunnelConfigPath = os.path.join(PROFILE_DIR, "ssltunnel.cfg")
sslTunnelConfig = open(sslTunnelConfigPath, "w")
sslTunnelConfig.write("httpproxy:1\n")
sslTunnelConfig.write("certdbdir:%s\n" % CERTS_DIR)
sslTunnelConfig.write("certdbdir:%s\n" % CERTS_SRC_DIR)
sslTunnelConfig.write("forward:127.0.0.1:8888\n")
sslTunnelConfig.write("listen:*:4443:pgo server certificate\n")
@ -437,16 +438,17 @@ def fillCertificateDB(profileDir):
return status
# Walk the cert directory and add custom CAs and client certs
files = os.listdir(CERTS_DIR)
files = os.listdir(CERTS_SRC_DIR)
for item in files:
root, ext = os.path.splitext(item)
if ext == ".ca":
Process(certutil, ["-A", "-i", os.path.join(CERTS_DIR, item),
Process(certutil, ["-A", "-i", os.path.join(CERTS_SRC_DIR, item),
"-d", profileDir, "-f", pwfilePath, "-n", root, "-t", "CT,,"],
environment()).wait()
if ext == ".client":
Process(pk12util, ["-i", os.path.join(CERTS_DIR, item), "-w", pwfilePath,
"-d", profileDir], environment()).wait()
Process(pk12util, ["-i", os.path.join(CERTS_SRC_DIR, item), "-w",
pwfilePath, "-d", profileDir],
environment()).wait()
os.unlink(pwfilePath)
return 0
@ -478,7 +480,7 @@ def runApp(testURL, env, app, profileDir, extraArgs):
# start ssltunnel to provide https:// URLs capability
ssltunnel = DIST_BIN + "/ssltunnel" + BIN_SUFFIX
ssltunnelProcess = Process(ssltunnel, [os.path.join(CERTS_DIR, "ssltunnel.cfg")], environment())
ssltunnelProcess = Process(ssltunnel, [os.path.join(PROFILE_DIR, "ssltunnel.cfg")], environment())
log.info("SSL tunnel pid: %d", ssltunnelProcess.pid)
"Run the app, returning the time at which it was started."

Просмотреть файл

@ -1,74 +0,0 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla test code
#
# The Initial Developer of the Original Code is
# Mozilla Foundation
# Portions created by the Initial Developer are Copyright (C) 2008
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Honza Bambas <honzab@firemni.cz>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
_PROFILE_DIR = $(DEPTH)/_profile/pgo
_CERTS_DIR = $(_PROFILE_DIR)/certs
# Following files will be added as trusted Certificate Authorities
# to the PGO profile.
# Extension of those files MUST BE '.ca'.
_CERT_AUTHORITIES = \
pgoca.ca \
$(NULL)
# Following files will be added as user/client certificates
# to the PGO profile to be used for client authentication.
# Extension of those files MUST BE '.client'.
_CLIENT_CERTS = \
mochitest.client \
$(NULL)
_SERV_FILES = \
pgoca.p12 \
cert8.db \
key3.db \
secmod.db \
$(NULL)
include $(topsrcdir)/config/rules.mk
libs:: $(_SERV_FILES) $(_CERT_AUTHORITIES) $(_CLIENT_CERTS)
$(INSTALL) $^ $(_CERTS_DIR)

Просмотреть файл

@ -44,7 +44,7 @@ import sys
#expand DIST_BIN = __XPC_BIN_PATH__
#expand BIN_SUFFIX = __BIN_SUFFIX__
#expand CERTS_DIR = __CERTS_DIR__
#expand PROFILE_DIR = __PROFILE_DIR__
#expand CERTS_SRC_DIR = __CERTS_SRC_DIR__
dbFiles = [
@ -68,13 +68,6 @@ def dbFilesExist(path):
return True
return False
def installDbFiles(path, dest):
for root, dirs, files in os.walk(path):
for name in files:
for dbFile in dbFiles:
if dbFile.match(name):
shutil.copy(os.path.join(root, name), os.path.join(dest, name))
def runUtil(util, args, inputdata = None):
proc = automation.Process(util, args, automation.environment(), inputdata)
@ -89,11 +82,11 @@ def createRandomFile(randomFile):
file.close()
def createCertificateAuthority(dbDir, srcDir):
def createCertificateAuthority(profileDir, srcDir):
certutil = DIST_BIN + "/certutil" + BIN_SUFFIX
pk12util = DIST_BIN + "/pk12util" + BIN_SUFFIX
tempDbDir = os.path.join(dbDir, ".temp")
tempDbDir = os.path.join(profileDir, ".temp")
if not os.path.exists(tempDbDir):
os.mkdir(tempDbDir)
@ -101,8 +94,6 @@ def createCertificateAuthority(dbDir, srcDir):
rndfilePath = os.path.join(tempDbDir, ".rndfile")
pgoCAModulePathSrc = os.path.join(srcDir, "pgoca.p12")
pgoCAPathSrc = os.path.join(srcDir, "pgoca.ca")
pgoCAModulePath = os.path.join(srcDir, "pgoca.p12")
pgoCAPath = os.path.join(srcDir, "pgoca.ca")
pwfile = open(pwfilePath, "w")
pwfile.write("\n")
@ -135,21 +126,20 @@ def createCertificateAuthority(dbDir, srcDir):
return 0
def createSSLServerCertificate(dbDir, srcDir):
def createSSLServerCertificate(profileDir, srcDir):
certutil = DIST_BIN + "/certutil" + BIN_SUFFIX
pk12util = DIST_BIN + "/pk12util" + BIN_SUFFIX
pwfilePath = os.path.join(dbDir, ".crtdbpw")
rndfilePath = os.path.join(dbDir, ".rndfile")
pgoCAPath = os.path.join(dbDir, "pgoca.p12")
pwfilePath = os.path.join(profileDir, ".crtdbpw")
rndfilePath = os.path.join(profileDir, ".rndfile")
pgoCAPath = os.path.join(srcDir, "pgoca.p12")
pwfile = open(pwfilePath, "w")
pwfile.write("\n")
pwfile.close()
unlinkDbFiles(dbDir)
if not dbFilesExist(srcDir):
# Make sure all DB files from src are really deleted
unlinkDbFiles(srcDir)
# Create certification database for ssltunnel
@ -162,7 +152,7 @@ def createSSLServerCertificate(dbDir, srcDir):
return status
# Generate automatic certificate
locations = automation.readLocations(os.path.join(dbDir, "../server-locations.txt"))
locations = automation.readLocations(os.path.join(profileDir, "server-locations.txt"))
locations.pop(0)
locationsParam = ""
firstLocation = ""
@ -196,7 +186,6 @@ def createSSLServerCertificate(dbDir, srcDir):
if status != 0:
return status
installDbFiles(srcDir, dbDir)
os.unlink(pwfilePath)
os.unlink(rndfilePath)
return 0
@ -207,14 +196,14 @@ if len(sys.argv) == 1:
sys.exit(1)
if sys.argv[1] == "--gen-server":
certificateStatus = createSSLServerCertificate(CERTS_DIR, CERTS_SRC_DIR)
certificateStatus = createSSLServerCertificate(PROFILE_DIR, CERTS_SRC_DIR)
if certificateStatus != 0:
print "ERROR FAIL: SSL Server Certificate generation"
sys.exit(certificateStatus)
if sys.argv[1] == "--gen-ca":
certificateStatus = createCertificateAuthority(CERTS_DIR, CERTS_SRC_DIR)
certificateStatus = createCertificateAuthority(PROFILE_DIR, CERTS_SRC_DIR)
if certificateStatus != 0:
print "ERROR FAIL: Certificate Authority generation"
else:

Просмотреть файл

@ -74,7 +74,8 @@ _SERV_FILES = \
_DEST_DIR = $(DEPTH)/_tests/$(relativesrcdir)
_CERTS_DIR = $(DEPTH)/_profile/pgo/certs
_PROFILE_DIR = $(DEPTH)/_profile/pgo
_CERTS_SRC_DIR = $(topsrcdir)/build/pgo/certs
ifeq ($(USE_SHORT_LIBNAME), 1)
PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
@ -101,7 +102,8 @@ TEST_DRIVER_PPARGS = \
-DBROWSER_PATH=$(browser_path) \
-DXPC_BIN_PATH=\"$(LIBXUL_DIST)/bin\" \
-DBIN_SUFFIX=\"$(BIN_SUFFIX)\" \
-DCERTS_DIR=\"../$(_CERTS_DIR)\" \
-DPROFILE_DIR=\"../$(_PROFILE_DIR)\" \
-DCERTS_SRC_DIR=\"$(_CERTS_SRC_DIR)\" \
$(NULL)
ifeq ($(OS_ARCH),Darwin)