uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,96 @@
{ 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
, xfsprogs, f2fs-tools, dosfstools, e2fsprogs, btrfs-progs, exfat, nilfs-utils, ntfs3g
, nixosTests
}:
stdenv.mkDerivation rec {
pname = "udisks";
version = "2.9.4";
src = fetchFromGitHub {
owner = "storaged-project";
repo = "udisks";
rev = "${pname}-${version}";
sha256 = "sha256-MYQztzIyp5kh9t1bCIlj08/gaOmZfuu/ZOwo3F+rZiw=";
};
outputs = [ "out" "man" "dev" ] ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "devdoc";
patches = [
(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";
sed = "${gnused}/bin/sed";
sh = "${bash}/bin/sh";
sleep = "${coreutils}/bin/sleep";
swapon = "${util-linux}/bin/swapon";
true = "${coreutils}/bin/true";
})
(substituteAll {
src = ./force-path.patch;
path = lib.makeBinPath [
btrfs-progs coreutils dosfstools e2fsprogs exfat f2fs-tools nilfs-utils
xfsprogs ntfs3g parted util-linux
];
})
];
strictDeps = true;
# pkg-config had to be in both to find gtk-doc and gobject-introspection
depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [
autoreconfHook which gobject-introspection pkg-config
gtk-doc libxslt docbook_xml_dtd_412 docbook_xml_dtd_43 docbook_xsl
];
postPatch = lib.optionalString stdenv.hostPlatform.isMusl ''
substituteInPlace udisks/udisksclient.c \
--replace 'defined( __GNUC_PREREQ)' 1 \
--replace '__GNUC_PREREQ(4,6)' 1
'';
buildInputs = [
expat libgudev libblockdev acl systemd glib libatasmart polkit util-linux
];
preConfigure = "NOCONFIGURE=1 ./autogen.sh";
configureFlags = [
(lib.enableFeature (stdenv.buildPlatform == stdenv.hostPlatform) "gtk-doc")
"--sysconfdir=/etc"
"--localstatedir=/var"
"--with-systemdsystemunitdir=$(out)/etc/systemd/system"
"--with-udevdir=$(out)/lib/udev"
"--with-tmpfilesdir=no"
];
makeFlags = [
"INTROSPECTION_GIRDIR=$(dev)/share/gir-1.0"
"INTROSPECTION_TYPELIBDIR=$(out)/lib/girepository-1.0"
];
installFlags = [
"sysconfdir=${placeholder "out"}/etc"
];
enableParallelBuilding = true;
doCheck = true;
passthru.tests.vm = nixosTests.udisks2;
meta = with 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 = with licenses; [ lgpl2Plus gpl2Plus ]; # lgpl2Plus for the library, gpl2Plus for the tools & daemon
maintainers = teams.freedesktop.members ++ (with maintainers; [ johnazoidberg ]);
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,158 @@
diff --git a/data/80-udisks2.rules b/data/80-udisks2.rules
index ca802cce..bfd1c29e 100644
--- a/data/80-udisks2.rules
+++ b/data/80-udisks2.rules
@@ -17,9 +17,9 @@ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="?*", GOTO="udisks_probe_end"
#
# 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"
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
+++ b/src/tests/test.c
@@ -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);
_g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_success), NULL);
g_object_unref (job);
@@ -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);
_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 @@ 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);
+ 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)");
@@ -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);
udisks_spawned_job_start (job);
g_timeout_add (10, on_timeout, cancellable); /* 10 msec */
_g_assert_signal_received (job, "completed", G_CALLBACK (on_completed_expect_failure),
@@ -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);
g_object_unref (job);
}

View file

@ -0,0 +1,17 @@
diff --git a/src/main.c b/src/main.c
index b4dbf9e0..3171fa34 100644
--- a/src/main.c
+++ b/src/main.c
@@ -144,8 +144,7 @@ main (int argc,
g_setenv("G_MESSAGES_DEBUG", "udisks", FALSE);
}
- if (g_getenv ("PATH") == NULL)
- g_setenv ("PATH", "/usr/bin:/bin:/usr/sbin:/sbin", TRUE);
+ g_setenv ("PATH", "@path@", TRUE);
udisks_notice ("udisks daemon version %s starting", PACKAGE_VERSION);
--
2.33.1