Merge pull request #1 from import/rust:rosa2016.1

Backports and updates to 1.31.0
This commit is contained in:
djam 2018-12-26 14:55:30 +03:00
commit bbaeceb98f
4 changed files with 566 additions and 88 deletions

View file

@ -1,2 +1,4 @@
sources:
rustc-1.19.0-src.tar.gz: 846b7a8ce1f33c3fc5e0d3b0b4258540515d67a9
rust-1.30.0-i686-unknown-linux-gnu.tar.xz: da90ccc0a4f16ea4db8f87fc0a862744f2ac30df
rust-1.30.0-x86_64-unknown-linux-gnu.tar.xz: 12901cf47732ad13ccc3fbea0aba853544644676
rustc-1.31.0-src.tar.xz: 79878ca48506ee7d17cd8375fca5f9950699c097

View file

@ -0,0 +1,118 @@
From f107514aef0b25b0d959941df1e45b18a478151b Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Fri, 30 Nov 2018 15:33:40 -0800
Subject: [PATCH] Deal with EINTR in net timeout tests
We've seen sporadic QE failures in the timeout tests on this assertion:
assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
So there's an error, but not either of the expected kinds. Adding a
format to show the kind revealed `ErrorKind::Interrupted` (`EINTR`).
For the cases that were using `read`, we can just use `read_exact` to
keep trying after interruption. For those using `recv_from`, we have to
manually loop until we get a non-interrupted result.
---
src/libstd/net/tcp.rs | 10 ++++++----
src/libstd/net/udp.rs | 20 ++++++++++++++++----
src/libstd/sys/unix/ext/net.rs | 10 ++++++----
3 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs
index ad212a547579..be797803233a 100644
--- a/src/libstd/net/tcp.rs
+++ b/src/libstd/net/tcp.rs
@@ -1548,8 +1548,9 @@ mod tests {
let mut buf = [0; 10];
let start = Instant::now();
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
assert!(start.elapsed() > Duration::from_millis(400));
drop(listener);
}
@@ -1570,8 +1571,9 @@ mod tests {
assert_eq!(b"hello world", &buf[..]);
let start = Instant::now();
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
assert!(start.elapsed() > Duration::from_millis(400));
drop(listener);
}
diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs
index 0ebe3284b4f0..fc68abae05a0 100644
--- a/src/libstd/net/udp.rs
+++ b/src/libstd/net/udp.rs
@@ -1030,8 +1030,14 @@ mod tests {
let mut buf = [0; 10];
let start = Instant::now();
- let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ loop {
+ let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
+ if kind != ErrorKind::Interrupted {
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
+ break;
+ }
+ }
assert!(start.elapsed() > Duration::from_millis(400));
}
@@ -1049,8 +1055,14 @@ mod tests {
assert_eq!(b"hello world", &buf[..]);
let start = Instant::now();
- let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ loop {
+ let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
+ if kind != ErrorKind::Interrupted {
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
+ break;
+ }
+ }
assert!(start.elapsed() > Duration::from_millis(400));
}
diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs
index 55f43ccd7db4..737437c76b7c 100644
--- a/src/libstd/sys/unix/ext/net.rs
+++ b/src/libstd/sys/unix/ext/net.rs
@@ -1654,8 +1654,9 @@ mod test {
or_panic!(stream.set_read_timeout(Some(Duration::from_millis(1000))));
let mut buf = [0; 10];
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == io::ErrorKind::WouldBlock || kind == io::ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
}
#[test]
@@ -1675,8 +1676,9 @@ mod test {
or_panic!(stream.read(&mut buf));
assert_eq!(b"hello world", &buf[..]);
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == io::ErrorKind::WouldBlock || kind == io::ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
}
// Ensure the `set_read_timeout` and `set_write_timeout` calls return errors
--
2.19.1

View file

@ -1,2 +1,11 @@
addFilter("spurious-executable-perm")
addFilter("zero-length")
# 834 warnings
addFilter("W: binaryinfo-readelf-failed")
addFilter("W: devel-file-in-non-devel-package")
addFilter("W: hidden-file-or-dir")
addFilter("W: no-soname")
addFilter("W: non-executable-script")
addFilter("W: only-non-binary-in-usr-lib")
addFilter("W: script-without-shebang")
#
addFilter("E: wrong-script-interpreter")
addFilter("E: unstripped-binary-or-object")

519
rust.spec
View file

