This is an archive of the discontinued Mercurial Phabricator instance.

packaging: stage files and dynamically generate WiX installer
ClosedPublic

Authored by indygreg on Oct 23 2019, 9:55 PM.

Details

Summary

Like we did for Inno, we want to make the WiX installer
"dumb" and simply consume source files from a directory
tree rather than have to define every single file in
installer files. This will greatly decrease the amount of
effort required to maintain the WiX installer since we don't
have to think that much about keeping files in sync.

This commit changes the WiX packager to populate a staging
directory as part of packaging. After it does so, it scans
that directory and dynamically generates WiX XML defining the
content within.

The IDs and GUIDs being generated are deterministic. So,
upgrades should work as expected in Windows Installer land.
(WiX has a "heat" tool that can generate XML by walking the
filesystem but it doesn't have this deterministic property,
sadly.)

As part of this change, GUIDs are now effectively reset.
So the next upgrade should be a complete wipe and replace.
This could potentially cause issues. But in my local testing,
I was able to upgrade an existing 5.1.2 install without
issue.

Compared to the previous commit, the installed files differ
in the following:

  • A ReleaseNotes.txt file is now included
  • A hgrc.d/editor.rc file is now generated (mercurial.rc has been updated to reflect this logical change to the content source)
  • All files are marked as read-only. Previously, only a subset of files were. This should help prevent unwanted tampering. Although we may want to consider use cases like modifying template files...

This change also means that Inno and WiX are now using very
similar code for managing the install layout. This means
that on disk both packages are nearly identical. The
differences in install layout are as follows:

  • Inno has a Copying.txt vs a COPYING.rtf for WiX. (The WiX installer wants to use RTF.)
  • Inno has a Mercurial.url file that is an internet shortcut to www.mercurial-scm.org. (This could potentially be removed.)
  • Inno includes msvc[mpr]90.dll files and WiX does not. (WiX installs the MSVC runtime via merge modules.)
  • Inno includes unins000.{dat,exe} files. (WiX's state is managed by Windows Installer, which places things elsewhere.)

Because file lists are dynamically generated now, the test
ensuring things remain in sync has been deleted. Good riddance.

While this is a huge step towards unifying the Windows installers,
there's still some improvements that can be made. But I think
it is worth celebrating the milestone of getting both Inno
and WiX to essentially share core packaging code and workflows.
That should make it much easier to change the installers going
forward. This will aid support of Python 3.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Oct 23 2019, 9:55 PM
indygreg updated this revision to Diff 17406.Oct 24 2019, 11:34 PM
indygreg abandoned this revision.Nov 8 2019, 5:44 PM

This has conflicts on rebase.

indygreg updated this revision to Diff 17805.Nov 8 2019, 5:47 PM
durin42 requested changes to this revision.Nov 11 2019, 4:06 PM
durin42 added a subscriber: durin42.

LG, but needs rebased.

This revision now requires changes to proceed.Nov 11 2019, 4:06 PM
indygreg edited the summary of this revision. (Show Details)
indygreg updated this revision to Diff 18033.

This has been rebased and all dependent commits have landed. Please take another look, @durin42.

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.

This change also means that Inno and WiX are now using very similar code for managing the install layout. This means that on disk both packages are nearly identical. The differences in install layout are as follows:
...

I diffed the WiX and Inno installs side by side, and there are a few more differences right before the 5.3 release. I don't think there's anything critical, but just in case there could be an issue:

  • Inno installs backports.configparser, certifi, dulwich, keyring, urllib3, and win32ctypes in library.zip.
  • Inno installs additional *.pyc files in wsgiref.
  • ConfigParser.pyc is 24K in WiX, 1.5K in Inno. Probably related to the backport package being present in Inno.
  • WiX installs a mercurial.rc, corresponding to contrib/win32/mercurial.ini; Inno does not.

Presumably dulwich and keyring were thrown in previously to support 3rd party extensions. Should we do that with WiX? Before the release? What about the other discrepancies?

This change also means that Inno and WiX are now using very similar code for managing the install layout. This means that on disk both packages are nearly identical. The differences in install layout are as follows:
...

I diffed the WiX and Inno installs side by side, and there are a few more differences right before the 5.3 release. I don't think there's anything critical, but just in case there could be an issue:

  • Inno installs backports.configparser, certifi, dulwich, keyring, urllib3, and win32ctypes in library.zip.

I think these are related to TortoiseHg somehow. But I could be wrong about that. I'd favor unifying the set of packages between the installers so everything is consistent.

  • Inno installs additional *.pyc files in wsgiref.
  • ConfigParser.pyc is 24K in WiX, 1.5K in Inno. Probably related to the backport package being present in Inno.
  • WiX installs a mercurial.rc, corresponding to contrib/win32/mercurial.ini; Inno does not.

I thought I had fixed this discrepancy...

Anyway, I will stamp any patches to converge the final install layout. As for what release, I don't have strong opinions. The Python 3 installer (presumably next release) would be a good time to make any significant changes we're scared of.

contrib/packaging/wix/mercurial.wxs