[Request] [+- ] D8474: packaging: isolate invocation of WiX to own function

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Wed Apr 22 02:39:37 UTC 2020


indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Like we did for Inno, we want to split out the building
  of Mercurial from invoking the packaging tool so that we
  can introduce an alternate build mechanism.
  
  As part of this refactor, there are inconsequential changes
  to file layouts. Before, some shared files such as the
  WiX binaries and merge modules would be installed under
  build/. Now, they are installed under build/wix-*. This
  is to keep implementation simpler. But it also helps keep
  build state more isolated.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D8474

AFFECTED FILES
  contrib/packaging/hgpackaging/wix.py

CHANGE DETAILS

diff --git a/contrib/packaging/hgpackaging/wix.py b/contrib/packaging/hgpackaging/wix.py
--- a/contrib/packaging/hgpackaging/wix.py
+++ b/contrib/packaging/hgpackaging/wix.py
@@ -341,7 +341,6 @@
 
     hg_build_dir = source_dir / 'build'
     dist_dir = source_dir / 'dist'
-    wix_dir = source_dir / 'contrib' / 'packaging' / 'wix'
 
     requirements_txt = (
         source_dir / 'contrib' / 'packaging' / 'requirements_win32.txt'
@@ -388,13 +387,41 @@
             print('removing %s' % p)
             p.unlink()
 
-    wix_pkg, wix_entry = download_entry('wix', hg_build_dir)
-    wix_path = hg_build_dir / ('wix-%s' % wix_entry['version'])
+    return run_wix_packaging(
+        source_dir,
+        build_dir,
+        staging_dir,
+        arch,
+        version=version,
+        orig_version=orig_version,
+        msi_name=msi_name,
+        extra_wxs=extra_wxs,
+        extra_features=extra_features,
+    )
+
+
+def run_wix_packaging(
+    source_dir: pathlib.Path,
+    build_dir: pathlib.Path,
+    staging_dir: pathlib.Path,
+    arch: str,
+    version: str,
+    orig_version: str,
+    msi_name: typing.Optional[str] = "mercurial",
+    extra_wxs: typing.Optional[typing.Dict[str, str]] = None,
+    extra_features: typing.Optional[typing.List[str]] = None,
+):
+    """Invokes WiX to package up a built Mercurial."""
+
+    wix_dir = source_dir / 'contrib' / 'packaging' / 'wix'
+
+    wix_pkg, wix_entry = download_entry('wix', build_dir)
+    wix_path = build_dir / ('wix-%s' % wix_entry['version'])
 
     if not wix_path.exists():
         extract_zip_to_directory(wix_pkg, wix_path)
 
-    ensure_vc90_merge_modules(hg_build_dir)
+    ensure_vc90_merge_modules(build_dir)
 
     source_build_rel = pathlib.Path(os.path.relpath(source_dir, build_dir))
 
@@ -413,7 +440,7 @@
     source = wix_dir / 'mercurial.wxs'
     defines['Version'] = version
     defines['Comments'] = 'Installs Mercurial version %s' % version
-    defines['VCRedistSrcDir'] = str(hg_build_dir)
+    defines['VCRedistSrcDir'] = str(build_dir)
     if extra_features:
         assert all(';' not in f for f in extra_features)
         defines['MercurialExtraFeatures'] = ';'.join(extra_features)



To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200422/c9fc9218/attachment-0001.html>


More information about the Mercurial-patches mailing list