## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

# Generated by rust2rpm 21
%bcond_without check

%global crate btrd

%if 0%{?el8}
# el8 doesn't have these macros
%global __crates_url https://crates.io/api/v1/crates/
%global crates_source %{__crates_url}%{crate}/%{version}/download#/%{crate}-%{version}.crate
%global version_no_tilde %{version}
%endif

Name:           rust-%{crate}
Version:        0.5.2
Release:        %autorelease
Summary:        Btrfs debugger

# Upstream license specification: GPL-2.0
License:        GPLv2
URL:            https://crates.io/crates/btrd
Source:         %{crates_source}
# vendored dependencies for EPEL
# update with ./update-vendor-tarball.sh after bumping the specfile version
Source1:        %{crate}-%{version}-vendor.tar.gz

ExclusiveArch:  %{rust_arches}

%if 0%{?rhel}
BuildRequires:  rust-toolset
%else
BuildRequires:  rust-packaging >= 21
%endif

%global _description %{expand:
btrd is a REPL debugger that helps inspect mounted btrfs filesystems. btrd is
particularly useful in exploring on-disk structures and has full knowledge of
all on-disk types.}

%description %{_description}

%package     -n %{crate}
Summary:        %{summary}

%description -n %{crate} %{_description}

%files       -n %{crate}
%license LICENSE
%doc scripts README.md
%{_bindir}/btrd

%if 0%{?fedora}
%package        devel
Summary:        %{summary}
BuildArch:      noarch

%description    devel %{_description}

This package contains library source intended for building other packages which
use the "%{crate}" crate.

%files          devel
%license %{crate_instdir}/LICENSE
%doc %{crate_instdir}/README.md
%doc %{crate_instdir}/docs
%{crate_instdir}/

%package     -n %{name}+default-devel
Summary:        %{summary}
BuildArch:      noarch

%description -n %{name}+default-devel %{_description}

This package contains library source intended for building other packages which
use the "default" feature of the "%{crate}" crate.

%files       -n %{name}+default-devel
%ghost %{crate_instdir}/Cargo.toml
%endif

%prep
%autosetup -n %{crate}-%{version_no_tilde} -p1
%if 0%{?rhel}
%cargo_prep -V 1
%else
%cargo_prep

%generate_buildrequires
%cargo_generate_buildrequires
%endif

%build
%cargo_build

%install
%cargo_install

%if %{with check}
%check
%cargo_test
%endif

%changelog
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> 0.5.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Thu May 19 2022 Davide Cavalca <dcavalca@fedoraproject.org> 0.5.2-1
- Update to 0.5.2 and build for EPEL

* Sun Feb 20 2022 Igor Raits <igor.raits@gmail.com> 0.5.0-4
- Update simplelog to 0.11

* Tue Feb 15 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> 0.5.0-3
- Rebuild with package notes

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> 0.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Wed Oct 27 2021 Davide Cavalca <dcavalca@fedoraproject.org> 0.5.0-1
- Initial import; Fixes: RHBZ#1980426