From 1aa71e0d578c68400fe58b98256e9e7d64cda256 Mon Sep 17 00:00:00 2001 From: triallax Date: Wed, 3 May 2023 01:38:56 +0300 Subject: [PATCH] thin-provisioning-tools: update to 1.0.4. --- .../patches/fix-musl.diff | 36 +++++++++++++++++++ srcpkgs/thin-provisioning-tools/template | 22 +++++++----- 2 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 srcpkgs/thin-provisioning-tools/patches/fix-musl.diff diff --git a/srcpkgs/thin-provisioning-tools/patches/fix-musl.diff b/srcpkgs/thin-provisioning-tools/patches/fix-musl.diff new file mode 100644 index 000000000000..5f0d03174139 --- /dev/null +++ b/srcpkgs/thin-provisioning-tools/patches/fix-musl.diff @@ -0,0 +1,36 @@ +diff --git a/src/file_utils.rs b/src/file_utils.rs +index 0ca3c0f..279a202 100644 +--- a/src/file_utils.rs ++++ b/src/file_utils.rs +@@ -56,7 +56,12 @@ fn get_device_size>(path: P) -> io::Result { + let fd = file.as_raw_fd(); + let mut cap = 0u64; + unsafe { +- if libc::ioctl(fd, BLKGETSIZE64 as libc::c_ulong, &mut cap) == 0 { ++ #[cfg(target_env = "musl")] ++ type RequestType = libc::c_int; ++ #[cfg(not(target_env = "musl"))] ++ type RequestType = libc::c_ulong; ++ ++ if libc::ioctl(fd, BLKGETSIZE64 as RequestType, &mut cap) == 0 { + Ok(cap) + } else { + Err(io::Error::last_os_error()) +diff --git a/src/thin/trim.rs b/src/thin/trim.rs +index 3d938ca..80f3d6f 100644 +--- a/src/thin/trim.rs ++++ b/src/thin/trim.rs +@@ -135,7 +135,12 @@ impl<'a> Iterator for RangeIterator<'a> { + const BLKDISCARD: u32 = 0x1277; + fn ioctl_blkdiscard(fd: i32, range: &[u64; 2]) -> std::io::Result<()> { + unsafe { +- if libc::ioctl(fd, BLKDISCARD as libc::c_ulong, range) == 0 { ++ #[cfg(target_env = "musl")] ++ type RequestType = libc::c_int; ++ #[cfg(not(target_env = "musl"))] ++ type RequestType = libc::c_ulong; ++ ++ if libc::ioctl(fd, BLKDISCARD as RequestType, range) == 0 { + Ok(()) + } else { + Err(std::io::Error::last_os_error()) diff --git a/srcpkgs/thin-provisioning-tools/template b/srcpkgs/thin-provisioning-tools/template index d74be6fe5d72..1eb520953b0a 100644 --- a/srcpkgs/thin-provisioning-tools/template +++ b/srcpkgs/thin-provisioning-tools/template @@ -1,21 +1,25 @@ # Template file for 'thin-provisioning-tools' pkgname=thin-provisioning-tools -version=0.9.0 +version=1.0.4 revision=1 -build_style=gnu-configure -hostmakedepends="automake autoconf libtool pkg-config" -makedepends="boost-devel expat-devel libaio-devel" +build_style=cargo +hostmakedepends="pkg-config" +# Note: links statically to libzstd +makedepends="libzstd-devel" short_desc="Tools for manipulating the metadata of dm-thin device-mapper targets" maintainer="Orphaned " license="GPL-3.0-or-later" homepage="https://github.com/jthornber/thin-provisioning-tools" +changelog="https://raw.githubusercontent.com/jthornber/thin-provisioning-tools/main/CHANGES" distfiles="${homepage}/archive/v${version}.tar.gz" -checksum=a2508d9933ed8a3f6c8d302280d838d416668a1d914a83c4bd0fb01eaf0676e8 +checksum=a973786fb9cb49d30be6fb8178d6739bc23609d4114ab601f0983ecdbf349abf +# Does a ton of disk IO. +make_check=extended -pre_configure() { - autoreconf -fi +post_patch() { + vsed -e "s:target/release/pdata_tools:target/${RUST_TARGET}/release/pdata_tools:" -i Makefile } -do_install() { - make DESTDIR=${DESTDIR} BINDIR=${DESTDIR}/usr/bin MANDIR=/usr/share/man install +post_install() { + make DESTDIR=${DESTDIR} BINDIR=${DESTDIR}/usr/bin install }