parent
f89e4b4d98
commit
a71632f5f7
@ -1,26 +0,0 @@
|
|||||||
From b1df4d587fb03dcaedd7e8f29fbe5b7265ea5638 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
Date: Mon, 6 May 2019 10:43:05 +0200
|
|
||||||
Subject: [PATCH 01/14] templates: Do not put empty line after %changelog
|
|
||||||
|
|
||||||
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
---
|
|
||||||
rust2rpm/templates/main.spec | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec
|
|
||||||
index dcd24ca..0c84325 100644
|
|
||||||
--- a/rust2rpm/templates/main.spec
|
|
||||||
+++ b/rust2rpm/templates/main.spec
|
|
||||||
@@ -183,6 +183,7 @@ echo {{ "%r"|format(req) }}
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
-{% if auto_changelog_entry %}
|
|
||||||
+{%- if auto_changelog_entry %}
|
|
||||||
+
|
|
||||||
{% include target ~ "-changelog.spec.inc" %}
|
|
||||||
{% endif %}
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From 1f64bd9564c0cc27d23f5dc5e523f0db46496644 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
||||||
Date: Mon, 6 May 2019 22:08:07 +0200
|
|
||||||
Subject: [PATCH 02/14] licensing: translate GPL[123]+
|
|
||||||
|
|
||||||
The "+" variants were described in the comment, but not explicitly
|
|
||||||
listed in the table. Let's just replace the comment with
|
|
||||||
machine-readable lines.
|
|
||||||
|
|
||||||
Fixes #79.
|
|
||||||
---
|
|
||||||
rust2rpm/spdx_to_fedora.csv | 15 ++++++---------
|
|
||||||
1 file changed, 6 insertions(+), 9 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv
|
|
||||||
index c42e66e..4fc3321 100644
|
|
||||||
--- a/rust2rpm/spdx_to_fedora.csv
|
|
||||||
+++ b/rust2rpm/spdx_to_fedora.csv
|
|
||||||
@@ -141,15 +141,12 @@ GNU Affero General Public License v3.0,AGPL-3.0,AGPLv3,Affero General Public Lic
|
|
||||||
GNU Free Documentation License v1.1,GFDL-1.1,,,This specific version not on Fedora list,
|
|
||||||
GNU Free Documentation License v1.2,GFDL-1.2,,,This specific version not on Fedora list,
|
|
||||||
GNU Free Documentation License v1.3,GFDL-1.3,GFDL,,,
|
|
||||||
-GNU General Public License v1.0 only,GPL-1.0,GPLv1,,"For “or later” add + to SPDX or Fedora short identifier:
|
|
||||||
-SPDX: GPL-1.0+
|
|
||||||
-Fedora: GPLv1+ or GPL+",
|
|
||||||
-GNU General Public License v2.0 only,GPL-2.0,GPLv2,,"For “or later” add + to SPDX or Fedora short identifier:
|
|
||||||
-SPDX: GPL-2.0+
|
|
||||||
-Fedora: GPLv2+",
|
|
||||||
-GNU General Public License v3.0 only,GPL-3.0,GPLv3,,"For “or later” add + to SPDX or Fedora short identifier:
|
|
||||||
-SPDX: GPL-3.0+
|
|
||||||
-Fedora: GPLv3+",
|
|
||||||
+GNU General Public License v1.0 only,GPL-1.0,GPLv1,,,
|
|
||||||
+GNU General Public License v1.0 or later,GPL-1.0+,GPLv1+,,,
|
|
||||||
+GNU General Public License v2.0 only,GPL-2.0,GPLv2,,,
|
|
||||||
+GNU General Public License v2.0 or later,GPL-2.0+,GPLv2+,,,
|
|
||||||
+GNU General Public License v3.0 only,GPL-3.0,GPLv3,,,
|
|
||||||
+GNU General Public License v3.0 or later,GPL-3.0+,GPLv3+,,,
|
|
||||||
GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,,
|
|
||||||
GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,,
|
|
||||||
GNU Library General Public License v2 only,LGPL-2.0,LGPLv2,,,
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
From 8d21ef1ee4152294c3e9df451404db7c732fb415 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
||||||
Date: Tue, 7 May 2019 08:32:25 +0200
|
|
||||||
Subject: [PATCH 03/14] licensing: add "-or-later" variants for GPL licenses
|
|
||||||
|
|
||||||
SPDX actually deprecated the variants with "+" and "-or-later" is now
|
|
||||||
recommneded. They both map to the same identiefiers on Fedora side.
|
|
||||||
---
|
|
||||||
rust2rpm/spdx_to_fedora.csv | 3 +++
|
|
||||||
1 file changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv
|
|
||||||
index 4fc3321..a3f9604 100644
|
|
||||||
--- a/rust2rpm/spdx_to_fedora.csv
|
|
||||||
+++ b/rust2rpm/spdx_to_fedora.csv
|
|
||||||
@@ -143,10 +143,13 @@ GNU Free Documentation License v1.2,GFDL-1.2,,,This specific version not on Fedo
|
|
||||||
GNU Free Documentation License v1.3,GFDL-1.3,GFDL,,,
|
|
||||||
GNU General Public License v1.0 only,GPL-1.0,GPLv1,,,
|
|
||||||
GNU General Public License v1.0 or later,GPL-1.0+,GPLv1+,,,
|
|
||||||
+GNU General Public License v1.0 or later,GPL-1.0-or-later,GPLv1+,,,
|
|
||||||
GNU General Public License v2.0 only,GPL-2.0,GPLv2,,,
|
|
||||||
GNU General Public License v2.0 or later,GPL-2.0+,GPLv2+,,,
|
|
||||||
+GNU General Public License v2.0 or later,GPL-2.0-or-later,GPLv2+,,,
|
|
||||||
GNU General Public License v3.0 only,GPL-3.0,GPLv3,,,
|
|
||||||
GNU General Public License v3.0 or later,GPL-3.0+,GPLv3+,,,
|
|
||||||
+GNU General Public License v3.0 or later,GPL-3.0-or-later,GPLv3+,,,
|
|
||||||
GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,,
|
|
||||||
GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,,
|
|
||||||
GNU Library General Public License v2 only,LGPL-2.0,LGPLv2,,,
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
From aa9fc8646a4bcf43bba544d37c2f6e6e59b1bebb Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
||||||
Date: Mon, 6 May 2019 22:34:02 +0200
|
|
||||||
Subject: [PATCH 04/14] Move version string to the python code
|
|
||||||
|
|
||||||
This way the python module "knows" its own version. To avoid duplication,
|
|
||||||
read the value back from setup.py. The reader function only needs to
|
|
||||||
support the specific format used in the code, so it can be very simplistic.
|
|
||||||
---
|
|
||||||
rust2rpm/__init__.py | 2 ++
|
|
||||||
setup.py | 11 ++++++++++-
|
|
||||||
2 files changed, 12 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/__init__.py b/rust2rpm/__init__.py
|
|
||||||
index 6aba575..4a0db7b 100644
|
|
||||||
--- a/rust2rpm/__init__.py
|
|
||||||
+++ b/rust2rpm/__init__.py
|
|
||||||
@@ -1,2 +1,4 @@
|
|
||||||
from .metadata import *
|
|
||||||
from . import licensing
|
|
||||||
+
|
|
||||||
+__version__ = '9'
|
|
||||||
diff --git a/setup.py b/setup.py
|
|
||||||
index 3eb2a77..79367da 100644
|
|
||||||
--- a/setup.py
|
|
||||||
+++ b/setup.py
|
|
||||||
@@ -1,8 +1,17 @@
|
|
||||||
from setuptools import setup
|
|
||||||
|
|
||||||
+def read_version(path):
|
|
||||||
+ with open(path, 'rt') as f:
|
|
||||||
+ for line in f:
|
|
||||||
+ if line.startswith('__version__'):
|
|
||||||
+ return line.split("'")[1]
|
|
||||||
+ raise IOError
|
|
||||||
+
|
|
||||||
+version = read_version('rust2rpm/__init__.py')
|
|
||||||
+
|
|
||||||
ARGS = dict(
|
|
||||||
name="rust2rpm",
|
|
||||||
- version="9",
|
|
||||||
+ version=version,
|
|
||||||
description="Convert Rust crates to RPM",
|
|
||||||
license="MIT",
|
|
||||||
keywords="rust cargo rpm",
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
From 253d1f6021765051c26d4427967786040d215853 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
||||||
Date: Mon, 6 May 2019 22:36:43 +0200
|
|
||||||
Subject: [PATCH 05/14] Check /usr/lib/os-release in addition to
|
|
||||||
/etc/os-release
|
|
||||||
|
|
||||||
---
|
|
||||||
rust2rpm/__main__.py | 7 +++++--
|
|
||||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py
|
|
||||||
index b307505..b8d3772 100644
|
|
||||||
--- a/rust2rpm/__main__.py
|
|
||||||
+++ b/rust2rpm/__main__.py
|
|
||||||
@@ -34,8 +34,11 @@ JINJA_ENV = jinja2.Environment(
|
|
||||||
lstrip_blocks=True)
|
|
||||||
|
|
||||||
def get_default_target():
|
|
||||||
- # TODO: add fallback for /usr/lib/os-release
|
|
||||||
- with open("/etc/os-release") as os_release_file:
|
|
||||||
+ try:
|
|
||||||
+ os_release_file = open('/etc/os-release')
|
|
||||||
+ except FileNotFoundError:
|
|
||||||
+ os_release_file = open('/usr/lib/os-release')
|
|
||||||
+ with os_release_file:
|
|
||||||
conf = configparser.ConfigParser()
|
|
||||||
conf.read_file(itertools.chain(["[os-release]"], os_release_file))
|
|
||||||
os_release = conf["os-release"]
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
|||||||
From 6de75b87af4bd86d87dfee038f5b6cdf99437a7c Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
||||||
Date: Mon, 6 May 2019 22:44:55 +0200
|
|
||||||
Subject: [PATCH 06/14] Include rust2rpm version info in the generated spec
|
|
||||||
file
|
|
||||||
|
|
||||||
Fixes #77.
|
|
||||||
---
|
|
||||||
rust2rpm/__main__.py | 3 ++-
|
|
||||||
rust2rpm/templates/main.spec | 2 +-
|
|
||||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py
|
|
||||||
index b8d3772..a7674fd 100644
|
|
||||||
--- a/rust2rpm/__main__.py
|
|
||||||
+++ b/rust2rpm/__main__.py
|
|
||||||
@@ -17,7 +17,7 @@ import jinja2
|
|
||||||
import requests
|
|
||||||
import tqdm
|
|
||||||
|
|
||||||
-from . import Metadata, licensing
|
|
||||||
+from . import Metadata, licensing, __version__
|
|
||||||
from .metadata import normalize_deps
|
|
||||||
|
|
||||||
DEFAULT_EDITOR = "vi"
|
|
||||||
@@ -265,6 +265,7 @@ def main():
|
|
||||||
patch_file = None
|
|
||||||
|
|
||||||
kwargs = {}
|
|
||||||
+ kwargs["generator_version"] = __version__
|
|
||||||
kwargs["crate"] = crate
|
|
||||||
kwargs["target"] = args.target
|
|
||||||
kwargs["all_features"] = args.all_features
|
|
||||||
diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec
|
|
||||||
index 0c84325..0ef0b10 100644
|
|
||||||
--- a/rust2rpm/templates/main.spec
|
|
||||||
+++ b/rust2rpm/templates/main.spec
|
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
{% include target ~ "-header.spec.inc" ignore missing %}
|
|
||||||
-# Generated by rust2rpm
|
|
||||||
+# Generated by rust2rpm {{ generator_version }}
|
|
||||||
%bcond_without check
|
|
||||||
{% if not include_main %}
|
|
||||||
%global debug_package %{nil}
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
From 36663449594b33ec4b0c0ae9ea568cad819bb920 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
||||||
Date: Mon, 6 May 2019 22:47:06 +0200
|
|
||||||
Subject: [PATCH 07/14] Bump classifiers
|
|
||||||
|
|
||||||
This software is used, so let's at least it's beta.
|
|
||||||
Seems to work fine with python3.8, let's say that.
|
|
||||||
---
|
|
||||||
setup.py | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/setup.py b/setup.py
|
|
||||||
index 79367da..b5b1157 100644
|
|
||||||
--- a/setup.py
|
|
||||||
+++ b/setup.py
|
|
||||||
@@ -44,13 +44,14 @@ ARGS = dict(
|
|
||||||
author_email="ignatenkobrain@fedoraproject.org",
|
|
||||||
url="https://pagure.io/fedora-rust/rust2rpm",
|
|
||||||
classifiers=[
|
|
||||||
- "Development Status :: 3 - Alpha",
|
|
||||||
+ "Development Status :: 4 - Beta",
|
|
||||||
"Intended Audience :: Developers",
|
|
||||||
"License :: OSI Approved :: MIT License",
|
|
||||||
"Operating System :: POSIX :: Linux",
|
|
||||||
"Programming Language :: Python :: 3 :: Only",
|
|
||||||
"Programming Language :: Python :: 3.6",
|
|
||||||
"Programming Language :: Python :: 3.7",
|
|
||||||
+ "Programming Language :: Python :: 3.8",
|
|
||||||
"Topic :: Software Development :: Build Tools",
|
|
||||||
"Topic :: System :: Software Distribution",
|
|
||||||
"Topic :: Utilities",
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
|||||||
From 216de8e4271f9dbca1f009e8c0e046a7f5a198fd Mon Sep 17 00:00:00 2001
|
|
||||||
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
Date: Wed, 15 May 2019 08:01:46 +0200
|
|
||||||
Subject: [PATCH 08/14] Mangle summary automagically
|
|
||||||
|
|
||||||
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
---
|
|
||||||
rust2rpm/metadata.py | 35 ++++++++++++++++++++++++++++++++++-
|
|
||||||
rust2rpm/templates/main.spec | 3 +--
|
|
||||||
2 files changed, 35 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py
|
|
||||||
index 77c2932..e41902d 100644
|
|
||||||
--- a/rust2rpm/metadata.py
|
|
||||||
+++ b/rust2rpm/metadata.py
|
|
||||||
@@ -3,6 +3,7 @@ __all__ = ["Dependency", "Metadata"]
|
|
||||||
import collections
|
|
||||||
import copy
|
|
||||||
import json
|
|
||||||
+import re
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
import semantic_version as semver
|
|
||||||
@@ -116,11 +117,43 @@ class Metadata:
|
|
||||||
self.license = None
|
|
||||||
self.license_file = None
|
|
||||||
self.readme = None
|
|
||||||
- self.description = None
|
|
||||||
+ self._description = None
|
|
||||||
+ self._summary = None
|
|
||||||
self.targets = set()
|
|
||||||
self.dependencies = {}
|
|
||||||
self.dev_dependencies = set()
|
|
||||||
|
|
||||||
+ @property
|
|
||||||
+ def description(self):
|
|
||||||
+ return self._description
|
|
||||||
+
|
|
||||||
+ @property
|
|
||||||
+ def summary(self):
|
|
||||||
+ return self._summary
|
|
||||||
+
|
|
||||||
+ @description.setter
|
|
||||||
+ def description(self, description):
|
|
||||||
+ # https://salsa.debian.org/rust-team/debcargo/blob/master/src/crates.rs
|
|
||||||
+ # get_summary_description()
|
|
||||||
+ if description is None:
|
|
||||||
+ self._description = self._summary = None
|
|
||||||
+ return
|
|
||||||
+ description = description.replace('\n\n', '\r').replace('\n', ' ').replace('\r', '\n').strip()
|
|
||||||
+ description = re.sub(r'^(?:a|an|the)\s+', '', description, flags=re.I)
|
|
||||||
+ description = f'{description[0].upper()}{description[1:]}'
|
|
||||||
+ if description[-1] != '.':
|
|
||||||
+ description = f'{description}.'
|
|
||||||
+
|
|
||||||
+ p1 = description.find('.')
|
|
||||||
+ p2 = description.find('\n')
|
|
||||||
+ if p2 != -1:
|
|
||||||
+ p = min(p1, p2)
|
|
||||||
+ else:
|
|
||||||
+ p = p1
|
|
||||||
+
|
|
||||||
+ self._description = description
|
|
||||||
+ self._summary = description[:p]
|
|
||||||
+
|
|
||||||
@classmethod
|
|
||||||
def from_json(cls, metadata):
|
|
||||||
md = metadata
|
|
||||||
diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec
|
|
||||||
index 0ef0b10..803b74e 100644
|
|
||||||
--- a/rust2rpm/templates/main.spec
|
|
||||||
+++ b/rust2rpm/templates/main.spec
|
|
||||||
@@ -16,8 +16,7 @@ Release: {{ pkg_release }}
|
|
||||||
{% if md.description is none %}
|
|
||||||
Summary: # FIXME
|
|
||||||
{% else %}
|
|
||||||
-{% set description_lines = md.description.split("\n") %}
|
|
||||||
-Summary: {{ description_lines|join(" ")|trim }}
|
|
||||||
+Summary: {{ md.summary }}
|
|
||||||
{% endif %}
|
|
||||||
{% if rust_group is defined %}
|
|
||||||
Group: {{ rust_group }}
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
|||||||
From 16085843c800827526ab78354bacdd6bd388993f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
Date: Wed, 15 May 2019 08:07:18 +0200
|
|
||||||
Subject: [PATCH 09/14] =?UTF-8?q?Use=20%{expand:=E2=80=A6}=20for=20descrip?=
|
|
||||||
=?UTF-8?q?tion?=
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
So that we stop playing with escaping.
|
|
||||||
|
|
||||||
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
---
|
|
||||||
rust2rpm/templates/main.spec | 9 +++++----
|
|
||||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec
|
|
||||||
index 803b74e..660bb60 100644
|
|
||||||
--- a/rust2rpm/templates/main.spec
|
|
||||||
+++ b/rust2rpm/templates/main.spec
|
|
||||||
@@ -64,12 +64,13 @@ BuildRequires: {{ req }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
-%global _description \
|
|
||||||
+%global _description %{expand:
|
|
||||||
{% if md.description is none %}
|
|
||||||
%{summary}.
|
|
||||||
-{% else %}
|
|
||||||
-{{ md.description|wordwrap(wrapstring="\\\n")|trim }}
|
|
||||||
-{% endif %}
|
|
||||||
+{%- else %}
|
|
||||||
+{{ md.description|wordwrap }}
|
|
||||||
+{%- endif %}
|
|
||||||
+}
|
|
||||||
|
|
||||||
%description %{_description}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
From e1cfff321693432f19a9a1303431b2ce4ec4edc9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
Date: Wed, 15 May 2019 20:00:59 +0200
|
|
||||||
Subject: [PATCH 10/14] Remove more common prefixes
|
|
||||||
|
|
||||||
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
---
|
|
||||||
rust2rpm/metadata.py | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/metadata.py b/rust2rpm/metadata.py
|
|
||||||
index e41902d..1b4faad 100644
|
|
||||||
--- a/rust2rpm/metadata.py
|
|
||||||
+++ b/rust2rpm/metadata.py
|
|
||||||
@@ -139,6 +139,7 @@ class Metadata:
|
|
||||||
self._description = self._summary = None
|
|
||||||
return
|
|
||||||
description = description.replace('\n\n', '\r').replace('\n', ' ').replace('\r', '\n').strip()
|
|
||||||
+ description = re.sub(rf'^(?:{self.name}|This(?:\s+\w+)?)(?:\s*,|\s+is|\s+provides)\s+', '', description, flags=re.I)
|
|
||||||
description = re.sub(r'^(?:a|an|the)\s+', '', description, flags=re.I)
|
|
||||||
description = f'{description[0].upper()}{description[1:]}'
|
|
||||||
if description[-1] != '.':
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
|||||||
From 04f63e0f20d6b517119053c6bc00aa8be3c3a19f Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
||||||
Date: Sun, 2 Jun 2019 15:48:45 +0200
|
|
||||||
Subject: [PATCH 11/14] Add AGPL-3.0-or-later and automatically translate "+"
|
|
||||||
suffix into "-or-later"
|
|
||||||
|
|
||||||
This way we don't need to add all the deprecated variants with "+" suffix.
|
|
||||||
|
|
||||||
Fixes #84.
|
|
||||||
---
|
|
||||||
rust2rpm/licensing.py | 14 ++++++++++----
|
|
||||||
rust2rpm/spdx_to_fedora.csv | 4 +---
|
|
||||||
2 files changed, 11 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/licensing.py b/rust2rpm/licensing.py
|
|
||||||
index 233903e..6ca4e45 100644
|
|
||||||
--- a/rust2rpm/licensing.py
|
|
||||||
+++ b/rust2rpm/licensing.py
|
|
||||||
@@ -35,18 +35,24 @@ def translate_license_fedora(license):
|
|
||||||
elif tag.upper() == 'AND':
|
|
||||||
final.append('and')
|
|
||||||
else:
|
|
||||||
- mapped = spdx_to_fedora_map().get(tag, None)
|
|
||||||
+ if tag.endswith('+'):
|
|
||||||
+ key = tag[:-1] + '-or-later'
|
|
||||||
+ fulltag = f'{tag} ({key})'
|
|
||||||
+ else:
|
|
||||||
+ key = fulltag = tag
|
|
||||||
+
|
|
||||||
+ mapped = spdx_to_fedora_map().get(key, None)
|
|
||||||
if mapped is None:
|
|
||||||
- comments += f'# FIXME: Upstream uses unknown SPDX tag {tag}!'
|
|
||||||
+ comments += f'# FIXME: Upstream uses unknown SPDX tag {fulltag}!'
|
|
||||||
final.append(tag)
|
|
||||||
elif mapped == '':
|
|
||||||
- comments += f"# FIXME: Upstream SPDX tag {tag} not listed in Fedora's good licenses list.\n"
|
|
||||||
+ comments += f"# FIXME: Upstream SPDX tag {fulltag} not listed in Fedora's good licenses list.\n"
|
|
||||||
comments += "# FIXME: This package might not be allowed in Fedora!\n"
|
|
||||||
final.append(tag)
|
|
||||||
else:
|
|
||||||
final.append(mapped)
|
|
||||||
if mapped != tag:
|
|
||||||
- print(f'Upstream license tag {tag} translated to {mapped}',
|
|
||||||
+ print(f'Upstream license tag {fulltag} translated to {mapped}',
|
|
||||||
file=_sys.stderr)
|
|
||||||
return (' '.join(final), comments or None)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv
|
|
||||||
index a3f9604..006d80c 100644
|
|
||||||
--- a/rust2rpm/spdx_to_fedora.csv
|
|
||||||
+++ b/rust2rpm/spdx_to_fedora.csv
|
|
||||||
@@ -138,17 +138,15 @@ Giftware License,Giftware,Giftware,,,
|
|
||||||
GL2PS License,GL2PS,GL2PS,,,
|
|
||||||
Glulxe License,Glulxe,Glulxe,,,
|
|
||||||
GNU Affero General Public License v3.0,AGPL-3.0,AGPLv3,Affero General Public License 3.0,,
|
|
||||||
+GNU Affero General Public License v3.0 or later,AGPL-3.0-or-later,AGPLv3+,Affero General Public License 3.0 or later,,
|
|
||||||
GNU Free Documentation License v1.1,GFDL-1.1,,,This specific version not on Fedora list,
|
|
||||||
GNU Free Documentation License v1.2,GFDL-1.2,,,This specific version not on Fedora list,
|
|
||||||
GNU Free Documentation License v1.3,GFDL-1.3,GFDL,,,
|
|
||||||
GNU General Public License v1.0 only,GPL-1.0,GPLv1,,,
|
|
||||||
-GNU General Public License v1.0 or later,GPL-1.0+,GPLv1+,,,
|
|
||||||
GNU General Public License v1.0 or later,GPL-1.0-or-later,GPLv1+,,,
|
|
||||||
GNU General Public License v2.0 only,GPL-2.0,GPLv2,,,
|
|
||||||
-GNU General Public License v2.0 or later,GPL-2.0+,GPLv2+,,,
|
|
||||||
GNU General Public License v2.0 or later,GPL-2.0-or-later,GPLv2+,,,
|
|
||||||
GNU General Public License v3.0 only,GPL-3.0,GPLv3,,,
|
|
||||||
-GNU General Public License v3.0 or later,GPL-3.0+,GPLv3+,,,
|
|
||||||
GNU General Public License v3.0 or later,GPL-3.0-or-later,GPLv3+,,,
|
|
||||||
GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,,
|
|
||||||
GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,,
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
From d9b2cef72e129963ac082ec3737a877785232123 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
||||||
Date: Sun, 2 Jun 2019 15:45:13 +0200
|
|
||||||
Subject: [PATCH 12/14] Add --translate-license to translate a specific license
|
|
||||||
|
|
||||||
Before, all known licenses would be listed by --show-license-map, so
|
|
||||||
grepping the list was enough to find a license. But now we support
|
|
||||||
alternative syntaxes, so this is not enough. Add a call to translate a
|
|
||||||
specific license:
|
|
||||||
|
|
||||||
$ python3 -m rust2rpm --translate-license GPL-3.0+
|
|
||||||
Upstream license tag GPL-3.0+ (GPL-3.0-or-later) translated to GPLv3+
|
|
||||||
GPLv3+
|
|
||||||
|
|
||||||
$ python3 -m rust2rpm --show-license-map | grep -F GPL-3.0+
|
|
||||||
(nada)
|
|
||||||
---
|
|
||||||
rust2rpm/__main__.py | 9 +++++++++
|
|
||||||
1 file changed, 9 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py
|
|
||||||
index a7674fd..c55dacc 100644
|
|
||||||
--- a/rust2rpm/__main__.py
|
|
||||||
+++ b/rust2rpm/__main__.py
|
|
||||||
@@ -222,6 +222,8 @@ def main():
|
|
||||||
formatter_class=argparse.RawTextHelpFormatter)
|
|
||||||
parser.add_argument("--show-license-map", action="store_true",
|
|
||||||
help="Print license mappings and exit")
|
|
||||||
+ parser.add_argument("--translate-license", action="store_true",
|
|
||||||
+ help="Print mapping for specified license and exit")
|
|
||||||
parser.add_argument("--no-auto-changelog-entry", action="store_true",
|
|
||||||
help="Do not generate a changelog entry")
|
|
||||||
parser.add_argument("-", "--stdout", action="store_true",
|
|
||||||
@@ -248,6 +250,13 @@ def main():
|
|
||||||
licensing.dump_sdpx_to_fedora_map(sys.stdout)
|
|
||||||
return
|
|
||||||
|
|
||||||
+ if args.translate_license:
|
|
||||||
+ license, comments = licensing.translate_license(args.target, args.crate)
|
|
||||||
+ if comments:
|
|
||||||
+ print(comments)
|
|
||||||
+ print(license)
|
|
||||||
+ return
|
|
||||||
+
|
|
||||||
if args.crate is None:
|
|
||||||
parser.error("required crate/path argument missing")
|
|
||||||
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,192 +0,0 @@
|
|||||||
From 37cf4d78df2f3805f1f230252e1c0030a2f08877 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
Date: Sat, 8 Jun 2019 19:35:38 +0200
|
|
||||||
Subject: [PATCH 13/14] Implement %__cargo_skip_build
|
|
||||||
|
|
||||||
We need to have an easy way how to skip doing 'cargo build' to speedup a
|
|
||||||
module builds.
|
|
||||||
|
|
||||||
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
---
|
|
||||||
data/macros.cargo | 65 +++++++++++++++++++++---------------
|
|
||||||
data/macros.rust-srpm | 16 +++++++++
|
|
||||||
rust2rpm/templates/main.spec | 34 ++++++++++---------
|
|
||||||
3 files changed, 73 insertions(+), 42 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/data/macros.cargo b/data/macros.cargo
|
|
||||||
index a60289a..1182850 100644
|
|
||||||
--- a/data/macros.cargo
|
|
||||||
+++ b/data/macros.cargo
|
|
||||||
@@ -49,27 +49,35 @@ EOF\
|
|
||||||
}
|
|
||||||
|
|
||||||
%cargo_generate_buildrequires(af:) \
|
|
||||||
-%{__cargo_inspector} -BR %{__cargo_parse_opts %{-a} %{-f:-f%{-f*}}} Cargo.toml \
|
|
||||||
-%if %{with check} \
|
|
||||||
-%{__cargo_inspector} -TR Cargo.toml \
|
|
||||||
+%if ! 0%{?__cargo_skip_build} \
|
|
||||||
+ %{__cargo_inspector} -BR %{__cargo_parse_opts %{-a} %{-f:-f%{-f*}}} Cargo.toml \
|
|
||||||
+ %if %{with check} \
|
|
||||||
+ %{__cargo_inspector} -TR Cargo.toml \
|
|
||||||
+ %endif \
|
|
||||||
%endif
|
|
||||||
|
|
||||||
-%cargo_build(naf:) %{shrink:\
|
|
||||||
-%{__cargo} build \
|
|
||||||
- %{__cargo_common_opts} \
|
|
||||||
- --release \
|
|
||||||
- %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
|
|
||||||
- %* \
|
|
||||||
-}
|
|
||||||
+%cargo_build(naf:) \
|
|
||||||
+%if ! 0%{?__cargo_skip_build} \
|
|
||||||
+ %{shrink:\
|
|
||||||
+ %{__cargo} build \
|
|
||||||
+ %{__cargo_common_opts} \
|
|
||||||
+ --release \
|
|
||||||
+ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
|
|
||||||
+ %* \
|
|
||||||
+ } \
|
|
||||||
+%endif
|
|
||||||
|
|
||||||
-%cargo_test(naf:) %{shrink:\
|
|
||||||
-%{__cargo} test \
|
|
||||||
- %{__cargo_common_opts} \
|
|
||||||
- --release \
|
|
||||||
- --no-fail-fast \
|
|
||||||
- %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
|
|
||||||
- %* \
|
|
||||||
-}
|
|
||||||
+%cargo_test(naf:) \
|
|
||||||
+%if ! 0%{?__cargo_skip_build} \
|
|
||||||
+ %{shrink:\
|
|
||||||
+ %{__cargo} test \
|
|
||||||
+ %{__cargo_common_opts} \
|
|
||||||
+ --release \
|
|
||||||
+ --no-fail-fast \
|
|
||||||
+ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
|
|
||||||
+ %* \
|
|
||||||
+ } \
|
|
||||||
+%endif
|
|
||||||
|
|
||||||
%cargo_install(t:naf:) (\
|
|
||||||
set -eu \
|
|
||||||
@@ -88,15 +96,18 @@ if %__cargo_is_lib; then \
|
|
||||||
%{__rm} -f $REG_DIR/Cargo.toml.{orig,deps} \
|
|
||||||
echo '{"files":{},"package":""}' > $REG_DIR/.cargo-checksum.json \
|
|
||||||
fi \
|
|
||||||
-if %__cargo_is_bin; then \
|
|
||||||
- %{shrink:%{__cargo} install \
|
|
||||||
- %{__cargo_common_opts} \
|
|
||||||
- --path . \
|
|
||||||
- %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
|
|
||||||
- %* \
|
|
||||||
- }\
|
|
||||||
- %{__rm} %{buildroot}%{_prefix}/.crates.toml \
|
|
||||||
-fi \
|
|
||||||
+%if ! %__cargo_skip_build \
|
|
||||||
+ if %__cargo_is_bin; then \
|
|
||||||
+ %{shrink:\
|
|
||||||
+ %{__cargo} install \
|
|
||||||
+ %{__cargo_common_opts} \
|
|
||||||
+ --path . \
|
|
||||||
+ %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
|
|
||||||
+ %* \
|
|
||||||
+ } \
|
|
||||||
+ %{__rm} %{buildroot}%{_prefix}/.crates.toml \
|
|
||||||
+ fi \
|
|
||||||
+%endif \
|
|
||||||
)
|
|
||||||
|
|
||||||
%__cargo_feature_from_name(n:) %{lua:
|
|
||||||
diff --git a/data/macros.rust-srpm b/data/macros.rust-srpm
|
|
||||||
index 872b87f..88d5a0f 100644
|
|
||||||
--- a/data/macros.rust-srpm
|
|
||||||
+++ b/data/macros.rust-srpm
|
|
||||||
@@ -37,3 +37,19 @@
|
|
||||||
\
|
|
||||||
print(url .. crate .. '/' .. version .. '/download#/' .. crate .. '-' .. version .. '.crate')
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+# If crate not in _build_crates and _module_build is set, we should skip the build
|
|
||||||
+%__cargo_skip_build %{lua:
|
|
||||||
+local crate = rpm.expand('%{crate}')
|
|
||||||
+local build_crate = false
|
|
||||||
+for w in rpm.expand('%{?_build_crates}'):gmatch('%S+') do
|
|
||||||
+ if w == crate then
|
|
||||||
+ build_crate = true
|
|
||||||
+ break
|
|
||||||
+ end
|
|
||||||
+end
|
|
||||||
+if (rpm.expand('%{defined _module_build}') ~= '0' and not build_crate) then
|
|
||||||
+ print(1)
|
|
||||||
+else
|
|
||||||
+ print(0)
|
|
||||||
+end}
|
|
||||||
diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec
|
|
||||||
index 660bb60..69d23d7 100644
|
|
||||||
--- a/rust2rpm/templates/main.spec
|
|
||||||
+++ b/rust2rpm/templates/main.spec
|
|
||||||
@@ -42,26 +42,28 @@ ExclusiveArch: %{rust_arches}
|
|
||||||
|
|
||||||
BuildRequires: rust-packaging
|
|
||||||
{% if not generate_buildrequires %}
|
|
||||||
-{% if not all_features %}
|
|
||||||
-{% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %}
|
|
||||||
-{% else %}
|
|
||||||
-{% set buildrequires = normalize_deps(md.all_dependencies)|sort %}
|
|
||||||
-{% set cargo_args = " -a" %}
|
|
||||||
-{% endif %}
|
|
||||||
-{% for req in buildrequires %}
|
|
||||||
+%if ! %{__cargo_skip_build}
|
|
||||||
+ {% if not all_features %}
|
|
||||||
+ {% set buildrequires = normalize_deps(md.requires("default", resolve=True))|sort %}
|
|
||||||
+ {% else %}
|
|
||||||
+ {% set buildrequires = normalize_deps(md.all_dependencies)|sort %}
|
|
||||||
+ {% set cargo_args = " -a" %}
|
|
||||||
+ {% endif %}
|
|
||||||
+ {% for req in buildrequires %}
|
|
||||||
BuildRequires: {{ req }}
|
|
||||||
-{% endfor %}
|
|
||||||
-{% set testrequires = normalize_deps(md.dev_dependencies)|sort %}
|
|
||||||
-{% if testrequires|length > 0 %}
|
|
||||||
+ {% endfor %}
|
|
||||||
+ {% set testrequires = normalize_deps(md.dev_dependencies)|sort %}
|
|
||||||
+ {% if testrequires|length > 0 %}
|
|
||||||
%if %{with check}
|
|
||||||
- {% for req in testrequires %}
|
|
||||||
+ {% for req in testrequires %}
|
|
||||||
BuildRequires: {{ req }}
|
|
||||||
- {% endfor %}
|
|
||||||
+ {% endfor %}
|
|
||||||
%endif
|
|
||||||
-{% endif %}
|
|
||||||
-{% for req in to_list(distconf.get("buildrequires"))|sort %}
|
|
||||||
+ {% endif %}
|
|
||||||
+ {% for req in to_list(distconf.get("buildrequires"))|sort %}
|
|
||||||
BuildRequires: {{ req }}
|
|
||||||
-{% endfor %}
|
|
||||||
+ {% endfor %}
|
|
||||||
+%endif
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
%global _description %{expand:
|
|
||||||
@@ -75,6 +77,7 @@ BuildRequires: {{ req }}
|
|
||||||
%description %{_description}
|
|
||||||
|
|
||||||
{% if include_main %}
|
|
||||||
+%if ! %{__cargo_skip_build}
|
|
||||||
%package -n %{crate}
|
|
||||||
Summary: %{summary}
|
|
||||||
{% if rust_group is defined %}
|
|
||||||
@@ -96,6 +99,7 @@ Requires: {{ req }}
|
|
||||||
{% for bin in bins %}
|
|
||||||
%{_bindir}/{{ bin.name }}
|
|
||||||
{% endfor %}
|
|
||||||
+%endif
|
|
||||||
|
|
||||||
{% endif -%}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
|||||||
From cbd5313fb9d5ca1aa59ffa3dffaa8d1ad9e68d69 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
Date: Sat, 8 Jun 2019 20:01:12 +0200
|
|
||||||
Subject: [PATCH 14/14] Set BuildArch: noarch with %__cargo_skip_build
|
|
||||||
|
|
||||||
We do not need to spawn 7 tasks for each architecture to copy same files
|
|
||||||
over and over.
|
|
||||||
|
|
||||||
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
||||||
---
|
|
||||||
rust2rpm/templates/main.spec | 3 +++
|
|
||||||
1 file changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/rust2rpm/templates/main.spec b/rust2rpm/templates/main.spec
|
|
||||||
index 69d23d7..a3e3c2e 100644
|
|
||||||
--- a/rust2rpm/templates/main.spec
|
|
||||||
+++ b/rust2rpm/templates/main.spec
|
|
||||||
@@ -39,6 +39,9 @@ Patch0: {{ patch_file }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
ExclusiveArch: %{rust_arches}
|
|
||||||
+%if %{__cargo_skip_build}
|
|
||||||
+BuildArch: noarch
|
|
||||||
+%endif
|
|
||||||
|
|
||||||
BuildRequires: rust-packaging
|
|
||||||
{% if not generate_buildrequires %}
|
|
||||||
--
|
|
||||||
2.22.0.rc3
|
|
||||||
|
|
@ -1 +1 @@
|
|||||||
SHA512 (rust2rpm-9.tar.xz) = 64ba9f22aa7a205c4e418783689cb3d380d32d7358c2a5162713a6425cc6ea7fb0b0c82698b89934368b3b7961589e6b332655bda5c9b64fc2dc5488cf8b0c5e
|
SHA512 (rust2rpm-10.tar.xz) = ce93363760faab392b8f46e1f7126de8f437ecdd35a90d5cfb144ec13dd1d29a559ab99d99ce9a8347c1b4649fe24705bd317cc15f97b055549c6843752a62c3
|
||||||
|
Loading…
Reference in new issue