| |
@@ -170,6 +170,23 @@
|
| |
break_the_build(str(exc))
|
| |
exit(1)
|
| |
|
| |
+ case "license":
|
| |
+ try:
|
| |
+ metadata = Metadata.from_cargo(args.path)
|
| |
+
|
| |
+ if metadata.is_workspace():
|
| |
+ print("Cannot determine crate license from a cargo workspace.", file=sys.stderr)
|
| |
+ # exit code 1 will fail package scriptlets
|
| |
+ exit(1)
|
| |
+
|
| |
+ print(metadata.packages[0].license)
|
| |
+ exit(0)
|
| |
+
|
| |
+ except subprocess.CalledProcessError as exc:
|
| |
+ # catch the exception to ensure stdout and stderr are printed
|
| |
+ print(pretty_called_process_error(exc), file=sys.stderr)
|
| |
+ exit(1)
|
| |
+
|
| |
case "parse-vendor-manifest":
|
| |
try:
|
| |
action_parse_vendor_manifest(args)
|
| |
This is useful for a script I'm writing to collect all the bundled
crate licenses for centos-style vendored crates
Signed-off-by: Benjamin Herrenschmidt benh@amazon.com