Allow building with gpg2.
This commit is contained in:
parent
8688f08804
commit
d5ba9cb728
6 changed files with 17 additions and 6 deletions
|
@ -30,7 +30,7 @@ bundledPrograms = catMaybes
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
, Just "sh"
|
, Just "sh"
|
||||||
#endif
|
#endif
|
||||||
, ifset SysConfig.gpg "gpg"
|
, SysConfig.gpg
|
||||||
, ifset SysConfig.curl "curl"
|
, ifset SysConfig.curl "curl"
|
||||||
, ifset SysConfig.wget "wget"
|
, ifset SysConfig.wget "wget"
|
||||||
, ifset SysConfig.bup "bup"
|
, ifset SysConfig.bup "bup"
|
||||||
|
|
|
@ -31,7 +31,9 @@ tests =
|
||||||
, TestCase "curl" $ testCmd "curl" "curl --version >/dev/null"
|
, TestCase "curl" $ testCmd "curl" "curl --version >/dev/null"
|
||||||
, TestCase "wget" $ testCmd "wget" "wget --version >/dev/null"
|
, TestCase "wget" $ testCmd "wget" "wget --version >/dev/null"
|
||||||
, TestCase "bup" $ testCmd "bup" "bup --version >/dev/null"
|
, TestCase "bup" $ testCmd "bup" "bup --version >/dev/null"
|
||||||
, TestCase "gpg" $ testCmd "gpg" "gpg --version >/dev/null"
|
, TestCase "gpg" $ maybeSelectCmd "gpg"
|
||||||
|
[ ("gpg", "--version >/dev/null")
|
||||||
|
, ("gpg2", "--version >/dev/null") ]
|
||||||
, TestCase "lsof" $ findCmdPath "lsof" "lsof"
|
, TestCase "lsof" $ findCmdPath "lsof" "lsof"
|
||||||
, TestCase "ssh connection caching" getSshConnectionCaching
|
, TestCase "ssh connection caching" getSshConnectionCaching
|
||||||
] ++ shaTestCases
|
] ++ shaTestCases
|
||||||
|
|
2
Test.hs
2
Test.hs
|
@ -732,7 +732,7 @@ test_bup_remote env = "git-annex bup remote" ~: intmpclonerepo env $ when Build.
|
||||||
|
|
||||||
-- gpg is not a build dependency, so only test when it's available
|
-- gpg is not a build dependency, so only test when it's available
|
||||||
test_crypto :: TestEnv -> Test
|
test_crypto :: TestEnv -> Test
|
||||||
test_crypto env = "git-annex crypto" ~: intmpclonerepo env $ when Build.SysConfig.gpg $ do
|
test_crypto env = "git-annex crypto" ~: intmpclonerepo env $ whenM (Utility.Path.inPath Utility.Gpg.gpgcmd) $ do
|
||||||
#ifndef __WINDOWS__
|
#ifndef __WINDOWS__
|
||||||
Utility.Gpg.testTestHarness @? "test harness self-test failed"
|
Utility.Gpg.testTestHarness @? "test harness self-test failed"
|
||||||
Utility.Gpg.testHarness $ do
|
Utility.Gpg.testHarness $ do
|
||||||
|
|
|
@ -17,10 +17,16 @@ import System.Path
|
||||||
|
|
||||||
import Common
|
import Common
|
||||||
import Utility.Env
|
import Utility.Env
|
||||||
|
import qualified Build.SysConfig as SysConfig
|
||||||
|
|
||||||
newtype KeyIds = KeyIds [String]
|
newtype KeyIds = KeyIds [String]
|
||||||
deriving (Ord, Eq)
|
deriving (Ord, Eq)
|
||||||
|
|
||||||
|
{- If a specific gpg command was found at configure time, use it.
|
||||||
|
- Otherwise, try to run gpg. -}
|
||||||
|
gpgcmd :: FilePath
|
||||||
|
gpgcmd = fromMaybe "gpg" SysConfig.gpg
|
||||||
|
|
||||||
stdParams :: [CommandParam] -> IO [String]
|
stdParams :: [CommandParam] -> IO [String]
|
||||||
stdParams params = do
|
stdParams params = do
|
||||||
#ifndef __WINDOWS__
|
#ifndef __WINDOWS__
|
||||||
|
@ -44,7 +50,7 @@ stdParams params = do
|
||||||
readStrict :: [CommandParam] -> IO String
|
readStrict :: [CommandParam] -> IO String
|
||||||
readStrict params = do
|
readStrict params = do
|
||||||
params' <- stdParams params
|
params' <- stdParams params
|
||||||
withHandle StdoutHandle createProcessSuccess (proc "gpg" params') $ \h -> do
|
withHandle StdoutHandle createProcessSuccess (proc gpgcmd params') $ \h -> do
|
||||||
hSetBinaryMode h True
|
hSetBinaryMode h True
|
||||||
hGetContentsStrict h
|
hGetContentsStrict h
|
||||||
|
|
||||||
|
@ -53,7 +59,7 @@ readStrict params = do
|
||||||
pipeStrict :: [CommandParam] -> String -> IO String
|
pipeStrict :: [CommandParam] -> String -> IO String
|
||||||
pipeStrict params input = do
|
pipeStrict params input = do
|
||||||
params' <- stdParams params
|
params' <- stdParams params
|
||||||
withBothHandles createProcessSuccess (proc "gpg" params') $ \(to, from) -> do
|
withBothHandles createProcessSuccess (proc gpgcmd params') $ \(to, from) -> do
|
||||||
hSetBinaryMode to True
|
hSetBinaryMode to True
|
||||||
hSetBinaryMode from True
|
hSetBinaryMode from True
|
||||||
hPutStr to input
|
hPutStr to input
|
||||||
|
@ -84,7 +90,7 @@ feedRead params passphrase feeder reader = do
|
||||||
|
|
||||||
params' <- stdParams $ [Param "--batch"] ++ passphrasefd ++ params
|
params' <- stdParams $ [Param "--batch"] ++ passphrasefd ++ params
|
||||||
closeFd frompipe `after`
|
closeFd frompipe `after`
|
||||||
withBothHandles createProcessSuccess (proc "gpg" params') go
|
withBothHandles createProcessSuccess (proc gpgcmd params') go
|
||||||
where
|
where
|
||||||
go (to, from) = do
|
go (to, from) = do
|
||||||
void $ forkIO $ do
|
void $ forkIO $ do
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -6,6 +6,7 @@ git-annex (4.20130517) UNRELEASED; urgency=low
|
||||||
catching exceptions.
|
catching exceptions.
|
||||||
* Fix a zombie that could result when running a process like gpg to
|
* Fix a zombie that could result when running a process like gpg to
|
||||||
read and write to it.
|
read and write to it.
|
||||||
|
* Allow building with gpg2.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Fri, 17 May 2013 11:17:03 -0400
|
-- Joey Hess <joeyh@debian.org> Fri, 17 May 2013 11:17:03 -0400
|
||||||
|
|
||||||
|
|
|
@ -21,3 +21,5 @@ add tinco.gpg
|
||||||
.. (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) ..etc
|
.. (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) (gpg) ..etc
|
||||||
|
|
||||||
recv (resource unavailable or something) ..
|
recv (resource unavailable or something) ..
|
||||||
|
|
||||||
|
> [[done]]; fixed 3 bugs! --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue