udisks2: 2.1.6 → 2.7.6

supersedes #35551
closes #34999

/cc https://github.com/NixOS/nixpkgs/pull/38382

+178 -33
+47 -33
pkgs/os-specific/linux/udisks/2-default.nix
··· 1 - { stdenv, fetchurl, pkgconfig, intltool, gnused 2 - , expat, acl, systemd, glib, libatasmart, polkit 3 - , libxslt, docbook_xsl, utillinux, mdadm, libgudev 4 - , gobjectIntrospection 1 + { stdenv, fetchFromGitHub, substituteAll, libtool, pkgconfig, intltool, gnused 2 + , gnome3, gtk-doc, acl, systemd, glib, libatasmart, polkit, coreutils, bash 3 + , expat, libxslt, docbook_xsl, utillinux, mdadm, libgudev, libblockdev, parted 4 + , gobjectIntrospection, docbook_xml_dtd_412, docbook_xml_dtd_43 5 + , libxfs, f2fs-tools, dosfstools, e2fsprogs, btrfs-progs, exfat, nilfs-utils, udftools, ntfs3g 5 6 }: 6 7 7 - stdenv.mkDerivation rec { 8 - name = "udisks-2.1.8"; 8 + let 9 + version = "2.7.6"; 10 + in stdenv.mkDerivation rec { 11 + name = "udisks-${version}"; 9 12 10 - src = fetchurl { 11 - url = "http://udisks.freedesktop.org/releases/${name}.tar.bz2"; 12 - sha256 = "1nkxhnqh39c9pzvm4zfj50rgv6apqawdx09bv3sfaxrah4a6jhfs"; 13 + src = fetchFromGitHub { 14 + owner = "storaged-project"; 15 + repo = "udisks"; 16 + rev = name; 17 + sha256 = "16kf104vv2xbk8cdgaqygszcl69d7lz9gf3vmi7ggywn7nfbp2ks"; 13 18 }; 14 19 15 - outputs = [ "out" "man" "dev" ]; 20 + outputs = [ "out" "man" "dev" "devdoc" ]; 16 21 17 - patches = [ ./force-path.patch ]; 22 + patches = [ 23 + (substituteAll { 24 + src = ./fix-paths.patch; 25 + bash = "${bash}/bin/bash"; 26 + blkid = "${utillinux}/bin/blkid"; 27 + false = "${coreutils}/bin/false"; 28 + mdadm = "${mdadm}/bin/mdadm"; 29 + sed = "${gnused}/bin/sed"; 30 + sh = "${bash}/bin/sh"; 31 + sleep = "${coreutils}/bin/sleep"; 32 + true = "${coreutils}/bin/true"; 33 + }) 34 + (substituteAll { 35 + src = ./force-path.patch; 36 + path = stdenv.lib.makeBinPath [ btrfs-progs coreutils dosfstools e2fsprogs exfat f2fs-tools nilfs-utils libxfs ntfs3g parted utillinux ]; 37 + }) 38 + ]; 18 39 19 - # FIXME remove /var/run/current-system/sw/* references 20 - # FIXME add references to parted, cryptsetup, etc (see the sources) 21 - postPatch = 22 - '' 23 - substituteInPlace src/main.c --replace \ 24 - "@path@" \ 25 - "${utillinux}/bin:${mdadm}/bin:/run/current-system/sw/bin" 26 - substituteInPlace data/80-udisks2.rules \ 27 - --replace "/bin/sh" "${stdenv.shell}" \ 28 - --replace "/sbin/mdadm" "${mdadm}/bin/mdadm" \ 29 - --replace " sed " " ${gnused}/bin/sed " 30 - '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl '' 31 - substituteInPlace udisks/udisksclient.c \ 32 - --replace 'defined( __GNUC_PREREQ)' 1 \ 33 - --replace '__GNUC_PREREQ(4,6)' 1 34 - ''; 40 + nativeBuildInputs = [ 41 + pkgconfig gnome3.gnome-common libtool intltool gobjectIntrospection 42 + gtk-doc libxslt docbook_xml_dtd_412 docbook_xml_dtd_43 docbook_xsl 43 + ]; 35 44 36 - nativeBuildInputs = [ pkgconfig intltool gobjectIntrospection ]; 45 + buildInputs = [ 46 + expat libgudev libblockdev acl systemd glib libatasmart polkit 47 + ]; 37 48 38 - buildInputs = [ libxslt docbook_xsl libgudev expat acl systemd glib libatasmart polkit ]; 49 + preConfigure = "./autogen.sh"; 39 50 40 51 configureFlags = [ 52 + "--enable-gtk-doc" 41 53 "--localstatedir=/var" 42 54 "--with-systemdsystemunitdir=$(out)/etc/systemd/system" 43 55 "--with-udevdir=$(out)/lib/udev" ··· 50 62 51 63 doCheck = false; # fails 52 64 53 - meta = { 54 - homepage = http://www.freedesktop.org/wiki/Software/udisks; 55 - description = "A daemon and command-line utility for querying and manipulating storage devices"; 56 - platforms = stdenv.lib.platforms.linux; 65 + meta = with stdenv.lib; { 66 + description = "A daemon, tools and libraries to access and manipulate disks, storage devices and technologies"; 67 + homepage = https://www.freedesktop.org/wiki/Software/udisks/; 68 + license = licenses.gpl2Plus; # lgpl2Plus for the library, gpl2Plus for the tools & daemon 69 + maintainers = with maintainers; []; 70 + platforms = platforms.linux; 57 71 }; 58 72 }
+131
pkgs/os-specific/linux/udisks/fix-paths.patch
··· 1 + --- a/Makefile.am 2 + +++ b/Makefile.am 3 + @@ -1,6 +1,6 @@ 4 + ## Process this file with automake to produce Makefile.in 5 + 6 + -SHELL = /bin/bash 7 + +SHELL = @bash@ 8 + .SHELLFLAGS = -o pipefail -c 9 + 10 + PYTHON ?= python3 11 + --- a/data/80-udisks2.rules 12 + +++ b/data/80-udisks2.rules 13 + @@ -17,9 +17,9 @@ 14 + # 15 + # TODO: file bug against mdadm(8) to have --export-prefix option that can be used with e.g. UDISKS_MD_MEMBER 16 + # 17 + -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'" 18 + +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'" 19 + 20 + -SUBSYSTEM=="block", KERNEL=="md*", ENV{DEVTYPE}!="partition", IMPORT{program}="/bin/sh -c '/sbin/mdadm --detail --export $tempnode | /bin/sed s/^MD_/UDISKS_MD_/g'" 21 + +SUBSYSTEM=="block", KERNEL=="md*", ENV{DEVTYPE}!="partition", IMPORT{program}="@sh@ -c '@mdadm@ --detail --export $tempnode | @sed@ s/^MD_/UDISKS_MD_/g'" 22 + 23 + LABEL="udisks_probe_end" 24 + 25 + --- a/modules/zram/udiskslinuxmanagerzram.c 26 + +++ b/modules/zram/udiskslinuxmanagerzram.c 27 + @@ -250,7 +250,7 @@ 28 + 29 + g_snprintf (tmp, 255, "zram%" G_GUINT64_FORMAT, i); 30 + filename = g_build_filename (PACKAGE_ZRAMCONF_DIR, tmp, NULL); 31 + - contents = g_strdup_printf ("#!/bin/bash\n\n" 32 + + contents = g_strdup_printf ("#!@bash@\n\n" 33 + "ZRAM_NUM_STR=%" G_GUINT64_FORMAT "\n" 34 + "ZRAM_DEV_SIZE=%" G_GUINT64_FORMAT "\n" 35 + "SWAP=n\n", 36 + --- a/src/tests/install-udisks/runtest.sh 37 + +++ b/src/tests/install-udisks/runtest.sh 38 + @@ -1,4 +1,4 @@ 39 + -#!/bin/bash 40 + +#!@bash@ 41 + # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k 42 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 + # 44 + --- a/src/tests/integration-test 45 + +++ b/src/tests/integration-test 46 + @@ -414,7 +414,7 @@ 47 + f.write('KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ' 48 + 'ATTRS{model}=="scsi_debug*", ' 49 + 'ENV{ID_CDROM_MEDIA}=="?*", ' 50 + - 'IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode"\n') 51 + + 'IMPORT{program}="@blkid@ -o udev -p -u noraid $tempnode"\n') 52 + # reload udev 53 + subprocess.call('sync; pkill --signal HUP udevd || ' 54 + 'pkill --signal HUP systemd-udevd', 55 + @@ -1079,7 +1079,7 @@ 56 + self.assertFalse(os.access(f, os.X_OK)) 57 + 58 + f = os.path.join(mount_point, 'simple.exe') 59 + - shutil.copy('/bin/bash', f) 60 + + shutil.copy('@bash@', f) 61 + self.assertTrue(os.access(f, os.R_OK)) 62 + self.assertTrue(os.access(f, os.W_OK)) 63 + self.assertTrue(os.access(f, os.X_OK)) 64 + @@ -1092,7 +1092,7 @@ 65 + self.assertFalse(os.access(f, os.X_OK)) 66 + 67 + f = os.path.join(mount_point, 'subdir', 'subdir.exe') 68 + - shutil.copy('/bin/bash', f) 69 + + shutil.copy('@bash@', f) 70 + self.assertTrue(os.access(f, os.R_OK)) 71 + self.assertTrue(os.access(f, os.W_OK)) 72 + self.assertTrue(os.access(f, os.X_OK)) 73 + --- a/src/tests/storadectl/runtest.sh 74 + +++ b/src/tests/storadectl/runtest.sh 75 + @@ -1,4 +1,4 @@ 76 + -#!/bin/bash 77 + +#!@bash@ 78 + # vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k 79 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 + # 81 + --- a/src/tests/test.c 82 + +++ b/src/tests/test.c 83 + @@ -71,7 +71,7 @@ 84 + { 85 + UDisksSpawnedJob *job; 86 + 87 + - job = udisks_spawned_job_new ("/bin/true", NULL, getuid (), geteuid (), NULL, NULL); 88 + + job = udisks_spawned_job_new ("@true@", NULL, getuid (), geteuid (), NULL, NULL); 89 + udisks_spawned_job_start (job); 90 + _g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_success), NULL); 91 + g_object_unref (job); 92 + @@ -84,10 +84,10 @@ 93 + { 94 + UDisksSpawnedJob *job; 95 + 96 + - job = udisks_spawned_job_new ("/bin/false", NULL, getuid (), geteuid (), NULL, NULL); 97 + + job = udisks_spawned_job_new ("@false@", NULL, getuid (), geteuid (), NULL, NULL); 98 + udisks_spawned_job_start (job); 99 + _g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_failure), 100 + - (gpointer) "Command-line `/bin/false' exited with non-zero exit status 1: "); 101 + + (gpointer) "Command-line `@false@' exited with non-zero exit status 1: "); 102 + g_object_unref (job); 103 + } 104 + 105 + @@ -119,7 +119,7 @@ 106 + 107 + cancellable = g_cancellable_new (); 108 + g_cancellable_cancel (cancellable); 109 + - job = udisks_spawned_job_new ("/bin/true", NULL, getuid (), geteuid (), NULL, cancellable); 110 + + job = udisks_spawned_job_new ("@true@", NULL, getuid (), geteuid (), NULL, cancellable); 111 + udisks_spawned_job_start (job); 112 + _g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_failure), 113 + (gpointer) "Operation was cancelled (g-io-error-quark, 19)"); 114 + @@ -145,7 +145,7 @@ 115 + GCancellable *cancellable; 116 + 117 + cancellable = g_cancellable_new (); 118 + - job = udisks_spawned_job_new ("/bin/sleep 0.5", NULL, getuid (), geteuid (), NULL, cancellable); 119 + + job = udisks_spawned_job_new ("@sleep@ 0.5", NULL, getuid (), geteuid (), NULL, cancellable); 120 + udisks_spawned_job_start (job); 121 + g_timeout_add (10, on_timeout, cancellable); /* 10 msec */ 122 + g_main_loop_run (loop); 123 + @@ -199,7 +199,7 @@ 124 + { 125 + UDisksSpawnedJob *job; 126 + 127 + - job = udisks_spawned_job_new ("/bin/sleep 1000", NULL, getuid (), geteuid (), NULL, NULL /* GCancellable */); 128 + + job = udisks_spawned_job_new ("@sleep@ 1000", NULL, getuid (), geteuid (), NULL, NULL /* GCancellable */); 129 + udisks_spawned_job_start (job); 130 + g_object_unref (job); 131 + }