diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py index b5fd6f3..49023bd 100644 --- a/rust2rpm/__main__.py +++ b/rust2rpm/__main__.py @@ -363,6 +363,8 @@ def main(): help="Use autorelease and autochangelog features") parser.add_argument("--no-rpmautospec", action="store_false", help="Do not use rpmautospec") + parser.add_argument("--relative-license-paths", action="store_true", + help="Put all license files in main license directory") parser.add_argument("--all-features", action="store_true", help="Activate all available features") parser.add_argument("--dynamic-buildrequires", action="store_true", @@ -447,6 +449,8 @@ def main(): rpmautospec = detect_rpmautospec(default_target, spec_file) kwargs["rpmautospec"] = rpmautospec + kwargs["relative_license_paths"] = args.relative_license_paths + if args.target in {"fedora", "mageia", "opensuse"}: kwargs["include_build_requires"] = True kwargs["include_provides"] = False diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec index 30fce2a..0799363 100644 --- a/rust2rpm/templates/main.spec +++ b/rust2rpm/templates/main.spec @@ -160,7 +160,13 @@ use {% if feature is not none %}the "{{ feature }}" feature of {% endif %}the "% %files {{ pkg }} {% if feature is none %} {% if license_files|length > 0 %} + {% if relative_license_paths %} %license {{ license_files|join(' ') }} + {% else %} + {% for file in license_files %} +%license %{crate_instdir}/{{ file }} + {% endfor %} + {% endif %} {% else %} # FIXME: no license files detected {% endif %}