diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-10-24 10:43:29 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-10-24 10:43:29 +0200 |
commit | 6b6db4e26a03928a3327f0c3622c3c807b7ecde9 (patch) | |
tree | ff3cb5bb04c2a4d21489cf0005125104b389d4e9 /pkgs | |
parent | 051f375ca96f448820f0da33a24a8ee4bb937ad2 (diff) | |
download | Nix-6b6db4e26a03928a3327f0c3622c3c807b7ecde9.tar.gz Nix-6b6db4e26a03928a3327f0c3622c3c807b7ecde9.tar.zst Nix-6b6db4e26a03928a3327f0c3622c3c807b7ecde9.zip |
Add blivet3 repackaging (work in progress)
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/python-packages/blivet/default.nix | 118 | ||||
-rw-r--r-- | pkgs/python-packages/blivet/fix_path.patch | 21 | ||||
-rw-r--r-- | pkgs/python-packages/blivet/poetry.lock | 96 | ||||
-rw-r--r-- | pkgs/python-packages/blivet/pyproject.toml | 20 | ||||
-rw-r--r-- | pkgs/python-packages/default.nix | 1 |
5 files changed, 256 insertions, 0 deletions
diff --git a/pkgs/python-packages/blivet/default.nix b/pkgs/python-packages/blivet/default.nix new file mode 100644 index 0000000..108d548 --- /dev/null +++ b/pkgs/python-packages/blivet/default.nix | |||
@@ -0,0 +1,118 @@ | |||
1 | { lib, writeText, poetry2nix, python, pythonPackages, | ||
2 | gobject-introspection, libblockdev, libbytesize, fetchFromGitHub, | ||
3 | pkg-config, parted, systemd, | ||
4 | with_dmraid ? false, | ||
5 | with_fs_btrfs ? false, | ||
6 | with_fs_fat ? false, | ||
7 | with_fs_f2fs ? false, | ||
8 | with_fs_hfs_plus ? false, | ||
9 | with_fs_jfs ? false, | ||
10 | with_fs_nfs ? false, | ||
11 | with_fs_nfsv4 ? false, | ||
12 | with_fs_ntfs ? false, | ||
13 | with_fs_reiserfs ? false, | ||
14 | with_fs_xfs ? false, | ||
15 | with_luks ? false, | ||
16 | with_lvm ? false, | ||
17 | with_mdadm ? false, | ||
18 | with_multipath ? false, | ||
19 | with_optical ? false, | ||
20 | with_iscsi ? false, | ||
21 | dmraid, multipath_tools, lvm2, eject, kmod, utillinux, lsof, | ||
22 | openiscsi, coreutils, dosfstools, e2fsprogs, jfsutils, btrfs-progs, | ||
23 | xfsprogs, f2fs-tools, hfsprogs, nfs-utils, ntfs3g, ntfsprogs, | ||
24 | reiserfsprogs, devicemapper, cryptsetup, mdadm | ||
25 | }@args: | ||
26 | let | ||
27 | # FIXME: blivet/tasks/fsmount.py links to /sbin | ||
28 | additionalPackages = | ||
29 | lib.optionals with_dmraid [ dmraid ] | ||
30 | ++ lib.optionals with_fs_btrfs [ btrfs-progs ] | ||
31 | ++ lib.optionals with_fs_fat [ dosfstools ] | ||
32 | ++ lib.optionals with_fs_f2fs [ f2fs-tools ] | ||
33 | ++ lib.optionals with_fs_hfs_plus [ hfsprogs ] | ||
34 | ++ lib.optionals with_fs_jfs [ jfsutils ] | ||
35 | ++ lib.optionals with_fs_nfs [ nfs-utils ] | ||
36 | ++ lib.optionals with_fs_ntfs [ ntfs3g ntfsprogs ] | ||
37 | ++ lib.optionals with_fs_reiserfs [ reiserfsprogs ] | ||
38 | ++ lib.optionals with_fs_xfs [ xfsprogs.bin ] | ||
39 | ++ lib.optionals with_luks [ devicemapper cryptsetup ] | ||
40 | ++ lib.optionals with_lvm [ lvm2 ] | ||
41 | ++ lib.optionals with_mdadm [ mdadm ] | ||
42 | ++ lib.optionals with_multipath [ multipath_tools ] | ||
43 | ++ lib.optionals with_optical [ eject ] | ||
44 | ++ lib.optionals with_iscsi [ openiscsi ]; | ||
45 | in | ||
46 | # nix-shell -E "with import <nixpkgs> {}; pkgs.mkShell { buildInputs = [ python3 python3Packages.blivet3 ]; }" | ||
47 | # nix-shell -E "with import <nixpkgs> {}; pkgs.mkShell { buildInputs = [ (python3.withPackages(p: [ p.blivet3 ])) ]; }" | ||
48 | poetry2nix.mkPoetryApplication { | ||
49 | inherit python; | ||
50 | propagatedBuildInputs = [ | ||
51 | gobject-introspection | ||
52 | (pythonPackages.toPythonModule libblockdev) | ||
53 | (pythonPackages.toPythonModule libbytesize) | ||
54 | ]; | ||
55 | src = fetchFromGitHub { | ||
56 | owner = "storaged-project"; | ||
57 | repo = "blivet"; | ||
58 | rev = "blivet-3.3.0"; | ||
59 | sha256 = "0ynxm37cxxr2sf2hj18hrdxs1qfw6dgdagkvv5f6g4fmp51m7c3c"; | ||
60 | }; | ||
61 | overrides = poetry2nix.overrides.withDefaults (self: super: { | ||
62 | pyparted = super.pyparted.overridePythonAttrs (old: { | ||
63 | buildInputs = old.buildInputs ++ [ parted ]; | ||
64 | nativeBuildInputs = old.nativeBuildInputs ++ [ pkg-config ]; | ||
65 | }); | ||
66 | selinux = super.selinux.overridePythonAttrs (old: { | ||
67 | buildInputs = old.buildInputs ++ [ self.setuptools-scm-git-archive ]; | ||
68 | nativeBuildInputs = old.nativeBuildInputs ++ [ pkg-config ]; | ||
69 | }); | ||
70 | }); | ||
71 | patches = [ ./fix_path.patch ]; | ||
72 | postPatch = let | ||
73 | runtimePaths = lib.makeBinPath ([ | ||
74 | systemd utillinux kmod e2fsprogs mdadm lsof coreutils | ||
75 | ] ++ additionalPackages); | ||
76 | libraryPath = builtins.concatStringsSep " " (map (v: "-rpath ${v}/lib -L ${v}/lib") [ systemd.lib ]); | ||
77 | giLibraryPath = lib.makeSearchPath "lib/girepository-1.0" [libblockdev gobject-introspection]; | ||
78 | addGiPath = writeText "add-gi-path" '' | ||
79 | import os | ||
80 | newGiPath = "${giLibraryPath}" | ||
81 | if newGiPath not in os.environ.get("GI_TYPELIB_PATH", ""): | ||
82 | os.environ["GI_TYPELIB_PATH"] = os.environ.get("GI_TYPELIB_PATH", "") + ":" + newGiPath | ||
83 | ''; | ||
84 | addPath = writeText "add-path" '' | ||
85 | import os | ||
86 | newPath = "${runtimePaths}" | ||
87 | newLibraryPath = "${libraryPath}" | ||
88 | if newPath not in os.environ.get("PATH", ""): | ||
89 | os.environ["PATH"] = os.environ.get("PATH", "") + ":" + newPath | ||
90 | os.environ["NIX_LDFLAGS"] = os.environ.get("NIX_LDFLAGS", "") + " " + newLibraryPath | ||
91 | ''; | ||
92 | in | ||
93 | '' | ||
94 | prepend() { | ||
95 | mv "$1" "$1.bak" | ||
96 | cat ${addPath} "$1.bak" > $1 | ||
97 | rm -f "$1.bak" | ||
98 | } | ||
99 | prepend "blivet/__init__.py" | ||
100 | prepend "blivet/iscsi.py" | ||
101 | prepend "blivet/tasks/availability.py" | ||
102 | prepend "blivet/util.py" | ||
103 | prepend "blivet/udev.py" | ||
104 | prependGi() { | ||
105 | mv "$1" "$1.bak" | ||
106 | cat ${addGiPath} "$1.bak" > $1 | ||
107 | rm -f "$1.bak" | ||
108 | } | ||
109 | grep -rl require_version blivet/ | while read i; do prependGi "$i"; done | ||
110 | sed -i -e "s@/lib/modules@/run/booted-system/kernel-modules/lib/modules/@" blivet/tasks/fsmount.py | ||
111 | ''; | ||
112 | postInstall = let | ||
113 | in '' | ||
114 | rm -rf $out/lib/python*/site-packages/{etc,usr} | ||
115 | ''; | ||
116 | pyproject = ./pyproject.toml; | ||
117 | poetrylock = ./poetry.lock; | ||
118 | } | ||
diff --git a/pkgs/python-packages/blivet/fix_path.patch b/pkgs/python-packages/blivet/fix_path.patch new file mode 100644 index 0000000..29c4052 --- /dev/null +++ b/pkgs/python-packages/blivet/fix_path.patch | |||
@@ -0,0 +1,21 @@ | |||
1 | diff --git a/blivet/tasks/fsmount.py b/blivet/tasks/fsmount.py | ||
2 | index 15f79a3e..bb3fe873 100644 | ||
3 | --- a/blivet/tasks/fsmount.py | ||
4 | +++ b/blivet/tasks/fsmount.py | ||
5 | @@ -19,6 +19,7 @@ | ||
6 | # | ||
7 | # Red Hat Author(s): Anne Mulhern <amulhern@redhat.com> | ||
8 | |||
9 | +from distutils.spawn import find_executable | ||
10 | import os | ||
11 | |||
12 | from ..errors import FSError | ||
13 | @@ -58,7 +59,7 @@ class FSMount(task.BasicApplication, fstask.FSTask): | ||
14 | @property | ||
15 | def _can_mount(self): | ||
16 | return (self.mount_type in fslib.kernel_filesystems) or \ | ||
17 | - (os.access("/sbin/mount.%s" % (self.mount_type,), os.X_OK)) or \ | ||
18 | + (find_executable("mount.%s" % (self.mount_type,)) is not None) or \ | ||
19 | self._has_driver | ||
20 | |||
21 | @property | ||
diff --git a/pkgs/python-packages/blivet/poetry.lock b/pkgs/python-packages/blivet/poetry.lock new file mode 100644 index 0000000..c45011a --- /dev/null +++ b/pkgs/python-packages/blivet/poetry.lock | |||
@@ -0,0 +1,96 @@ | |||
1 | [[package]] | ||
2 | name = "distro" | ||
3 | version = "1.5.0" | ||
4 | description = "Distro - an OS platform information API" | ||
5 | category = "main" | ||
6 | optional = false | ||
7 | python-versions = "*" | ||
8 | |||
9 | [[package]] | ||
10 | name = "pycairo" | ||
11 | version = "1.19.1" | ||
12 | description = "Python interface for cairo" | ||
13 | category = "main" | ||
14 | optional = false | ||
15 | python-versions = ">=3.5, <4" | ||
16 | |||
17 | [[package]] | ||
18 | name = "pygobject" | ||
19 | version = "3.36.1" | ||
20 | description = "Python bindings for GObject Introspection" | ||
21 | category = "main" | ||
22 | optional = false | ||
23 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" | ||
24 | |||
25 | [package.dependencies] | ||
26 | pycairo = ">=1.11.1" | ||
27 | |||
28 | [[package]] | ||
29 | name = "pyparted" | ||
30 | version = "3.11.6" | ||
31 | description = "Python bindings for GNU parted" | ||
32 | category = "main" | ||
33 | optional = false | ||
34 | python-versions = "*" | ||
35 | |||
36 | [[package]] | ||
37 | name = "pyudev" | ||
38 | version = "0.22.0" | ||
39 | description = "A libudev binding" | ||
40 | category = "main" | ||
41 | optional = false | ||
42 | python-versions = "*" | ||
43 | |||
44 | [package.dependencies] | ||
45 | six = "*" | ||
46 | |||
47 | [[package]] | ||
48 | name = "selinux" | ||
49 | version = "0.2.1" | ||
50 | description = "shim selinux module" | ||
51 | category = "main" | ||
52 | optional = false | ||
53 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" | ||
54 | |||
55 | [package.dependencies] | ||
56 | distro = ">=1.3.0" | ||
57 | setuptools = ">=39.0" | ||
58 | |||
59 | [[package]] | ||
60 | name = "six" | ||
61 | version = "1.15.0" | ||
62 | description = "Python 2 and 3 compatibility utilities" | ||
63 | category = "main" | ||
64 | optional = false | ||
65 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" | ||
66 | |||
67 | [metadata] | ||
68 | lock-version = "1.0" | ||
69 | python-versions = "^3.8" | ||
70 | content-hash = "636edb46b1deb0f6d5db636b0bc6639205335c9915480b156a417067137548f8" | ||
71 | |||
72 | [metadata.files] | ||
73 | distro = [ | ||
74 | {file = "distro-1.5.0-py2.py3-none-any.whl", hash = "sha256:df74eed763e18d10d0da624258524ae80486432cd17392d9c3d96f5e83cd2799"}, | ||
75 | {file = "distro-1.5.0.tar.gz", hash = "sha256:0e58756ae38fbd8fc3020d54badb8eae17c5b9dcbed388b17bb55b8a5928df92"}, | ||
76 | ] | ||
77 | pycairo = [ | ||
78 | {file = "pycairo-1.19.1.tar.gz", hash = "sha256:2c143183280feb67f5beb4e543fd49990c28e7df427301ede04fc550d3562e84"}, | ||
79 | ] | ||
80 | pygobject = [ | ||
81 | {file = "PyGObject-3.36.1.tar.gz", hash = "sha256:012a589aec687bfa809a1ff9f5cd775dc7f6fcec1a6bc7fe88e1002a68f8ba34"}, | ||
82 | ] | ||
83 | pyparted = [ | ||
84 | {file = "pyparted-3.11.6.tar.gz", hash = "sha256:727ccdf308c194069aa9797f7a6a973bc95b2e407cdf5d58d6c8bc4c9dec92dc"}, | ||
85 | ] | ||
86 | pyudev = [ | ||
87 | {file = "pyudev-0.22.0.tar.gz", hash = "sha256:69bb1beb7ac52855b6d1b9fe909eefb0017f38d917cba9939602c6880035b276"}, | ||
88 | ] | ||
89 | selinux = [ | ||
90 | {file = "selinux-0.2.1-py2.py3-none-any.whl", hash = "sha256:820adcf1b4451c9cc7759848797703263ba0eb6a4cad76d73548a9e0d57b7926"}, | ||
91 | {file = "selinux-0.2.1.tar.gz", hash = "sha256:d435f514e834e3fdc0941f6a29d086b80b2ea51b28112aee6254bd104ee42a74"}, | ||
92 | ] | ||
93 | six = [ | ||
94 | {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, | ||
95 | {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, | ||
96 | ] | ||
diff --git a/pkgs/python-packages/blivet/pyproject.toml b/pkgs/python-packages/blivet/pyproject.toml new file mode 100644 index 0000000..cf86aa1 --- /dev/null +++ b/pkgs/python-packages/blivet/pyproject.toml | |||
@@ -0,0 +1,20 @@ | |||
1 | [tool.poetry] | ||
2 | name = "blivet" | ||
3 | version = "3.3.0" | ||
4 | description = "A python module for system storage configuration" | ||
5 | authors = ["David Lehman <dlehman@redhat.com>"] | ||
6 | license = "GPL-2.0-or-later" | ||
7 | |||
8 | [tool.poetry.dependencies] | ||
9 | python = "^3.8" | ||
10 | six = "^1.15.0" | ||
11 | pyudev = "^0.22.0" | ||
12 | pyparted = "^3.11.6" | ||
13 | selinux = "^0.2.1" | ||
14 | pygobject = "^3.36.1" | ||
15 | |||
16 | [tool.poetry.dev-dependencies] | ||
17 | |||
18 | [build-system] | ||
19 | requires = ["poetry>=0.12"] | ||
20 | build-backend = "poetry.masonry.api" | ||
diff --git a/pkgs/python-packages/default.nix b/pkgs/python-packages/default.nix index 9347a06..94bb5fe 100644 --- a/pkgs/python-packages/default.nix +++ b/pkgs/python-packages/default.nix | |||
@@ -1,6 +1,7 @@ | |||
1 | { mylibs, callPackage, python }: | 1 | { mylibs, callPackage, python }: |
2 | { | 2 | { |
3 | apprise = callPackage ./apprise { inherit mylibs; pythonPackages = python.pkgs; }; | 3 | apprise = callPackage ./apprise { inherit mylibs; pythonPackages = python.pkgs; }; |
4 | blivet3 = callPackage ./blivet { inherit python; pythonPackages = python.pkgs; }; | ||
4 | buildbot-plugins = callPackage ./buildbot/plugins { inherit python; }; | 5 | buildbot-plugins = callPackage ./buildbot/plugins { inherit python; }; |
5 | wokkel = callPackage ./wokkel.nix { pythonPackages = python.pkgs; }; | 6 | wokkel = callPackage ./wokkel.nix { pythonPackages = python.pkgs; }; |
6 | pymilter = callPackage ./pymilter.nix { pythonPackages = python.pkgs; }; | 7 | pymilter = callPackage ./pymilter.nix { pythonPackages = python.pkgs; }; |