-
Notifications
You must be signed in to change notification settings - Fork 7
add license-validate test #30
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../rpmlint/distgit-prepare.py |
| 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 | ||
| # soft requirement of python3-specfile | ||
| - redhat-rpm-config | ||
| # can remove when license-validate-29 lands stable | ||
| - python3-specfile | ||
| test: python3 ./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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this for?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no idea. I just copied that from rpmlint directory.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| 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) | ||
Uh oh!
There was an error while loading. Please reload this page.