From 0bf11c122d4b1ba32ed0c8bdee00d6c52905f964 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Thu, 2 Mar 2023 21:55:01 +0100 Subject: [PATCH] main: bail if crate version has un-stripped "build metadata" Versions like "0.4.60+curl-7.88.1" currently break package builds. Stripping "build metadata" automatically and operating with "crate version" != "rpm version" might be supported in the future, but this will require changing the %{crate_instdir} macro, among other things. Coincidentally, setting the %{crate_version}" macro in cases of "crate version" != "rpm version" would also render the lua implementation of the %{version_no_tilde} macro obsolete. --- rust2rpm/__main__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py index d7df115..379013a 100644 --- a/rust2rpm/__main__.py +++ b/rust2rpm/__main__.py @@ -2,7 +2,7 @@ import os import pathlib import sys -from cargo2rpm.metadata import FeatureFlags +from cargo2rpm.metadata import FeatureFlags, Version from rust2rpm import log from rust2rpm.cli import get_parser @@ -113,7 +113,14 @@ def main(): ) if not metadata.is_workspace(): - warn_if_package_uses_restrictive_dependencies(metadata.packages[0]) + package = metadata.packages[0] + + if build_meta := Version.parse(package.version).build: + log.error(f"Crate version {package.version!r} contains build metadata: '+{build_meta}'") + log.error(f"This is not supported by rust2rpm; remove the '+{build_meta}' suffix.") + sys.exit(1) + + warn_if_package_uses_restrictive_dependencies(package) spec_contents = spec_render_crate( metadata=metadata,