Skip to content

Commit

Permalink
Satisfy build and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alt-romes committed Feb 26, 2024
1 parent 6c19b98 commit ed3579a
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module UnitTests.Distribution.PackageDescription.Check (tests) where

import Distribution.Compat.Prelude.Internal
import Distribution.Compat.Prelude
import Prelude ()

import Distribution.PackageDescription.Check
Expand Down
4 changes: 2 additions & 2 deletions Cabal/src/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,9 @@ computeLocalBuildConfig cfg comp programDb = do

data PackageInfo = PackageInfo
{ internalPackageSet :: Set LibraryName
, promisedDepsSet :: Map (PackageName, ComponentName) ComponentId
, promisedDepsSet :: Map (PackageName, ComponentName, Maybe PrivateAlias) ComponentId
, installedPackageSet :: InstalledPackageIndex
, requiredDepsMap :: Map (PackageName, ComponentName) InstalledPackageInfo
, requiredDepsMap :: Map (PackageName, ComponentName, Maybe PrivateAlias) InstalledPackageInfo
}

configurePackage
Expand Down
2 changes: 1 addition & 1 deletion Cabal/src/Distribution/Types/LocalBuildInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ pattern LocalBuildInfo
-> Maybe FilePath
-> Graph ComponentLocalBuildInfo
-> Map ComponentName [ComponentLocalBuildInfo]
-> Map (PackageName, ComponentName) ComponentId
-> Map (PackageName, ComponentName, Maybe PrivateAlias) ComponentId
-> InstalledPackageIndex
-> PackageDescription
-> ProgramDb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,6 @@ convLibDepsAs :: DependencyReason PN -> PrivateDependency -> [LDep PN]
convLibDepsAs dr (PrivateDependency alias deps) =
[ LDep dr $ Dep (PkgComponent pn (ExposedLib lib)) (Private alias) (Constrained vr)
| Dependency pn vr libs <- deps, lib <- NonEmptySet.toList libs ]
where


-- | Convert a Cabal dependency on an executable (build-tools) to a solver-specific dependency.
convExeDep :: DependencyReason PN -> ExeDependency -> LDep PN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ instance IsNode NonSetupLibDepSolverPlanPackage where
nodeKey spkg

nodeNeighbors (NonSetupLibDepSolverPlanPackage spkg) =
ordNub $ (map fst $ CD.nonSetupDeps (resolverPackageLibDeps spkg))
ordNub $ map fst (CD.nonSetupDeps (resolverPackageLibDeps spkg))

-- | Work out which version of the Cabal we will be using to talk to the
-- Setup.hs interface for this package.
Expand Down
11 changes: 5 additions & 6 deletions cabal-install/tests/UnitTests/Distribution/Client/ScriptUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ testScriptPath (ShortPath p) = withMaxSuccess 10000 $ ioProperty $ do
hashed_path <- getScriptCacheDirectory p
script_build_dir <- defaultScriptBuildsDir
return $
and
-- 1. Is it a valid path at all
[ isValid hashed_path
, -- 2. Is the computed hashed path in the expected directory?
(script_build_dir </> takeFileName hashed_path) `equalFilePath` hashed_path
]
-- 1. Is it a valid path at all
isValid hashed_path
&&
-- 2. Is the computed hashed path in the expected directory?
(script_build_dir </> takeFileName hashed_path) `equalFilePath` hashed_path
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ import Distribution.Solver.Types.Settings
import Distribution.Solver.Types.SolverPackage
import Distribution.Solver.Types.SourcePackage
import Distribution.Solver.Types.Variable
import Distribution.Types.Dependency (PrivateAlias)

{-------------------------------------------------------------------------------
Example package database DSL
Expand Down Expand Up @@ -680,6 +679,7 @@ exAvSrcPkg ex =

mkDirectD :: (ExamplePkgName, C.LibraryName, C.VersionRange, Maybe ExamplePrivateAlias) -> C.PrivateDependency
mkDirectD (dep, name, vr, Just alias) = C.PrivateDependency (C.PrivateAlias (fromString alias)) [C.Dependency (C.mkPackageName dep) vr (NonEmptySet.singleton name)]
mkDirectD (_, _, _, Nothing) = error "mkDirectD: private deps are never Nothing since we partition them by 'isJust' above"

mkFlagged
:: (C.LibraryVisibility -> C.BuildInfo -> a)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ main = do
"show" -> do
s <- getContents
let a1 :: A = decode s
res <- return $ show a1
res = show a1
putStr (encode res)
"inc" -> do
s <- getContents
let a1 :: A = decode s
res <- return $ inc a1
res = inc a1
putStr (encode res)
_ -> error "Hook not yet implemented"
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ revertA2 L2.B = L.B

hooks_show :: L.A -> HooksM String
hooks_show a = do
ver <- hooksVersion <$> ask
ver <- asks hooksVersion
case ver of
V01 -> readHooksExe "show" (convertA1 a)
V02 -> readHooksExe "show" (convertA2 a)

hooks_inc :: L.A -> HooksM L.A
hooks_inc a = do
ver <- hooksVersion <$> ask
ver <- asks hooksVersion
case ver of
V01 -> revertA1 <$> (readHooksExe "inc" (convertA1 a))
V02 -> revertA2 <$> (readHooksExe "inc" (convertA2 a))
Expand All @@ -88,7 +88,7 @@ hooks_inc a = do

readHooksExe :: (Binary a, Binary b) => String -> a -> HooksM b
readHooksExe hook args = do
exe <- hooksExe <$> ask
exe <- asks hooksExe
liftIO $ readHooksExe_ exe hook args

withForkWait :: IO () -> (IO () -> IO a) -> IO a
Expand Down
2 changes: 1 addition & 1 deletion cabal-testsuite/src/Test/Cabal/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ findDependencyInStore :: String -- ^package name prefix
findDependencyInStore pkgName = do
storeDir <- testStoreDir <$> getTestEnv
liftIO $ do
storeDirForGhcVersion <- head <$> listDirectory storeDir
(storeDirForGhcVersion:_) <- listDirectory storeDir
packageDirs <- listDirectory (storeDir </> storeDirForGhcVersion)
-- Ideally, we should call 'hashedInstalledPackageId' from 'Distribution.Client.PackageHash'.
-- But 'PackageHashInputs', especially 'PackageHashConfigInputs', is too hard to construct.
Expand Down

0 comments on commit ed3579a

Please sign in to comment.