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