## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 4;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

# Generated by rust2rpm 25
%bcond_without check

Name:           rustup
Version:        1.27.1
Release:        %autorelease
Summary:        Manage multiple rust installations with ease

SourceLicense:  MIT OR Apache-2.0
# (MIT OR Apache-2.0) AND Unicode-DFS-2016
# 0BSD OR MIT OR Apache-2.0
# Apache-2.0
# Apache-2.0 OR BSL-1.0
# Apache-2.0 OR ISC OR MIT
# Apache-2.0 OR MIT
# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
# BSD-3-Clause
# ISC
# ISC AND MIT AND OpenSSL
# MIT
# MIT OR Apache-2.0
# MIT OR Apache-2.0 OR Zlib
# MIT OR Zlib OR Apache-2.0
# Unlicense OR MIT
# Zlib OR Apache-2.0 OR MIT
License:        Apache-2.0 AND BSD-3-Clause AND ISC AND MIT AND OpenSSL AND Unicode-DFS-2016 AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR ISC OR MIT) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT)
# LICENSE.dependencies contains a full license breakdown

URL:            https://github.com/rust-lang/rustup
Source:         %{url}/archive/%{version}/rustup-%{version}.tar.gz

# non-upstreamable patches:
# * drop Windows-specific dependencies
Patch:          0001-Drop-Windows-specific-dependencies.patch
# * drop unavailable "openssl/vendored" feature
Patch:          0002-Drop-feature-for-statically-linking-against-vendored.patch
# * remove unused tracing support and unnecessary "rs_tracing" dependency
Patch:          0003-Remove-unused-tracing-support.patch
# * remove unused git-based versioning and unnecessary "git-testament" dependency
Patch:          0004-Remove-unused-git-based-versioning.patch
# * add powerpc64le and s390x to known target_arch values for tests
Patch:          0005-Add-powerpc64-and-s390x-to-known-target_arch-values-.patch
# * temporarily downgrade opener dependency from 0.7 to 0.6 to match cargo
Patch:          0006-temporarily-downgrade-opener-dependency-from-0.7-to-.patch
# * bump pulldown-cmark dependency from 0.10 to 0.11:
#   https://github.com/rust-lang/rustup/commit/d84c907
Patch:          0007-bump-pulldown-cmark-dependency-from-0.10-to-0.11.patch
# * bump fs_at dependency from 0.1 to 0.2:
#   https://github.com/rust-lang/rustup/commit/4b0f03b
Patch:          0008-bump-fs_at-dependency-from-0.1-to-0.2.patch

ExcludeArch:    %{ix86}

BuildRequires:  cargo-rpm-macros >= 24

%global _description %{expand:
Manage multiple rust installations with ease.}

%description %{_description}

%prep
%autosetup -n rustup-%{version} -p1
%cargo_prep

%generate_buildrequires
%cargo_generate_buildrequires -f test

%build
%cargo_build -f no-self-update
%{cargo_license_summary -f no-self-update}
%{cargo_license -f no-self-update} > LICENSE.dependencies

%install
%cargo_install -f no-self-update

# generate and install shell completions
cp -pav target/rpm/rustup-init target/rpm/rustup
target/rpm/rustup completions bash > rustup.bash
target/rpm/rustup completions fish > rustup.fish
target/rpm/rustup completions zsh > _rustup

install -Dpm 0644 rustup.bash -t %{buildroot}/%{bash_completions_dir}
install -Dpm 0644 rustup.fish -t %{buildroot}/%{fish_completions_dir}
install -Dpm 0644 _rustup -t %{buildroot}/%{zsh_completions_dir}

%if %{with check}
%check
# * skip tests that require internet access
# * skip tests for the "rustup" binary that is not built in this package
%cargo_test -f test -- -- --skip suite::cli_exact::check_updates --skip suite::cli_ui::rustup_ui_doc_text_tests
%endif

%files
%license LICENSE-APACHE
%license LICENSE-MIT
%license LICENSE.dependencies
%doc CHANGELOG.md
%doc README.md

%{_bindir}/rustup-init

%{bash_completions_dir}/rustup.bash
%{fish_completions_dir}/rustup.fish
%{zsh_completions_dir}/_rustup

%changelog
## START: Generated by rpmautospec
* Fri Aug 09 2024 Fabio Valentini <decathorpe@gmail.com> - 1.27.1-4
- Bump fs_at dependency from 0.1 to 0.2

* Sat Jul 20 2024 blinxen <h-k-81@hotmail.com> - 1.27.1-3
- Update pulldown-cmark to version 0.11

* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.27.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Thu Jun 13 2024 Fabio Valentini <decathorpe@gmail.com> - 1.27.1-1
- Update to version 1.27.1; Fixes RHBZ#2269302

* Thu May 23 2024 Fabio Valentini <decathorpe@gmail.com> - 1.26.0-3
- Rebuild with Rust 1.78 to fix incomplete debuginfo and backtraces

* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.26.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Thu Nov 30 2023 Fabio Valentini <decathorpe@gmail.com> - 1.26.0-1
- Initial import (#2251579)
## END: Generated by rpmautospec