Hi,

Here's the second patch I promised.  It's a little less invasive than
the other one.

-steve

Mon Oct  6 23:46:56 EDT 2008  Stephen Hicks <[EMAIL PROTECTED]>
  * Add warning message for installing inaccessible binaries.
  I changed InstallSymlink to also return a failure when there's no
  symlink-bindir specified and the private-bindir is not found in
  the user's path.  The Install module checks for the presence of
  symlink-bindir to decide which error message to yield.
New patches:

[Add warning message for installing inaccessible binaries.
Stephen Hicks <[EMAIL PROTECTED]>**20081007034656
 I changed InstallSymlink to also return a failure when there's no
 symlink-bindir specified and the private-bindir is not found in
 the user's path.  The Install module checks for the presence of
 symlink-bindir to decide which error message to yield.
] {
hunk ./Distribution/Client/Install.hs 359
-           "could not create a symlink in " ++ bindir ++ " for "
-        ++ exe ++ " because the file exists there already but is not "
-        ++ "managed by cabal. You can create a symlink for this executable "
-        ++ "manually if you wish. The executable file has been installed at "
-        ++ path
+        case maybebindir of
+          Nothing ->
+            "did not create a symlink for " ++ exe ++ " because no "
+            ++ "symlink-bindir was specified either at the command line "
+            ++ "or in a configuration file. You can create a symlink for "
+            ++ "this executable manually if you wish. The executable file "
+            ++ "has been installed at " ++ path ++ ", which does not appear "
+            ++ "to be currently in your $PATH"
+          Just bindir ->
+            "could not create a symlink in " ++ bindir ++ " for "
+            ++ exe ++ " because the file exists there already but is not "
+            ++ "managed by cabal. You can create a symlink for this "
+            ++ "executable manually if you wish. The executable file has "
+            ++ "been installed at " ++ path
hunk ./Distribution/Client/Install.hs 375
-           "could not create symlinks in " ++ bindir ++ " for "
-        ++ intercalate ", " [ exe | (_, exe, _) <- exes ]
-        ++ " because the files exist there already and are not "
-        ++ "managed by cabal. You can create symlinks for these executables "
-        ++ "manually if you wish. The executable files have been installed at "
-        ++ intercalate ", " [ path | (_, _, path) <- exes ]
+        case maybebindir of
+          Nothing ->
+            "did not create a symlink for "
+            ++ intercalate ", " [ exe | (_, exe, _) <- exes ]
+            ++ " because no symlink-bindir was specified either at the "
+            ++ "command line or in a configuration file. You can create "
+            ++ "a symlink for these executables manually if you wish. The "
+            ++ "executable files have been installed at "
+            ++ intercalate ", " [ path | (_, _, path) <- exes ] ++ ", which "
+            ++ "do not appear to be currently in your $PATH"
+          Just bindir ->
+            "could not create symlinks in " ++ bindir ++ " for "
+            ++ intercalate ", " [ exe | (_, exe, _) <- exes ]
+            ++ " because the files exist there already and are not "
+            ++ "managed by cabal. You can create symlinks for these "
+            ++ "executables manually if you wish. The executable files "
+            ++ "have been installed at "
+            ++ intercalate ", " [ path | (_, _, path) <- exes ]
hunk ./Distribution/Client/Install.hs 394
-    bindir = Cabal.fromFlag (installSymlinkBinDir installFlags)
+    maybebindir = Cabal.flagToMaybe (installSymlinkBinDir installFlags)
hunk ./Distribution/Client/InstallSymlink.hs 69
-         ( (</>), takeDirectory, splitPath, joinPath, isAbsolute )
+         ( (</>), takeDirectory, splitPath, joinPath, isAbsolute,
+           getSearchPath )
hunk ./Distribution/Client/InstallSymlink.hs 75
+import Control.Monad
+         ( guard )
hunk ./Distribution/Client/InstallSymlink.hs 105
-  case flagToMaybe (installSymlinkBinDir installFlags) of
-    Nothing            -> return []
-    Just symlinkBinDir
-           | null exes -> return []
-           | otherwise -> do
-      publicBinDir  <- canonicalizePath symlinkBinDir
+  case exes of
+    [] -> return []
+    _  -> do
+      case flagToMaybe (installSymlinkBinDir installFlags) of
+        Nothing -> do -- no symlinkdir: generate warnings when not in path
+          searchpath <- mapM canonicalizePath =<< getSearchPath
+          fmap catMaybes $ sequence
+            [ do privateBinDir <- pkgBinDir pkg
+                 -- it might be good to test this against the known privateExe
+                 -- path <- findExecutable publicExeName
+                 -- maybe compare files w/ diff?
+                 return $ (guard $ not $ privateBinDir `elem` searchpath)
+                           >> Just (pkgid, publicExeName,
+                                    privateBinDir </> privateExeName)
+            | (pkg, exe) <- exes
+            , let publicExeName  = PackageDescription.exeName exe
+                  privateExeName = prefix ++ publicExeName ++ suffix
+                  pkgid  = packageId pkg
+                  prefix = substTemplate pkgid prefixTemplate
+                  suffix = substTemplate pkgid suffixTemplate ]
+        Just symlinkBinDir -> do
+          publicBinDir  <- canonicalizePath symlinkBinDir
hunk ./Distribution/Client/InstallSymlink.hs 129
-      fmap catMaybes $ sequence
-        [ do privateBinDir <- pkgBinDir pkg
-             ok <- symlinkBinary
-                     publicBinDir  privateBinDir
-                     publicExeName privateExeName
-             if ok
-               then return Nothing
-               else return (Just (pkgid, publicExeName,
-                                  privateBinDir </> privateExeName))
-        | (pkg, exe) <- exes
-        , let publicExeName  = PackageDescription.exeName exe
-              privateExeName = prefix ++ publicExeName ++ suffix
-              pkgid  = packageId pkg
-              prefix = substTemplate pkgid prefixTemplate
-              suffix = substTemplate pkgid suffixTemplate ]
+          fmap catMaybes $ sequence
+            [ do privateBinDir <- pkgBinDir pkg
+                 ok <- symlinkBinary
+                         publicBinDir  privateBinDir
+                         publicExeName privateExeName
+                 if ok
+                   then return Nothing
+                   else return (Just (pkgid, publicExeName,
+                                      privateBinDir </> privateExeName))
+            | (pkg, exe) <- exes
+            , let publicExeName  = PackageDescription.exeName exe
+                  privateExeName = prefix ++ publicExeName ++ suffix
+                  pkgid  = packageId pkg
+                  prefix = substTemplate pkgid prefixTemplate
+                  suffix = substTemplate pkgid suffixTemplate ]
}

