udisks2: 2.1.6 → 2.7.6

supersedes #35551
closes #34999

/cc https://github.com/NixOS/nixpkgs/pull/38382
This commit is contained in:
Florian Klink 2018-05-30 00:19:46 +02:00
parent 058b0e7a47
commit 41b140cb25
2 changed files with 178 additions and 33 deletions

View File

@ -1,43 +1,55 @@
{ stdenv, fetchurl, pkgconfig, intltool, gnused
, expat, acl, systemd, glib, libatasmart, polkit
, libxslt, docbook_xsl, utillinux, mdadm, libgudev
, gobjectIntrospection
{ stdenv, fetchFromGitHub, substituteAll, libtool, pkgconfig, intltool, gnused
, gnome3, gtk-doc, acl, systemd, glib, libatasmart, polkit, coreutils, bash
, expat, libxslt, docbook_xsl, utillinux, mdadm, libgudev, libblockdev, parted
, gobjectIntrospection, docbook_xml_dtd_412, docbook_xml_dtd_43
, libxfs, f2fs-tools, dosfstools, e2fsprogs, btrfs-progs, exfat, nilfs-utils, udftools, ntfs3g
}:
stdenv.mkDerivation rec {
name = "udisks-2.1.8";
let
version = "2.7.6";
in stdenv.mkDerivation rec {
name = "udisks-${version}";
src = fetchurl {
url = "http://udisks.freedesktop.org/releases/${name}.tar.bz2";
sha256 = "1nkxhnqh39c9pzvm4zfj50rgv6apqawdx09bv3sfaxrah4a6jhfs";
src = fetchFromGitHub {
owner = "storaged-project";
repo = "udisks";
rev = name;
sha256 = "16kf104vv2xbk8cdgaqygszcl69d7lz9gf3vmi7ggywn7nfbp2ks";
};
outputs = [ "out" "man" "dev" ];
outputs = [ "out" "man" "dev" "devdoc" ];
patches = [ ./force-path.patch ];
patches = [
(substituteAll {
src = ./fix-paths.patch;
bash = "${bash}/bin/bash";
blkid = "${utillinux}/bin/blkid";
false = "${coreutils}/bin/false";
mdadm = "${mdadm}/bin/mdadm";
sed = "${gnused}/bin/sed";
sh = "${bash}/bin/sh";
sleep = "${coreutils}/bin/sleep";
true = "${coreutils}/bin/true";
})
(substituteAll {
src = ./force-path.patch;
path = stdenv.lib.makeBinPath [ btrfs-progs coreutils dosfstools e2fsprogs exfat f2fs-tools nilfs-utils libxfs ntfs3g parted utillinux ];
})
];
# FIXME remove /var/run/current-system/sw/* references
# FIXME add references to parted, cryptsetup, etc (see the sources)
postPatch =
''
substituteInPlace src/main.c --replace \
"@path@" \
"${utillinux}/bin:${mdadm}/bin:/run/current-system/sw/bin"
substituteInPlace data/80-udisks2.rules \
--replace "/bin/sh" "${stdenv.shell}" \
--replace "/sbin/mdadm" "${mdadm}/bin/mdadm" \
--replace " sed " " ${gnused}/bin/sed "
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
substituteInPlace udisks/udisksclient.c \
--replace 'defined( __GNUC_PREREQ)' 1 \
--replace '__GNUC_PREREQ(4,6)' 1
'';
nativeBuildInputs = [
pkgconfig gnome3.gnome-common libtool intltool gobjectIntrospection
gtk-doc libxslt docbook_xml_dtd_412 docbook_xml_dtd_43 docbook_xsl
];
nativeBuildInputs = [ pkgconfig intltool gobjectIntrospection ];
buildInputs = [
expat libgudev libblockdev acl systemd glib libatasmart polkit
];
buildInputs = [ libxslt docbook_xsl libgudev expat acl systemd glib libatasmart polkit ];
preConfigure = "./autogen.sh";
configureFlags = [
"--enable-gtk-doc"
"--localstatedir=/var"
"--with-systemdsystemunitdir=$(out)/etc/systemd/system"
"--with-udevdir=$(out)/lib/udev"
@ -50,9 +62,11 @@ stdenv.mkDerivation rec {
doCheck = false; # fails
meta = {
homepage = http://www.freedesktop.org/wiki/Software/udisks;
description = "A daemon and command-line utility for querying and manipulating storage devices";
platforms = stdenv.lib.platforms.linux;
meta = with stdenv.lib; {
description = "A daemon, tools and libraries to access and manipulate disks, storage devices and technologies";
homepage = https://www.freedesktop.org/wiki/Software/udisks/;
license = licenses.gpl2Plus; # lgpl2Plus for the library, gpl2Plus for the tools & daemon
maintainers = with maintainers; [];
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,131 @@
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-SHELL = /bin/bash
+SHELL = @bash@
.SHELLFLAGS = -o pipefail -c
PYTHON ?= python3
--- a/data/80-udisks2.rules
+++ b/data/80-udisks2.rules
@@ -17,9 +17,9 @@
#
# TODO: file bug against mdadm(8) to have --export-prefix option that can be used with e.g. UDISKS_MD_MEMBER
#
-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"
--- a/modules/zram/udiskslinuxmanagerzram.c
+++ b/modules/zram/udiskslinuxmanagerzram.c
@@ -250,7 +250,7 @@
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\n"
+ contents = g_strdup_printf ("#!@bash@\n\n"
"ZRAM_NUM_STR=%" G_GUINT64_FORMAT "\n"
"ZRAM_DEV_SIZE=%" G_GUINT64_FORMAT "\n"
"SWAP=n\n",
--- 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
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
--- a/src/tests/integration-test
+++ b/src/tests/integration-test
@@ -414,7 +414,7 @@
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',
@@ -1079,7 +1079,7 @@
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))
@@ -1092,7 +1092,7 @@
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))
--- 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
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
--- a/src/tests/test.c
+++ b/src/tests/test.c
@@ -71,7 +71,7 @@
{
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);
_g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_success), NULL);
g_object_unref (job);
@@ -84,10 +84,10 @@
{
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);
_g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_failure),
- (gpointer) "Command-line `/bin/false' exited with non-zero exit status 1: ");
+ (gpointer) "Command-line `@false@' exited with non-zero exit status 1: ");
g_object_unref (job);
}
@@ -119,7 +119,7 @@
cancellable = g_cancellable_new ();
g_cancellable_cancel (cancellable);
- job = udisks_spawned_job_new ("/bin/true", NULL, getuid (), geteuid (), NULL, cancellable);
+ job = udisks_spawned_job_new ("@true@", NULL, getuid (), geteuid (), NULL, cancellable);
udisks_spawned_job_start (job);
_g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_failure),
(gpointer) "Operation was cancelled (g-io-error-quark, 19)");
@@ -145,7 +145,7 @@
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);
udisks_spawned_job_start (job);
g_timeout_add (10, on_timeout, cancellable); /* 10 msec */
g_main_loop_run (loop);
@@ -199,7 +199,7 @@
{
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);
g_object_unref (job);
}