Use local mirror for speed up

This commit is contained in:
Funda Wang 2023-07-30 20:42:55 +08:00
parent e0fa1bcf6e
commit 0435ef73b0
4 changed files with 30 additions and 1 deletions

5
cargo-config Normal file
View File

@ -0,0 +1,5 @@
[source.crates-io]
replace-with = 'ustc'
[source.ustc]
registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"

5
cargo-config.csh Normal file
View File

@ -0,0 +1,5 @@
# Copy cargo config from skel if it is not exist
if ( ! -e "$HOME/.cargo/config.toml" ) then
mkdir -p $HOME/.cargo
cp -f /etc/skel/.cargo/config.toml $HOME/.cargo
endif

5
cargo-config.sh Normal file
View File

@ -0,0 +1,5 @@
# Copy cargo config from skel if it is not exist
if [ ! -f "$HOME/.cargo/config.toml" ] ; then
mkdir -p $HOME/.cargo
cp -f /etc/skel/.cargo/config.toml $HOME/.cargo
fi

View File

@ -12,11 +12,15 @@
Name: rust
Version: 1.71.0
Release: 1
Release: 2
Summary: The Rust Programming Language
License: (ASL 2.0 or MIT) and (BSD and MIT)
URL: https://www.rust-lang.org
Source0: https://static.rust-lang.org/dist/rustc-%{version}-src.tar.xz
# SOURCE1-3: use local mirror for speed up
Source1: cargo-config
Source2: cargo-config.sh
Source3: cargo-config.csh
Patch0000: rustc-1.71.0-disable-libssh2.patch
Patch0001: rustc-1.71.0-disable-http2.patch
@ -369,6 +373,11 @@ mkdir -p %{buildroot}%{_datadir}/cargo/registry
mkdir -p %{buildroot}%{_docdir}/cargo
ln -sT ../rust/html/cargo/ %{buildroot}%{_docdir}/cargo/html
# install default config for cargo mirror
install -m 0644 -D -p %{SOURCE1} %{buildroot}%{_sysconfdir}/skel/.cargo/config.toml
install -m 0644 -D -p %{SOURCE2} %{buildroot}%{_sysconfdir}/profile.d/cargo-config.sh
install -m 0644 -D -p %{SOURCE3} %{buildroot}%{_sysconfdir}/profile.d/cargo-config.csh
%if %{with analyzer}
# The rls stub doesn't have an install target, but we can just copy it.
%{__install} -t %{buildroot}%{_bindir} build/%{rust_triple}/stage2-tools-bin/rls
@ -439,6 +448,8 @@ export %{rust_env}
%files -n cargo
%license src/tools/cargo/LICENSE-APACHE src/tools/cargo/LICENSE-MIT src/tools/cargo/LICENSE-THIRD-PARTY
%doc src/tools/cargo/README.md
%config(noreplace) %{_sysconfdir}/skel/.cargo/config.toml
%{_sysconfdir}/profile.d/cargo-config.*
%{_bindir}/cargo
%{_libexecdir}/cargo*
%{_sysconfdir}/bash_completion.d/cargo
@ -482,6 +493,9 @@ export %{rust_env}
%{_mandir}/man1/cargo*.1*
%changelog
* Sun Jul 30 2023 Funda Wang <fundawang@yeah.net> - 1.71.0-2
- Use local mirror for speed up
* Fri Jul 28 2023 jchzhou <zhoujiacheng@iscas.ac.cn> - 1.71.0-1
- Update to 1.71.0