dnf-plugins-core: init at 4.4.3

This commit is contained in:
Paul Meyer 2023-12-16 19:28:29 +01:00
parent 168f0d5034
commit 64365bbfce
4 changed files with 139 additions and 0 deletions

View File

@ -0,0 +1,122 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
# dependencies
, cmake
, dateutil
, dbus-python
, dnf4
, gettext
, libcomps
, libdnf
, python
, rpm
, sphinx
, systemd
}:
let
pyMajor = lib.versions.major python.version;
in
buildPythonPackage rec {
pname = "dnf-plugins-core";
version = "4.4.3";
format = "other";
outputs = [ "out" "man" ];
src = fetchFromGitHub {
owner = "rpm-software-management";
repo = "dnf-plugins-core";
rev = version;
hash = "sha256-YEw8REvK2X7mBg9HDI6V2p8QtZ3TJh4Dzn8Uuhfbrgo=";
};
patches = [
./fix-python-install-dir.patch
];
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "@PYTHON_INSTALL_DIR@" "$out/${python.sitePackages}" \
--replace "SYSCONFDIR /etc" "SYSCONFDIR $out/etc" \
--replace "SYSTEMD_DIR /usr/lib/systemd/system" "SYSTEMD_DIR $out/lib/systemd/system"
substituteInPlace doc/CMakeLists.txt \
--replace 'SPHINX_BUILD_NAME "sphinx-build-3"' 'SPHINX_BUILD_NAME "${sphinx}/bin/sphinx-build"'
'';
nativeBuildInputs = [
cmake
gettext
sphinx
];
propagatedBuildInputs = [
dateutil
dbus-python
dnf4.py
libcomps
libdnf
rpm
systemd
];
cmakeFlags = [
"-DPYTHON_DESIRED=${pyMajor}"
"-DWITHOUT_LOCAL=0"
];
postBuild = ''
make doc-man
'';
pythonImportsCheck = [
# This is the python module imported by dnf4 when plugins are loaded.
"dnfpluginscore"
];
# Don't use symbolic links so argv[0] is set to the correct value.
postInstall = ''
# See https://github.com/rpm-software-management/dnf-plugins-core/blob/aee9cacdeb50768c1e869122cd432924ec533213/dnf-plugins-core.spec#L478
mv $out/libexec/dnf-utils-${pyMajor} $out/libexec/dnf-utils
# See https://github.com/rpm-software-management/dnf-plugins-core/blob/aee9cacdeb50768c1e869122cd432924ec533213/dnf-plugins-core.spec#L487-L503
bins=(
"debuginfo-install"
"needs-restarting"
"find-repos-of-install"
"repo-graph"
"package-cleanup"
"repoclosure"
"repodiff"
"repomanage"
"repoquery"
"reposync"
"repotrack"
"yum-builddep"
"yum-config-manager"
"yum-debug-dump"
"yum-debug-restore"
"yum-groups-manager"
"yumdownloader"
)
mkdir -p $out/bin
for bin in "''${bins[@]}"; do
ln $out/libexec/dnf-utils $out/bin/$bin
done
'';
makeWrapperArgs = [
''--add-flags "--setopt=pluginpath=$out/${python.sitePackages}/dnf-plugins"''
];
meta = with lib; {
description = "Core plugins to use with DNF package manager";
homepage = "https://github.com/rpm-software-management/dnf-plugins-core";
changelog = "https://github.com/rpm-software-management/dnf-plugins-core/releases/tag/${version}";
license = licenses.gpl2Only;
maintainers = with maintainers; [ katexochen ];
};
}

View File

@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1eea7b..00fbaf3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ ELSE ()
MESSAGE (FATAL_ERROR "Invalid PYTHON_DESIRED value: " ${PYTHON_DESIRED})
ENDIF()
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from sysconfig import get_path; stdout.write(get_path('purelib'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+SET(PYTHON_INSTALL_DIR "@PYTHON_INSTALL_DIR@")
MESSAGE(STATUS "Python install dir is ${PYTHON_INSTALL_DIR}")
SET (SYSCONFDIR /etc)

View File

@ -617,6 +617,8 @@ with pkgs;
dec-decode = callPackage ../development/tools/dec-decode { };
dnf-plugins-core = with python3Packages; toPythonApplication dnf-plugins-core;
dnf4 = with python3Packages; toPythonApplication dnf4;
dnf5 = callPackage ../tools/package-management/dnf5 { };

View File

@ -3243,6 +3243,8 @@ self: super: with self; {
dnachisel = callPackage ../development/python-modules/dnachisel { };
dnf-plugins-core = callPackage ../development/python-modules/dnf-plugins-core { };
dnf4 = callPackage ../development/python-modules/dnf4 { };
dnfile = callPackage ../development/python-modules/dnfile { };