kicad: bunch of cleanup

add patch to ensure writability of created projects
  (upstream issue 12941)

disable the qa_eeschema test as it fails to find the ngspice lib
  which allows re-enabling tests as a whole on unstable
  there is a patch for this, but it still fails with something else...
  (upstream issue 12491)
  and remove ngspice workaround that doesn't work anymore

set meta.mainProgram
  since for kicad-unstable, the binary isn't called kicad-unstable
This commit is contained in:
Evils 2022-10-18 09:32:17 +02:00 committed by Bjørn Forsman
parent 1c3de7e308
commit 8a6772fee6
3 changed files with 64 additions and 8 deletions

View File

@ -33,6 +33,7 @@
, dbus
, at-spi2-core
, libXtst
, pcre2
, swig4
, python
@ -67,6 +68,11 @@ stdenv.mkDerivation rec {
src = kicadSrc;
patches = [
# upstream issue 12941 (attempted to upstream, but appreciably unacceptable)
./writable.patch
];
# tagged releases don't have "unknown"
# kicad nightlies use git describe --dirty
# nix removes .git, so its approximated here
@ -114,6 +120,9 @@ stdenv.mkDerivation rec {
]
++ optionals (!withPCM && stable) [
"-DKICAD_PCM=OFF"
]
++ optionals (!stable) [ # upstream issue 12491
"-DCMAKE_CTEST_ARGUMENTS='--exclude-regex;qa_eeschema'"
];
nativeBuildInputs = [
@ -136,6 +145,7 @@ stdenv.mkDerivation rec {
dbus
at-spi2-core
libXtst
pcre2
];
buildInputs = [
@ -162,14 +172,10 @@ stdenv.mkDerivation rec {
++ optional (withScripting) wxPython
++ optional (withNgspice) libngspice
++ optional (withOCC) opencascade-occt
++ optional (debug) valgrind
;
# started becoming necessary halfway into 2022, not sure what changed to break a test...
preInstallCheck = optionals (withNgspice) [ "export LD_LIBRARY_PATH=${libngspice}/lib" ];
++ optional (debug) valgrind;
# debug builds fail all but the python test
doInstallCheck = !(!stable || debug);
doInstallCheck = !(debug);
installCheckTarget = "test";
dontStrip = debug;

View File

@ -138,8 +138,7 @@ stdenv.mkDerivation rec {
++ optionals (withScripting)
[ python.pkgs.wrapPython ];
# We are emulating wrapGAppsHook, along with other variables to the
# wrapper
# We are emulating wrapGAppsHook, along with other variables to the wrapper
makeWrapperArgs = with passthru.libraries; [
"--prefix XDG_DATA_DIRS : ${base}/share"
"--prefix XDG_DATA_DIRS : ${hicolor-icon-theme}/share"
@ -231,5 +230,7 @@ stdenv.mkDerivation rec {
# as long as the base and libraries (minus 3d) are build,
# this wrapper does not need to get built
# the kicad-*small "packages" cause this to happen
mainProgram = "kicad";
};
}

View File

@ -0,0 +1,49 @@
commit 6a72fd032405515e468797be91b5a6ebcbbb5fd8
Author: Evils <evils.devils@protonmail.com>
Date: Wed Nov 23 19:49:13 2022 +0100
ensure new projects are writable
diff --git a/kicad/kicad_manager_frame.cpp b/kicad/kicad_manager_frame.cpp
index 7ee8090858..391514519c 100644
--- a/kicad/kicad_manager_frame.cpp
+++ b/kicad/kicad_manager_frame.cpp
@@ -638,6 +638,12 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
// wxFFile dtor will close the file
}
+
+ if( destFileName.IsOk() && !destFileName.IsFileWritable() )
+ {
+ destFileName.SetPermissions(0644);
+ }
+
}
}
diff --git a/kicad/project_template.cpp b/kicad/project_template.cpp
index bf951fcddb..2bef94326b 100644
--- a/kicad/project_template.cpp
+++ b/kicad/project_template.cpp
@@ -282,6 +282,21 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
result = false;
}
+ else if( !destFile.IsFileWritable() && !destFile.SetPermissions(0644) )
+ {
+ if( aErrorMsg )
+ {
+ if( !aErrorMsg->empty() )
+ *aErrorMsg += "\n";
+
+ wxString msg;
+
+ msg.Printf( _( "Cannot make file writable: '%s'." ), destFile.GetFullPath() );
+ *aErrorMsg += msg;
+ }
+
+ result = false;
+ }
}
return result;