Merge pull request #266635 from katexochen/dnf4-init

dnf4: init at 4.18.1
This commit is contained in:
Peder Bergebakken Sundt 2023-12-05 17:55:57 +01:00 committed by GitHub
commit 7cb7b7f98d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 234 additions and 8 deletions

View file

@ -0,0 +1,83 @@
{ 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;
};
}

View file

@ -0,0 +1,13 @@
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)

View file

@ -0,0 +1,65 @@
{ lib
, check
, cmake
, doxygen
, expat
, fetchFromGitHub
, libxml2
, python
, sphinx
, stdenv
, zlib
}:
stdenv.mkDerivation rec {
pname = "libcomps";
version = "0.1.20";
outputs = [ "out" "dev" "py" ];
src = fetchFromGitHub {
owner = "rpm-software-management";
repo = "libcomps";
rev = version;
hash = "sha256-IX4du1+G7lwWrGnllydnBDap2aqK5pzos1Mdyu4MzOU=";
};
patches = [
./fix-python-install-dir.patch
];
postPatch = ''
substituteInPlace libcomps/src/python/src/CMakeLists.txt \
--replace "@PYTHON_INSTALL_DIR@" "$out/${python.sitePackages}"
'';
nativeBuildInputs = [
check
cmake
doxygen
python
sphinx
];
buildInputs = [
expat
libxml2
zlib
];
dontUseCmakeBuildDir = true;
cmakeDir = "libcomps";
postFixup = ''
ls $out/lib
moveToOutput "lib/${python.libPrefix}" "$py"
'';
meta = with lib; {
description = "Comps XML file manipulation library";
homepage = "https://github.com/rpm-software-management/libcomps";
license = licenses.gpl2Only;
maintainers = with maintainers; [ katexochen ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,13 @@
diff --git a/libcomps/src/python/src/CMakeLists.txt b/libcomps/src/python/src/CMakeLists.txt
index d22b84e..57bd1c2 100644
--- a/libcomps/src/python/src/CMakeLists.txt
+++ b/libcomps/src/python/src/CMakeLists.txt
@@ -85,7 +85,7 @@ IF (SKBUILD)
INSTALL(FILES libcomps/__init__.py DESTINATION libcomps/src/python/src/libcomps)
INSTALL(TARGETS pycomps LIBRARY DESTINATION libcomps/src/python/src/libcomps)
ELSE ()
- EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from sysconfig import get_path; stdout.write(get_path('platlib'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+ SET(PYTHON_INSTALL_DIR "@PYTHON_INSTALL_DIR@")
INSTALL(FILES ${pycomps_SRCDIR}/libcomps/__init__.py DESTINATION ${PYTHON_INSTALL_DIR}/libcomps)
#INSTALL(FILES ${pycomps_SRCDIR}/tests/__test.py DESTINATION

View file

@ -15,12 +15,19 @@
, libyaml
, rpm
, zchunk
, cppunit
, python
, swig
, glib
, sphinx
}:
stdenv.mkDerivation rec {
pname = "libdnf";
version = "0.72.0";
outputs = [ "out" "dev" "py" ];
src = fetchFromGitHub {
owner = "rpm-software-management";
repo = pname;
@ -36,12 +43,16 @@ stdenv.mkDerivation rec {
buildInputs = [
check
cppunit
openssl
json_c
libsmartcols
libyaml
libmodulemd
zchunk
python
swig
sphinx
];
propagatedBuildInputs = [
@ -56,29 +67,38 @@ stdenv.mkDerivation rec {
cp ${libsolv}/share/cmake/Modules/FindLibSolv.cmake cmake/modules/
'';
postPatch = ''
# See https://github.com/NixOS/nixpkgs/issues/107428
substituteInPlace CMakeLists.txt \
--replace "enable_testing()" "" \
--replace "add_subdirectory(tests)" ""
patches = [
./fix-python-install-dir.patch
];
postPatch = ''
# https://github.com/rpm-software-management/libdnf/issues/1518
substituteInPlace libdnf/libdnf.pc.in \
--replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@
substituteInPlace cmake/modules/FindPythonInstDir.cmake \
--replace "@PYTHON_INSTALL_DIR@" "$out/${python.sitePackages}"
'';
cmakeFlags = [
"-DWITH_GTKDOC=OFF"
"-DWITH_HTML=OFF"
"-DWITH_BINDINGS=OFF"
"-DPYTHON_DESIRED=${lib.head (lib.splitString ["."] python.version)}"
];
postInstall = ''
rm -r $out/${python.sitePackages}/hawkey/test
'';
postFixup = ''
moveToOutput "lib/${python.libPrefix}" "$py"
'';
meta = with lib; {
description = "Package management library";
homepage = "https://github.com/rpm-software-management/libdnf";
changelog = "https://github.com/rpm-software-management/libdnf/releases/tag/${version}";
license = licenses.gpl2Plus;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ rb2k ];
maintainers = with maintainers; [ rb2k katexochen ];
};
}

View file

@ -0,0 +1,12 @@
diff --git a/cmake/modules/FindPythonInstDir.cmake b/cmake/modules/FindPythonInstDir.cmake
index ed098ded..2a2e1543 100644
--- a/cmake/modules/FindPythonInstDir.cmake
+++ b/cmake/modules/FindPythonInstDir.cmake
@@ -1,6 +1 @@
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "
-from sys import stdout
-from sysconfig import get_path
-path=get_path(name='platlib', vars={'platbase':'${CMAKE_INSTALL_PREFIX}'})
-stdout.write(path)"
-OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+SET(PYTHON_INSTALL_DIR "@PYTHON_INSTALL_DIR@")

View file

@ -617,6 +617,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 { };
@ -22582,6 +22584,8 @@ with pkgs;
libcollectdclient = callPackage ../development/libraries/libcollectdclient { };
libcomps = callPackage ../tools/package-management/libcomps { python = python3; };
libcpr = callPackage ../development/libraries/libcpr { };
libcredis = callPackage ../development/libraries/libcredis { };
@ -22670,7 +22674,7 @@ with pkgs;
libdnet = callPackage ../development/libraries/libdnet { };
libdnf = callPackage ../tools/package-management/libdnf { };
libdnf = callPackage ../tools/package-management/libdnf { python = python3; };
libdovi = callPackage ../development/libraries/libdovi { };

View file

@ -3236,6 +3236,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 { };
@ -6223,8 +6225,22 @@ self: super: with self; {
libcloud = callPackage ../development/python-modules/libcloud { };
libcomps = lib.pipe pkgs.libcomps [
toPythonModule
(p: p.overrideAttrs (super: { meta = super.meta // { outputsToInstall = [ "py" ]; }; }))
(p: p.override { inherit python; })
(p: p.py)
];
libcst = callPackage ../development/python-modules/libcst { };
libdnf = lib.pipe pkgs.libdnf [
toPythonModule
(p: p.overrideAttrs (super: { meta = super.meta // { outputsToInstall = [ "py" ]; }; }))
(p: p.override { inherit python; })
(p: p.py)
];
libevdev = callPackage ../development/python-modules/libevdev { };
libfdt = toPythonModule (pkgs.dtc.override {