File rapidquilt.spec of Package rapidquilt

#
# spec file for package rapidquilt
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

# SUSE rpm likes to mess with config.guess files
# see auto-config-update-aarch64-ppc64le.diff for details
%define save_automake_files() \
    find %1				\\\
	-name config.guess -o		\\\
	-name config.sub |		\
    while read f ; do			\
        mv "$f" "$f".saved		\
    done				\
    %{nil}
%define restore_automake_files() \
    find %1				\\\
	-name config.guess.saved -o	\\\
	-name config.sub.saved |	\
    while read f ; do			\
        mv "$f" "${f%%.saved}"		\
    done				\
    %{nil}

Name:           rapidquilt
Version:        0.6.8+git3.d2200ec
Release:        0
Summary:        A multi-threaded combination of quilt and patch
License:        MIT
Group:          Productivity/Text/Utilities
URL:            https://github.com/openSUSE/rapidquilt
Source:         https://github.com/openSUSE/rapidquilt/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.xz
Source2:        Cargo.lock
BuildRequires:  cargo
BuildRequires:  rust >= 1.42.0

%description
This is multi-threaded reimplementation of quilt and patch in one program.
It supports only the push command. The goal is to be very fast.

%prep
%setup -q
%setup -q -D -T -a 1
%autopatch -p1

cp %{S:2} .
mkdir cargo-home
cat >cargo-home/config <<EOF
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = './vendor'
EOF
%save_automake_files vendor

%build
%restore_automake_files vendor
export CARGO_HOME=$PWD/cargo-home
cargo build --release %{?_smp_mflags}

%install
export CARGO_HOME=$PWD/cargo-home

ver=$( cargo --version )
oldifs="$IFS"
IFS=.
set -- ${ver##* }
IFS="$oldifs"
if [ "$1" -gt 1 -o \
     "$1" -eq 1 -a "$2" -gt 36 ]
then
    cargo install --no-track --path=. --root=%{buildroot}%{_prefix}
else
    cargo install --path=. --root=%{buildroot}%{_prefix}

    # remove residue crate file
    rm %{buildroot}%{_prefix}/.crates*
fi

%check
export CARGO_HOME=$PWD/cargo-home
cargo test

%files
%license LICENSE.md
%doc README.md
%{_bindir}/rapidquilt

%changelog
openSUSE Build Service is sponsored by