-
Notifications
You must be signed in to change notification settings - Fork 211
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
'gpl' cabal flag to switch between HsYAML and aeson-yaml #1417
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far this is pretty small change, which is nice! :)
I assume the change in the dhall/dhall-lang
submodule was not intended?
@patrickmn Can you show us a diff of some YAML generated with both versions of dhall-to-yaml
? Maybe one of the example configs from dhall-kubernetes
?
It would be good to have tests for both variants, and to run them in CI. As long as the output differs between the variants, the output files produced with -fgpl
could have the file extension .yaml-gpl
.
Does this allow us to fully get rid of the Eta-specific code in dhall-json
?
Indeed, submodule change was unintended. Think I fixed it.
@sjakobi Here's an example of aeson-yaml yaml: https://github.com/clovyr/aeson-yaml/blob/master/test/Test/Data/Aeson/Yaml.hs#L94-L126 Will post a diff and add a gpl cpp flag in a bit.
HsYAML doesn't build on eta, but if you're ok with only encoding and not parsing on eta, I can certainly strip that out. |
HsYAML apiVersion: apps/v1
kind: Deployment
spec:
revisionHistoryLimit: 10
selector:
matchLabels:
app: nginx
strategy:
rollingUpdate:
maxSurge: 5
maxUnavailable: 0
type: RollingUpdate
template:
spec:
containers:
- image: nginx:1.15.3
imagePullPolicy: Always
resources:
limits:
cpu: 500m
requests:
cpu: 10m
name: nginx
ports:
- containerPort: 80
metadata:
name: nginx
labels:
app: nginx
replicas: 2
metadata:
name: nginx aeson-yaml apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 2
revisionHistoryLimit: 10
selector:
matchLabels:
app: nginx
strategy:
rollingUpdate:
maxSurge: 5
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
app: nginx
name: nginx
spec:
containers:
- image: nginx:1.15.3
imagePullPolicy: Always
name: nginx
ports:
- containerPort: 80
resources:
limits:
cpu: 500m
requests:
cpu: 10m One syntax difference (list indentation), and aeson-yaml sorts objects (hashmaps) by key before outputting. |
I guess I could add some checks to aeson-yaml to output simple strings unquoted. Will mess with it tomorrow. |
I got to build it some time ago, what was the problem when trying to build it? |
Flag gpl | ||
Description: Use GPL-licensed components like HsYAML, and enable yaml-to-dhall binary | ||
Default: False | ||
Manual: True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a manual flag? Why not like Cabal choose whatever if it's unspecified? This opens the door to more potential build plans, if you don't care.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That didn't seem like an explicit opt-in.
How can you not care about something that will cause you to have to relicense your project GPL? If you're using dhall-json as a library, that's something you have to consider. And if you're not, it's easy to do cabal v2-install -fgpl dhall-json
.
I personally wouldn't expect a Dhall (which is otherwise BSD3) utility package to semi-randomly have this effect. Curious what others think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @patrickmn that this flag should definitely be manual (since we don't want cabal
's solver to govern the decision of what license to use) and off by default (since I imagine most users will prefer a BSD license but they can enable the GPL version if they better YAML support and are willing to convince management/customers that it's safe)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I say you do want Cabal to choose unless you actually care. But it seems like we disagree there, and that's ok - we've had the conversation which is more important
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW there shouldn't be a case where aeson-yaml won't build; it only depends on aeson, bytestring, text, unordered-containers and vector.
Will try it again and strip the FFI stuff if it works. Added simple unquoted strings and (always) quoted encoding to aeson-yaml, and updated the diff above. Will add multi-line literal block scalars as well; then the only difference in the tests should be double- vs single quoting. |
@patrickmn: I have a pull request against your branch to enable the |
I pushed a new aeson-yaml release that uses single quotes for simple strings, and now the yaml tests pass without modification. |
@jneira On second thought: since this works, let's rip out the Eta FFI stuff in its own PR? |
Since the primary/only concern is redistributing GPL components, it seemed to make sense to name the flag 'gpl', and have that flag be opt-in rather than opt-out. That way, the user controls whether they want to be subject to the GPL.
Relating to aeson-yaml: A couple of test cases are failing due to aeson-yaml double-quoting all strings.
I will add quoting of keys to aeson-yaml and update this PR, but unquoted scalar support would significantly complicate things: https://stackoverflow.com/questions/3790454/how-do-i-break-a-string-over-multiple-lines/21699210#21699210
Thoughts?