From 41786ec21f5070682c5bd78a1981e24b57cdd262 Mon Sep 17 00:00:00 2001 From: Mike Sperber Date: Fri, 22 May 2020 13:28:02 +0200 Subject: [PATCH] Update tensorflow-haskell dependencies. Updating to the current HEAD of the Tensorflow-Haskell bindings allows us to also update the dependencies, specifically proto-lens, and avoid having to retain their outdated versions. --- .../configuration-hackage2nix.yaml | 11 -- .../configuration-tensorflow.nix | 69 +------- .../patches/proto-lens-0.5.1.0.patch | 23 --- .../patches/proto-lens-setup-0.4.0.2.patch | 154 ------------------ 4 files changed, 7 insertions(+), 250 deletions(-) delete mode 100644 pkgs/development/haskell-modules/patches/proto-lens-0.5.1.0.patch delete mode 100644 pkgs/development/haskell-modules/patches/proto-lens-setup-0.4.0.2.patch diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml index f347e75e828b..4798f99e2f03 100644 --- a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml +++ b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml @@ -2412,8 +2412,6 @@ extra-packages: - http-conduit ^>= 2.2 # pre-lts-11.x versions neeed by git-annex 6.20180227 - inline-c < 0.6 # required on GHC 8.0.x - inline-c-cpp < 0.2 # required on GHC 8.0.x - - lens-family ==1.2.3 # required for tensorflow - - lens-family-core ==1.2.3 # required for tensorflow - lens-labels == 0.1.* # required for proto-lens-descriptors - megaparsec >= 7.0.4 && < 8 # required for idris: https://github.com/idris-lang/Idris-dev/issues/4826 - mtl < 2.2 # newer versions require transformers > 0.4.x, which we cannot provide in GHC 7.8.x @@ -2427,11 +2425,6 @@ extra-packages: - persistent-sqlite < 2.7 # pre-lts-11.x versions neeed by git-annex 6.20180227 - prettyprinter == 1.6.1 # required by ghc 8.8.x, and dhall-1.29.0 - primitive == 0.5.1.* # required to build alex with GHC 6.12.3 - - proto-lens == 0.5.* # required for tensorflow-proto - - proto-lens-protobuf-types == 0.5.* # required for tensorflow-proto - - proto-lens-protoc == 0.5.* # required for tensorflow-proto - - proto-lens-runtime == 0.5.* # required for tensorflow-proto - - proto-lens-setup == 0.4.0.2 # required for tensorflow-proto - QuickCheck < 2 # required by test-framework-quickcheck and its users - resolv == 0.1.1.2 # required to build cabal-install-3.0.0.0 with pre ghc-8.8.x - resourcet ==1.1.* # pre-lts-11.x versions neeed by git-annex 6.20180227 @@ -9916,10 +9909,6 @@ broken-packages: - tempus - tensor - tensor-safe - - tensorflow - - tensorflow-core-ops - - tensorflow-logging - - tensorflow-ops - termbox - termbox-banana - termbox-bindings diff --git a/pkgs/development/haskell-modules/configuration-tensorflow.nix b/pkgs/development/haskell-modules/configuration-tensorflow.nix index aab416b9a87b..1be2b2e8ec32 100644 --- a/pkgs/development/haskell-modules/configuration-tensorflow.nix +++ b/pkgs/development/haskell-modules/configuration-tensorflow.nix @@ -11,79 +11,28 @@ let tensorflow-haskell = pkgs.fetchFromGitHub { owner = "tensorflow"; repo = "haskell"; - rev = "0f322b2e0611cbe7011c84ba8b6cb822e4725ebc"; - sha256 = "15gn66i547q20sd50ixwm6yk1g00syfgxp8xa6xjd0i3kcsl3gs1"; + rev = "568c9b6f03e5d66a25685a776386e2ff50b61aa9"; + sha256 = "0v58zhqipa441hzdvp9pwgv6srir2fm7cp0bq2pb5jl1imwyd37h"; fetchSubmodules = true; }; setTensorflowSourceRoot = dir: drv: (overrideCabal drv (drv: { src = tensorflow-haskell; })) .overrideAttrs (_oldAttrs: {sourceRoot = "source/${dir}";}); - - proto-lens = self.proto-lens_0_5_1_0; - proto-lens-protoc = self.proto-lens-protoc_0_5_0_0; - proto-lens-runtime = self.proto-lens-runtime_0_5_0_0; - proto-lens-protobuf-types = self.proto-lens-protobuf-types_0_5_0_0; - proto-lens-setup = self.proto-lens-setup_0_4_0_2; - lens-family = self.lens-family_1_2_3; in { - lens-family_1_2_3 = super.lens-family_1_2_3.override { - lens-family-core = self.lens-family-core_1_2_3; - }; - - proto-lens_0_5_1_0 = (appendPatch (doJailbreak super.proto-lens_0_5_1_0) ./patches/proto-lens-0.5.1.0.patch).override { - inherit lens-family; - }; - - proto-lens-runtime_0_5_0_0 = doJailbreak (super.proto-lens-runtime_0_5_0_0.override { - inherit lens-family proto-lens; - }); - - proto-lens-protoc_0_5_0_0 = doJailbreak (super.proto-lens-protoc_0_5_0_0.override { - inherit lens-family proto-lens; - haskell-src-exts = self.haskell-src-exts_1_19_1; - }); - proto-lens-setup_0_4_0_2 = appendPatch (doJailbreak (super.proto-lens-setup_0_4_0_2.override { - inherit proto-lens-protoc; - })) ./patches/proto-lens-setup-0.4.0.2.patch; - - proto-lens-protobuf-types_0_5_0_0 = doJailbreak (super.proto-lens-protobuf-types_0_5_0_0.override { - inherit lens-family proto-lens proto-lens-runtime proto-lens-setup; - }); - - haskell-src-exts_1_19_1 = appendPatches (doJailbreak super.haskell-src-exts_1_19_1) [ - # Adapt to the Semigroup–Monoid Proposal (enables building on GHC >= 8.4) - (pkgs.fetchpatch { - url = "https://github.com/haskell-suite/haskell-src-exts/commit/258e072fe9e37f94360b7488b58ea2832843bbb8.patch"; - sha256 = "0ja6ai41v9plinlhjwja282m6ahn6mw4xi79np0jxqk83cg0z1ff"; - }) - # Adapt to MonadFail proposal (enables building on GHC >= 8.8) - (pkgs.fetchpatch { - url = "https://gist.githubusercontent.com/mikesperber/0f2addaf3fbe97ffb4a5234d8711ba41/raw/e09e20998283c7195e82d546ba9266d290eb000d/gistfile1.txt"; - sha256 = "18clvli7vpqsqlf2f3qidn71738j9zdlpana6wha3x0dxwan5ly0"; - }) ]; - - tensorflow-proto = (setTensorflowSourceRoot "tensorflow-proto" super.tensorflow-proto).override { - inherit proto-lens proto-lens-runtime proto-lens-setup proto-lens-protobuf-types; - }; + tensorflow-proto = doJailbreak (setTensorflowSourceRoot "tensorflow-proto" super.tensorflow-proto); tensorflow = (setTensorflowSourceRoot "tensorflow" super.tensorflow).override { - inherit lens-family proto-lens; # the "regular" Python package does not seem to include the binary library libtensorflow = pkgs.libtensorflow-bin; }; - tensorflow-core-ops = (setTensorflowSourceRoot "tensorflow-core-ops" super.tensorflow-core-ops).override { - inherit lens-family proto-lens; - }; + tensorflow-core-ops = setTensorflowSourceRoot "tensorflow-core-ops" super.tensorflow-core-ops; - tensorflow-logging = (setTensorflowSourceRoot "tensorflow-logging" super.tensorflow-logging).override { - inherit lens-family proto-lens; - }; + tensorflow-logging = setTensorflowSourceRoot "tensorflow-logging" super.tensorflow-logging; tensorflow-mnist = (setTensorflowSourceRoot "tensorflow-mnist" super.tensorflow-mnist).override { - inherit lens-family proto-lens; # https://github.com/tensorflow/haskell/issues/215 tensorflow-mnist-input-data = self.tensorflow-mnist-input-data; }; @@ -124,11 +73,7 @@ in } ) {}); - tensorflow-opgen = (setTensorflowSourceRoot "tensorflow-opgen" super.tensorflow-opgen).override { - inherit lens-family proto-lens; - }; + tensorflow-opgen = setTensorflowSourceRoot "tensorflow-opgen" super.tensorflow-opgen; - tensorflow-ops = (setTensorflowSourceRoot "tensorflow-ops" super.tensorflow-ops).override { - inherit lens-family proto-lens; - }; + tensorflow-ops = setTensorflowSourceRoot "tensorflow-ops" super.tensorflow-ops; } diff --git a/pkgs/development/haskell-modules/patches/proto-lens-0.5.1.0.patch b/pkgs/development/haskell-modules/patches/proto-lens-0.5.1.0.patch deleted file mode 100644 index b50d3f1cdbfc..000000000000 --- a/pkgs/development/haskell-modules/patches/proto-lens-0.5.1.0.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/src/Data/ProtoLens/Encoding/Parser/Internal.hs b/src/Data/ProtoLens/Encoding/Parser/Internal.hs -index 30eeaad..f2703e7 100644 ---- a/src/Data/ProtoLens/Encoding/Parser/Internal.hs -+++ b/src/Data/ProtoLens/Encoding/Parser/Internal.hs -@@ -1,4 +1,5 @@ - {-# LANGUAGE LambdaCase #-} -+{-# LANGUAGE CPP #-} - -- | Definition of the parsing monad, plus internal - -- unsafe functions. - module Data.ProtoLens.Encoding.Parser.Internal -@@ -36,8 +37,11 @@ instance Applicative Parser where - (<*>) = ap - - instance Monad Parser where -- fail s = Parser $ \_ _ -> return $ ParseFailure s - return = pure - Parser f >>= g = Parser $ \end pos -> f end pos >>= \case - ParseSuccess pos' x -> unParser (g x) end pos' - ParseFailure s -> return $ ParseFailure s -+#if MIN_VERSION_base(4,13,0) -+instance MonadFail Parser where -+#endif -+ fail s = Parser $ \_ _ -> return $ ParseFailure s diff --git a/pkgs/development/haskell-modules/patches/proto-lens-setup-0.4.0.2.patch b/pkgs/development/haskell-modules/patches/proto-lens-setup-0.4.0.2.patch deleted file mode 100644 index a95df00e5dbf..000000000000 --- a/pkgs/development/haskell-modules/patches/proto-lens-setup-0.4.0.2.patch +++ /dev/null @@ -1,154 +0,0 @@ -diff --git a/src/Data/ProtoLens/Setup.hs b/src/Data/ProtoLens/Setup.hs -index e68f32b..f381199 100644 ---- a/src/Data/ProtoLens/Setup.hs -+++ b/src/Data/ProtoLens/Setup.hs -@@ -41,9 +41,6 @@ import Distribution.PackageDescription - , exeName - , exposedModules - , extraSrcFiles --#if !MIN_VERSION_Cabal(2,0,0) -- , hsSourceDirs --#endif - #if MIN_VERSION_Cabal(2,4,0) - , specVersion - #endif -@@ -53,7 +50,7 @@ import Distribution.PackageDescription - , testBuildInfo - , testName - ) --import qualified Distribution.Simple.BuildPaths as BuildPaths -+import Distribution.Simple.BuildPaths (autogenComponentModulesDir) - import Distribution.Simple.InstallDirs (datadir) - import Distribution.Simple.LocalBuildInfo - ( LocalBuildInfo(..) -@@ -61,9 +58,10 @@ import Distribution.Simple.LocalBuildInfo - , ComponentName(..) - , ComponentLocalBuildInfo - , componentPackageDeps --#if MIN_VERSION_Cabal(2,0,0) - , allComponentsInBuildOrder - , componentNameMap -+#if MIN_VERSION_Cabal(3,0,0) -+ , LibraryName(..) - #endif - ) - import qualified Distribution.Simple.PackageIndex as PackageIndex -@@ -205,16 +203,6 @@ generatingSpecificProtos root getProtos hooks = hooks - { buildHook = \p l h f -> generate l >> buildHook hooks p l h f - , haddockHook = \p l h f -> generate l >> haddockHook hooks p l h f - , replHook = \p l h f args -> generate l >> replHook hooks p l h f args --#if !MIN_VERSION_Cabal(2,0,0) -- -- Older versions of Cabal don't support the autogen-modules field. -- -- Work around it by manually generating the modules and putting them -- -- in a place where `cabal sdist` will pick them up. -- , sDistHook = \p maybe_l h f -> case maybe_l of -- Nothing -> error "Can't run protoc; run 'cabal configure' first." -- Just l -> do -- generate l -- sDistHook hooks (fudgePackageDesc l p) maybe_l h f --#endif - , postCopy = \a flags pkg lbi -> do - let verb = fromFlag $ copyVerbosity flags - let destDir = datadir (absoluteInstallDirs pkg lbi -@@ -316,39 +304,6 @@ copyProtosToDataDir verb root destDir files = do - protoLensImportsPrefix :: FilePath - protoLensImportsPrefix = "proto-lens-imports" - --#if !MIN_VERSION_Cabal(2,0,0) ---- | Add the autogen directory to the hs-source-dirs of all the targets in the ---- .cabal file. Used to fool 'sdist' by pointing it to the generated source ---- files. --fudgePackageDesc :: LocalBuildInfo -> PackageDescription -> PackageDescription --fudgePackageDesc lbi p = p -- { library = -- (\lib -> lib { libBuildInfo = fudgeBuildInfo CLibName $ libBuildInfo lib }) -- <$> library p -- , executables = -- (\exe -> exe { buildInfo = fudgeBuildInfo (CExeName $ exeName exe) -- $ buildInfo exe }) -- <$> executables p -- , testSuites = -- (\test -> test { testBuildInfo = fudgeBuildInfo (CTestName $ testName test) -- $ testBuildInfo test }) -- <$> testSuites p -- , benchmarks = -- (\bench -> bench { benchmarkBuildInfo = -- fudgeBuildInfo (CBenchName $ benchmarkName bench) -- $ benchmarkBuildInfo bench }) -- <$> benchmarks p -- } -- where -- comps = allComponents lbi -- fudgeBuildInfo n bi -- | Just compLBI <- Map.lookup n comps -- = bi { hsSourceDirs = autogenComponentModulesDir lbi compLBI -- : hsSourceDirs bi } -- | otherwise = bi -- Could happen if a component isn't active; try -- -- anyway and see whether Cabal complains later on. --#endif -- - -- | Returns whether the @root@ is a parent folder of @f@. - isSubdirectoryOf :: FilePath -> FilePath -> Bool - isSubdirectoryOf root f -@@ -423,15 +378,18 @@ collectActiveModules - collectActiveModules l = map (\(n, c) -> (c, f n)) $ Map.toList $ allComponents l - where - p = localPkgDescr l -- f CLibName = maybeToList (library p) >>= -+#if MIN_VERSION_Cabal(3,0,0) -+ f (CLibName LMainLibName) -+#else -+ f CLibName -+#endif -+ = maybeToList (library p) >>= - \lib -> exposedModules lib - ++ otherModules (libBuildInfo lib) - f (CExeName n) = otherModules . buildInfo $ exes Map.! n - f (CTestName n) = otherModules . testBuildInfo $ tests Map.! n - f (CBenchName n) = otherModules . benchmarkBuildInfo $ benchs Map.! n --#if MIN_VERSION_Cabal(2,0,0) - f _ = [] -- TODO: other lib kinds; for now just suppress the warning --#endif - exes = Map.fromList [(exeName e, e) | e <- executables p] - tests = Map.fromList [(testName e, e) | e <- testSuites p] - benchs = Map.fromList [(benchmarkName e, e) | e <- benchmarks p] -@@ -441,22 +399,14 @@ collectActiveModules l = map (\(n, c) -> (c, f n)) $ Map.toList $ allComponents - - -- | List all the packages that this one depends on. - collectDeps :: LocalBuildInfo -> [InstalledPackageInfo.InstalledPackageInfo] --#if MIN_VERSION_Cabal(2,0,0) - collectDeps l = do - c <- allComponentsInBuildOrder l - (i,_) <- componentPackageDeps c - Just p <- [PackageIndex.lookupUnitId (installedPkgs l) i] - return p --#else --collectDeps l = do -- (_, c ,_) <- componentsConfigs l -- (_, i) <- componentPackageDeps c -- PackageIndex.lookupSourcePackageId (installedPkgs l) i --#endif - - -- | All the components that will be built by this Cabal command. - allComponents :: LocalBuildInfo -> Map.Map ComponentName ComponentLocalBuildInfo --#if MIN_VERSION_Cabal(2,0,0) - allComponents l = fmap requireOne $ componentNameMap l - where - -- TODO: this doesn't support Backpack, which can have more than one -@@ -464,16 +414,3 @@ allComponents l = fmap requireOne $ componentNameMap l - requireOne [x] = x - requireOne xs = error $ "Data.ProtoLens.Setup.allComponents: expected one " - ++ "component per name, got " ++ show xs -- --#else --allComponents l = Map.fromList [(c, b) | (c, b, _) <- componentsConfigs l] --#endif -- ---- | Get the component-level "autogen" directory where we're putting the ---- generated .hs files. (For Cabal-1.0, use the shared 'BuildPaths.autogenModulesDir'.) --autogenComponentModulesDir :: LocalBuildInfo -> ComponentLocalBuildInfo -> FilePath --#if MIN_VERSION_Cabal(2,0,0) --autogenComponentModulesDir = BuildPaths.autogenComponentModulesDir --#else --autogenComponentModulesDir lbi _ = BuildPaths.autogenModulesDir lbi --#endif