diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libblockdev')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/libblockdev/default.nix | 60 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/libblockdev/fix-paths.patch | 47 |
2 files changed, 107 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libblockdev/default.nix b/nixpkgs/pkgs/development/libraries/libblockdev/default.nix new file mode 100644 index 000000000000..9b1654420e74 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/libblockdev/default.nix @@ -0,0 +1,60 @@ +{ lib, stdenv, fetchFromGitHub, fetchpatch, substituteAll, 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 +}: +stdenv.mkDerivation rec { + pname = "libblockdev"; + version = "2.25"; + + src = fetchFromGitHub { + owner = "storaged-project"; + repo = "libblockdev"; + rev = "${version}-1"; + sha256 = "sha256-eHUHTogKoNrnwwSo6JaI7NMxVt9JeMqfWyhR62bDMuQ="; + }; + + outputs = [ "out" "dev" "devdoc" ]; + + patches = [ + (substituteAll { + src = ./fix-paths.patch; + sgdisk = "${gptfdisk}/bin/sgdisk"; + }) + + # fix build with glib 2.68 (g_memdup is deprecated) + # https://github.com/storaged-project/libblockdev/pull/623 + (fetchpatch { + url = "https://github.com/storaged-project/libblockdev/commit/5528baef6ccc835a06c45f9db34a2c9c3f2dd940.patch"; + sha256 = "jxq4BLeyTMeNvBvY8k8QXIvYSJ2Gah0J75pq6FpG7PM="; + }) + ]; + + postPatch = '' + patchShebangs scripts + ''; + + nativeBuildInputs = [ + autoreconfHook pkg-config gtk-doc libxslt docbook_xsl docbook_xml_dtd_43 + python3 gobject-introspection autoconf-archive makeWrapper + ]; + + buildInputs = [ + glib udev kmod parted gptfdisk cryptsetup lvm2 dmraid util-linux libbytesize + libndctl nss volume_key libyaml + ]; + + postInstall = '' + wrapProgram $out/bin/lvm-cache-stats --prefix PATH : \ + ${lib.makeBinPath [ thin-provisioning-tools ]} + ''; + + meta = with lib; { + description = "A library for manipulating block devices"; + homepage = "http://storaged.org/libblockdev/"; + license = with licenses; [ lgpl2Plus gpl2Plus ]; # lgpl2Plus for the library, gpl2Plus for the utils + maintainers = with maintainers; [ johnazoidberg ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/libblockdev/fix-paths.patch b/nixpkgs/pkgs/development/libraries/libblockdev/fix-paths.patch new file mode 100644 index 000000000000..85822165d8c5 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/libblockdev/fix-paths.patch @@ -0,0 +1,47 @@ +--- 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; |