有没有办法自动更新 .cabal-file 中的 build-depends 字段?例如,如果我们从以下.cabal
文件开始:
name: HUnit
version: 1.1.1
synopsis: A unit testing framework for Haskell
homepage: http://hunit.sourceforge.net/
category: Testing
author: Dean Herington
license: BSD3
license-file: LICENSE
cabal-version: >= 1.10
build-type: Simple
library
build-depends: base >= 2 && < 4
exposed-modules: Test.HUnit.Base, Test.HUnit.Lang,
Test.HUnit.Terminal, Test.HUnit.Text, Test.HUnit
default-extensions: CPP
然后,安装一个包:
cabal install warp
现在,我必须将warp >=3.0 && <3.1
添加到build-depends
字段,以使文件看起来像这样:
name: HUnit
version: 1.1.1
synopsis: A unit testing framework for Haskell
homepage: http://hunit.sourceforge.net/
category: Testing
author: Dean Herington
license: BSD3
license-file: LICENSE
cabal-version: >= 1.10
build-type: Simple
library
build-depends: base >= 2 && < 4, warp >=3.0 && <3.1
exposed-modules: Test.HUnit.Base, Test.HUnit.Lang,
Test.HUnit.Terminal, Test.HUnit.Text, Test.HUnit
default-extensions: CPP
我的问题是:我们如何自动更新此文件?
答案 0 :(得分:2)
现代cabal-install
中有两个工具用于帮助管理依赖关系的边界。首先是gen-bounds
,它根据当前安装的版本规范为软件包建议正确的版本范围。第二个是outdated
,其中列出了cabal
文件中hackage
上存在较新版本的依赖项。两者都记录在电话簿手册中:https://www.haskell.org/cabal/users-guide/developing-packages.html#generating-dependency-version-bounds