Use local mirror for speed up

This commit is contained in:
Funda Wang 2023-07-30 22:59:52 +08:00
parent 4fc5bb1f00
commit 1b168183b7
4 changed files with 32 additions and 2 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

@ -10,11 +10,15 @@
%bcond_without lldb
Name: rust
Version: 1.64.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.60.0-disable-libssh2.patch
Patch0001: rustc-1.63.0-disable-http2.patch
@ -324,7 +328,7 @@ fi
--enable-vendor \
--enable-verbose-tests \
%{?codegen_units_std} \
--release-channel=%{channel}
--release-channel=stable
%{python} ./x.py build -j "$ncpus" --stage 2
%{python} ./x.py doc --stage 2
@ -362,6 +366,12 @@ find %{buildroot}%{_docdir}/%{name}/html -type f -exec chmod -x '{}' '+'
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 %without lldb
rm -f %{buildroot}%{_bindir}/rust-lldb
rm -f %{buildroot}%{rustlibdir}/etc/lldb_*
@ -424,6 +434,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
@ -481,6 +493,9 @@ export %{rust_env}
%{_mandir}/man1/cargo*.1*
%changelog
* Sun Jul 30 2023 Funda Wang <fundawang@yeah.net> - 1.64.0-2
- Use local mirror for speed up
* Thu May 11 2023 wangkai <13474090681@163.com> - 1.64.0-1
- Update to 1.64.0