Add rust2rpm --show-license-map

This is helpful when debugging the list.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-08-16 16:09:15 +02:00
parent d5d78d9fb1
commit 7f2885fbfd
2 changed files with 16 additions and 1 deletions

View file

@ -7,6 +7,7 @@ import itertools
import os
import shlex
import shutil
import sys
import tarfile
import tempfile
import time
@ -185,6 +186,8 @@ def make_diff_metadata(crate, version, patch=False, store=False):
def main():
parser = argparse.ArgumentParser("rust2rpm",
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument("--show-license-map", action="store_true",
help="Print license mappings and exit")
parser.add_argument("-", "--stdout", action="store_true",
help="Print spec and patches into stdout")
parser.add_argument("-t", "--target", action="store",
@ -196,10 +199,18 @@ def main():
help="Store crate in current directory")
parser.add_argument("crate", help="crates.io name\n"
"path/to/local.crate\n"
"path/to/project/")
"path/to/project/",
nargs="?")
parser.add_argument("version", nargs="?", help="crates.io version")
args = parser.parse_args()
if args.show_license_map:
licensing.dump_sdpx_to_fedora_map(sys.stdout)
return
if args.crate is None:
parser.error('required crate/path argument missing')
crate, diff, metadata = make_diff_metadata(args.crate, args.version,
patch=args.patch,
store=args.store_crate)

View file

@ -21,6 +21,10 @@ def spdx_to_fedora_map():
for line in reader
if line['SPDX License Identifier']}
def dump_sdpx_to_fedora_map(file):
for k,v in spdx_to_fedora_map().items():
print(f"{k}{v}", file=file)
def translate_license_fedora(license):
comments = ''
final = []