| |
@@ -20,13 +20,13 @@
|
| |
API_URL = "https://crates.io/api/v1/"
|
| |
TEMPLATE = """# Generated by rust2rpm
|
| |
%bcond_without check
|
| |
- {% if not include_debug %}
|
| |
+ {% if not include_main %}
|
| |
%global debug_package %{nil}
|
| |
{% endif %}
|
| |
|
| |
%global crate {{ md.name }}
|
| |
|
| |
- Name: {{ name }}
|
| |
+ Name: rust-%{crate}
|
| |
Version: {{ md.version }}
|
| |
Release: 1%{?dist}
|
| |
{% if md.description is none %}
|
| |
@@ -74,8 +74,16 @@
|
| |
%description
|
| |
%{summary}.
|
| |
|
| |
- {% if name_devel is not none %}
|
| |
- %package {{ name_devel }}
|
| |
+ {% if include_main %}
|
| |
+ %package -n %{crate}
|
| |
+ Summary: %{summary}
|
| |
+
|
| |
+ %description -n %{crate}
|
| |
+ %{summary}.
|
| |
+
|
| |
+ {% endif %}
|
| |
+ {% if include_devel %}
|
| |
+ %package devel
|
| |
Summary: %{summary}
|
| |
BuildArch: noarch
|
| |
{% if include_provides %}
|
| |
@@ -98,7 +106,7 @@
|
| |
{% endif %}
|
| |
{% endif %}
|
| |
|
| |
- %description {{ name_devel }}
|
| |
+ %description devel
|
| |
{% if md.description is none %}
|
| |
%{summary}.
|
| |
{% else %}
|
| |
@@ -125,7 +133,7 @@
|
| |
%endif
|
| |
|
| |
{% if include_main %}
|
| |
- %files
|
| |
+ %files -n %{crate}
|
| |
{% if md.license_file is not none %}
|
| |
%license {{ md.license_file }}
|
| |
{% endif %}
|
| |
@@ -134,8 +142,8 @@
|
| |
{% endfor %}
|
| |
|
| |
{% endif %}
|
| |
- {% if name_devel is not none %}
|
| |
- %files {{ name_devel }}
|
| |
+ {% if include_devel %}
|
| |
+ %files devel
|
| |
{% if md.license_file is not none %}
|
| |
%license {{ md.license_file }}
|
| |
{% endif %}
|
| |
@@ -256,23 +264,13 @@
|
| |
is_bin = len(bins) > 0
|
| |
is_lib = len(libs) > 0
|
| |
if is_bin:
|
| |
- spec_basename = args.crate
|
| |
- kwargs["include_debug"] = True
|
| |
- kwargs["name"] = "%{crate}"
|
| |
kwargs["include_main"] = True
|
| |
kwargs["bins"] = bins
|
| |
- if not is_lib:
|
| |
- kwargs["name_devel"] = None
|
| |
- else:
|
| |
- kwargs["name_devel"] = "-n rust-%{crate}-devel"
|
| |
elif is_lib:
|
| |
- spec_basename = "rust-{}".format(args.crate)
|
| |
- kwargs["include_debug"] = False
|
| |
- kwargs["name"] = "rust-%{crate}"
|
| |
kwargs["include_main"] = False
|
| |
- kwargs["name_devel"] = " devel"
|
| |
else:
|
| |
raise ValueError("No bins and no libs")
|
| |
+ kwargs["include_devel"] = is_lib
|
| |
|
| |
if args.target == "fedora":
|
| |
kwargs["include_build_requires"] = True
|
| |
@@ -288,7 +286,7 @@
|
| |
kwargs["date"] = time.strftime("%a %b %d %Y")
|
| |
kwargs["packager"] = detect_packager()
|
| |
|
| |
- spec_file = "{}.spec".format(spec_basename)
|
| |
+ spec_file = "rust-{}.spec".format(args.crate)
|
| |
spec_contents = template.render(md=metadata, patch_file=patch_file, **kwargs)
|
| |
if args.stdout:
|
| |
print("# {}".format(spec_file))
|
| |
Signed-off-by: Igor Gnatenko ignatenkobrain@fedoraproject.org