Commit 0465f280 authored by Paul Meyer's avatar Paul Meyer
Browse files

dnf4: init at 4.18.1

parent 1d845b40
Loading
Loading
Loading
Loading
+83 −0
Original line number Diff line number Diff line
{ lib
, buildPythonPackage
, cmake
, fetchFromGitHub
, gettext
, libcomps
, libdnf
, python
, rpm
, sphinx
}:

buildPythonPackage rec {
  pname = "dnf4";
  version = "4.18.1";
  format = "other";

  outputs = [ "out" "man" ];

  src = fetchFromGitHub {
    owner = "rpm-software-management";
    repo = "dnf";
    rev = version;
    hash = "sha256-pgS4y87HbFiaS+fftdhKHOZAl2hYTUds3XVXUuQN6tU=";
  };

  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 etc/tmpfiles.d/CMakeLists.txt \
      --replace "DESTINATION /usr/lib/tmpfiles.d" "DESTINATION $out/usr/lib/tmpfiles.d"
    substituteInPlace dnf/const.py.in \
      --replace "/etc" "$out/etc"
    substituteInPlace doc/CMakeLists.txt \
      --replace 'SPHINX_BUILD_NAME "sphinx-build-3"' 'SPHINX_BUILD_NAME "${sphinx}/bin/sphinx-build"'
  '';

  nativeBuildInputs = [
    cmake
    gettext
    sphinx
  ];

  propagatedBuildInputs = [
    libcomps
    libdnf
    rpm
  ];

  cmakeFlags = [
    "-DPYTHON_DESIRED=${lib.head (lib.splitString ["."] python.version)}"
  ];

  postBuild = ''
    make doc-man
  '';

  postInstall = ''
    # See https://github.com/rpm-software-management/dnf/blob/41a287e2bd60b4d1100c329a274776ff32ba8740/dnf.spec#L218-L220
    ln -s dnf-3 $out/bin/dnf
    ln -s dnf-3 $out/bin/dnf4
    mv $out/bin/dnf-automatic-3 $out/bin/dnf-automatic
    # See https://github.com/rpm-software-management/dnf/blob/41a287e2bd60b4d1100c329a274776ff32ba8740/dnf.spec#L231-L232
    ln -s $out/etc/dnf/dnf.conf $out/etc/yum.conf
    ln -s dnf-3 $out/bin/yum
  '';

  meta = with lib; {
    description = "Package manager based on libdnf and libsolv. Replaces YUM";
    homepage = "https://github.com/rpm-software-management/dnf";
    changelog = "https://github.com/rpm-software-management/dnf/releases/tag/${version}";
    license = licenses.gpl2Only;
    maintainers = with maintainers; [ katexochen ];
    mainProgram = "dnf";
    platforms = platforms.unix;
  };
}
+13 −0
Original line number Diff line number Diff line
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4aee99fb..0bb28897 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,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}")

 ADD_SUBDIRECTORY (dnf)
+2 −0
Original line number Diff line number Diff line
@@ -605,6 +605,8 @@ with pkgs;
  dec-decode = callPackage ../development/tools/dec-decode { };
  dnf4 =  with python3Packages; toPythonApplication dnf4;
  dnf5 = callPackage ../tools/package-management/dnf5 { };
  documenso = callPackage ../applications/office/documenso { };
+2 −0
Original line number Diff line number Diff line
@@ -3204,6 +3204,8 @@ self: super: with self; {
  dnachisel = callPackage ../development/python-modules/dnachisel { };
  dnf4 = callPackage ../development/python-modules/dnf4 { };
  dnfile = callPackage ../development/python-modules/dnfile { };
  dnslib = callPackage ../development/python-modules/dnslib { };