mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-07 15:43:49 +02:00
thin-provisioning-tools: update to 1.0.4.
Closes: #43722 [via git-merge-pr]
This commit is contained in:
parent
297e3f03e7
commit
672d52565a
2 changed files with 103 additions and 9 deletions
90
srcpkgs/thin-provisioning-tools/patches/fix-musl.patch
Normal file
90
srcpkgs/thin-provisioning-tools/patches/fix-musl.patch
Normal file
|
@ -0,0 +1,90 @@
|
|||
From fbce51f27fa164ebad7994b177908e5a200b95c9 Mon Sep 17 00:00:00 2001
|
||||
From: triallax <triallax@tutanota.com>
|
||||
Date: Thu, 4 May 2023 20:42:39 +0300
|
||||
Subject: [PATCH] [build] fix build on musl
|
||||
|
||||
Before this commit, compilation would fail with this error:
|
||||
|
||||
```
|
||||
error[E0308]: mismatched types
|
||||
--> src/file_utils.rs:59:28
|
||||
|
|
||||
59 | if libc::ioctl(fd, BLKGETSIZE64 as libc::c_ulong, &mut cap) == 0 {
|
||||
| ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
note: function defined here
|
||||
--> /host/cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.142/src/unix/linux_like/linux/musl/mod.rs:739:12
|
||||
|
|
||||
739 | pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
|
||||
| ^^^^^
|
||||
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
|
||||
|
|
||||
59 | if libc::ioctl(fd, (BLKGETSIZE64 as libc::c_ulong).try_into().unwrap(), &mut cap) == 0 {
|
||||
| + +++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> src/thin/trim.rs:138:28
|
||||
|
|
||||
138 | if libc::ioctl(fd, BLKDISCARD as libc::c_ulong, range) == 0 {
|
||||
| ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
note: function defined here
|
||||
--> /host/cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.142/src/unix/linux_like/linux/musl/mod.rs:739:12
|
||||
|
|
||||
739 | pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
|
||||
| ^^^^^
|
||||
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
|
||||
|
|
||||
138 | if libc::ioctl(fd, (BLKDISCARD as libc::c_ulong).try_into().unwrap(), range) == 0 {
|
||||
| + +++++++++++++++++++++
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
```
|
||||
---
|
||||
src/file_utils.rs | 8 +++++++-
|
||||
src/thin/trim.rs | 7 ++++++-
|
||||
2 files changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/file_utils.rs b/src/file_utils.rs
|
||||
index 0ca3c0fc..81d4a8a7 100644
|
||||
--- a/src/file_utils.rs
|
||||
+++ b/src/file_utils.rs
|
||||
@@ -55,8 +55,14 @@ fn get_device_size<P: AsRef<Path>>(path: P) -> io::Result<u64> {
|
||||
let file = File::open(path.as_ref())?;
|
||||
let fd = file.as_raw_fd();
|
||||
let mut cap = 0u64;
|
||||
+
|
||||
+ #[cfg(target_env = "musl")]
|
||||
+ type RequestType = libc::c_int;
|
||||
+ #[cfg(not(target_env = "musl"))]
|
||||
+ type RequestType = libc::c_ulong;
|
||||
+
|
||||
unsafe {
|
||||
- if libc::ioctl(fd, BLKGETSIZE64 as libc::c_ulong, &mut cap) == 0 {
|
||||
+ 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 3d938caf..0d1fb590 100644
|
||||
--- a/src/thin/trim.rs
|
||||
+++ b/src/thin/trim.rs
|
||||
@@ -134,8 +134,13 @@ impl<'a> Iterator for RangeIterator<'a> {
|
||||
|
||||
const BLKDISCARD: u32 = 0x1277;
|
||||
fn ioctl_blkdiscard(fd: i32, range: &[u64; 2]) -> std::io::Result<()> {
|
||||
+ #[cfg(target_env = "musl")]
|
||||
+ type RequestType = libc::c_int;
|
||||
+ #[cfg(not(target_env = "musl"))]
|
||||
+ type RequestType = libc::c_ulong;
|
||||
+
|
||||
unsafe {
|
||||
- if libc::ioctl(fd, BLKDISCARD as libc::c_ulong, range) == 0 {
|
||||
+ if libc::ioctl(fd, BLKDISCARD as RequestType, range) == 0 {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(std::io::Error::last_os_error())
|
|
@ -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: statically links to libzstd.
|
||||
makedepends="libzstd-devel"
|
||||
short_desc="Tools for manipulating the metadata of dm-thin device-mapper targets"
|
||||
maintainer="Orphaned <orphan@voidlinux.org>"
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue