From a71632f5f74348736c720b5334d8012ce660097f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 16 Jun 2019 17:18:14 +0200 Subject: [PATCH] Update to 10 Signed-off-by: Igor Gnatenko --- .gitignore | 1 + ...o-not-put-empty-line-after-changelog.patch | 26 --- 0002-licensing-translate-GPL-123.patch | 43 ---- ...d-or-later-variants-for-GPL-licenses.patch | 32 --- ...ve-version-string-to-the-python-code.patch | 48 ----- ...-release-in-addition-to-etc-os-relea.patch | 31 --- ...-version-info-in-the-generated-spec-.patch | 47 ----- 0007-Bump-classifiers.patch | 34 ---- 0008-Mangle-summary-automagically.patch | 85 -------- 0009-Use-expand-for-description.patch | 41 ---- 0010-Remove-more-common-prefixes.patch | 25 --- ...later-and-automatically-translate-su.patch | 73 ------- ...cense-to-translate-a-specific-licens.patch | 50 ----- 0013-Implement-__cargo_skip_build.patch | 192 ------------------ ...dArch-noarch-with-__cargo_skip_build.patch | 30 --- rust-packaging.spec | 23 +-- sources | 2 +- 17 files changed, 8 insertions(+), 775 deletions(-) delete mode 100644 0001-templates-Do-not-put-empty-line-after-changelog.patch delete mode 100644 0002-licensing-translate-GPL-123.patch delete mode 100644 0003-licensing-add-or-later-variants-for-GPL-licenses.patch delete mode 100644 0004-Move-version-string-to-the-python-code.patch delete mode 100644 0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch delete mode 100644 0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch delete mode 100644 0007-Bump-classifiers.patch delete mode 100644 0008-Mangle-summary-automagically.patch delete mode 100644 0009-Use-expand-for-description.patch delete mode 100644 0010-Remove-more-common-prefixes.patch delete mode 100644 0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch delete mode 100644 0012-Add-translate-license-to-translate-a-specific-licens.patch delete mode 100644 0013-Implement-__cargo_skip_build.patch delete mode 100644 0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch diff --git a/.gitignore b/.gitignore index b86ab64..deb76e9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /rust2rpm-7.tar.xz /rust2rpm-8.tar.xz /rust2rpm-9.tar.xz +/rust2rpm-10.tar.xz diff --git a/0001-templates-Do-not-put-empty-line-after-changelog.patch b/0001-templates-Do-not-put-empty-line-after-changelog.patch deleted file mode 100644 index 00bd68f..0000000 --- a/0001-templates-Do-not-put-empty-line-after-changelog.patch +++ /dev/null @@ -1,26 +0,0 @@ -From b1df4d587fb03dcaedd7e8f29fbe5b7265ea5638 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -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 ---- - 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 - diff --git a/0002-licensing-translate-GPL-123.patch b/0002-licensing-translate-GPL-123.patch deleted file mode 100644 index 559941f..0000000 --- a/0002-licensing-translate-GPL-123.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 1f64bd9564c0cc27d23f5dc5e523f0db46496644 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -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 - diff --git a/0003-licensing-add-or-later-variants-for-GPL-licenses.patch b/0003-licensing-add-or-later-variants-for-GPL-licenses.patch deleted file mode 100644 index 6ac4be3..0000000 --- a/0003-licensing-add-or-later-variants-for-GPL-licenses.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 8d21ef1ee4152294c3e9df451404db7c732fb415 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -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 - diff --git a/0004-Move-version-string-to-the-python-code.patch b/0004-Move-version-string-to-the-python-code.patch deleted file mode 100644 index 9f04d6c..0000000 --- a/0004-Move-version-string-to-the-python-code.patch +++ /dev/null @@ -1,48 +0,0 @@ -From aa9fc8646a4bcf43bba544d37c2f6e6e59b1bebb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -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 - diff --git a/0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch b/0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch deleted file mode 100644 index ed5472f..0000000 --- a/0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 253d1f6021765051c26d4427967786040d215853 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -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 - diff --git a/0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch b/0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch deleted file mode 100644 index 7f332f9..0000000 --- a/0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 6de75b87af4bd86d87dfee038f5b6cdf99437a7c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -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 - diff --git a/0007-Bump-classifiers.patch b/0007-Bump-classifiers.patch deleted file mode 100644 index 6967f8d..0000000 --- a/0007-Bump-classifiers.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 36663449594b33ec4b0c0ae9ea568cad819bb920 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -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 - diff --git a/0008-Mangle-summary-automagically.patch b/0008-Mangle-summary-automagically.patch deleted file mode 100644 index 9f6fbcc..0000000 --- a/0008-Mangle-summary-automagically.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 216de8e4271f9dbca1f009e8c0e046a7f5a198fd Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Wed, 15 May 2019 08:01:46 +0200 -Subject: [PATCH 08/14] Mangle summary automagically - -Signed-off-by: Igor Gnatenko ---- - 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 - diff --git a/0009-Use-expand-for-description.patch b/0009-Use-expand-for-description.patch deleted file mode 100644 index c2ecfdf..0000000 --- a/0009-Use-expand-for-description.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 16085843c800827526ab78354bacdd6bd388993f Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -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 ---- - 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 - diff --git a/0010-Remove-more-common-prefixes.patch b/0010-Remove-more-common-prefixes.patch deleted file mode 100644 index c22444a..0000000 --- a/0010-Remove-more-common-prefixes.patch +++ /dev/null @@ -1,25 +0,0 @@ -From e1cfff321693432f19a9a1303431b2ce4ec4edc9 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Wed, 15 May 2019 20:00:59 +0200 -Subject: [PATCH 10/14] Remove more common prefixes - -Signed-off-by: Igor Gnatenko ---- - 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 - diff --git a/0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch b/0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch deleted file mode 100644 index 6679e3a..0000000 --- a/0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 04f63e0f20d6b517119053c6bc00aa8be3c3a19f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -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 - diff --git a/0012-Add-translate-license-to-translate-a-specific-licens.patch b/0012-Add-translate-license-to-translate-a-specific-licens.patch deleted file mode 100644 index 18e32a2..0000000 --- a/0012-Add-translate-license-to-translate-a-specific-licens.patch +++ /dev/null @@ -1,50 +0,0 @@ -From d9b2cef72e129963ac082ec3737a877785232123 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -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 - diff --git a/0013-Implement-__cargo_skip_build.patch b/0013-Implement-__cargo_skip_build.patch deleted file mode 100644 index 02df663..0000000 --- a/0013-Implement-__cargo_skip_build.patch +++ /dev/null @@ -1,192 +0,0 @@ -From 37cf4d78df2f3805f1f230252e1c0030a2f08877 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -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 ---- - 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 - diff --git a/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch b/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch deleted file mode 100644 index 8094aad..0000000 --- a/0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch +++ /dev/null @@ -1,30 +0,0 @@ -From cbd5313fb9d5ca1aa59ffa3dffaa8d1ad9e68d69 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -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 ---- - 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 - diff --git a/rust-packaging.spec b/rust-packaging.spec index 0357a8e..56430c9 100644 --- a/rust-packaging.spec +++ b/rust-packaging.spec @@ -4,27 +4,13 @@ %global debug_package %{nil} Name: rust-packaging -Version: 9 -Release: 3%{?dist} +Version: 10 +Release: 1%{?dist} Summary: RPM macros for building Rust packages on various architectures License: MIT URL: https://pagure.io/fedora-rust/rust2rpm -Source0: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz -Patch0001: 0001-templates-Do-not-put-empty-line-after-changelog.patch -Patch0002: 0002-licensing-translate-GPL-123.patch -Patch0003: 0003-licensing-add-or-later-variants-for-GPL-licenses.patch -Patch0004: 0004-Move-version-string-to-the-python-code.patch -Patch0005: 0005-Check-usr-lib-os-release-in-addition-to-etc-os-relea.patch -Patch0006: 0006-Include-rust2rpm-version-info-in-the-generated-spec-.patch -Patch0007: 0007-Bump-classifiers.patch -Patch0008: 0008-Mangle-summary-automagically.patch -Patch0009: 0009-Use-expand-for-description.patch -Patch0010: 0010-Remove-more-common-prefixes.patch -Patch0011: 0011-Add-AGPL-3.0-or-later-and-automatically-translate-su.patch -Patch0012: 0012-Add-translate-license-to-translate-a-specific-licens.patch -Patch0013: 0013-Implement-__cargo_skip_build.patch -Patch0014: 0014-Set-BuildArch-noarch-with-__cargo_skip_build.patch +Source: https://releases.pagure.org/fedora-rust/rust2rpm/rust2rpm-%{version}.tar.xz ExclusiveArch: %{rust_arches} @@ -85,6 +71,9 @@ py.test-%{python3_version} -vv test.py %{python3_sitelib}/rust2rpm/ %changelog +* Sun Jun 16 2019 Igor Gnatenko - 10-1 +- Update to 10 + * Sat Jun 08 2019 Igor Gnatenko - 9-3 - Update patches diff --git a/sources b/sources index 4561ec6..c2243ba 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rust2rpm-9.tar.xz) = 64ba9f22aa7a205c4e418783689cb3d380d32d7358c2a5162713a6425cc6ea7fb0b0c82698b89934368b3b7961589e6b332655bda5c9b64fc2dc5488cf8b0c5e +SHA512 (rust2rpm-10.tar.xz) = ce93363760faab392b8f46e1f7126de8f437ecdd35a90d5cfb144ec13dd1d29a559ab99d99ce9a8347c1b4649fe24705bd317cc15f97b055549c6843752a62c3