Skip to content

Implement the '--allow-newer' option for 'configure'/'install' - #1604

Merged
23Skidoo merged 17 commits into
haskell:masterfrom
23Skidoo:allow-newer
Dec 9, 2013
Merged

23Skidoo merged 17 commits into
haskell:masterfrom
23Skidoo:allow-newer

Conversation

@23Skidoo

@23Skidoo 23Skidoo commented Dec 5, 2013

Copy link
Copy Markdown
Member

Fixes #949. Example usage:

$ grep array tst.cabal
  build-depends:       base >=4.5 && <4.6, array >= 0.3 && < 0.4

$ ghc-pkg list array --simple-output
array-0.4.0.0

$ cabal configure
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: tst-0.1.0.0 (user goal)
next goal: array (dependency of tst-0.1.0.0)
rejecting: array-0.4.0.0/installed-4f6... (conflict: tst => array>=0.3 &&
<0.4)
Dependency tree exhaustively searched.

$ cabal configure --allow-newer
Resolving dependencies...
Configuring tst-0.1.0.0...

$ cabal build
Building tst-0.1.0.0...
Preprocessing executable 'tst' for tst-0.1.0.0...
[1 of 1] Compiling Main             ( Main.hs, dist/build/tst/tst-tmp/Main.o )
Linking dist/build/tst/tst ...

Known issues:

  • Dependencies on internal libraries are not relaxed.
  • build-depends: a < 3 && >= 2; if (someFlag): build-depends: a >= 5 && < 6 gets relaxed to build-depends: >= 2; if (someFlag): build-depends: a >= 5 (4 is now allowed where it previously wasn't).
  • When configure --exact-configuration fails, the error message should probably mention --exact-configuration.

Implemented by going through all packages in the 'depResolverSourcePkgIndex' and
applying 'relaxUpperBound' to the dependencies listed in 'build-depends'.

Known issue:
'build-depends: a < 3 && >= 2; if (someFlag): build-depends: a >= 5 && < 6'
gets converted to
'build-depends: >= 2; if (someFlag): build-depends: a >= 5'
(4 is now allowed where it previously wasn't).

Example:

    $ cabal install --dry-run ./tst
    Resolving dependencies...
    In order, the following would be installed (use -v for more details):
    array-0.3.0.3 (latest: 0.5.0.0)
    tst-0.1.0.0 (latest: 0.1.1)

    $ cabal install --dry-run --allow-newer=array ./tst
    Resolving dependencies...
    In order, the following would be installed (use -v for more details):
    tst-0.1.0.0 (latest: 0.1.1)
@23Skidoo

23Skidoo commented Dec 6, 2013

Copy link
Copy Markdown
Member Author

@dcoutts I think I've now addressed all your comments.

@dcoutts

dcoutts commented Dec 7, 2013

Copy link
Copy Markdown
Contributor

Thanks, I'll have another look.

@bos

bos commented Dec 9, 2013

Copy link
Copy Markdown
Contributor

I tried this last night, and it absolutely saved my bacon. Thanks, @23Skidoo!

@dcoutts

dcoutts commented Dec 9, 2013

Copy link
Copy Markdown
Contributor

@23Skidoo ok, I think we're good to go.

@bos ah, good to know. Thanks for trying it. Perhaps mention it in an update on your blog/G+? ;-)

23Skidoo added a commit that referenced this pull request Dec 9, 2013
Implement the '--allow-newer' option for 'configure'/'install'
@23Skidoo
23Skidoo merged commit 9fb3927 into haskell:master Dec 9, 2013
@23Skidoo
23Skidoo deleted the allow-newer branch December 9, 2013 17:06
@23Skidoo

23Skidoo commented Dec 9, 2013

Copy link
Copy Markdown
Member Author

@bos Glad to hear that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: --ignore-constraints

3 participants