From 7a8ae42b3bfb590bd8f1f277d33a71dba288393b Mon Sep 17 00:00:00 2001 From: K900 Date: Wed, 28 Jun 2023 22:48:02 +0300 Subject: [PATCH 1/2] libblockdev: 2.28 -> 3.0 --- .../libraries/libblockdev/default.nix | 19 +++----- .../libraries/libblockdev/fix-paths.patch | 47 ------------------- 2 files changed, 6 insertions(+), 60 deletions(-) delete mode 100644 pkgs/development/libraries/libblockdev/fix-paths.patch diff --git a/pkgs/development/libraries/libblockdev/default.nix b/pkgs/development/libraries/libblockdev/default.nix index c64fd87e6c28..e14632af1a68 100644 --- a/pkgs/development/libraries/libblockdev/default.nix +++ b/pkgs/development/libraries/libblockdev/default.nix @@ -1,29 +1,22 @@ -{ lib, stdenv, fetchFromGitHub, substituteAll, autoreconfHook, pkg-config, gtk-doc +{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, gtk-doc , docbook_xml_dtd_43, python3, gobject-introspection, glib, udev, kmod, parted , cryptsetup, lvm2, dmraid, util-linux, libbytesize, libndctl, nss, volume_key , libxslt, docbook_xsl, gptfdisk, libyaml, autoconf-archive -, thin-provisioning-tools, makeWrapper +, thin-provisioning-tools, makeWrapper, e2fsprogs, libnvme, keyutils }: stdenv.mkDerivation rec { pname = "libblockdev"; - version = "2.28"; + version = "3.0"; src = fetchFromGitHub { owner = "storaged-project"; repo = "libblockdev"; rev = "${version}-1"; - sha256 = "sha256-6MrM3psLqMcpf4haaEHg3FwrhUDz5h/DeY1w96T0UlE="; + sha256 = "sha256-pdS3rMqAgNdYSyXN2ItvOmDO9MEEiHTgPWFVc24N6VE="; }; outputs = [ "out" "dev" "devdoc" ]; - patches = [ - (substituteAll { - src = ./fix-paths.patch; - sgdisk = "${gptfdisk}/bin/sgdisk"; - }) - ]; - postPatch = '' patchShebangs scripts ''; @@ -34,8 +27,8 @@ stdenv.mkDerivation rec { ]; buildInputs = [ - glib udev kmod parted gptfdisk cryptsetup lvm2 dmraid util-linux libbytesize - libndctl nss volume_key libyaml + e2fsprogs glib udev keyutils kmod parted gptfdisk cryptsetup lvm2 util-linux libbytesize + libndctl libnvme nss volume_key libyaml ]; postInstall = '' diff --git a/pkgs/development/libraries/libblockdev/fix-paths.patch b/pkgs/development/libraries/libblockdev/fix-paths.patch deleted file mode 100644 index 85822165d8c5..000000000000 --- a/pkgs/development/libraries/libblockdev/fix-paths.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/src/plugins/part.c -+++ b/src/plugins/part.c -@@ -146,7 +146,7 @@ static GMutex deps_check_lock; - #define DEPS_LAST 2 - - static const UtilDep deps[DEPS_LAST] = { -- {"sgdisk", "0.8.6", NULL, "GPT fdisk \\(sgdisk\\) version ([\\d\\.]+)"}, -+ {"@sgdisk@", "0.8.6", NULL, "GPT fdisk \\(sgdisk\\) version ([\\d\\.]+)"}, - {"sfdisk", NULL, NULL, NULL}, - }; - -@@ -355,7 +355,7 @@ gboolean bd_part_create_table (const gchar *disk, BDPartTableType type, gboolean - } - - static gchar* get_part_type_guid_and_gpt_flags (const gchar *device, int part_num, guint64 *flags, GError **error) { -- const gchar *args[4] = {"sgdisk", NULL, device, NULL}; -+ const gchar *args[4] = {"@sgdisk@", NULL, device, NULL}; - gchar *output = NULL; - gchar **lines = NULL; - gchar **line_p = NULL; -@@ -1325,7 +1325,7 @@ gboolean bd_part_resize_part (const gchar *disk, const gchar *part, guint64 size - - - static gboolean set_gpt_flag (const gchar *device, int part_num, BDPartFlag flag, gboolean state, GError **error) { -- const gchar *args[5] = {"sgdisk", "--attributes", NULL, device, NULL}; -+ const gchar *args[5] = {"@sgdisk@", "--attributes", NULL, device, NULL}; - int bit_num = 0; - gboolean success = FALSE; - -@@ -1351,7 +1351,7 @@ static gboolean set_gpt_flag (const gchar *device, int part_num, BDPartFlag flag - } - - static gboolean set_gpt_flags (const gchar *device, int part_num, guint64 flags, GError **error) { -- const gchar *args[5] = {"sgdisk", "--attributes", NULL, device, NULL}; -+ const gchar *args[5] = {"@sgdisk@", "--attributes", NULL, device, NULL}; - guint64 real_flags = 0; - gchar *mask_str = NULL; - gboolean success = FALSE; -@@ -1791,7 +1791,7 @@ gboolean bd_part_set_part_name (const gchar *disk, const gchar *part, const gcha - * Tech category: %BD_PART_TECH_GPT-%BD_PART_TECH_MODE_MODIFY_PART - */ - gboolean bd_part_set_part_type (const gchar *disk, const gchar *part, const gchar *type_guid, GError **error) { -- const gchar *args[5] = {"sgdisk", "--typecode", NULL, disk, NULL}; -+ const gchar *args[5] = {"@sgdisk@", "--typecode", NULL, disk, NULL}; - const gchar *part_num_str = NULL; - gboolean success = FALSE; - guint64 progress_id = 0; From 708b8c91226490544e0cf0a0b8ed22a24b5a3263 Mon Sep 17 00:00:00 2001 From: K900 Date: Wed, 28 Jun 2023 22:48:13 +0300 Subject: [PATCH 2/2] udisks2: 2.9.4 -> 2.10.0 Also remove some patch substitutions from tests we don't run. --- pkgs/os-specific/linux/udisks/2-default.nix | 12 +- pkgs/os-specific/linux/udisks/fix-paths.patch | 107 ++---------------- 2 files changed, 12 insertions(+), 107 deletions(-) diff --git a/pkgs/os-specific/linux/udisks/2-default.nix b/pkgs/os-specific/linux/udisks/2-default.nix index 9b56695e212b..36f0963935bb 100644 --- a/pkgs/os-specific/linux/udisks/2-default.nix +++ b/pkgs/os-specific/linux/udisks/2-default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, substituteAll, fetchpatch, pkg-config, gnused, autoreconfHook +{ lib, stdenv, fetchFromGitHub, substituteAll, pkg-config, gnused, autoreconfHook , gtk-doc, acl, systemd, glib, libatasmart, polkit, coreutils, bash, which , expat, libxslt, docbook_xsl, util-linux, mdadm, libgudev, libblockdev, parted , gobject-introspection, docbook_xml_dtd_412, docbook_xml_dtd_43 @@ -8,13 +8,13 @@ stdenv.mkDerivation rec { pname = "udisks"; - version = "2.9.4"; + version = "2.10.0"; src = fetchFromGitHub { owner = "storaged-project"; repo = "udisks"; rev = "${pname}-${version}"; - sha256 = "sha256-MYQztzIyp5kh9t1bCIlj08/gaOmZfuu/ZOwo3F+rZiw="; + sha256 = "sha256-M0L2MjVKv7VmtML/JZx0I8vNj+m6KDWGezvcwFqoTNI="; }; outputs = [ "out" "man" "dev" ] ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "devdoc"; @@ -23,7 +23,6 @@ stdenv.mkDerivation rec { (substituteAll { src = ./fix-paths.patch; bash = "${bash}/bin/bash"; - blkid = "${util-linux}/bin/blkid"; false = "${coreutils}/bin/false"; mdadm = "${mdadm}/bin/mdadm"; mkswap = "${util-linux}/bin/mkswap"; @@ -40,11 +39,6 @@ stdenv.mkDerivation rec { xfsprogs ntfs3g parted util-linux ]; }) - # Fix crash on exit, remove on upgrade to 2.10. - (fetchpatch { - url = "https://github.com/storaged-project/udisks/commit/6464e3083c27b9e4d97848b9e69e862f265511d5.patch"; - hash = "sha256-XGprXjJLIL8l4P5MRTHV8GOQR1hpaaFiLgexGnO9Lvg="; - }) ]; strictDeps = true; diff --git a/pkgs/os-specific/linux/udisks/fix-paths.patch b/pkgs/os-specific/linux/udisks/fix-paths.patch index 30bc08da8cfa..76d44b96d551 100644 --- a/pkgs/os-specific/linux/udisks/fix-paths.patch +++ b/pkgs/os-specific/linux/udisks/fix-paths.patch @@ -8,101 +8,12 @@ index ca802cce..bfd1c29e 100644 # -SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="raid", ENV{ID_FS_TYPE}=="linux_raid_member", ENV{UDISKS_MD_MEMBER_LEVEL}=="", IMPORT{program}="/bin/sh -c '/sbin/mdadm --examine --export $tempnode | /bin/sed s/^MD_/UDISKS_MD_MEMBER_/g'" +SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="raid", ENV{ID_FS_TYPE}=="linux_raid_member", ENV{UDISKS_MD_MEMBER_LEVEL}=="", IMPORT{program}="@sh@ -c '@mdadm@ --examine --export $tempnode | @sed@ s/^MD_/UDISKS_MD_MEMBER_/g'" - + -SUBSYSTEM=="block", KERNEL=="md*", ENV{DEVTYPE}!="partition", IMPORT{program}="/bin/sh -c '/sbin/mdadm --detail --export $tempnode | /bin/sed s/^MD_/UDISKS_MD_/g'" +SUBSYSTEM=="block", KERNEL=="md*", ENV{DEVTYPE}!="partition", IMPORT{program}="@sh@ -c '@mdadm@ --detail --export $tempnode | @sed@ s/^MD_/UDISKS_MD_/g'" - + LABEL="udisks_probe_end" - -diff --git a/modules/zram/data/udisks2-zram-setup@.service.in b/modules/zram/data/udisks2-zram-setup@.service.in -index ac868e84..03fdd887 100644 ---- a/modules/zram/data/udisks2-zram-setup@.service.in -+++ b/modules/zram/data/udisks2-zram-setup@.service.in -@@ -8,7 +8,7 @@ Requires=dev-%i.device - Type=oneshot - RemainAfterExit=no - EnvironmentFile=-@zramconfdir@/%i --ExecStart=-/bin/sh -c 'if [ -n "$ZRAM_NUM_STR" ]; then echo "$ZRAM_NUM_STR" > /sys/class/block/%i/max_comp_streams; fi' --ExecStart=-/bin/sh -c 'if [ -n "$ZRAM_DEV_SIZE" ]; then echo "$ZRAM_DEV_SIZE" > /sys/class/block/%i/disksize; fi' --ExecStart=-/bin/sh -c 'if [ "$SWAP" = "y" ]; then mkswap /dev/%i && swapon /dev/%i; fi' --# ExecStop=-/bin/sh -c 'echo 1 > /sys/class/block/%i/reset' -+ExecStart=-@sh@ -c 'if [ -n "$ZRAM_NUM_STR" ]; then echo "$ZRAM_NUM_STR" > /sys/class/block/%i/max_comp_streams; fi' -+ExecStart=-@sh@ -c 'if [ -n "$ZRAM_DEV_SIZE" ]; then echo "$ZRAM_DEV_SIZE" > /sys/class/block/%i/disksize; fi' -+ExecStart=-@sh@ -c 'if [ "$SWAP" = "y" ]; then @mkswap@ /dev/%i && @swapon@ /dev/%i; fi' -+# ExecStop=-@sh@ -c 'echo 1 > /sys/class/block/%i/reset' -diff --git a/modules/zram/udiskslinuxmanagerzram.c b/modules/zram/udiskslinuxmanagerzram.c -index f647f653..df81e910 100644 ---- a/modules/zram/udiskslinuxmanagerzram.c -+++ b/modules/zram/udiskslinuxmanagerzram.c -@@ -243,7 +243,7 @@ create_conf_files (guint64 num_devices, - - g_snprintf (tmp, 255, "zram%" G_GUINT64_FORMAT, i); - filename = g_build_filename (PACKAGE_ZRAMCONF_DIR, tmp, NULL); -- contents = g_strdup_printf ("#!/bin/bash\n" -+ contents = g_strdup_printf ("#!@bash@\n" - "# UDisks2 managed ZRAM configuration\n\n" - "ZRAM_NUM_STR=%" G_GUINT64_FORMAT "\n" - "ZRAM_DEV_SIZE=%" G_GUINT64_FORMAT "\n" -diff --git a/src/tests/install-udisks/runtest.sh b/src/tests/install-udisks/runtest.sh -index e7df4ed2..ab4356d9 100644 ---- a/src/tests/install-udisks/runtest.sh -+++ b/src/tests/install-udisks/runtest.sh -@@ -1,4 +1,4 @@ --#!/bin/bash -+#!@bash@ - # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - # -diff --git a/src/tests/integration-test b/src/tests/integration-test -index 07e4e029..3bd8ec51 100755 ---- a/src/tests/integration-test -+++ b/src/tests/integration-test -@@ -299,7 +299,7 @@ class UDisksTestCase(unittest.TestCase): - if not device: - device = cls.devname(partition) - result = {} -- cmd = subprocess.Popen(['blkid', '-p', '-o', 'udev', device], stdout=subprocess.PIPE) -+ cmd = subprocess.Popen(['@blkid@', '-p', '-o', 'udev', device], stdout=subprocess.PIPE) - for l in cmd.stdout: - (key, value) = l.decode('UTF-8').split('=', 1) - result[key] = value.strip() -@@ -437,7 +437,7 @@ class UDisksTestCase(unittest.TestCase): - f.write('KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ' - 'ATTRS{model}=="scsi_debug*", ' - 'ENV{ID_CDROM_MEDIA}=="?*", ' -- 'IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode"\n') -+ 'IMPORT{program}="@blkid@ -o udev -p -u noraid $tempnode"\n') - # reload udev - subprocess.call('sync; pkill --signal HUP udevd || ' - 'pkill --signal HUP systemd-udevd', -@@ -1142,7 +1142,7 @@ class FS(UDisksTestCase): - self.assertFalse(os.access(f, os.X_OK)) - - f = os.path.join(mount_point, 'simple.exe') -- shutil.copy('/bin/bash', f) -+ shutil.copy('@bash@', f) - self.assertTrue(os.access(f, os.R_OK)) - self.assertTrue(os.access(f, os.W_OK)) - self.assertTrue(os.access(f, os.X_OK)) -@@ -1155,7 +1155,7 @@ class FS(UDisksTestCase): - self.assertFalse(os.access(f, os.X_OK)) - - f = os.path.join(mount_point, 'subdir', 'subdir.exe') -- shutil.copy('/bin/bash', f) -+ shutil.copy('@bash@', f) - self.assertTrue(os.access(f, os.R_OK)) - self.assertTrue(os.access(f, os.W_OK)) - self.assertTrue(os.access(f, os.X_OK)) -diff --git a/src/tests/storadectl/runtest.sh b/src/tests/storadectl/runtest.sh -index f03885f9..baca6a93 100644 ---- a/src/tests/storadectl/runtest.sh -+++ b/src/tests/storadectl/runtest.sh -@@ -1,4 +1,4 @@ --#!/bin/bash -+#!@bash@ - # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - # + diff --git a/src/tests/test.c b/src/tests/test.c index 3ddbdf2c..a87f960a 100644 --- a/src/tests/test.c @@ -110,7 +21,7 @@ index 3ddbdf2c..a87f960a 100644 @@ -71,7 +71,7 @@ test_spawned_job_successful (void) { UDisksSpawnedJob *job; - + - job = udisks_spawned_job_new ("/bin/true", NULL, getuid (), geteuid (), NULL, NULL); + job = udisks_spawned_job_new ("@true@", NULL, getuid (), geteuid (), NULL, NULL); udisks_spawned_job_start (job); @@ -119,7 +30,7 @@ index 3ddbdf2c..a87f960a 100644 @@ -84,10 +84,10 @@ test_spawned_job_failure (void) { UDisksSpawnedJob *job; - + - job = udisks_spawned_job_new ("/bin/false", NULL, getuid (), geteuid (), NULL, NULL); + job = udisks_spawned_job_new ("@false@", NULL, getuid (), geteuid (), NULL, NULL); udisks_spawned_job_start (job); @@ -128,9 +39,9 @@ index 3ddbdf2c..a87f960a 100644 + (gpointer) "Command-line `@false@' exited with non-zero exit status 1: "); g_object_unref (job); } - + @@ -119,7 +119,7 @@ test_spawned_job_cancelled_at_start (void) - + cancellable = g_cancellable_new (); g_cancellable_cancel (cancellable); - job = udisks_spawned_job_new ("/bin/true", NULL, getuid (), geteuid (), NULL, cancellable); @@ -140,7 +51,7 @@ index 3ddbdf2c..a87f960a 100644 (gpointer) "Operation was cancelled (g-io-error-quark, 19)"); @@ -144,7 +144,7 @@ test_spawned_job_cancelled_midway (void) GCancellable *cancellable; - + cancellable = g_cancellable_new (); - job = udisks_spawned_job_new ("/bin/sleep 0.5", NULL, getuid (), geteuid (), NULL, cancellable); + job = udisks_spawned_job_new ("@sleep@ 0.5", NULL, getuid (), geteuid (), NULL, cancellable); @@ -150,7 +61,7 @@ index 3ddbdf2c..a87f960a 100644 @@ -197,7 +197,7 @@ test_spawned_job_premature_termination (void) { UDisksSpawnedJob *job; - + - job = udisks_spawned_job_new ("/bin/sleep 1000", NULL, getuid (), geteuid (), NULL, NULL /* GCancellable */); + job = udisks_spawned_job_new ("@sleep@ 1000", NULL, getuid (), geteuid (), NULL, NULL /* GCancellable */); udisks_spawned_job_start (job);