diff --git a/.gitignore b/.gitignore index 1844bef..8293048 100644 --- a/.gitignore +++ b/.gitignore @@ -53,11 +53,3 @@ /dmpd1011-vendor.tar.gz /v1.0.12.tar.gz /dmpd1012-vendor.tar.gz -/v1.1.0.tar.gz -/dmpd110-vendor.tar.gz -/v1.2.1.tar.gz -/dmpd121-vendor.tar.gz -/v1.3.0.tar.gz -/dmpd130-vendor.tar.gz -/v1.3.1.tar.gz -/dmpd131-vendor.tar.gz diff --git a/0001-Tweak-cargo.toml-to-work-with-vendor-directory.patch b/0001-Tweak-cargo.toml-to-work-with-vendor-directory.patch new file mode 100644 index 0000000..0532ec2 --- /dev/null +++ b/0001-Tweak-cargo.toml-to-work-with-vendor-directory.patch @@ -0,0 +1,29 @@ +From 2a3a7ffa38a2e8ed7f9e89920deabd797ed961d5 Mon Sep 17 00:00:00 2001 +From: Marian Csontos +Date: Thu, 27 Jul 2023 11:37:01 +0200 +Subject: [PATCH] Tweak cargo.toml to work with vendor directory + +Mock works offline, cargo would try to download the files from github. +So cargo vendor has to be run first, and then change the Cargo.toml to +make mock happy. +--- + Cargo.toml | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Cargo.toml b/Cargo.toml +index b33b0a4b..2a87e432 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -33,7 +33,8 @@ quick-xml = "0.31" + rand = "0.8" + rangemap = "1.5" + roaring = "0.10" +-rio = { git = "https://github.com/jthornber/rio", branch = "master", optional = true } ++#rio = { git = "https://github.com/jthornber/rio", branch = "master", optional = true } ++rio = { version = "0.9.4", optional = true } + safemem = "0.3" + threadpool = "1.8" + thiserror = "1.0" +-- +2.43.0 + diff --git a/0002-tests-Explicitly-set-the-pipe-size-for-triggering-EP.patch b/0002-tests-Explicitly-set-the-pipe-size-for-triggering-EP.patch new file mode 100644 index 0000000..82159b8 --- /dev/null +++ b/0002-tests-Explicitly-set-the-pipe-size-for-triggering-EP.patch @@ -0,0 +1,25 @@ +From 9e55217135b7543f13a5801aafda0fe0a1fb363a Mon Sep 17 00:00:00 2001 +From: Ming-Hung Tsai +Date: Mon, 26 Feb 2024 21:11:27 +0800 +Subject: [PATCH] [tests] Explicitly set the pipe size for triggering EPIPE + +(cherry picked from commit 0b3c80efd7c627ce7d75397452f496b6329a90c0) +--- + tests/thin_dump.rs | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests/thin_dump.rs b/tests/thin_dump.rs +index 81982188..9eade06e 100644 +--- a/tests/thin_dump.rs ++++ b/tests/thin_dump.rs +@@ -154,6 +154,7 @@ fn test_no_stderr_on_broken_pipe(extra_args: &[&std::ffi::OsStr]) -> Result<()> + let mut pipefd = [0i32; 2]; + unsafe { + ensure!(libc::pipe2(pipefd.as_mut_slice().as_mut_ptr(), libc::O_CLOEXEC) == 0); ++ ensure!(libc::fcntl(pipefd[0], libc::F_SETPIPE_SZ, 65536) == 65536); + } + + let mut args = args![&md].to_vec(); +-- +2.43.0 + diff --git a/0003-tests-Fix-closing-the-pipe-fd-twice.patch b/0003-tests-Fix-closing-the-pipe-fd-twice.patch new file mode 100644 index 0000000..0681b5c --- /dev/null +++ b/0003-tests-Fix-closing-the-pipe-fd-twice.patch @@ -0,0 +1,40 @@ +From 54e7eaf002a2b07cd5571b5d3374eb760d727381 Mon Sep 17 00:00:00 2001 +From: Ming-Hung Tsai +Date: Tue, 27 Feb 2024 01:24:01 +0800 +Subject: [PATCH] [tests] Fix closing the pipe fd twice + +The duct::Expression::stdout_file() takes the ownership of the +passed-in file descriptor, thus the caller doesn't need to close +the fd afterward. Closing a fd twice in tests might inadvertently +closing the fd recently opened by other test threads, leading to +unexpected bugs. + +(cherry picked from commit 3b378b0e39a7ae111a81d394f8721bae89f9ca37) +--- + tests/thin_dump.rs | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/tests/thin_dump.rs b/tests/thin_dump.rs +index 9eade06e..caae31ef 100644 +--- a/tests/thin_dump.rs ++++ b/tests/thin_dump.rs +@@ -161,7 +161,7 @@ fn test_no_stderr_on_broken_pipe(extra_args: &[&std::ffi::OsStr]) -> Result<()> + args.extend_from_slice(extra_args); + let cmd = thin_dump_cmd(args) + .to_expr() +- .stdout_file(pipefd[1]) ++ .stdout_file(pipefd[1]) // this transfers ownership of the fd + .stderr_capture(); + let handle = cmd.unchecked().start()?; + +@@ -169,7 +169,6 @@ fn test_no_stderr_on_broken_pipe(extra_args: &[&std::ffi::OsStr]) -> Result<()> + std::thread::sleep(std::time::Duration::from_millis(1000)); + + unsafe { +- libc::close(pipefd[1]); // close the unused write-end + libc::close(pipefd[0]); // causing broken pipe + } + +-- +2.43.0 + diff --git a/README.md b/README.md index a81396d..4c77f74 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,24 @@ -# Packaging device-mapper-persitent-data (AKA dmpd) +# Packaging dmpd -This is rust package using *vendor* file for dependencies. (Vendor file is an archive of dependencies' sources.) +This is mostly regular package except recent addition of rust to used languages. -For most of simple fixes, there is nothing special, -to add a patches simply add them to dist-git, -add a corresponding `PatchN: 000N-...` lines, -increase `Release:` or `release_suffix` for Z-stream (or for test build use suffix like `.bzNNNNNN`), -add to `%changelog`, -commit, -push, -and build the package using `fedpkg build`. +## rust-tools -Alternatively before committing anything use `fedpkg srpm` and `fedpkg scratch-build --srpm $SRPM [--arches x86_64]` to create a scratch build. +To build the rust-tools (`make rust-tools`) one needs: -However when building a new version of dmpd or when updating a dependency is -needed (e.g. because of CVE in the dependency) vendor file -has to be regenerated. +- rust >= 1.35 +- cargo with vendor subcommand (now upstream, included in latest Fedora and RHEL8) -## Updating vendor file +### cargo vendpr -To build a new version of the package following tooling is needed: - -- `rust >= 1.35` -- `cargo` providing vendor subcommand (now upstream, included in latest Fedora and RHEL8+) - -To create the vendor file: - -In the upstream directory: - -1. Run `cargo vendor` in the directory with upstream sources to create *vendor* - directory with sources. - - TODO: There is a *cargo-vendor-filterer* project used by *stratisd* to - filter out unnecessary dependencies for other operating systems. -2. Run `tar czf device-mapper-persistent-data-vendor-$VERSION.tar.gz ./vendor` to create a tarball. -3. Copy the vendor file to dist git directory. - -In the dist-git directory: - -1. Get the upstream tarball `wget https://github.com/jthornber/thin-provisioning-tools/archive/v$VERSION.tar.gz` - - NOTE: Migration to `https://github.com/device-mapper-utils/thin-provisioning-tools` is coming. -2. Update *Source0* and *Source1* to correct values. -3. Add the tarballs to koji/brew lookaside: +- run `cargo vendor` in the disrectory with sources +- run `tar czf device-mapper-persistent-data-vendor-$VERSION.tar.gz ./vendor` +- copy the file (if version changed) and run the *fedpkg new-sources* command: - `fedpkg new-sources v$VERSION.tar.gz device-mapper-persistent-data-vendor-$VERSION.tar.gz` ## TODO/NOTES -Some of the dependencies are already packaged by Fedora. Can we instruct *cargo vendor* to include only those which are not provided by Fedora? -It would be possible to include these as submodules, and the rest could be used from Fedora. -For RHEL and CentOS Stream using vendor file is the recommended way. +Some of the dependencies may be already packaged by Fedora. Can we instruct *cargo vendor* to include only those which are not provided by Fedora? -*%cargo_install* installs by default in */usr/bin* but the package expects */usr/sbin*. For now I run *make install-rust-tools*. -Now Fedora unified the */usr/sbin* and */usr/bin* directories, to this can be "fixed" in Fedora and later in CentOS Stream. +*%cargo_install* installs by defualt in */usr/bin* but the package expects */usr/sbin*. For now I run *make install-rust-tools*. diff --git a/device-mapper-persistent-data.spec b/device-mapper-persistent-data.spec index 213bfff..fcac6bf 100644 --- a/device-mapper-persistent-data.spec +++ b/device-mapper-persistent-data.spec @@ -2,22 +2,25 @@ # Copyright (C) 2011-2017 Red Hat, Inc # %bcond_without check -#%%global debug_package %%{nil} +%global debug_package %{nil} #%%global version_suffix -rc2 #%%global release_suffix .test3 Summary: Device-mapper Persistent Data Tools Name: device-mapper-persistent-data -Version: 1.3.1 -Release: 1%{?dist}%{?release_suffix} +Version: 1.0.12 +Release: 3%{?dist}%{?release_suffix} License: GPL-3.0-only AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-3-Clause AND MIT AND (MIT OR Apache-2.0) AND (MIT OR Zlib OR Apache-2.0) AND (Unlicense OR MIT) AND (Zlib OR Apache-2.0 OR MIT) #ExcludeArch: %%{ix86} URL: https://github.com/jthornber/thin-provisioning-tools #Source0: https://github.com/jthornber/thin-provisioning-tools/archive/thin-provisioning-tools-%%{version}.tar.gz Source0: https://github.com/jthornber/thin-provisioning-tools/archive/v%{version}%{?version_suffix}.tar.gz -Source1: dmpd131-vendor.tar.gz +Source1: dmpd1012-vendor.tar.gz +Patch1: 0001-Tweak-cargo.toml-to-work-with-vendor-directory.patch +Patch2: 0002-tests-Explicitly-set-the-pipe-size-for-triggering-EP.patch +Patch3: 0003-tests-Fix-closing-the-pipe-fd-twice.patch %if %{defined rhel} BuildRequires: rust-toolset @@ -27,12 +30,6 @@ BuildRequires: rust >= 1.35 BuildRequires: cargo %endif BuildRequires: make -BuildRequires: systemd-devel -BuildRequires: clang-libs -BuildRequires: glibc-static -BuildRequires: device-mapper-devel -BuildRequires: clang -#BuildRequires: gcc %description thin-provisioning-tools contains check,dump,restore,repair,rmap @@ -45,18 +42,6 @@ snapshot eras %prep %autosetup -p1 -n thin-provisioning-tools-%{version}%{?version_suffix} -a1 %cargo_prep -v vendor - -# NOTE: Following could replace Cargo.toml patching, but some macros are not working well with it -# Notably at least one of cargo_license_summary, cargo_license_summary, or cargo_vendor_manifest -#cat >> .cargo/config.toml << EOF -# -#[source."git+https://github.com/jthornber/rio?branch=master"] -#git = "https://github.com/jthornber/rio" -#branch = "master" -#replace-with = "vendored-sources" -# -#EOF - echo %{version}-%{release} > VERSION %generate_buildrequires @@ -70,7 +55,7 @@ echo %{version}-%{release} > VERSION %install # TODO: Check that MANDIR is unused and remove -%make_install STRIP=true MANDIR=%{_mandir} BINDIR=%{buildroot}%{_sbindir} +%make_install MANDIR=%{_mandir} BINDIR=%{buildroot}%{_sbindir} %if %{with check} %check @@ -98,7 +83,6 @@ echo %{version}-%{release} > VERSION %{_mandir}/man8/thin_dump.8.gz %{_mandir}/man8/thin_ls.8.gz %{_mandir}/man8/thin_metadata_size.8.gz -%{_mandir}/man8/thin_migrate.8.gz %{_mandir}/man8/thin_repair.8.gz %{_mandir}/man8/thin_restore.8.gz %{_mandir}/man8/thin_rmap.8.gz @@ -121,7 +105,6 @@ echo %{version}-%{release} > VERSION %{_sbindir}/thin_dump %{_sbindir}/thin_ls %{_sbindir}/thin_metadata_size -%{_sbindir}/thin_migrate %{_sbindir}/thin_repair %{_sbindir}/thin_restore %{_sbindir}/thin_rmap @@ -131,27 +114,6 @@ echo %{version}-%{release} > VERSION #% {_sbindir}/thin_show_duplicates %changelog -* Tue Dec 02 2025 Marian Csontos - 1.3.1-1 -- Update to latest upstream release 1.3.1. - -* Wed Oct 22 2025 Marian Csontos - 1.3.0-1 -- Update to latest upstream release 1.3.0. - -* Thu Sep 04 2025 Marian Csontos - 1.2.1-1 -- Update to latest upstream release 1.2.1. - -* Wed Jul 23 2025 Fedora Release Engineering - 1.1.0-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Thu Jan 16 2025 Fedora Release Engineering - 1.1.0-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Sun Jan 12 2025 Zbigniew Jędrzejewski-Szmek - 1.1.0-2 -- Rebuilt for the bin-sbin merge (2nd attempt) - -* Mon Sep 02 2024 Marian Csontos - 1.1.0-1 -- Update to latest upstream release 1.1.0. - * Wed Jul 17 2024 Fedora Release Engineering - 1.0.12-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/sources b/sources index 4ddfdfb..05d1960 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (v1.3.1.tar.gz) = ff0758b21b50702568cad88522ee4c2b6b4433cec0a5f5074c9d1791c13e630e5c516601d7a68c51ac34e036091fc82fe831dbe51e6776737571d90ed266878e -SHA512 (dmpd131-vendor.tar.gz) = 0e1b8e501e330b64415c9097c94dfc1f1b43d2900a66258e40b6c8f28c51fd61247d60495f594f14550fb349ed4ad435f8959a8808fea1d363a206c5ead7db1e +SHA512 (v1.0.12.tar.gz) = 2e960e5a0d11016c1131ed48678a44c54164b43811f8efaa7172d9df7f433b185fa4b2f8d3d430affff19ced672f74a1f17614efd00287f2c310a6a3745ff8e5 +SHA512 (dmpd1012-vendor.tar.gz) = 02c0015545f05ac71c427f734a766e75a0f5a17a7edddae57abbb0d1277c0d91c6e26d59dd91aef2f2050aee6aef2e118478ca15183c36348e93185ebad3c1e0