Patchwork D7160: packaging: create empty hg.exe.local file

login
register
mail settings
Submitter phabricator
Date Oct. 24, 2019, 1:56 a.m.
Message ID <differential-rev-PHID-DREV-k34ecflx4yuwbkglxzom-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42549/
State Superseded
Headers show

Comments

phabricator - Oct. 24, 2019, 1:56 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now that we stage all files before packaging, we can simply
  touch an empty file instead of using Inno magic to create it.
  This makes things more consistent.
  
  While we're here, we also document why we do this because
  it is important.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/packaging/hgpackaging/inno.py
  contrib/packaging/hgpackaging/py2exe.py
  contrib/packaging/inno/mercurial.iss

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 24, 2019, 7:04 p.m.
mharbison72 added a comment.


  From the referenced URL:
  
  > If the application has a manifest, then any .local files are ignored.
  
  We seem to add a manifest now, so maybe this can go away instead?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7160/new/

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

To: indygreg, #hg-reviewers
Cc: mharbison72, mercurial-devel
phabricator - Oct. 25, 2019, 3:28 a.m.
indygreg added a comment.
indygreg abandoned this revision.


  In D7160#105267 <https://phab.mercurial-scm.org/D7160#105267>, @mharbison72 wrote:
  
  > From the referenced URL:
  >
  >> If the application has a manifest, then any .local files are ignored.
  >
  > We seem to add a manifest now, so maybe this can go away instead?
  
  Nice catch!
  
  I confirmed that we are embedding an application manifest in `hg.exe`. So we can delete this file. I'll update the series.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7160/new/

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

To: indygreg, #hg-reviewers
Cc: mharbison72, mercurial-devel
phabricator - Oct. 25, 2019, 3:47 a.m.
mharbison72 added a comment.
mharbison72 accepted this revision.


  > <exe>.manifest files are used by Windows to set up DLL
  
  s/manifest/local/ ?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7160/new/

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

To: indygreg, #hg-reviewers, mharbison72
Cc: mharbison72, mercurial-devel

Patch

diff --git a/contrib/packaging/inno/mercurial.iss b/contrib/packaging/inno/mercurial.iss
--- a/contrib/packaging/inno/mercurial.iss
+++ b/contrib/packaging/inno/mercurial.iss
@@ -68,7 +68,6 @@ 
 [UninstallDelete]
 Type: files; Name: {app}\Mercurial.url
 Type: filesandordirs; Name: {app}\default.d
-Type: files; Name: "{app}\hg.exe.local"
 
 [Icons]
 Name: {group}\Uninstall Mercurial; Filename: {uninstallexe}
diff --git a/contrib/packaging/hgpackaging/py2exe.py b/contrib/packaging/hgpackaging/py2exe.py
--- a/contrib/packaging/hgpackaging/py2exe.py
+++ b/contrib/packaging/hgpackaging/py2exe.py
@@ -211,3 +211,9 @@ 
     files.
     """
     process_install_rules(STAGING_RULES, source_dir, staging_dir)
+
+    # An empty .exe.local file enables DLL Redirection and forces
+    # Windows to look for DLLs relative to the .exe.
+    # See https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-redirection.
+    with (staging_dir / 'hg.exe.local').open('ab'):
+        pass
diff --git a/contrib/packaging/hgpackaging/inno.py b/contrib/packaging/hgpackaging/inno.py
--- a/contrib/packaging/hgpackaging/inno.py
+++ b/contrib/packaging/hgpackaging/inno.py
@@ -29,7 +29,6 @@ 
 
 PACKAGE_FILES_METADATA = {
     'ReadMe.html': 'Flags: isreadme',
-    'hg.exe': "AfterInstall: Touch('{app}\\hg.exe.local')",
 }