-
Notifications
You must be signed in to change notification settings - Fork 116
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
Include licenses in packages #882
Conversation
@@ -152,3 +152,5 @@ require ( | |||
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect | |||
sigs.k8s.io/yaml v1.3.0 // indirect | |||
) | |||
|
|||
replace github.com/elastic/package-spec => github.com/elastic/package-spec v1.12.2-0.20220629092545-9ee240e557a5 |
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.
To be removed before merging, once elastic/package-spec#355 is included in the used package-spec.
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 think that you may want to take a look also at the create
command and add an option to select licenses there.
@@ -110,7 +110,10 @@ type PackageManifest struct { | |||
Owner Owner `config:"owner" json:"owner" yaml:"owner"` | |||
Description string `config:"description" json:"description" yaml:"description"` | |||
License string `config:"license" json:"license" yaml:"license"` | |||
Categories []string `config:"categories" json:"categories" yaml:"categories"` | |||
Source struct { | |||
License string `config:"license" json:"license" yaml:"license"` |
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.
Do you plan to deprecate the license field in this PR?
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.
It is deprecated in the package-spec.
I think we are not doing anything with deprecations in elastic-package
, do you have a proposal for something that we could do here?
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 would drop a comment in the source in this place as both fields are modeled. Frankly speaking, it's another argument for switching to a common place with business/model structures.
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.
Frankly speaking, it's another argument for switching to a common place with business/model structures.
Yep, another +1 for something like elastic/package-spec#322.
} | ||
if license := m.Source.License; license != "" { | ||
logger.Debugf("Write license text for %q", license) | ||
err := licenses.WriteTextToFile(license, filepath.Join(destinationDir, "LICENSE.txt")) |
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.
Is there an option to use your own license? Will it break the building logic here?
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.
Not at the moment, do we want to support it?
If we want, we could relax the check of unknown licenses, and include whatever the developer places in the source.license
field and the LICENSE.txt
file.
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.
(it will break the current logic because it assumes that source.license
if set, is set to one of the values enumerated in the spec)
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.
Passing this to @akshay-saraswat. From developer's point of view, we may end up with an edge case, when a developer/team/customer needs to slightly modify the LICENSE text. For example, add an extra paragraph.
internal/builder/packages.go
Outdated
if options.buildDir == "" { | ||
destinationDir, err = BuildPackagesDirectory(options.PackageRoot) | ||
if err != nil { | ||
return "", errors.Wrap(err, "can't locate build directory") | ||
} | ||
} else { | ||
destinationDir, err = buildPackagesDirectory(options.buildDir, options.PackageRoot) | ||
if err != nil { | ||
return "", errors.Wrap(err, "can't locate build directory") | ||
} |
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 exactly do you need this if-else block? It looks like it complicated the current logic.
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 added options.buildDir
to have a predictable place where packages are built for testing.
I can move this logic to the new internal method. I didn't modify the behaviour or interface of BuildPackagesDirectory
because it is a exposed method, though it is in an internal package.
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.
Moved logic to the current BuildPackagesDirectory
and changed the other use we have of this.
🌐 Coverage report
|
same "printed page" as the copyright notice for easier | ||
identification within third-party archives. | ||
|
||
Copyright [yyyy] [name of copyright owner] |
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.
Should we render this data or remove the entry?
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.
This comment elastic/package-spec#367 (comment) applies here.
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.
Recent changes look good to me, but will hold my "approval" until we clarify this point.
@mtojek I am thinking on closing this, and leaving developers the responsibility of properly licensing their code. Reasons:
The plan would still be:
|
SGTM, maybe you can focus on the spec profiles and forbid using deprecated properties, or enable |
Include a new
LICENSE.txt
file when building packages that include thesource.license
field in their manifests.Follow up of elastic/package-spec#355.
Part of elastic/package-spec#298.