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

[WIP] Implement stack_snapshot.vendored_packages #910

Closed
wants to merge 1 commit into from

Conversation

mboes
Copy link
Member

@mboes mboes commented May 30, 2019

This feature allows overriding packages in the snapshot with targets
defined manually. Useful when the source distribution needs to be
patched, or when the BUILD file needs to be customized.

Closes #902.

This feature allows overriding packages in the snapshot with targets
defined manually. Useful when the source distribution needs to be
patched, or when the `BUILD` file needs to be customized.
@mboes mboes requested a review from aherrmann May 30, 2019 17:09
Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, might deserve a test-case for vendored_packages.

Useful [...] when the BUILD file needs to be customized

Yes, I agree that this covers that use-case very well.

Useful when the source distribution needs to be patched [...]

I'm not sure this is equivalent to Hazel's patches feature. With Hazel we get to do the following:

    hazel_repositories(
        packages = hazel_extra_packages(
            extra_pkgs = {
                "network": {
                    "version": "2.8.0.0",
                    "sha256": "c8905268b7e3b4cf624a40245bf11b35274a6dd836a5d4d531b5760075645303",
                    "patches": ["@ai_formation_hazel//third_party/haskell:network.patch"],
                },
            },
        ),
        ...
    )

I.e. here we customize the version of network and also apply a patch to its source distribution, but we don't have to write the boilerplate for defining the actual target.

As I understand this patch, we'd have to do something like this

http_archive(
    name = "network",
    urls = ...,
    patches = ...,
    ...
    build_file_content = """
        haskell_cabal_library(
            name = "network",
            deps = ...,
            ...
        ),
    """,
)

stack_snapshot(
    ...
    vendored_packages = { "network": "@network//:network" },
)

I.e. we have to write the BUILD file ourselves, and in particular we have to list the dependencies for network ourselves.

),
"packages": attr.string_list(
doc = "A set of package identifiers. For packages in the snapshot, version numbers can be omitted.",
),
"vendored_packages": attr.label_keyed_string_dict(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be covered by the test-suite.

@mboes
Copy link
Member Author

mboes commented May 31, 2019

I.e. we have to write the BUILD file ourselves, and in particular we have to list the dependencies for network ourselves.

Yes, this is correct.

@mboes mboes mentioned this pull request May 31, 2019
@mboes mboes changed the title Implement stack_snapshot.vendored_packages WIP Implement stack_snapshot.vendored_packages Jun 3, 2019
@mboes mboes changed the title WIP Implement stack_snapshot.vendored_packages [WIP] Implement stack_snapshot.vendored_packages Jun 3, 2019
@mboes
Copy link
Member Author

mboes commented Jun 3, 2019

I'm parking this PR as WIP for now. The reason is, while the change is fairly lightweight, it's not super convenient to test, but much more importantly, the work is a little ahead of our actual use cases at this point, especially given that I'd expect many use cases to be covered by Stack custom snapshots instead. We should merge this once downstream starts feeling the pinch of not having this feature.

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.

stack_install: let user apply source patches
2 participants