Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use package-id arg to stack ghc/runghc instead of package name #2497

Merged
merged 2 commits into from
Aug 16, 2016

Conversation

harendra-kumar
Copy link
Collaborator

Current mechanism of using GHC_PACKAGE_PATH for runghc and ghc commands does
not seem to work well when we have multiple versions of the same package. GHC
does not always pick up the packages in the same order as GHC_PACKAGE_PATH.

This fix determines of the package-ids using ghc-pkg and then passes
package-ids on command line of ghc or runghc invocation. This works only when
the user explicitly passes --package to runghc or ghc commands. When --package
is not specified we have no easy way to determine what all packages will be
used by the file being compiled.

This will make sure that scripts which explicitly list all or multi-instance
packages will always run reliably.

fixes #1957 (Requires all packages to be listed explicitly)

@Blaisorblade
Copy link
Collaborator

This looks mostly good to me, and the fix idea and new code is probably good.

Only one concern: would you mind separating the behavior-preserving refactoring from the behavioral change, and document them as such? (That is, the refactoring should declare itself as such, since one can't tell from looking at the diff).
This is not critical; but it's hard to tell the different changes apart, and that can be a concern when looking at history, so I care a bit.

So that we can use the installed package-ids to prepare the ghc command (to
be done in the next commit). This commit does not change behavior.
Current mechanism of using GHC_PACKAGE_PATH for runghc and ghc commands does
not seem to work well when we have multiple versions of the same package. GHC
does not always pick up the packages in the same order as GHC_PACKAGE_PATH.

This fix determines the package-ids using ghc-pkg and then passes
package-ids on command line of ghc or runghc invocation. This works only when
the user explicitly passes --package to runghc or ghc commands. When --package
is not specified we have no easy way to determine what all packages will be
used by the file being compiled.

This will make sure that scripts which explicitly list all packages will
always run reliably even in presence of packages which have multiple instances
of the same version or multiple versions installed.

fixes #1957 (Requires all packages to be listed explicitly)
@harendra-kumar
Copy link
Collaborator Author

The CI failure does not seem to have anything to do with the change.

@Blaisorblade
Copy link
Collaborator

Failure seems indeed spurious (seen this before). LGTM & merging. Thanks!

@Blaisorblade Blaisorblade merged commit 66fb845 into master Aug 16, 2016
@Blaisorblade Blaisorblade deleted the self-contained-scripts branch August 16, 2016 14:06
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.

Running Haskell script with Stack uses multiple versions of one package
4 participants