mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
Merge pull request #136526 from smancill/shogun-remove-svmlight
shogun: remove non-distributable SVMlight code
This commit is contained in:
commit
9f5d7fa703
@ -8,6 +8,7 @@
|
||||
# extra support
|
||||
, pythonSupport ? true, pythonPackages ? null
|
||||
, opencvSupport ? false, opencv ? null
|
||||
, withSvmLight ? false
|
||||
}:
|
||||
|
||||
assert pythonSupport -> pythonPackages != null;
|
||||
@ -60,7 +61,7 @@ stdenv.mkDerivation rec {
|
||||
url = "https://github.com/awild82/shogun/commit/365ce4c4c700736d2eec8ba6c975327a5ac2cd9b.patch";
|
||||
sha256 = "158hqv4xzw648pmjbwrhxjp7qcppqa7kvriif87gn3zdn711c49s";
|
||||
})
|
||||
];
|
||||
] ++ lib.optional (!withSvmLight) ./svmlight-scrubber.patch;
|
||||
|
||||
CCACHE_DISABLE="1";
|
||||
CCACHE_DIR=".ccache";
|
||||
@ -86,12 +87,29 @@ stdenv.mkDerivation rec {
|
||||
(flag "CMAKE_VERBOSE_MAKEFILE:BOOL" doCheck)
|
||||
(flag "PythonModular" pythonSupport)
|
||||
(flag "OpenCV" opencvSupport)
|
||||
(flag "USE_SVMLIGHT" withSvmLight)
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Fix preprocessing SVMlight code
|
||||
sed -i \
|
||||
-e 's@#ifdef SVMLIGHT@#ifdef USE_SVMLIGHT@' \
|
||||
-e '/^#ifdef USE_SVMLIGHT/,/^#endif/ s@#endif@#endif //USE_SVMLIGHT@' \
|
||||
src/shogun/kernel/string/CommUlongStringKernel.cpp
|
||||
sed -i -e 's/#if USE_SVMLIGHT/#ifdef USE_SVMLIGHT/' src/interfaces/swig/Machine.i
|
||||
sed -i -e 's@// USE_SVMLIGHT@//USE_SVMLIGHT@' src/interfaces/swig/Transfer.i
|
||||
sed -i -e 's@/\* USE_SVMLIGHT \*/@//USE_SVMLIGHT@' src/interfaces/swig/Transfer_includes.i
|
||||
'' + lib.optionalString (!withSvmLight) ''
|
||||
# Run SVMlight scrubber
|
||||
patchShebangs scripts/light-scrubber.sh
|
||||
echo "removing SVMlight code"
|
||||
./scripts/light-scrubber.sh
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A toolbox which offers a wide range of efficient and unified machine learning methods";
|
||||
homepage = "http://shogun-toolbox.org/";
|
||||
license = licenses.gpl3;
|
||||
license = if withSvmLight then licenses.unfree else licenses.gpl3Plus;
|
||||
maintainers = with maintainers; [ edwtjo ];
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
From: Sebastián Mancilla <smancill@smancill.dev>
|
||||
Subject: Update SVMlight scrubber script
|
||||
|
||||
This requires previously fixing a few wrong preprocessor directives that
|
||||
are supposed to fence code using SVMlight.
|
||||
|
||||
- The script was too eager and removing *.light files in SVMlight format
|
||||
that are used by other tests. The code reading those files doesn't use
|
||||
any SVMlight code so it should be fine to keep it and run the tests.
|
||||
|
||||
- The Python test *domainadaptationsvm.py was not removed because of
|
||||
wrong globbing.
|
||||
|
||||
- Remove a couple of examples using SVMlight that were missed.
|
||||
|
||||
- The script is actually modifying (and breaking) itself because the
|
||||
grep for the USE_SVMLIGHT macro is too eager again and matches itself
|
||||
(and the version stored in upstream's Debian package control tarball
|
||||
is broken because of it). Just fix it by grepping for preprocessor
|
||||
directives only.
|
||||
|
||||
- No need to fix the Transfer_includes.i file in the script with a final
|
||||
%} when its preprocessor directives have been fixed.
|
||||
|
||||
- The Swig files were moved to a new directory at some point but the
|
||||
script was not updated accordingly.
|
||||
---
|
||||
scripts/light-scrubber.sh | 16 ++++++----------
|
||||
1 file changed, 6 insertions(+), 10 deletions(-)
|
||||
|
||||
diff a/scripts/light-scrubber.sh b/scripts/light-scrubber.sh
|
||||
--- a/scripts/light-scrubber.sh
|
||||
+++ b/scripts/light-scrubber.sh
|
||||
@@ -26,14 +26,16 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
-rm -rf examples/*/*/{*light*,*_domainadaptationsvm_*} \
|
||||
+rm -rf examples/*/*/{*light*.*,*domainadaptationsvm*} \
|
||||
examples/undocumented/matlab_and_octave/tests/*light* \
|
||||
+ examples/undocumented/python/serialization_string_kernels.py \
|
||||
+ examples/undocumented/python/mkl_binclass.py \
|
||||
src/shogun/classifier/svm/SVMLight.* \
|
||||
src/shogun/classifier/svm/SVMLightOneClass.* \
|
||||
src/shogun/regression/svr/SVRLight.* \
|
||||
doc/md/LICENSE_SVMlight*
|
||||
|
||||
-for _file in `grep -rl USE_SVMLIGHT .`
|
||||
+grep -rl '^#ifdef USE_SVMLIGHT' . | while read -r _file
|
||||
do
|
||||
sed -i.orig -e \
|
||||
'/\#ifdef USE_SVMLIGHT/,/\#endif \/\/USE_SVMLIGHT/c \\' ${_file} && \
|
||||
@@ -41,7 +43,7 @@ do
|
||||
rm -rf ${_file}.orig
|
||||
done
|
||||
|
||||
-for _file in `find . -depth -name 'CMakeLists.txt'`
|
||||
+find . -depth -name 'CMakeLists.txt' | while read -r _file
|
||||
do
|
||||
sed -i.orig -e 's!.*_sv[mr]light_.*!!g' ${_file} && \
|
||||
touch -r ${_file}.orig ${_file} && \
|
||||
@@ -56,13 +58,7 @@ do
|
||||
rm -rf ${_file}.orig
|
||||
done
|
||||
|
||||
-_file="src/interfaces/modular/Transfer_includes.i" && \
|
||||
-cp -a ${_file} ${_file}.orig && \
|
||||
-echo '%}' >> ${_file} && \
|
||||
-touch -r ${_file}.orig ${_file} && \
|
||||
-rm -rf ${_file}.orig
|
||||
-
|
||||
-_file="src/interfaces/modular/Machine.i" && \
|
||||
+_file="src/interfaces/swig/Machine.i" && \
|
||||
sed -i.orig -e '/.*CSVRLight.*/d' ${_file} && \
|
||||
touch -r ${_file}.orig ${_file} && \
|
||||
rm -rf ${_file}.orig
|
Loading…
Reference in New Issue
Block a user