From 1b168183b78c25757c3b735c657a0bcf077fb84f Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Sun, 30 Jul 2023 22:59:52 +0800 Subject: [PATCH] Use local mirror for speed up --- cargo-config | 5 +++++ cargo-config.csh | 5 +++++ cargo-config.sh | 5 +++++ rust.spec | 19 +++++++++++++++++-- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 cargo-config create mode 100644 cargo-config.csh create mode 100644 cargo-config.sh diff --git a/cargo-config b/cargo-config new file mode 100644 index 0000000..621c190 --- /dev/null +++ b/cargo-config @@ -0,0 +1,5 @@ +[source.crates-io] +replace-with = 'ustc' + +[source.ustc] +registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/" diff --git a/cargo-config.csh b/cargo-config.csh new file mode 100644 index 0000000..7613473 --- /dev/null +++ b/cargo-config.csh @@ -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 diff --git a/cargo-config.sh b/cargo-config.sh new file mode 100644 index 0000000..2338945 --- /dev/null +++ b/cargo-config.sh @@ -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 diff --git a/rust.spec b/rust.spec index f6f1b44..238ec42 100644 --- a/rust.spec +++ b/rust.spec @@ -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 - 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