Skip to content

Commit 0ca282c

Browse files
committed
add license-validate test
1 parent 9b53c08 commit 0ca282c

5 files changed

Lines changed: 79 additions & 0 deletions

File tree

plans/license-validate/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# License Validate
2+
3+
Check if the License tag is SPDX formula and contains only allowed licenses.
4+
Run [license-validate] on the SPEC file.
5+
6+
## See Also
7+
8+
- [license-validate]
9+
10+
[license-validate]: https://github.com/fedora-copr/license-validate

plans/license-validate/main.fmf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
summary: Run license-validate on the SPEC file
2+
3+
description: |
4+
Check if the License tag is SPDX formula and contains only allowed licenses.
5+
6+
provision:
7+
how: container
8+
image: fedora:latest
9+
10+
discover:
11+
how: fmf
12+
test: /tests/license-validate
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../rpmlint/distgit-prepare.py

tests/license-validate/main.fmf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/:
2+
inherit: false
3+
4+
/prepare-distgit:
5+
summary: Prepare with distgit environment
6+
enabled: false
7+
duration: 30m
8+
order: 40
9+
require:
10+
- koji
11+
- git
12+
test: python3 ./distgit-prepare.py
13+
adjust:
14+
# TODO: For now this is only available for distgit commits
15+
when: initiator == fedora-ci and trigger == commit
16+
enabled: true
17+
18+
/run-license-validate:
19+
summary: Run license-validate
20+
duration: 30m
21+
require:
22+
- license-validate
23+
test: python3 ./run-license-validate.py
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/python3
2+
# /// script
3+
# dependencies = [ ]
4+
# ///
5+
6+
import argparse
7+
import os
8+
import subprocess
9+
10+
11+
def main(args: argparse.Namespace) -> None:
12+
"""
13+
Run rpmlint
14+
"""
15+
rpmlint_args = []
16+
if args.spec_file:
17+
rpmlint_args.append(args.spec_file)
18+
print(f"Running license-validate with: {rpmlint_args}")
19+
subprocess.run(["license-validate", "-v", "--spec", *rpmlint_args])
20+
21+
22+
if __name__ == "__main__":
23+
parser = argparse.ArgumentParser(
24+
description="Simple wrapper for license-validate. Can also pass variables via environment variables."
25+
)
26+
parser.add_argument(
27+
"--spec-file",
28+
help="Spec file to check.",
29+
default=os.environ.get("SPEC_FILE"),
30+
)
31+
32+
args = parser.parse_args()
33+
main(args)

0 commit comments

Comments
 (0)