When cabal install is run with the desktop file location not writable, display a...
authorJoey Hess <joeyh@joeyh.name>
Tue, 3 Nov 2015 14:45:33 +0000 (10:45 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 3 Nov 2015 14:47:33 +0000 (10:47 -0400)
Installing the desktop file etc is a niceity of git-annex's cabal install,
but not a requirement.

closes https://github.com/fpco/stackage/issues/726

Setup.hs
debian/changelog

index a3c1f1cf6404f76008462d9249007b24188f5329..44816774ad604420bcf0fa188adde4160845eeb4 100644 (file)
--- a/Setup.hs
+++ b/Setup.hs
@@ -14,6 +14,7 @@ import Control.Applicative
 import Control.Monad
 import System.Directory
 import Data.List
+import Control.Exception
 
 import qualified Build.DesktopFile as DesktopFile
 import qualified Build.Configure as Configure
@@ -64,7 +65,11 @@ installManpages copyDest verbosity pkg lbi =
 installDesktopFile :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
 installDesktopFile copyDest _verbosity pkg lbi
        | progfile copyDest == progfile NoCopyDest =
-               DesktopFile.installUser (progfile copyDest)
+               let dest = progfile copyDest
+               in DesktopFile.installUser dest
+                       `catch` installerror dest
        | otherwise = return ()
   where
        progfile cd = bindir (absoluteInstallDirs pkg lbi cd) </> "git-annex"
+       installerror :: FilePath -> SomeException -> IO ()
+       installerror dest e = putStrLn ("installation of desktop intrgration files in " ++ dest ++ " did not succeed (" ++ show e ++ "); skipping (set DESTDIR to install these files to a different location)")
index 2f6b9e9df3170f706bbd2590a637497ee5990050..df1fa743613924508a87ebbc0842948c25f4839c 100644 (file)
@@ -3,6 +3,8 @@ git-annex (5.20151103) UNRELEASED; urgency=medium
   * Avoid installing desktop file and program file if cabal install
     git-annex is run as root, since that is not a systemwide install,
     but to /root, and so generating a systemwide desktop file is not right.
+  * When cabal install is run with the desktop file location not writable,
+    display a warning, but continue successfully.
 
  -- Joey Hess <id@joeyh.name>  Tue, 03 Nov 2015 10:36:43 -0400