summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-23 20:38:10 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-23 20:38:10 +0000
commit00f6618c63e8246693a3f315c99e3034ec3774aa (patch)
tree01a64227cd5a9125d71d6a8668950b18afc99de2
parent60226f128b1175e47ce5154f447a7efa43cc949f (diff)
downloadchromium_src-00f6618c63e8246693a3f315c99e3034ec3774aa.zip
chromium_src-00f6618c63e8246693a3f315c99e3034ec3774aa.tar.gz
chromium_src-00f6618c63e8246693a3f315c99e3034ec3774aa.tar.bz2
Keystone auto-update support for TestShell
Review URL: http://codereview.chromium.org/18521 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8574 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xbuild/mac/pkg-dmg8
-rw-r--r--webkit/tools/test_shell/mac/KeystoneGlue.m9
-rwxr-xr-xwebkit/tools/test_shell/mac/TestShell.xcodeproj/package_test_shell.sh76
-rw-r--r--webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj62
-rwxr-xr-xwebkit/tools/test_shell/mac/keystone_install.sh51
5 files changed, 201 insertions, 5 deletions
diff --git a/build/mac/pkg-dmg b/build/mac/pkg-dmg
index b88fa1e..301d226 100755
--- a/build/mac/pkg-dmg
+++ b/build/mac/pkg-dmg
@@ -566,7 +566,7 @@ push(@gCleanup,
# treated as the volume root itself. rsync will do this by default, if no
# trailing '/' is present. With a trailing '/', $sourceFolder becomes
# $tempRoot, instead of becoming an entry in $tempRoot.
-if(command($gConfig{'cmd_rsync'}, '-a', '--copy-unsafe-links',
+if(command($gConfig{'cmd_rsync'}, '-aC', '--copy-unsafe-links',
$sourceFolder.($sourceFile?'':'/'),$tempRoot) != 0) {
cleanupDie('rsync failed');
}
@@ -597,7 +597,7 @@ if($gConfig{'create_directly'}) {
}
if(defined($iconFile)) {
- if(command($gConfig{'cmd_rsync'}, '-a', '--copy-unsafe-links', $iconFile,
+ if(command($gConfig{'cmd_rsync'}, '-aC', '--copy-unsafe-links', $iconFile,
$tempRoot.'/.VolumeIcon.icns') != 0) {
cleanupDie('rsync failed for volume icon');
}
@@ -897,7 +897,7 @@ sub copyFiles($@) {
$success = commandInternal('symlink', $source, $target);
}
else {
- $success = !command($gConfig{'cmd_rsync'}, '-a', '--copy-unsafe-links',
+ $success = !command($gConfig{'cmd_rsync'}, '-aC', '--copy-unsafe-links',
$source, $target);
}
if(!$success) {
@@ -1160,7 +1160,7 @@ sub diskImageMaker($$$$$$$$) {
# the volume is mounted, copy the files. --copy-unsafe-links is
# unnecessary since it was used to copy everything to the staging
# area. There can be no more unsafe links.
- if(command($gConfig{'cmd_rsync'}, '-a',
+ if(command($gConfig{'cmd_rsync'}, '-aC',
$source.'/',$partitionMountPoint) != 0) {
cleanupDie('rsync to new volume failed');
}
diff --git a/webkit/tools/test_shell/mac/KeystoneGlue.m b/webkit/tools/test_shell/mac/KeystoneGlue.m
index 64538fa..87b470e 100644
--- a/webkit/tools/test_shell/mac/KeystoneGlue.m
+++ b/webkit/tools/test_shell/mac/KeystoneGlue.m
@@ -18,13 +18,20 @@ typedef enum { kKSPathExistenceChecker } KSExistenceCheckerType;
@implementation KeystoneGlue
+// TODO(mmentovai): Determine if the app is writable, and don't register for
+// updates if not - but keep the periodic activity pings.
+ (void)registerWithKeystone {
// Figure out who we are.
NSBundle* mainBundle = [NSBundle mainBundle];
NSString* bundleIdentifier = [mainBundle bundleIdentifier];
NSDictionary* infoDictionary = [mainBundle infoDictionary];
NSString* url = [infoDictionary objectForKey:@"KSUpdateURL"];
- NSString* version = [infoDictionary objectForKey:(id)kCFBundleVersionKey];
+ // TODO(mmentovai): The svn version serves our purposes for now, but it will
+ // likely be replaced. The key problem is that it does not monotonically
+ // increase for releases when considering svn branches and tags. For the
+ // purposes of TestShell, though, which will likely only ever survive in
+ // auto-updatable form in builds straight from the trunk, this is fine.
+ NSString* version = [infoDictionary objectForKey:@"SVNRevision"];
if (!bundleIdentifier || !url || !version) {
// If parameters required for Keystone are missing, don't use it.
return;
diff --git a/webkit/tools/test_shell/mac/TestShell.xcodeproj/package_test_shell.sh b/webkit/tools/test_shell/mac/TestShell.xcodeproj/package_test_shell.sh
new file mode 100755
index 0000000..59db31c
--- /dev/null
+++ b/webkit/tools/test_shell/mac/TestShell.xcodeproj/package_test_shell.sh
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Packages TestShell up into a disk image, renaming it "Chromium TestShell"
+# so that it's easily identifiable.
+#
+# TODO(mmentovai): This is temporary, as soon as we can package up Chromium
+# proper, we should rip this out and let TestShell live out the rest of its
+# years as a simple test shell.
+
+set -ex
+
+TOP="${SRCROOT}/../../../.."
+PKG_DMG="${TOP}/build/mac/pkg-dmg"
+KEYSTONE_URL="https://tools.google.com/service/update2"
+
+SRC_APP_NAME="TestShell"
+DST_APP_NAME="Chromium TestShell"
+SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}.app"
+
+KSR="${TOP}/third_party/googlemac/Releases/Keystone/KeystoneRegistration.framework"
+
+# Really, if you want to distribute something, it probably shouldn't be
+# a debug-mode build. Release-mode builds are already stripped and are
+# intended for this sort of thing.
+if [ "${CONFIGURATION}" != "Release" ] ; then
+ echo "warning: packaging in non-release mode" >&2
+fi
+
+# Figure out what version this build corresponds to. Just use the svn revision
+# for now.
+SVN_REVISION=$(svnversion "${TOP}" | sed -e "s/[^0-9]//g")
+if [ -z "${SVN_REVISION}" ] ; then
+ echo "warning: could not determine svn revision" >&2
+fi
+
+# I really hate how "defaults" doesn't take a real pathname but instead insists
+# on appending ".plist" to everything.
+INFO_PLIST_PATH="Contents/Info.plist"
+TMP_INFO_PLIST_DEFAULTS="${TEMP_DIR}/Info"
+TMP_INFO_PLIST="${TMP_INFO_PLIST_DEFAULTS}.plist"
+cp "${SRC_APP_PATH}/${INFO_PLIST_PATH}" "${TMP_INFO_PLIST}"
+
+# Stuff the version information in the Info.plist, and update the CFBundleName
+# to correspond to what we want to call it.
+defaults write "${TMP_INFO_PLIST_DEFAULTS}" CFBundleName "${DST_APP_NAME}"
+defaults write "${TMP_INFO_PLIST_DEFAULTS}" SVNRevision "0.0.${SVN_REVISION}"
+if [ -d "${KSR}" ] ; then
+ defaults write "${TMP_INFO_PLIST_DEFAULTS}" KSUpdateURL "${KEYSTONE_URL}"
+fi
+
+# Info.plist will work perfectly well in any plist format, but traditionally
+# applications use xml1 for this, so convert it back after whatever defaults
+# might have done.
+plutil -convert xml1 "${TMP_INFO_PLIST}"
+
+# If the Keystone registration framework is available, stuff it and the
+# Keystone installation script into the application, so that the result will
+# be both auto-updatable and suitable for use as the target of an update.
+PKG_DMG_EXTRA=()
+if [ -d "${KSR}" ] ; then
+ PKG_DMG_EXTRA=(--copy "${KSR}:/${DST_APP_NAME}.app/Contents/Frameworks" \
+ --copy "${SRCROOT}/keystone_install.sh:/.keystone_install")
+fi
+
+"${PKG_DMG}" --source /var/empty \
+ --target "${BUILT_PRODUCTS_DIR}/ChromiumTestShell.dmg" \
+ --format UDBZ \
+ --volname "${DST_APP_NAME}" \
+ --tempdir "${TEMP_DIR}" \
+ --copy "${SRC_APP_PATH}/:/${DST_APP_NAME}.app/" \
+ --copy "${TMP_INFO_PLIST}:/${DST_APP_NAME}.app/${INFO_PLIST_PATH}" \
+ "${PKG_DMG_EXTRA[@]}"
diff --git a/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj b/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj
index 58e1540..902bbf3a 100644
--- a/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj
+++ b/webkit/tools/test_shell/mac/TestShell.xcodeproj/project.pbxproj
@@ -7,6 +7,18 @@
objects = {
/* Begin PBXAggregateTarget section */
+ 4D1F55010F2905C60040C1E3 /* package_test_shell */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 4D1F55170F2906220040C1E3 /* Build configuration list for PBXAggregateTarget "package_test_shell" */;
+ buildPhases = (
+ 4D1F55000F2905C60040C1E3 /* ShellScript */,
+ );
+ dependencies = (
+ 4D1F55050F2905DC0040C1E3 /* PBXTargetDependency */,
+ );
+ name = package_test_shell;
+ productName = "Package TestShell";
+ };
4DCE98940EF0600700682526 /* All */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 4DCE98AF0EF0602400682526 /* Build configuration list for PBXAggregateTarget "All" */;
@@ -214,6 +226,13 @@
remoteGlobalIDString = 4D7B007E0E9D5538009A6919;
remoteInfo = sqlite;
};
+ 4D1F55040F2905DC0040C1E3 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = E45628C30E26B4FE005E4685;
+ remoteInfo = TestShell;
+ };
4DB687D30EAFE79200AB2128 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4DB687CA0EAFE79200AB2128 /* libxslt.xcodeproj */;
@@ -1472,6 +1491,7 @@
E45628C30E26B4FE005E4685 /* TestShell */,
E45067A70EEF2776003BE099 /* test_shell_tests */,
E4506A340EF020E4003BE099 /* run_test_shell_tests */,
+ 4D1F55010F2905C60040C1E3 /* package_test_shell */,
);
};
/* End PBXProject section */
@@ -1804,6 +1824,20 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
+ 4D1F55000F2905C60040C1E3 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "set -ex\nexec \"${PROJECT_FILE_PATH}/${PRODUCT_NAME}.sh\" \"${@}\"\n";
+ showEnvVarsInLog = 0;
+ };
4D3D52680EC3838E00650CA0 /* Strip If Needed */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -1932,6 +1966,11 @@
name = sqlite;
targetProxy = 4D1638770EBFA706008F024E /* PBXContainerItemProxy */;
};
+ 4D1F55050F2905DC0040C1E3 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = E45628C30E26B4FE005E4685 /* TestShell */;
+ targetProxy = 4D1F55040F2905DC0040C1E3 /* PBXContainerItemProxy */;
+ };
4DB687D60EAFE7B100AB2128 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = xslt;
@@ -2104,6 +2143,20 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
+ 4D1F55020F2905C70040C1E3 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = package_test_shell;
+ };
+ name = Debug;
+ };
+ 4D1F55030F2905C70040C1E3 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = package_test_shell;
+ };
+ name = Release;
+ };
4DCE98950EF0600700682526 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -2381,6 +2434,15 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ 4D1F55170F2906220040C1E3 /* Build configuration list for PBXAggregateTarget "package_test_shell" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4D1F55020F2905C70040C1E3 /* Debug */,
+ 4D1F55030F2905C70040C1E3 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
4DCE98AF0EF0602400682526 /* Build configuration list for PBXAggregateTarget "All" */ = {
isa = XCConfigurationList;
buildConfigurations = (
diff --git a/webkit/tools/test_shell/mac/keystone_install.sh b/webkit/tools/test_shell/mac/keystone_install.sh
new file mode 100755
index 0000000..b2e42f6
--- /dev/null
+++ b/webkit/tools/test_shell/mac/keystone_install.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Called by the Keystone system to update the installed application with a new
+# version from a disk image.
+
+set -e
+
+# The argument should be the disk image path. Make sure it exists.
+if [ ! -d "${1}" ] ; then
+ exit 1
+fi
+
+# Who we are.
+APP_NAME="Chromium TestShell.app"
+SRC="${1}/${APP_NAME}"
+
+# Sanity, make sure that there's something to copy from.
+if [ ! -d "${SRC}" ] ; then
+ exit 1
+fi
+
+# Figure out where we're going.
+BUNDLE_ID=$(defaults read "${SRC}/Contents/Info" CFBundleIdentifier)
+DEST=$(ksadmin -pP "${BUNDLE_ID}" | grep xc= | sed -E 's/.+path=(.+)>$/\1/g')
+
+# More sanity checking.
+if [ -z "${SRC}" ] || [ -z "${DEST}" ] || [ ! -d $(dirname "${DEST}") ]; then
+ exit 1
+fi
+
+# This usage will preserve any changes the user made to the application name.
+rsync -a --delete "${SRC}/" "${DEST}/"
+
+VERSION=$(defaults read "${DEST}/Contents/Info" SVNRevision)
+URL=$(defaults read "${DEST}/Contents/Info" KSUpdateURL)
+
+# Notify LaunchServices.
+/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister "${DEST}"
+
+# Notify Keystone.
+ksadmin -P "${BUNDLE_ID}" \
+ --version "${VERSION}" \
+ --xcpath "${DEST}" \
+ --url "${URL}"
+
+# Great success!
+exit 0