Commit 426a1007 authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Minor clean up for .pkg installation

These are several cleanups inspired by a reading of the excellent book
"Packaging for Apple Administrators".

https://books.apple.com/us/book/id1173928620

1. The package now requires that no copies of the app be running while
being installed. This is more of a completeness thing than any real
protection.

2. This changes the source comments from "product archive" to
"distribution package" which is a broader term, and more technically
correct, as we're not actually trying to make a product archive (which
is a specific thing).

3. This adds an identifier/version pair to the distribution package
in addition to having it on the component package. This technically
makes the distribution package a product archive :) but may be useful
in some situations such as NetInstalls and system install setups (see
https://managingosx.wordpress.com/2017/11/17/customized-high-sierra-install-issues-and-workarounds/
for more information).

Bug: none
Change-Id: Iefde2aae6a3b22721fc16876e6dbce505c3c9601
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134405
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756697}
parent c4fb74d3
......@@ -215,7 +215,11 @@ def _productbuild_distribution_path(paths, dist_config, component_pkg_path):
<!-- The individual choices. -->
<choice id="default"/>
<choice id="{bundle_id}" visible="false" title="{app_product}">
<pkg-ref id="{bundle_id}"/>
<pkg-ref id="{bundle_id}">
<must-close>
<app id="{bundle_id}"/>
</must-close>
</pkg-ref>
</choice>
<!-- The lone component package. -->
......@@ -248,8 +252,8 @@ def _package_and_sign_pkg(paths, dist_config):
# There are two .pkg files to be built:
# 1. The inner component package (which is the one that can contain things
# like postinstall scripts). This is built with `pkgbuild`.
# 2. The outer product archive (which is the installable thing that has
# pre-install requirements). This is built with `productbuild`.
# 2. The outer distribution package (which is the installable thing that
# has pre-install requirements). This is built with `productbuild`.
## The component package.
......@@ -279,7 +283,7 @@ def _package_and_sign_pkg(paths, dist_config):
'--scripts', scripts_path, component_pkg_path
])
## The product archive.
## The distribution package.
distribution_path = _productbuild_distribution_path(paths, dist_config,
component_pkg_path)
......@@ -288,8 +292,9 @@ def _package_and_sign_pkg(paths, dist_config):
paths.output, '{}.pkg'.format(dist_config.packaging_basename))
command = [
'productbuild', '--distribution', distribution_path, '--package-path',
paths.work, '--sign', dist_config.installer_identity
'productbuild', '--identifier', dist_config.base_bundle_id, '--version',
dist_config.version, '--distribution', distribution_path,
'--package-path', paths.work, '--sign', dist_config.installer_identity
]
if dist_config.notary_user:
# Assume if the config has notary authentication information that the
......
......@@ -435,6 +435,10 @@ framework dir is 'App Product.app/Contents/Frameworks/Product Framework.framewor
self.assertEqual('$W/scripts',
_get_adjacent_item(pkgbuild_args, '--scripts'))
self.assertEqual('test.signing.bundle_id',
_get_adjacent_item(productbuild_args, '--identifier'))
self.assertEqual('99.0.9999.99',
_get_adjacent_item(productbuild_args, '--version'))
self.assertEqual(
'$W/App Product.dist',
_get_adjacent_item(productbuild_args, '--distribution'))
......@@ -524,6 +528,10 @@ framework dir is 'App Product.app/Contents/Frameworks/Product Framework.framewor
self.assertEqual('$W/scripts',
_get_adjacent_item(pkgbuild_args, '--scripts'))
self.assertEqual('test.signing.bundle_id',
_get_adjacent_item(productbuild_args, '--identifier'))
self.assertEqual('99.0.9999.99',
_get_adjacent_item(productbuild_args, '--version'))
self.assertEqual(
'$W/App Product.dist',
_get_adjacent_item(productbuild_args, '--distribution'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment