drbd: 8.4.4 -> 9.19.1, ocf-resource-agents: init at 4.10.0

main
Ryan Mulligan 3 years ago committed by Astro
parent 5b42db3598
commit 036b909421
  1. 133
      pkgs/os-specific/linux/drbd/default.nix
  2. 24
      pkgs/os-specific/linux/drbd/fix-glibc-compilation.patch
  3. 15
      pkgs/os-specific/linux/drbd/pass-force.patch
  4. 56
      pkgs/os-specific/linux/ocf-resource-agents/default.nix
  5. 2
      pkgs/top-level/all-packages.nix

@ -1,49 +1,128 @@
{ lib, stdenv, fetchurl, flex, systemd, perl }:
{ lib
, stdenv
, docbook_xml_dtd_44
, docbook_xml_dtd_45
, docbook_xsl
, asciidoctor
, fetchurl
, flex
, kmod
, libxslt
, nixosTests
, perl
, systemd
# drbd-utils are compiled twice, once with forOCF = true to extract
# its OCF definitions for use in the ocf-resource-agents derivation,
# then again with forOCF = false, where the ocf-resource-agents is
# provided as the OCF_ROOT.
, forOCF ? false
, ocf-resource-agents
}:
stdenv.mkDerivation rec {
pname = "drbd";
version = "8.4.4";
version = "9.19.1";
src = fetchurl {
url = "http://oss.linbit.com/drbd/8.4/drbd-${version}.tar.gz";
sha256 = "1w4889h1ak7gy9w33kd4fgjlfpgmp6hzfya16p1pkc13bjf22mm0";
url = "https://pkg.linbit.com/downloads/drbd/utils/${pname}-utils-${version}.tar.gz";
sha256 = "1l99kcrb0j85wxxmrdihpx9bk1a4sdi7wlp5m1x5l24k8ck1m5cf";
};
patches = [ ./pass-force.patch ./fix-glibc-compilation.patch ];
nativeBuildInputs = [
flex
libxslt
docbook_xsl
asciidoctor
];
nativeBuildInputs = [ flex ];
buildInputs = [ perl ];
buildInputs = [
perl
# perlPackages.Po4a used by ja documentation
];
configureFlags = [
"--without-distro"
"--without-pacemaker"
"--libdir=${placeholder "out"}/lib"
"--sbindir=${placeholder "out"}/bin"
"--localstatedir=/var"
"--sysconfdir=/etc"
"--without-distro"
];
preConfigure =
''
export PATH=${systemd}/sbin:$PATH
substituteInPlace user/Makefile.in \
--replace /sbin '$(sbindir)'
substituteInPlace user/legacy/Makefile.in \
--replace '$(DESTDIR)/lib/drbd' '$(DESTDIR)$(LIBDIR)'
substituteInPlace user/drbdadm_usage_cnt.c --replace /lib/drbd $out/lib/drbd
substituteInPlace scripts/drbd.rules --replace /usr/sbin/drbdadm $out/sbin/drbdadm
'';
makeFlags = [ "SHELL=${stdenv.shell}" ];
makeFlags = [
"SOURCE_DATE_EPOCH=1"
"WANT_DRBD_REPRODUCIBLE_BUILD=1"
] ++ lib.optional (!forOCF) "OCF_ROOT=${ocf-resource-agents}/usr/lib/ocf}";
installFlags = [
"localstatedir=$(TMPDIR)/var"
"sysconfdir=$(out)/etc"
"INITDIR=$(out)/etc/init.d"
"prefix="
"DESTDIR=${placeholder "out"}"
"localstatedir=/var"
"DRBD_LIB_DIR=/var/lib"
"INITDIR=/etc/init.d"
"udevrulesdir=/etc/udev/rules.d"
"sysconfdir=/etc"
"sbindir=/bin"
"datadir="
"LIBDIR=/lib/drbd"
"mandir=/share/man"
];
postPatch = ''
patchShebangs .
substituteInPlace user/v84/drbdadm_usage_cnt.c \
--replace '"/lib/drbd");' \
'"${placeholder "out"}/lib/drbd");'
substituteInPlace user/v9/drbdsetup_linux.c \
--replace 'ret = system("/sbin/modprobe drbd");' \
'ret = system("${kmod}/bin/modprobe drbd");'
substituteInPlace user/v84/drbdsetup.c \
--replace 'system("/sbin/modprobe drbd")' \
'system("${kmod}/bin/modprobe drbd")'
substituteInPlace documentation/ra2refentry.xsl \
--replace "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" \
"${docbook_xml_dtd_44}/xml/dtd/docbook/docbookx.dtd"
function patch_docbook45() {
substituteInPlace $1 \
--replace "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" \
"${docbook_xml_dtd_45}/xml/dtd/docbook/docbookx.dtd"
}
patch_docbook45 documentation/v9/drbd.conf.xml.in
patch_docbook45 documentation/v9/drbdsetup.xml.in
patch_docbook45 documentation/v84/drbdsetup.xml
patch_docbook45 documentation/v84/drbd.conf.xml
# The ja documentation is disabled because:
# make[1]: Entering directory '/build/drbd-utils-9.16.0/documentation/ja/v84'
# /nix/store/wyx2nn2pjcn50lc95c6qgsgm606rn0x2-perl5.32.1-po4a-0.62/bin/po4a-translate -f docbook -M utf-8 -L utf-8 -keep 0 -m ../../v84/drbdsetup.xml -p drbdsetup.xml.po -l drbdsetup.xml
# Use of uninitialized value $args[1] in sprintf at /nix/store/wyx2nn2pjcn50lc95c6qgsgm606rn0x2-perl5.32.1-po4a-0.62/lib/perl5/site_perl/Locale/Po4a/Common.pm line 134.
# Invalid po file drbdsetup.xml.po:
substituteInPlace Makefile.in \
--replace 'DOC_DIRS := documentation/v9 documentation/ja/v9' \
'DOC_DIRS := documentation/v9' \
--replace 'DOC_DIRS += documentation/v84 documentation/ja/v84' \
'DOC_DIRS += documentation/v84' \
--replace '$(MAKE) -C documentation/ja/v9 doc' \
"" \
--replace '$(MAKE) -C documentation/ja/v84 doc' \
""
substituteInPlace user/v9/drbdtool_common.c \
--replace 'add_component_to_path("/lib/drbd");' \
'add_component_to_path("${placeholder "out"}/lib/drbd");'
'';
preConfigure = ''
export PATH=${systemd}/sbin:$PATH
'';
enableParallelBuilding = true;
passthru.tests.drbd = nixosTests.drbd;
meta = with lib; {
homepage = "http://www.drbd.org/";
description = "Distributed Replicated Block Device, a distributed storage system for Linux";
license = licenses.gpl2;
homepage = "https://linbit.com/drbd/";
description = "Distributed Replicated Block Device, a distributed storage system for Linux (userspace utilities)";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ ryantm astro ];
};
}