Context:

[Take preferred versions into account in dependency planning
Duncan Coutts <[EMAIL PROTECTED]>**20081006055129
 This means we can now globally prefer base 3 rather than 4.
 However we need to be slightly careful or we end up deciding
 to do silly things like rebuild haskell98 against base 3.
 That would happen because the h98 package doesn't constrain
 the choice to one or the other and we would prefer base 3.
 So we have to add that we really prefer whatever it uses
 currently (if any).
] 
[Pass the package suggested version constraints through to the resolver
Duncan Coutts <[EMAIL PROTECTED]>**20081006042758
 Not used yet.
] 
[Fix selection of paired packages
Duncan Coutts <[EMAIL PROTECTED]>**20081006040616] 
[Read preferred versions from the package index
Duncan Coutts <[EMAIL PROTECTED]>**20081006030259
 From a file named 'preferred-versions' in the 00-index.tar.gz
 If there are several they are combined. Contents is like:
 base < 4
 one suggested version constraint per line.
] 
[Refactor and update the hackage index reading code
Duncan Coutts <[EMAIL PROTECTED]>**20081005202747] 
[Print more details about what is to be installed with -v
Duncan Coutts <[EMAIL PROTECTED]>**20081005075556
 Reports if installs are new or reinstalls and for reinstalls
 prints what dependencies have changed.
] 
[When finalising paired packages, cope with there being multiple choices
Duncan Coutts <[EMAIL PROTECTED]>**20081005053821
 For ordinary packages we selected a single version which means
  we added an equality constraint. As a consequence we used to
 assume there was only one version left when finalising. For
 paired packages there may be two versions left if the package
 did not directly constrain the choice to just one. If there is
 more than one version remaining then we have to pick between
 them. At the moment we still pick the highest version, but
 later we can take a global preference or polciy into account.
] 
[When selecting paired packages, select both.
Duncan Coutts <[EMAIL PROTECTED]>**20081005053804] 
[Handle constraints on paired packages
Duncan Coutts <[EMAIL PROTECTED]>**20081005051919
 The trick is that when applying constraints to paired
 packages, the constraint has to exclude both packages at
 once. We exclude the pair together or not at all. If it
 would only exclude one then we discard the constraint.
] 
[Add the notion of paired packages to the Constraints ADT
Duncan Coutts <[EMAIL PROTECTED]>**20081005013141
 Packages like base-3 and base-4 are paired. This means they are
 supposed to be treated equivalently in some contexts. Paired
 packages are installed packages with the same name where one
 version depends on the other.
] 
[Make InstalledPackage an instance of PackageFixedDeps
Duncan Coutts <[EMAIL PROTECTED]>**20081005012741] 
[Add the glue code to actully report excluded packages
Duncan Coutts <[EMAIL PROTECTED]>**20081005001400
 Now displayed in the output of install --dry-run -v
] 
[Have Constraints.constrain report the excluded packages
Duncan Coutts <[EMAIL PROTECTED]>**20081004235006
 Each time we apply a constraint we can end up excluding some
 extra package. Report that list of packages because it is
 quite interesting information to get insight into what the
 resolver is actually doing.
] 
[Separate the construction of the exclusion list from its use
Duncan Coutts <[EMAIL PROTECTED]>**20081004234421
 Previously directly inserted packages into the excluded package
 list. Now we generate a list of them and then add them. We want
 the list of newly excluded packages separately because it is
 interesting information to report to the user when -v is on.
] 
[Generalise the logging of selected and discarded packages
Duncan Coutts <[EMAIL PROTECTED]>**20081004232555
 Allow for selecting several packages in one go.
 Currently when we select a package we only list the over versions
 of the same package that that excludes, and not the other packages
 we exclude by applying the dependency constraints of the selected
 package. In future we would like to do that so we now report the
 package name of discards not just the version. Though we do group
 by the package name to avoid too much repition.
] 
[Fix infinite loop in the TopDown dependency resolver
Andrea Vezzosi <[EMAIL PROTECTED]>**20080925181441
 The loop occurred only if a package depended on another one
 with the same name, e.g. base-3.0.3.0 <- base-4.0.0.0
] 
[small improvements to bootstrap
Duncan Coutts <[EMAIL PROTECTED]>**20080926214828
 patch sent in by brian0, ticket #357
] 
[Update to the development version of the Cabal lib
Duncan Coutts <[EMAIL PROTECTED]>**20080831225243
 The branch of cabal-install that tracks Cabal-1.4 now lives at
 http://darcs.haskell.org/cabal-branches/cabal-install-0.5/
] 
[Allow use of curl in bootstrap.sh
Duncan Coutts <[EMAIL PROTECTED]>**20080826233400
 Patch from jsnx. Fixes ticket #343. Also, use "cd blah; cd .."
 instead of "pushd blah; popd" as some shells lack pushd/popd
] 
[Relax version constraint on unix package
Duncan Coutts <[EMAIL PROTECTED]>**20080826232851
 Allows building with ghc-6.6.1
] 
[Use mplus not mappend for combining tar filename checks
Duncan Coutts <[EMAIL PROTECTED]>**20080826232606
 mappend would join the error messages in the case that both
 checks failed. Also the monoid instance was new in base 3.
] 
[TAG 0.5.2
Duncan Coutts <[EMAIL PROTECTED]>**20080826214238] 
Patch bundle hash:
3bdff5095d6894feef2860bd7147f1dc15f11a43
_______________________________________________
cabal-devel mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cabal-devel

Reply via email to