Skip to content
Merged
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
10 changes: 10 additions & 0 deletions plans/license-validate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# License Validate

Check if the License tag is SPDX formula and contains only allowed licenses.
Run [license-validate] on the SPEC file.

## See Also

- [license-validate]

[license-validate]: https://github.com/fedora-copr/license-validate
12 changes: 12 additions & 0 deletions plans/license-validate/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
summary: Run license-validate on the SPEC file

description: |
Check if the License tag is SPDX formula and contains only allowed licenses.

provision:
how: container
image: fedora:latest

discover:
how: fmf
test: /tests/license-validate
1 change: 1 addition & 0 deletions tests/license-validate/distgit-prepare.py
27 changes: 27 additions & 0 deletions tests/license-validate/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/:
inherit: false

/prepare-distgit:
summary: Prepare with distgit environment
enabled: false
duration: 30m
order: 40
require:
- koji
- git
test: python3 ./distgit-prepare.py
adjust:
# TODO: For now this is only available for distgit commits
when: initiator == fedora-ci and trigger == commit
enabled: true

/run-license-validate:
summary: Run license-validate
duration: 30m
require:
- license-validate
Comment thread
LecrisUT marked this conversation as resolved.
# soft requirement of python3-specfile
- redhat-rpm-config
# can remove when license-validate-29 lands stable
- python3-specfile
test: python3 ./run-license-validate.py
37 changes: 37 additions & 0 deletions tests/license-validate/run-license-validate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/python3
# /// script
# dependencies = [ ]
# ///
Comment on lines +2 to +4
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's this for?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have no idea. I just copied that from rpmlint directory.

Copy link
Copy Markdown
Collaborator

@LecrisUT LecrisUT Mar 2, 2026

Choose a reason for hiding this comment

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

It is PEP723. It is meant to be able to run locally with just (pipx|hatch|uv) run ... and it handles any missing dependencies etc.


import argparse
import os
import subprocess
import sys


def main(args: argparse.Namespace) -> None:
"""
Run rpmlint
"""
rpmlint_args = []
if args.spec_file:
rpmlint_args.append(args.spec_file)
print(f"Running: license-validate -v --spec {rpmlint_args}")
result = subprocess.run(["license-validate", "-v", "--spec", *rpmlint_args])
if result.returncode != 0:
print(f"Error: license-validate failed with exit code {result.returncode}")
sys.exit(1)


if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Simple wrapper for license-validate. Can also pass variables via environment variables."
)
parser.add_argument(
"--spec-file",
help="Spec file to check.",
default=os.environ.get("SPEC_FILE"),
)

args = parser.parse_args()
main(args)