1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # dependencies 7 cmake, 8 python-dateutil, 9 dbus-python, 10 dnf4, 11 gettext, 12 libcomps, 13 libdnf, 14 python, 15 rpm, 16 sphinx, 17 systemd, 18}: 19 20let 21 pyMajor = lib.versions.major python.version; 22in 23 24buildPythonPackage rec { 25 pname = "dnf-plugins-core"; 26 version = "4.7.0"; 27 format = "other"; 28 29 outputs = [ 30 "out" 31 "man" 32 ]; 33 34 src = fetchFromGitHub { 35 owner = "rpm-software-management"; 36 repo = "dnf-plugins-core"; 37 rev = "refs/tags/${version}"; 38 hash = "sha256-AQnnXjkUajztbyoKzKhxiKxZsb2o2+7C15fsrxGkWcM="; 39 }; 40 41 patches = [ ./fix-python-install-dir.patch ]; 42 43 postPatch = '' 44 substituteInPlace CMakeLists.txt \ 45 --replace "@PYTHON_INSTALL_DIR@" "$out/${python.sitePackages}" \ 46 --replace "SYSCONFDIR /etc" "SYSCONFDIR $out/etc" \ 47 --replace "SYSTEMD_DIR /usr/lib/systemd/system" "SYSTEMD_DIR $out/lib/systemd/system" 48 substituteInPlace doc/CMakeLists.txt \ 49 --replace 'SPHINX_BUILD_NAME "sphinx-build-3"' 'SPHINX_BUILD_NAME "${sphinx}/bin/sphinx-build"' 50 ''; 51 52 nativeBuildInputs = [ 53 cmake 54 gettext 55 sphinx 56 ]; 57 58 propagatedBuildInputs = [ 59 python-dateutil 60 dbus-python 61 dnf4.py 62 libcomps 63 libdnf 64 rpm 65 systemd 66 ]; 67 68 cmakeFlags = [ 69 "-DPYTHON_DESIRED=${pyMajor}" 70 "-DWITHOUT_LOCAL=0" 71 ]; 72 73 postBuild = '' 74 make doc-man 75 ''; 76 77 pythonImportsCheck = [ 78 # This is the python module imported by dnf4 when plugins are loaded. 79 "dnfpluginscore" 80 ]; 81 82 # Don't use symbolic links so argv[0] is set to the correct value. 83 postInstall = '' 84 # See https://github.com/rpm-software-management/dnf-plugins-core/blob/aee9cacdeb50768c1e869122cd432924ec533213/dnf-plugins-core.spec#L478 85 mv $out/libexec/dnf-utils-${pyMajor} $out/libexec/dnf-utils 86 87 # See https://github.com/rpm-software-management/dnf-plugins-core/blob/aee9cacdeb50768c1e869122cd432924ec533213/dnf-plugins-core.spec#L487-L503 88 bins=( 89 "debuginfo-install" 90 "needs-restarting" 91 "find-repos-of-install" 92 "repo-graph" 93 "package-cleanup" 94 "repoclosure" 95 "repodiff" 96 "repomanage" 97 "repoquery" 98 "reposync" 99 "repotrack" 100 "yum-builddep" 101 "yum-config-manager" 102 "yum-debug-dump" 103 "yum-debug-restore" 104 "yum-groups-manager" 105 "yumdownloader" 106 ) 107 mkdir -p $out/bin 108 for bin in "''${bins[@]}"; do 109 ln $out/libexec/dnf-utils $out/bin/$bin 110 done 111 ''; 112 113 makeWrapperArgs = [ ''--add-flags "--setopt=pluginpath=$out/${python.sitePackages}/dnf-plugins"'' ]; 114 115 meta = with lib; { 116 description = "Core plugins to use with DNF package manager"; 117 homepage = "https://github.com/rpm-software-management/dnf-plugins-core"; 118 changelog = "https://github.com/rpm-software-management/dnf-plugins-core/releases/tag/${version}"; 119 license = licenses.gpl2Only; 120 maintainers = with maintainers; [ katexochen ]; 121 }; 122}