@ -1,119 +1,468 @@
# https://src.fedoraproject.org/rpms/rust
# ALL Rust libraries are private, because they don't keep an ABI.
%define _privatelibs lib(.*-[[:xdigit:]]{16}*|rustc.*)[.]so.*
%define __provides_exclude ^(%{_privatelibs})$
%define __requires_exclude ^(%{_privatelibs})$
%define __provides_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
%define __requires_exclude_from ^(%{_docdir}|%{rustlibdir}/src)/.*$
%define debug_package %{nil}
%define _disable_lto 1
%define _disable_ld_no_undefined 1
# To avoid undefined symbols
%define _find_debuginfo_opts -g
Summary: A safe, concurrent, practical programming language
# We're going to override --libdir when configuring to get rustlib into a
# common path, but we'll fix the shared libraries during install.
%define rustlibdir %{_libdir}/rustlib
# Only x86_64 and i686 are Tier 1 platforms at this time.
# https://forge.rust-lang.org/platform-support.html
%define rust_arches x86_64 %{ix86}
# To bootstrap from scratch, set the channel and date from src/stage0.txt
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
# or nightly wants some beta-YYYY-MM-DD
# Note that cargo matches the program version here, not its crate version.
%define bootstrap_rust 1.30.0
%define bootstrap_cargo 1.30.0
%define bootstrap_date 2018-10-25
%bcond_without bootstrap
%if %{without bootstrap}
%define bootstrap_arches %{nil}
%else
%define bootstrap_arches %{rust_arches}
%endif
# Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases.
%bcond_without llvm_static
# LLDB only works on some architectures
# LLDB isn't available everywhere...
%bcond_with lldb
# Some sub-packages are versioned independently of the rust compiler and runtime itself.
# Also beware that if any of these are not changed in a version bump, then the release
# number should still increase, not be reset to 1!
%define rustc_version 1.31.0
%define cargo_version 1.31.0
%define rustfmt_version 1.0.0
%define rls_version 1.31.6
%define clippy_version 0.0.212
%ifarch x86_64
%define rust_triple x86_64-unknown-linux-gnu
%else
%define rust_triple i686-unknown-linux-gnu
%endif
%ifarch %{bootstrap_arches}
%define bootstrap_root rust-%{bootstrap_rust}-%{rust_triple}
%define local_rust_root %{_builddir}/%{bootstrap_root}/usr
%else
%define local_rust_root %{_prefix}
%endif
Summary: The Rust Programming Language
Name: rust
Version: 1.19.0
Release: 1
License: MIT
Version: %{rustc_version}
Release: 8
License: (ASL 2.0 or MIT) and (BSD and MIT)
Group: Development/Rust
Url: http://www.rust-lang.org/
Source0: http://static.rust-lang.org/dist/rustc-%{version}-src.tar.gz
Source10: %{name}.rpmlintrc
BuildRequires: cmake
BuildRequires: bison
# ^ written as: (rust itself) and (bundled libraries)
Url: https://www.rust-lang.org
Source0: https://static.rust-lang.org/dist/rustc-%{rustc_version}-src.tar.xz
# For bootstrap
Source1: https://static.rust-lang.org/dist/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.xz
Source2: https://static.rust-lang.org/dist/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.xz
Source10: rust.rpmlintrc
# https://github.com/rust-lang/rust/pull/56394
Patch1: 0001-Deal-with-EINTR-in-net-timeout-tests.patch
BuildRequires: ncurses-devel
BuildRequires: curl
BuildRequires: docbook-style-xsl
BuildRequires: flex
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zlib)
# needs libssh2_userauth_publickey_frommemory
BuildRequires: pkgconfig(libssh2) >= 1.6.0
BuildRequires: pkgconfig(python3)
BuildRequires: cmake >= 2.8.11
BuildRequires: llvm-devel >= 5.0
%if %{with llvm_static}
BuildRequires: pkgconfig(libffi)
%endif
# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs
BuildRequires: procps-ng
# debuginfo-gdb tests need gdb
BuildRequires: gdb
BuildRequires: git
BuildRequires: xsltproc
BuildRequires: llvm-devel
BuildRequires: pkgconfig(python)
%if %{without bootstrap}
BuildRequires: cargo >= %{bootstrap_cargo}
BuildRequires: %{name} >= %{bootstrap_rust}
#Conflicts: %%{name} > %%{rustc_version}
%endif
# Virtual provides for folks who attempt "dnf install rustc"
Provides: rustc = %{rustc_version}-%{release}
# Always require our exact standard library
Requires: %{name}-std-static = %{rustc_version}-%{release}
%description
Rust is a curly-brace, block-structured expression language. It
visually resembles the C language family, but differs significantly
in syntactic and semantic details. Its design is oriented toward
concerns of "programming in the large", that is, of creating and
maintaining boundaries - both abstract and operational - that
preserve large-system integrity, availability and concurrency.
Rust is a systems programming language that runs blazingly fast, prevents
segfaults, and guarantees thread safety.
It supports a mixture of imperative procedural, concurrent actor,
object-oriented and pure functional styles. Rust also supports
generic programming and metaprogramming, in both static and dynamic
styles.
This package includes the Rust compiler and documentation generator.
%files
%doc README.md COPYRIGHT LICENSE-APACHE LICENSE-MIT
%{_bindir}/rustc
%{_bindir}/rustdoc
%{_bindir}/rust-gdb
%{_bindir}/rust-lldb
%{_docdir}/%{name}/COPYRIGHT
%{_docdir}/%{name}/LICENSE-APACHE
%{_docdir}/%{name}/LICENSE-MIT
%{_docdir}/%{name}/README.md
%{_libdir}/lib*-*.so
%{_libdir}/rustlib/components
%{_libdir}/rustlib/etc/*.py
%{_libdir}/rustlib/*/lib/lib*-*.so
%{_libdir}/rustlib/*/lib/lib*-*.rlib
%{_mandir}/man*/*
%{_libdir}/*.so
%{_mandir}/man1/rustc.1*
%{_mandir}/man1/rustdoc.1*
%dir %{rustlibdir}
%dir %{rustlibdir}/%{rust_triple}
%dir %{rustlibdir}/%{rust_triple}/lib
%{rustlibdir}/%{rust_triple}/lib/*.so
%{rustlibdir}/%{rust_triple}/codegen-backends/
#----------------------------------------------------------------------------
#-------------------------------------------------------------------------
%package doc
Summary: Documentation for the Rust programming language
Group: Documentation
%package std-static
Summary: Standard library for Rust
Group: Development/Rust
%description std-static
This package includes the standard libraries for building applications
written in Rust.
%files std-static
%doc README.md COPYRIGHT LICENSE-APACHE LICENSE-MIT
%dir %{rustlibdir}
%dir %{rustlibdir}/%{rust_triple}
%dir %{rustlibdir}/%{rust_triple}/lib
%{rustlibdir}/%{rust_triple}/lib/*.rlib
#-------------------------------------------------------------------------
%package debugger-common
Summary: Common debugger pretty printers for Rust
Group: Development/Rust
BuildArch: noarch
%description doc
This package contains the HTML documentation of the Rust programming language.
%description debugger-common
This package includes the common functionality
for %{name}-gdb and %{name}-lldb.
%files doc
%{_docdir}/%{name}/html/
%files debugger-common
%doc README.md COPYRIGHT LICENSE-APACHE LICENSE-MIT
%dir %{rustlibdir}
%dir %{rustlibdir}/etc
%{rustlibdir}/etc/debugger_*.py*
#----------------------------------------------------------------------------
#-------------------------------------------------------------------------
%package gdb
Summary: GDB pretty printers for Rust
Group: Development/Rust
Requires: gdb
Requires: %{name}-debugger-common = %{rustc_version}-%{release}
BuildArch: noarch
# (akien) Handle moved files between our old Mageia package and this Fedora-based one
Conflicts: rust < 1.11.0-3
%description gdb
This package includes the rust-gdb script,
which allows easier debugging of Rust programs.
%files gdb
%doc README.md COPYRIGHT LICENSE-APACHE LICENSE-MIT
%{_bindir}/rust-gdb
%{rustlibdir}/etc/gdb_*.py*
#-------------------------------------------------------------------------
%if %{with lldb}
%package lldb
Summary: LLDB pretty printers for Rust
Group: Development/Rust
Requires: lldb
Requires: python-lldb
Requires: %{name}-debugger-common = %{rustc_version}-%{release}
# It could be noarch, but lldb has limited availability
#BuildArch: noarch
%description lldb
This package includes the rust-lldb script,
which allows easier debugging of Rust programs.
%files lldb
%doc README.md COPYRIGHT LICENSE-APACHE LICENSE-MIT
%{_bindir}/rust-lldb
%{rustlibdir}/etc/lldb_*.py*
%endif
#-------------------------------------------------------------------------
%package -n cargo
Summary: Rust's package manager and build tool
Version: %{cargo_version}
Group: Development/Rust
# For tests:
BuildRequires: git
# Cargo is not much use without Rust
Requires: rust
Obsoletes: cargo < 1.26.0-1
%description -n cargo
Cargo is a tool that allows Rust projects to declare their various dependencies
and ensure that you'll always get a repeatable build.
%files -n cargo
%doc README.md COPYRIGHT LICENSE-APACHE LICENSE-MIT
%{_bindir}/cargo
%{_mandir}/man1/cargo*.1*
%{_sysconfdir}/bash_completion.d/cargo
%{_datadir}/zsh/site-functions/_cargo
%dir %{_datadir}/cargo
%dir %{_datadir}/cargo/registry
#-------------------------------------------------------------------------
%package -n rustfmt
Summary: Tool to find and fix Rust formatting issues
Group: Development/Rust
Version: %{rustfmt_version}
Requires: cargo
# The component/package was rustfmt-preview until Rust 1.31.
Obsoletes: rustfmt-preview < 1.0.0
Provides: rustfmt-preview = %{rustfmt_version}-%{release}
%description -n rustfmt
A tool for formatting Rust code according to style guidelines.
%files -n rustfmt
%doc src/tools/rustfmt/{README,CHANGELOG,Configurations}.md
%{_bindir}/rustfmt
%{_bindir}/cargo-fmt
#-------------------------------------------------------------------------
%package -n rls
Summary: Rust Language Server for IDE integration
Version: %{rls_version}
Group: Development/Rust
Provides: rls = %{rls_version}
Requires: rust-analysis
# /usr/bin/rls is dynamically linked against internal rustc libs
Requires: %{name} = %{rustc_version}-%{release}
# The component/package was rls-preview until Rust 1.31.
Obsoletes: rls-preview < 1.31.6
Provides: rls-preview = %{rls_version}-%{release}
%description -n rls
The Rust Language Server provides a server that runs in the background,
providing IDEs, editors, and other tools with information about Rust programs.
It supports functionality such as 'goto definition', symbol search,
reformatting, and code completion, and enables renaming and refactorings.
%files -n rls
%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md}
%{_bindir}/rls
#-------------------------------------------------------------------------
%package -n clippy
Summary: Lints to catch common mistakes and improve your Rust code
Version: %{clippy_version}
Group: Development/Rust
Provides: clippy = %{clippy_version}
Requires: cargo
# /usr/bin/clippy-driver is dynamically linked against internal rustc libs
Requires: %{name} = %{rustc_version}-%{release}
# The component/package was clippy-preview until Rust 1.31.
Obsoletes: clippy-preview <= 0.0.212
Provides: clippy-preview = %{clippy_version}-%{release}
%description -n clippy
A collection of lints to catch common mistakes and improve your Rust code.
%files -n clippy
%doc src/tools/clippy/{README.md,CHANGELOG.md}
%doc src/tools/clippy/LICENSE-{APACHE,MIT}
%{_bindir}/cargo-clippy
%{_bindir}/clippy-driver
#-------------------------------------------------------------------------
%package src
Summary: Sources for the Rust standard library
Group: Development/Rust
BuildArch: noarch
%description src
This package includes source files for the Rust standard library. It may be
useful as a reference for code completion tools in various editors.
%files src
%doc README.md COPYRIGHT LICENSE-APACHE LICENSE-MIT
%dir %{rustlibdir}
%{rustlibdir}/src
#-------------------------------------------------------------------------
%package analysis
Summary: Compiler analysis data for the Rust standard library
Group: Development/Rust
Requires: rust-std-static = %{rustc_version}-%{release}
%description analysis
This package contains analysis data files produced with rustc's -Zsave-analysis
feature for the Rust standard library. The RLS (Rust Language Server) uses this
data to provide information about the Rust standard library.
%files analysis
%doc README.md COPYRIGHT LICENSE-APACHE LICENSE-MIT
%{rustlibdir}/%{rust_triple}/analysis/
#-------------------------------------------------------------------------
%prep
%setup -q -n rustc-%{version}-src
%ifarch %{bootstrap_arches}
%ifarch x86_64
tar xf %{SOURCE1}
%else
tar xf %{SOURCE2}
%endif
cd rust-%{bootstrap_rust}-%{rust_triple}
./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \
--prefix=%{local_rust_root} --disable-ldconfig
test -f '%{local_rust_root}/bin/cargo'
test -f '%{local_rust_root}/bin/rustc'
%endif
%if %{without bootstrap}
%patch1 -p1
%endif
%setup -qn rustc-%{rustc_version}-src
# python3
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure
# We're disabling jemalloc, but rust-src still wants it.
# rm -rf src/jemalloc/
rm -rf src/llvm/
%build
./configure \
--prefix=%{_prefix} \
--sysconfdir=%{_sysconfdir} \
--datadir=%{_datadir} \
--libdir=%{_libdir} \
--localstatedir=%{_localstatedir} \
--mandir=%{_mandir} \
--infodir=%{_infodir} \
--disable-rpath \
--default-linker=gcc \
--disable-codegen-tests \
--enable-llvm-link-shared \
--llvm-root=%{_prefix} \
--enable-vendor
# We never enable emscripten.
rm -rf src/llvm-emscripten/
./x.py build
./x.py doc
# We never enable other LLVM tools.
rm -rf src/tools/clang
rm -rf src/tools/lld
rm -rf src/tools/lldb
# extract bundled licenses for packaging
sed -e '/*\//q' src/libbacktrace/backtrace.h \
>src/libbacktrace/LICENSE-libbacktrace
%if %{with llvm_static}
# Static linking to distro LLVM needs to add -lffi
# https://github.com/rust-lang/rust/issues/34486
sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
src/librustc_llvm/lib.rs
%endif
# The configure macro will modify some autoconf-related files, which upsets
# cargo when it tries to verify checksums in those files. If we just truncate
# that file list, cargo won't have anything to complain about.
find src/vendor -name .cargo-checksum.json \
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
%build
# Use hardening ldflags.
%if %{without bootstrap}
%ifarch x86_64
%define rustflags -Clink-arg=-Wl,-z,relro,-z,now -L %{rustlibdir}/%{rust_triple}/lib
%else
%define rustflags -Clink-arg=-Wl,-z,relro,-z,now
%endif
%else
%define rustflags -Clink-arg=-Wl,-z,relro,-z,now
%endif
# convince libssh2-sys to use the distro libssh2
export LIBSSH2_SYS_USE_PKG_CONFIG=1
export RUSTFLAGS="%{rustflags}"
%configure2_5x \
--disable-option-checking \
--libdir=%{_libdir} \
--build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
--local-rust-root=%{local_rust_root} \
--llvm-root=%{_prefix} \
--disable-codegen-tests \
--disable-jemalloc \
--disable-rpath \
--enable-extended \
--enable-vendor \
--release-channel=stable \
--disable-debuginfo \
--disable-debuginfo-only-std \
--disable-debuginfo-tools \
--disable-debuginfo-lines
#%%{!?with_llvm_static: --enable-llvm-link-shared } } \
python3 ./x.py build
%install
DESTDIR=%{buildroot} ./x.py install --verbose
export RUSTFLAGS="%{rustflags}"
rm -f %{buildroot}%{_libdir}/rustlib/install.log
rm -f %{buildroot}%{_libdir}/rustlib/manifest-*
rm -f %{buildroot}%{_libdir}/rustlib/rust-installer-version
rm -f %{buildroot}%{_libdir}/rustlib/uninstall.sh
DESTDIR=%{buildroot} python3 ./x.py install
# Turn libraries into symlinks to avoid duplicate Provides
pushd %{buildroot}%{_libdir}/rustlib/*/lib/
rm lib*.so
for lib in ../../../*.so
do
ln -s $lib `basename $lib`
done
popd
# The shared libraries should be executable for debuginfo extraction.
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
-exec chmod -v +x '{}' '+'
# Manually strip them because auto-strip damages files
pushd %{buildroot}%{_libdir}
strip *.so
popd
pushd %{buildroot}%{_bindir}
strip rustc
strip rustdoc
popd
# The libdir libraries are identical to those under rustlib/. It's easier on
# library loading if we keep them in libdir, but we do need them in rustlib/
# to support dynamic linking for compiler plugins, so we'll symlink.
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" &&
find ../../../../%{_lib} -maxdepth 1 -name '*.so' |
while read lib; do
# make sure they're actually identical!
cmp "$lib" "${lib##*/}"
ln -v -f -s -t . "$lib"
done)
# Remove installer artifacts (manifests, uninstall scripts, etc.)
find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
# Remove backup files from %%configure munging
find %{buildroot}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+'
# https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
# We don't actually need to ship any of those python scripts in rust-src anyway.
find %{buildroot}%{rustlibdir}/src -type f -name '*.py' -exec rm -v '{}' '+'
# Remove unwanted documentation files (we already package them)
rm -f %{buildroot}%{_docdir}/%{name}/README.md
rm -f %{buildroot}%{_docdir}/%{name}/COPYRIGHT
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-APACHE
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY
rm -f %{buildroot}%{_docdir}/%{name}/*.old
# Create the path for crate-devel packages
mkdir -p %{buildroot}%{_datadir}/cargo/registry
%if %{without lldb}
rm -f %{buildroot}%{_bindir}/rust-lldb
rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*
%endif