apparmor: fix python import issues
With buildPythonApplication the PYTHONPATH is now populated properly, which should address the ModuleNotFoundError issue. I also moved some of the substitutions from postInstall to prePatch, so they don't conflict with the wrapped executables. Because upstream does not seem to hardcode binary paths in the utils anymore, some of the old substituteInPlace rules could be removed. Partial fix for nixpkgs#169056
This commit is contained in:
parent
0f474b4c6c
commit
1256178263
1 changed files with 16 additions and 15 deletions
|
@ -128,9 +128,10 @@ let
|
|||
meta = apparmor-meta "library";
|
||||
};
|
||||
|
||||
apparmor-utils = stdenv.mkDerivation {
|
||||
apparmor-utils = python.pkgs.buildPythonApplication {
|
||||
pname = "apparmor-utils";
|
||||
version = apparmor-version;
|
||||
format = "other";
|
||||
|
||||
src = apparmor-sources;
|
||||
|
||||
|
@ -146,14 +147,25 @@ let
|
|||
libapparmor.python
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
libapparmor.python
|
||||
|
||||
# Used by aa-notify
|
||||
python.pkgs.notify2
|
||||
python.pkgs.psutil
|
||||
];
|
||||
|
||||
prePatch = prePatchCommon +
|
||||
# Do not build vim file
|
||||
lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
sed -i ./utils/Makefile -e "/\<vim\>/d"
|
||||
'' + ''
|
||||
for file in utils/apparmor/easyprof.py utils/apparmor/aa.py utils/logprof.conf; do
|
||||
substituteInPlace $file --replace "/sbin/apparmor_parser" "${apparmor-parser}/bin/apparmor_parser"
|
||||
done
|
||||
sed -i -E 's/^(DESTDIR|BINDIR|PYPREFIX)=.*//g' ./utils/Makefile
|
||||
|
||||
sed -i utils/aa-unconfined -e "/my_env\['PATH'\]/d"
|
||||
|
||||
substituteInPlace utils/aa-remove-unknown \
|
||||
--replace "/lib/apparmor/rc.apparmor.functions" "${apparmor-parser}/lib/apparmor/rc.apparmor.functions"
|
||||
'';
|
||||
inherit patches;
|
||||
postPatch = "cd ./utils";
|
||||
|
@ -161,17 +173,6 @@ let
|
|||
installFlags = [ "DESTDIR=$(out)" "BINDIR=$(out)/bin" "VIM_INSTALL_PATH=$(out)/share" "PYPREFIX=" ];
|
||||
|
||||
postInstall = ''
|
||||
sed -i $out/bin/aa-unconfined -e "/my_env\['PATH'\]/d"
|
||||
for prog in aa-audit aa-autodep aa-cleanprof aa-complain aa-disable aa-enforce aa-genprof aa-logprof aa-mergeprof aa-unconfined ; do
|
||||
wrapProgram $out/bin/$prog --prefix PYTHONPATH : "$out/lib/${python.sitePackages}:$PYTHONPATH"
|
||||
done
|
||||
|
||||
substituteInPlace $out/bin/aa-notify \
|
||||
--replace /usr/bin/notify-send ${libnotify}/bin/notify-send \
|
||||
--replace /usr/bin/perl "${perl}/bin/perl -I ${libapparmor}/${perl.libPrefix}"
|
||||
|
||||
substituteInPlace $out/bin/aa-remove-unknown \
|
||||
--replace "/lib/apparmor/rc.apparmor.functions" "${apparmor-parser}/lib/apparmor/rc.apparmor.functions"
|
||||
wrapProgram $out/bin/aa-remove-unknown \
|
||||
--prefix PATH : ${lib.makeBinPath [ gawk ]}
|
||||
|
||||
|
|
Loading…
Reference in a new issue