diff --git a/cargo-config b/cargo-config new file mode 100644 index 0000000000000000000000000000000000000000..621c190a45fb404035d3285a4737f691d7b119a2 --- /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 0000000000000000000000000000000000000000..7613473719d1fdccdef429b66b565403a1caa799 --- /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 0000000000000000000000000000000000000000..2338945be912705cafbb21934bdb7143098f4aab --- /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 35cd7958225a1f680deed208ad5b58ad8696fe63..d9d00f5f1445ee1c12c06685ad890599762d66b1 100644 --- a/rust.spec +++ b/rust.spec @@ -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 - 1.71.0-2 +- Use local mirror for speed up + * Fri Jul 28 2023 jchzhou - 1.71.0-1 - Update to 1.71.0