From 7f1c4e4a927283fb5940a62a3f4692fc53590109 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Wed, 27 Oct 2021 08:41:11 -0700 Subject: [PATCH] Initial import; Fixes: RHBZ#1980426 --- .gitignore | 1 + btrd-bump-nix.patch | 68 ++++++++++++++++++++++++++++++++++ rust-btrd.spec | 89 +++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 4 files changed, 159 insertions(+) create mode 100644 .gitignore create mode 100644 btrd-bump-nix.patch create mode 100644 rust-btrd.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6c07bcc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/btrd-0.5.0.crate diff --git a/btrd-bump-nix.patch b/btrd-bump-nix.patch new file mode 100644 index 0000000..47c0e47 --- /dev/null +++ b/btrd-bump-nix.patch @@ -0,0 +1,68 @@ +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/rust-btrd.spec b/rust-btrd.spec new file mode 100644 index 0000000..66bf681 --- /dev/null +++ b/rust-btrd.spec @@ -0,0 +1,89 @@ +# Generated by rust2rpm 18 +%bcond_without check + +%global crate btrd + +Name: rust-%{crate} +Version: 0.5.0 +Release: %autorelease +Summary: Btrfs debugger + +# Upstream license specification: GPL-2.0 +License: GPLv2 +URL: https://crates.io/crates/btrd +Source: %{crates_source} +# Backport of PR#13: Bump nix to 0.22 +Patch0: btrd-bump-nix.patch + +ExclusiveArch: %{rust_arches} +%if %{__cargo_skip_build} +BuildArch: noarch +%endif + +BuildRequires: rust-packaging + +%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} + +%if ! %{__cargo_skip_build} +%package -n %{crate} +Summary: %{summary} + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LICENSE +%doc scripts README.md +%{_bindir}/btrd +%endif + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages +which use "%{crate}" crate. + +%files devel +%license LICENSE +%doc docs README.md +%{cargo_registry}/%{crate}-%{version_no_tilde}/ + +%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 "default" feature of "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{version_no_tilde} -p1 +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..893b0c1 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (btrd-0.5.0.crate) = 50b7c6b3e1929ca5d01ef28dc738ba6272e3ee457740f92b1214a3c9edfee3e48f0a7013197a5318b9cd7d90b19800275d50bea892f90327325653c6131ecb32