diff --git a/.gitignore b/.gitignore index 6c07bcc..405beca 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /btrd-0.5.0.crate +/btrd-0.5.2.crate +/btrd-0.5.2-vendor.tar.gz diff --git a/btrd-bump-nix.patch b/btrd-bump-nix.patch deleted file mode 100644 index 47c0e47..0000000 --- a/btrd-bump-nix.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff -Naur a/Cargo.lock b/Cargo.lock ---- a/Cargo.lock 1969-12-31 16:00:01.000000000 -0800 -+++ b/Cargo.lock 2021-10-26 13:31:36.126273907 -0700 -@@ -36,9 +36,9 @@ - - [[package]] - name = "bitflags" --version = "1.3.1" -+version = "1.2.1" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "2da1976d75adbe5fbc88130ecd119529cf1cc6a93ae1546d8696ee66f0d21af1" -+checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - - [[package]] - name = "btrd" -@@ -48,7 +48,7 @@ - "lazy_static", - "log", - "memmap2", -- "nix 0.21.0", -+ "nix 0.22.2", - "pom", - "rustyline", - "rustyline-derive", -@@ -251,9 +251,9 @@ - - [[package]] - name = "nix" --version = "0.21.0" -+version = "0.22.2" - source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "5c3728fec49d363a50a8828a190b379a446cc5cf085c06259bbbeb34447e4ec7" -+checksum = "d3bb9a13fa32bc5aeb64150cd3f32d6cf4c748f8f8a417cce5d2eb976a8370ba" - dependencies = [ - "bitflags", - "cc", -diff -Naur a/Cargo.toml b/Cargo.toml ---- a/Cargo.toml 1969-12-31 16:00:01.000000000 -0800 -+++ b/Cargo.toml 2021-10-26 13:31:57.715388958 -0700 -@@ -31,7 +31,7 @@ - version = "0.3" - - [dependencies.nix] --version = "0.21" -+version = "0.22" - - [dependencies.pom] - version = "3.2" -diff -Naur a/src/btrfs/fs.rs b/src/btrfs/fs.rs ---- a/src/btrfs/fs.rs 1973-11-29 13:33:09.000000000 -0800 -+++ b/src/btrfs/fs.rs 2021-10-26 13:31:36.127273913 -0700 -@@ -15,7 +15,6 @@ - use nix::fcntl::OFlag; - use nix::ioctl_readwrite; - use nix::sys::{stat::Mode, statfs::fstatfs}; --use nix::Error as NixError; - - const BTRFS_SUPERBLOCK_MAGIC: [u8; 8] = *b"_BHRfS_M"; - const BTRFS_SUPERBLOCK_MAGIC_LOCS: [usize; 3] = -@@ -202,7 +201,7 @@ - - match unsafe { btrfs_tree_search_v2(fs.as_raw_fd(), &mut *args) } { - Ok(_) => (), -- Err(NixError::Sys(Errno::EOVERFLOW)) => (), -+ Err(Errno::EOVERFLOW) => (), - Err(e) => bail!(e), - }; - diff --git a/btrd-fix-metadata.diff b/btrd-fix-metadata.diff deleted file mode 100644 index 269f5d3..0000000 --- a/btrd-fix-metadata.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- btrd-0.5.0/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ btrd-0.5.0/Cargo.toml 2022-02-20T16:38:57.037162+00:00 -@@ -43,7 +43,7 @@ - version = "0.4" - - [dependencies.simplelog] --version = "0.10" -+version = "0.11" - - [dependencies.structopt] - version = "0.3" diff --git a/rust-btrd.spec b/rust-btrd.spec index 1db8b57..f44b83d 100644 --- a/rust-btrd.spec +++ b/rust-btrd.spec @@ -1,10 +1,17 @@ -# Generated by rust2rpm 20 +# 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.0 +Version: 0.5.2 Release: %autorelease Summary: Btrfs debugger @@ -12,15 +19,17 @@ Summary: Btrfs debugger License: GPLv2 URL: https://crates.io/crates/btrd Source: %{crates_source} -# Initial patched metadata -# * Update simplelog to 0.11, https://github.com/danobi/btrd/pull/15 -Patch0: btrd-fix-metadata.diff -# Backport of PR#13: Bump nix to 0.22 -Patch1: btrd-bump-nix.patch +# vendored dependencies for EPEL +# update with ./update-vendor-tarball.sh after bumping the specfile version +Source1: %{crate}-%{version}-vendor.tar.gz ExclusiveArch: %{rust_arches} -BuildRequires: rust-packaging +%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 @@ -39,6 +48,7 @@ Summary: %{summary} %doc scripts README.md %{_bindir}/btrd +%if 0%{?fedora} %package devel Summary: %{summary} BuildArch: noarch @@ -49,9 +59,10 @@ This package contains library source intended for building other packages which use the "%{crate}" crate. %files devel -%license LICENSE -%doc docs README.md -%{cargo_registry}/%{crate}-%{version_no_tilde}/ +%license %{crate_instdir}/LICENSE +%doc %{crate_instdir}/README.md +%doc %{crate_instdir}/docs +%{crate_instdir}/ %package -n %{name}+default-devel Summary: %{summary} @@ -63,14 +74,19 @@ 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 %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%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 diff --git a/sources b/sources index 893b0c1..9a29fbe 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -SHA512 (btrd-0.5.0.crate) = 50b7c6b3e1929ca5d01ef28dc738ba6272e3ee457740f92b1214a3c9edfee3e48f0a7013197a5318b9cd7d90b19800275d50bea892f90327325653c6131ecb32 +SHA512 (btrd-0.5.2.crate) = 81438a48c596a2c06b5aecf0c3993b369d64f346274a4a400c23b70c74dea1fd7c69ee562cfbe58095d943fd6ef0be9b8f8a4f234d95ef4d120f9e79debdada5 +SHA512 (btrd-0.5.2-vendor.tar.gz) = 00e690d1059b2f381d08a0a00a36c8f3311840b0e96cf7b9e9c12628be68c6e1e9cff5d4a240d6e88ba3967bc9a0f4f2a2d98927cdb63d52011fc2b96ae1a9b7 diff --git a/update-vendor-tarball.sh b/update-vendor-tarball.sh new file mode 100755 index 0000000..16cd73d --- /dev/null +++ b/update-vendor-tarball.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +name='btrd' +specfile="rust-${name}.spec" +version=$(rpm -q --qf '%{VERSION}\n' --specfile "$specfile" | head -1) +nv="${name}-${version}" +crate="${nv}.crate" +vendor_tarball="${nv}-vendor.tar.gz" + +if [ -f "$vendor_tarball" ]; then + echo "${vendor_tarball} already exists, aborting" + exit 1 +fi + +[ -f "$crate" ] || spectool -g "$specfile" +tardir="$PWD" +workdir=$(mktemp -d) +trap 'rm -rf "$workdir"' EXIT + +tar xvzf "$tardir/$crate" -C "$workdir" +(cd "${workdir}/${nv}" && \ + cargo vendor && \ + tar cvzf "${tardir}/${vendor_tarball}" vendor/) + +exit 0