-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #266635 from katexochen/dnf4-init
dnf4: init at 4.18.1
- Loading branch information
Showing
8 changed files
with
234 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; | ||
} |
13 changes: 13 additions & 0 deletions
13
pkgs/development/python-modules/dnf4/fix-python-install-dir.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; | ||
} |
13 changes: 13 additions & 0 deletions
13
pkgs/tools/package-management/libcomps/fix-python-install-dir.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
pkgs/tools/package-management/libdnf/fix-python-install-dir.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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@") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters