When cabal install is run with the desktop file location not writable, display a warning, but continue successfully.

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
This commit is contained in:
Joey Hess 2015-11-03 10:45:33 -04:00
parent 0717ad4440
commit 628429f1b0
Failed to extract signature
2 changed files with 8 additions and 1 deletions

View file

@ -14,6 +14,7 @@ import Control.Applicative
import Control.Monad import Control.Monad
import System.Directory import System.Directory
import Data.List import Data.List
import Control.Exception
import qualified Build.DesktopFile as DesktopFile import qualified Build.DesktopFile as DesktopFile
import qualified Build.Configure as Configure import qualified Build.Configure as Configure
@ -64,7 +65,11 @@ installManpages copyDest verbosity pkg lbi =
installDesktopFile :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO () installDesktopFile :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
installDesktopFile copyDest _verbosity pkg lbi installDesktopFile copyDest _verbosity pkg lbi
| progfile copyDest == progfile NoCopyDest = | progfile copyDest == progfile NoCopyDest =
DesktopFile.installUser (progfile copyDest) let dest = progfile copyDest
in DesktopFile.installUser dest
`catch` installerror dest
| otherwise = return () | otherwise = return ()
where where
progfile cd = bindir (absoluteInstallDirs pkg lbi cd) </> "git-annex" 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)")

2
debian/changelog vendored
View file

@ -3,6 +3,8 @@ git-annex (5.20151103) UNRELEASED; urgency=medium
* Avoid installing desktop file and program file if cabal install * Avoid installing desktop file and program file if cabal install
git-annex is run as root, since that is not a systemwide 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. 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 -- Joey Hess <id@joeyh.name> Tue, 03 Nov 2015 10:36:43 -0400