Projects
openEuler:Mainline
rust-packaging
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
_service:tar_scm:rust-packaging.spec
Changed
@@ -3,7 +3,7 @@ %global debug_package %{nil} Name: rust-packaging -Version: 20 +Version: 21 Release: 1 Summary: RPM macros for building Rust packages on various architectures License: MIT @@ -65,6 +65,9 @@ %{python3_sitelib}/rust2rpm-*.egg-info/ %changelog +* Sat Aug 06 2022 tianlijing <tianlijing@kylinos.cn> - 21-1 +- update to 21 + * Tue Jan 18 2022 SimpleUpdate Robot <tc@openeuler.org> - 20-1 - Upgrade to version 20
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="scm">git</param> <param name="url">git@gitee.com:src-openeuler/rust-packaging.git</param> - <param name="revision">87a1bfd8ef463bbeef2a1aff4028d4966be4d7b6</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:rust2rpm-v20.tar.gz/NEWS -> _service:tar_scm:rust2rpm-v21.tar.gz/NEWS
Changed
@@ -1,5 +1,18 @@ rust2rpm +Version 21 + +- new %crate_instdir convenience macro with the path to the + installation directory +- license and documentation files are now installed just once under + %crate_instdir and are marked with %license and %doc there +- link flags are now passed using the RUSTFLAGS envvar and include + package note linker script (when %_package_note_file is defined) +- CFLAGS/CXXFLAGS are passed to the processes started by cargo +- rpmautospec can be disabled with --no-rpmautospec +- minor tweaks to existence checks, documentation file detection, license tags, + version handling and spec file naming + Version 20 - fix autodetection of rpmspec if it was already used in the existing spec file
View file
_service:tar_scm:rust2rpm-v20.tar.gz/data/macros.cargo -> _service:tar_scm:rust2rpm-v21.tar.gz/data/macros.cargo
Changed
@@ -4,12 +4,14 @@ # it never writes to ~/.cargo during rpmbuild. # We also need RUSTC_BOOTSTRAP since we use -Z avoid-dev-deps # until it gets stabilized: https://github.com/rust-lang/cargo/issues/5133 -%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 %{_bindir}/cargo +%__cargo %{_bindir}/env CARGO_HOME=.cargo RUSTC_BOOTSTRAP=1 RUSTFLAGS='%{build_rustflags}' %{_bindir}/cargo %__cargo_common_opts %{?_smp_mflags} -Z avoid-dev-deps %__cargo_inspector %{_bindir}/cargo-inspector %cargo_registry %{_datadir}/cargo/registry +%crate_instdir %{cargo_registry}/%{crate}-%{version_no_tilde} + %__cargo_is_lib() %__cargo_inspector --target-kinds Cargo.toml | grep -q -F -x "$(printf 'lib\\\nrlib\\\nproc-macro')" %__cargo_is_bin() %__cargo_inspector --target-kinds Cargo.toml | grep -q -F -x bin @@ -20,7 +22,11 @@ build\ rustc = "%{__rustc}"\ rustdoc = "%{__rustdoc}"\ -rustflags = %{__global_rustflags_toml}\ +\ +env\ +CFLAGS = "%{build_cflags}"\ +CXXFLAGS = "%{build_cxxflags}"\ +LDFLAGS = "%{build_ldflags}"\ \ install\ root = "%{buildroot}%{_prefix}"\
View file
_service:tar_scm:rust2rpm-v20.tar.gz/data/macros.rust -> _service:tar_scm:rust2rpm-v21.tar.gz/data/macros.rust
Changed
@@ -5,7 +5,9 @@ %build_rustflags %{shrink: -Copt-level=3 -Cdebuginfo=2 - -Clink-arg=-Wl,-z,relro,-z,now + -Clink-arg=-Wl,-z,relro + -Clink-arg=-Wl,-z,now + %{?_package_note_file:-Clink-arg=-Wl,-dT,%{_package_note_file}} -Ccodegen-units=1 --cap-lints=warn }
View file
_service:tar_scm:rust2rpm-v20.tar.gz/rust2rpm/__init__.py -> _service:tar_scm:rust2rpm-v21.tar.gz/rust2rpm/__init__.py
Changed
@@ -1,4 +1,4 @@ from .metadata import * from . import licensing -__version__ = '20' +__version__ = '21'
View file
_service:tar_scm:rust2rpm-v20.tar.gz/rust2rpm/__main__.py -> _service:tar_scm:rust2rpm-v21.tar.gz/rust2rpm/__main__.py
Changed
@@ -37,15 +37,14 @@ extensions="jinja2.ext.do", trim_blocks=True, lstrip_blocks=True) -LICENSES = re.compile( - r"(COPYING|COPYING\.\-.*|COPYRIGHT|COPYRIGHT\.\-.*|" - r"EULA|EULA\.\-.*|Llicencse|Llicencse.*|LICENCSE|" - r"LICENCSE\.\-.*|.*\.\-LICENCSE.*|NOTICE|NOTICE\.\-.*|" - r"PATENTS|PATENTS\.\-.*|UNLICENCSE|UNLICENCSE\.\-.*|" - r"agpl\.\-.*|gpl\.\-.*|lgpl\.\-.*|AGPL-.*0-9.*|" - r"APACHE-.*0-9.*|BSD-.*0-9.*|CC-BY-.*|GFDL-.*0-9.*|" - r"GNU-.*0-9.*|GPL-.*0-9.*|LGPL-.*0-9.*|MIT-.*0-9.*|" - r"MPL-.*0-9.*|OFL-.*0-9.*)") +LICENSES = re.compile(r""" + COPYING(?:.-.*)?|COPYRIGHT(?:.-.*)?| + EULA(?:.-.*)?|Llicencse|Llicencse.*| + (?:.*.-)?(?:UN)?LICENCSE(?:.-.*)?|NOTICE(?:.-.*)?| + PATENTS(?:.-.*)?| + (?:agpl|l?gpl).-.*|CC-BY-.*| + (?:AGPL|APACHE|BSD|GFDL|GNU|L?GPL|MIT|MPL|OFL)-.*0-9.* + """, re.VERBOSE) def sortify(func): """Return a sorted list from a generator""" @@ -236,27 +235,39 @@ @sortify def get_doc_files(path): - matcher = re.compile( - r"(.*\.md|.*\.markdown|.*\.mdown|.*\.mkdn|.*\.rst|.*\.txt|AUTHORS|" - r"AUTHORS\.\-.*|CONTRIBUTORS|CONTRIBUTORS\.\-.*|README|" - r"README\.\-.*|CHANGELOG|CHANGELOG\.\-.*|TODO|TODO\.\-.*)", - re.IGNORECASE) - matcherex = re.compile(r"CMakeLists\.txt") + plus = re.compile(r""" + .*\.(?:md|markdown|mdown|mkdn|rst|txt)|AUTHORS| + AUTHORS.-.*|CONTRIBUTORS|CONTRIBUTORS.-.*|README| + README.-.*|CHANGELOG|CHANGELOG.-.*|TODO|TODO.-.* + """, + re.IGNORECASE | re.VERBOSE) + minus = re.compile(r"CMakeLists\.txt|.*\.tpl|.*\.in") + for root, dirs, files in os.walk(path, topdown=True): dirs: = for f in files: - if matcher.match(f) and not LICENSES.match(f) and not matcherex.match(f): + if plus.fullmatch(f) and not LICENSES.fullmatch(f) and not minus.fullmatch(f): yield os.path.relpath(os.path.join(root, f), path) def get_package_info(package): url = requests.compat.urljoin(DIST_GIT_URL, f"rpms/{package}") req = requests.get(url, headers={"User-Agent": "rust2rpm"}) json = req.json() - if "name" in json: - return json - else: + if 'name' not in json: + return None + + # E.g. https://src.fedoraproject.org/rpms/rust-tiny_http0.6/blob/rawhide/f/rust-tiny_http0.6.spec + full_url = json'full_url' + spec_url = requests.compat.urljoin(full_url, f'blob/rawhide/f/rust-{package}.spec') + req = requests.head(url, headers={"User-Agent": "rust2rpm"}) + + if not req.ok: + # The repo exists, but doesn't have the spec file. We most + # likely want to create a spec file to add to that repo. return None + return json + def make_diff_metadata(crate, version, patch=False, store=False): if _is_path(crate): # Only things that look like a paths are considered local arguments @@ -277,6 +288,9 @@ cratef, crate, version = download(crate, version) with files_from_crate(cratef, crate, version) as (toml, doc_files, license_files): + if not license_files: + print(f"Warning: no license files detected in {crate}") + diff = make_patch(toml, enabled=patch) metadata = Metadata.from_file(toml) if len(metadata) > 1: @@ -347,6 +361,10 @@ help="Store crate in current directory") parser.add_argument("-a", "--rpmautospec", action="store_true", 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", @@ -408,7 +426,7 @@ if args.suffix is not None: if metadata.name-1.isdigit(): - suffix = f'-{args.suffix}' + suffix = f'_{args.suffix}' else: suffix = args.suffix else: @@ -426,9 +444,13 @@ kwargs"auto_changelog_entry" = not args.no_auto_changelog_entry - rpmautospec = args.rpmautospec or detect_rpmautospec(default_target, spec_file) + rpmautospec = args.rpmautospec + if args.rpmautospec is None: + 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
View file
_service:tar_scm:rust2rpm-v20.tar.gz/rust2rpm/metadata.py -> _service:tar_scm:rust2rpm-v21.tar.gz/rust2rpm/metadata.py
Changed
@@ -128,7 +128,7 @@ if kind == CargoSemVer.KIND_ANY: normalized.append((CargoSemVer.KIND_GTE, CargoSemVer.coerce(version))) - if version.major: + if version.major is not None: if version.minor is not None: upper_version = CargoSemVer.next_minor(version) else:
View file
_service:tar_scm:rust2rpm-v20.tar.gz/rust2rpm/spdx_to_fedora.csv -> _service:tar_scm:rust2rpm-v21.tar.gz/rust2rpm/spdx_to_fedora.csv
Changed
@@ -139,24 +139,30 @@ 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 only,AGPL-3.0,AGPLv3,Affero General Public License 3.0,deprecated identifier, +GNU Affero General Public License v3.0 only,AGPL-3.0-only,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 only,GPL-1.0,GPLv1,,deprecated identifier, +GNU General Public License v1.0 only,GPL-1.0-only,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 only,GPL-2.0,GPLv2,,deprecated identifier, +GNU General Public License v2.0 only,GPL-2.0-only,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 only,GPL-3.0,GPLv3,,deprecated identifier, +GNU General Public License v3.0 only,GPL-3.0-only,GPLv3,,, GNU General Public License v3.0 or later,GPL-3.0-or-later,GPLv3+,,, -GNU Lesser General Public License v2.0 only,LGPL-2.0,LGPLv2,,, -GNU Lesser General Public License v2.0 or later,LGPL-2.0-or-later,LGPLv2+,,, -GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,, +GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,deprecated identifier, +GNU Lesser General Public License v2.1 only,LGPL-2.1-only,LGPLv2,,, GNU Lesser General Public License v2.1 or later,LGPL-2.1-or-later,LGPLv2+,,, -GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,, +GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,deprecated identifier, +GNU Lesser General Public License v3.0 only,LGPL-3.0-only,LGPLv3,,, GNU Lesser General Public License v3.0 or later,LGPL-3.0-or-later,LGPLv3+,,, -GNU Library General Public License v2 only,LGPL-2.0,LGPLv2,,, +GNU Library General Public License v2 only,LGPL-2.0,LGPLv2,,deprecated identifier, +GNU Library General Public License v2 only,LGPL-2.0-only,LGPLv2,,, +GNU Library General Public License v2 or later,LGPL-2.0-or-later,LGPLv2+,,, gnuplot License,gnuplot,gnuplot,,, gSOAP Public License v1.3b,gSOAP-1.3b,,,not on Fedora list, Haskell Language Report License,HaskellReport,HaskellReport,,,
View file
_service:tar_scm:rust2rpm-v20.tar.gz/rust2rpm/templates/main.spec -> _service:tar_scm:rust2rpm-v21.tar.gz/rust2rpm/templates/main.spec
Changed
@@ -43,7 +43,7 @@ ExclusiveArch: %{rust_arches} -BuildRequires: rust-packaging +BuildRequires: rust-packaging >= 21 {% if all_features %} {% set cargo_args = " -a" %} {% endif %} @@ -101,6 +101,8 @@ %files -n %{crate} {% if license_files|length > 0 %} %license {{ license_files|join(' ') }} + {% else %} +# FIXME: no license files detected {% endif %} {% if doc_files|length > 0 %} %doc {{ doc_files|join(' ') }} @@ -142,7 +144,7 @@ {% endif %} {% if include_requires %} Requires: cargo - {% for req in md.requires(feature)|map("string")|sort %} + {% for req in normalize_deps(md.requires(feature))|map("string")|sort %} Requires: {{ req }} {% endfor %} {% endif %} @@ -158,14 +160,22 @@ %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 %} - {% if doc_files|length > 0 %} -%doc {{ doc_files|join(' ') }} - {% endif %} -%{cargo_registry}/%{crate}-%{version_no_tilde}/ + {% for file in doc_files %} +%doc %{crate_instdir}/{{ file }} + {% endfor %} +%{crate_instdir}/ {% else %} -%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%ghost %{crate_instdir}/Cargo.toml {% endif %} {% endfor %}
View file
_service:tar_scm:rust2rpm-v20.tar.gz/test.py -> _service:tar_scm:rust2rpm-v21.tar.gz/test.py
Changed
@@ -29,6 +29,14 @@ "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"), ("*", "crate(test) >= 0.0.0"), + ("0.*", + "(crate(test) >= 0.0.0 with crate(test) < 1.0.0~)"), + ("0.0.*", + "(crate(test) >= 0.0.0 with crate(test) < 0.1.0~)"), + ("0.1.*", + "(crate(test) >= 0.1.0 with crate(test) < 0.2.0~)"), + ("0.*.*", + "(crate(test) >= 0.0.0 with crate(test) < 1.0.0~)"), ("1.*", "(crate(test) >= 1.0.0 with crate(test) < 2.0.0~)"), ("1.2.*",
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2