Bug 1367741 - Search libexec paths on Unix systems for git-cinnabar; r?chmanchester draft
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 25 May 2017 14:51:44 +0100
changeset 584428 1597609bf7eab5fc68b4bc108c5813087c360108
parent 584413 e8da7192201e5786614ec49d557e64dffd114ff2
child 630382 bb3aadbda13c7900581ba74dd922c0dda2491c48
push id60742
push userbmo:ato@mozilla.com
push dateThu, 25 May 2017 14:05:39 +0000
reviewerschmanchester
bugs1367741
milestone55.0a1
Bug 1367741 - Search libexec paths on Unix systems for git-cinnabar; r?chmanchester When following git-cinnabar's installation instructions, it does not automatically get installed in a directory on PATH. Instead, it gets placed in the system's libexec path, which is meant for programs to be called by other programs and not directly by users. According to the Filesystem Hierarchy Standard (FHS) published by the Linux Foundation, Linux distributions should use /usr/libexec and /usr/local/libexec. This patch appends these two paths to the which(1) search path when it detects it is on Linux or macOS, which happens to share the same concept. Effectively, this change lets users install git-cinnabar following the normal installation instructions and avoid placing git-cinnabar on the system path. MozReview-Commit-ID: 8lxpi4ahMJz
testing/tools/autotry/autotry.py
--- a/testing/tools/autotry/autotry.py
+++ b/testing/tools/autotry/autotry.py
@@ -532,19 +532,25 @@ class AutoTry(object):
                 try:
                     subprocess.check_output(['hg', 'showconfig',
                                              'extensions.push-to-try'])
                 except subprocess.CalledProcessError:
                     print('\nThe "push-to-try" hg extension is required. It '
                           'can be installed to Mercurial 3.3 or above by '
                           'running ./mach mercurial-setup')
                 sys.exit(1)
+
         else:
+            # libexec contains programs meant for execution by other programs
+            path = list(sys.path)
+            if sys.platform in ['darwin', 'linux2']:
+                path.extend(['/usr/libexec/git-core', '/usr/local/libexec/git-core'])
+
             try:
-                which.which('git-cinnabar')
+                which.which('git-cinnabar', path=path)
                 self._git_push_to_try(msg)
             except which.WhichError:
                 print('ERROR git-cinnabar is required to push from git to try with'
                       'the autotry command.\n\nMore information can by found at '
                       'https://github.com/glandium/git-cinnabar')
                 sys.exit(1)
 
     def find_uncommited_changes(self):