@ -1,24 +0,0 @@
diff --git a/user/drbdadm_adjust.c b/user/drbdadm_adjust.c
index cb23270..3a751ca 100644
--- a/user/drbdadm_adjust.c
+++ b/user/drbdadm_adjust.c
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
+#include <sys/sysmacros.h>
#include <unistd.h>
#include <fcntl.h>
diff --git a/user/legacy/drbdadm_adjust.c b/user/legacy/drbdadm_adjust.c
index c79163c..6990ffb 100644
--- a/user/legacy/drbdadm_adjust.c
+++ b/user/legacy/drbdadm_adjust.c
@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
+#include <sys/sysmacros.h>
#include <unistd.h>
#include <fcntl.h>

@ -1,15 +0,0 @@
Propagate the --force flag in the legacy drbdadm to drbdsetup.
Otherwise "drbdadm primary --force" won't work as expected (the kernel
will say "State change failed: Need access to UpToDate data").
diff -ru -x '*~' drbd-8.4.0-orig/user/legacy/drbdadm_main.c drbd-8.4.0/user/legacy/drbdadm_main.c
--- drbd-8.4.0-orig/user/legacy/drbdadm_main.c 2011-07-07 06:55:39.000000000 -0400
+++ drbd-8.4.0/user/legacy/drbdadm_main.c 2011-11-02 14:51:04.000000000 -0400
@@ -1547,6 +1547,7 @@
for (i = 0; i < soi; i++) {
argv[NA(argc)] = setup_opts[i];
}
+ if (force) argv[NA(argc)] = "--force";
argv[NA(argc)] = 0;
setenv("DRBD_RESOURCE", res->name, 1);

@ -0,0 +1,56 @@
{ stdenv
, lib
, runCommand
, lndir
, fetchFromGitHub
, autoreconfHook
, pkg-config
, python3
, glib
, drbd
}:
let
drbdForOCF = drbd.override {
forOCF = true;
};
resource-agentsForOCF = stdenv.mkDerivation rec {
pname = "resource-agents";
version = "4.10.0";
src = fetchFromGitHub {
owner = "ClusterLabs";
repo = pname;
rev = "v${version}";
sha256 = "0haryi3yrszdfpqnkfnppxj1yiy6ipah6m80snvayc7v0ss0wnir";
};
nativeBuildInputs = [
autoreconfHook
pkg-config
];
buildInputs = [
glib
python3
];
meta = with lib; {
homepage = "https://github.com/ClusterLabs/resource-agents";
description = "Combined repository of OCF agents from the RHCS and Linux-HA projects";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ ryantm astro ];
};
};
in
# This combines together OCF definitions from other derivations.
# https://github.com/ClusterLabs/resource-agents/blob/master/doc/dev-guides/ra-dev-guide.asc
runCommand "ocf-resource-agents" {} ''
mkdir -p $out/usr/lib/ocf
${lndir}/bin/lndir -silent "${resource-agentsForOCF}/lib/ocf/" $out/usr/lib/ocf
${lndir}/bin/lndir -silent "${drbdForOCF}/usr/lib/ocf/" $out/usr/lib/ocf
''

@ -22428,6 +22428,8 @@ with pkgs;
system76-firmware = callPackage ../os-specific/linux/firmware/system76-firmware { };
ocf-resource-agents = callPackage ../os-specific/linux/ocf-resource-agents { };
open-vm-tools = callPackage ../applications/virtualization/open-vm-tools { };
open-vm-tools-headless = open-vm-tools.override { withX = false; };

Loading…
Cancel
Save