Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/md/melange_license-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ melange license-check file [flags]
```
--fix fix license issues in the melange yaml file
-h, --help help for license-check
--structured enable structured license grouping by directory while fixing license issues
--workdir string path to the working directory, e.g. where the source will be extracted to
```

Expand Down
43 changes: 43 additions & 0 deletions examples/complex-licensing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package:
name: complex-licensing-example
version: 1.0.0
epoch: 0
description: "Example package demonstrating complex licensing scenarios"
copyright:
# Simple license case (backward compatible)
- license: MIT
license-path: LICENSE-MIT

# Multi-licensed main code (user can choose either license)
- operator: OR
licenses:
- license: Apache-2.0
license-path: LICENSE-Apache
- license: GPL-3.0-or-later
license-path: LICENSE-GPL

# Vendored code with additional requirements (must comply with all)
- operator: AND
licenses:
# Main project has multiple license options
- operator: OR
licenses:
- license: MIT
- license: BSD-3-Clause
# Plus vendored GPL code that must be included
- license: LGPL-2.1-or-later
paths: ["vendor/lgpl-lib/*"]
license-path: vendor/lgpl-lib/COPYING

environment:
contents:
repositories:
- https://packages.wolfi.dev/os
keyring:
- https://packages.wolfi.dev/os/wolfi-signing.rsa.pub
packages:
- build-base
- busybox

pipeline:
- runs: echo "Complex licensing example"
3 changes: 3 additions & 0 deletions pkg/cli/license_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
func licenseCheck() *cobra.Command {
var workDir string
var fix bool
var structured bool
cmd := &cobra.Command{
Use: "license-check file",
Short: "Gather and check licensing data",
Expand Down Expand Up @@ -81,6 +82,7 @@ func licenseCheck() *cobra.Command {
ctx,
copyright.WithLicenses(detectedLicenses),
copyright.WithDiffs(diffs),
copyright.WithStructured(structured),
)
err = rc.Renovate(cmd.Context(), copyrightRenovator)
}
Expand All @@ -91,6 +93,7 @@ func licenseCheck() *cobra.Command {

cmd.Flags().StringVar(&workDir, "workdir", "", "path to the working directory, e.g. where the source will be extracted to")
cmd.Flags().BoolVar(&fix, "fix", false, "fix license issues in the melange yaml file")
cmd.Flags().BoolVar(&structured, "structured", false, "enable structured license grouping by directory while fixing license issues")

return cmd
}
Loading
Loading