From 398d93d4d2ee62c81b4c6036d77aa201dc915bb5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 19 Feb 2016 16:19:19 -0400 Subject: [PATCH] Linux and OSX standalone builds put the bundled gpg last in PATH, so any system gpg will be preferred over it. --- Build/BundledPrograms.hs | 22 +++++++++++++++++-- Build/Standalone.hs | 13 +++++++---- debian/changelog | 2 ++ doc/bugs/put_gpg_last_in_OSX_dmg_PATH.mdwn | 2 ++ standalone/linux/skel/runshell | 4 ++-- .../osx/git-annex.app/Contents/MacOS/runshell | 4 ++-- 6 files changed, 37 insertions(+), 10 deletions(-) diff --git a/Build/BundledPrograms.hs b/Build/BundledPrograms.hs index bd1c25359b..74e187618c 100644 --- a/Build/BundledPrograms.hs +++ b/Build/BundledPrograms.hs @@ -17,7 +17,26 @@ import Build.SysConfig as SysConfig - - These may be just the command name, or the full path to it. -} bundledPrograms :: [FilePath] -bundledPrograms = catMaybes +bundledPrograms = preferredBundledPrograms ++ extraBundledPrograms + +{- Programs that are only included in the bundle in case the system + - doesn't have them. These come after the system PATH. + -} +extraBundledPrograms :: [FilePath] +extraBundledPrograms = catMaybes + -- The system gpg is probably better, because it may better + -- integrate with the system gpg-agent, etc. + [ SysConfig.gpg + ] + +{- Programs that should be preferred for use from the bundle, over + - any that might be installed on the system otherwise. These come before + - the system PATH. + - + - For example, git-annex is built for a specific version of git. + -} +preferredBundledPrograms :: [FilePath] +preferredBundledPrograms = catMaybes [ Nothing #ifndef mingw32_HOST_OS -- git is not included in the windows bundle; git for windows is used @@ -56,7 +75,6 @@ bundledPrograms = catMaybes #ifndef mingw32_HOST_OS -- All these utilities are included in git for Windows , ifset SysConfig.curl "curl" - , SysConfig.gpg , SysConfig.sha1 , SysConfig.sha256 , SysConfig.sha512 diff --git a/Build/Standalone.hs b/Build/Standalone.hs index 2a6c04e6d9..a3a4bac484 100644 --- a/Build/Standalone.hs +++ b/Build/Standalone.hs @@ -26,6 +26,9 @@ progDir topdir = topdir progDir topdir = topdir "bin" #endif +extraProgDir :: FilePath -> FilePath +extraProgDir topdir = topdir "extra" + installProg :: FilePath -> FilePath -> IO (FilePath, FilePath) installProg dir prog = searchPath prog >>= go where @@ -41,7 +44,9 @@ main = getArgs >>= go where go [] = error "specify topdir" go (topdir:_) = do - let dir = progDir topdir - createDirectoryIfMissing True dir - installed <- forM bundledPrograms $ installProg dir - writeFile "tmp/standalone-installed" (show installed) + installed <- forM + [ (progDir topdir, preferredBundledPrograms) + , (extraProgDir topdir, extraBundledPrograms) ] $ \(dir, progs) -> do + createDirectoryIfMissing True dir + forM progs $ installProg dir + writeFile "tmp/standalone-installed" (show (concat installed)) diff --git a/debian/changelog b/debian/changelog index 1434746f9e..c1768b73e9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,8 @@ git-annex (6.20160218) UNRELEASED; urgency=medium * fsck: When the only copy of a file is in a dead repository, mention the repository. * info: Mention when run in a dead repository. + * Linux and OSX standalone builds put the bundled gpg last in PATH, + so any system gpg will be preferred over it. -- Joey Hess Thu, 18 Feb 2016 13:09:21 -0400 diff --git a/doc/bugs/put_gpg_last_in_OSX_dmg_PATH.mdwn b/doc/bugs/put_gpg_last_in_OSX_dmg_PATH.mdwn index 2f30352f91..dfaec26f13 100644 --- a/doc/bugs/put_gpg_last_in_OSX_dmg_PATH.mdwn +++ b/doc/bugs/put_gpg_last_in_OSX_dmg_PATH.mdwn @@ -6,3 +6,5 @@ A solution might be to move the gpg binary to a different directory and put it at the end of PATH, not the front. So system one is used if available. This should also be considered for the linux standalone builds. + +> [[done]] for both OSX and linux. --[[Joey]] diff --git a/standalone/linux/skel/runshell b/standalone/linux/skel/runshell index 8c1db42476..fff0f70822 100755 --- a/standalone/linux/skel/runshell +++ b/standalone/linux/skel/runshell @@ -81,10 +81,10 @@ if [ -z "$GIT_ANNEX_PACKAGE_INSTALL" ]; then fi # Put our binaries first, to avoid issues with out of date or incompatable -# system binaries. +# system binaries. Extra binaries come after system path. ORIG_PATH="$PATH" export ORIG_PATH -PATH="$base/bin:$PATH" +PATH="$base/bin:$PATH:$base/extra" export PATH # These env vars are used by the shim wrapper around each binary. diff --git a/standalone/osx/git-annex.app/Contents/MacOS/runshell b/standalone/osx/git-annex.app/Contents/MacOS/runshell index b48017f432..ab0076546d 100755 --- a/standalone/osx/git-annex.app/Contents/MacOS/runshell +++ b/standalone/osx/git-annex.app/Contents/MacOS/runshell @@ -61,10 +61,10 @@ if [ ! -e "$HOME/.ssh/git-annex-wrapper" ]; then fi # Put our binaries first, to avoid issues with out of date or incompatable -# system binaries. +# system binaries. Extra binaries come after system path. ORIG_PATH="$PATH" export ORIG_PATH -PATH="$bundle:$PATH" +PATH="$bundle:$PATH:$base/extra" export PATH ORIG_GIT_EXEC_PATH="$GIT_EXEC_PATH"