1From: Sebastián Mancilla <smancill@smancill.dev>
2Subject: Update SVMlight scrubber script
3
4This requires previously fixing a few wrong preprocessor directives that
5are supposed to fence code using SVMlight.
6
7- The script was too eager and removing *.light files in SVMlight format
8 that are used by other tests. The code reading those files doesn't use
9 any SVMlight code so it should be fine to keep it and run the tests.
10
11- The Python test *domainadaptationsvm.py was not removed because of
12 wrong globbing.
13
14- Remove a couple of examples using SVMlight that were missed.
15
16- The script is actually modifying (and breaking) itself because the
17 grep for the USE_SVMLIGHT macro is too eager again and matches itself
18 (and the version stored in upstream's Debian package control tarball
19 is broken because of it). Just fix it by grepping for preprocessor
20 directives only.
21
22- No need to fix the Transfer_includes.i file in the script with a final
23 %} when its preprocessor directives have been fixed.
24
25- The Swig files were moved to a new directory at some point but the
26 script was not updated accordingly.
27---
28 scripts/light-scrubber.sh | 16 ++++++----------
29 1 file changed, 6 insertions(+), 10 deletions(-)
30
31diff a/scripts/light-scrubber.sh b/scripts/light-scrubber.sh
32--- a/scripts/light-scrubber.sh
33+++ b/scripts/light-scrubber.sh
34@@ -26,14 +26,16 @@
35 # You should have received a copy of the GNU General Public License
36 # along with this program. If not, see <http://www.gnu.org/licenses/>.
37 #
38-rm -rf examples/*/*/{*light*,*_domainadaptationsvm_*} \
39+rm -rf examples/*/*/{*light*.*,*domainadaptationsvm*} \
40 examples/undocumented/matlab_and_octave/tests/*light* \
41+ examples/undocumented/python/serialization_string_kernels.py \
42+ examples/undocumented/python/mkl_binclass.py \
43 src/shogun/classifier/svm/SVMLight.* \
44 src/shogun/classifier/svm/SVMLightOneClass.* \
45 src/shogun/regression/svr/SVRLight.* \
46 doc/md/LICENSE_SVMlight*
47
48-for _file in `grep -rl USE_SVMLIGHT .`
49+grep -rl '^#ifdef USE_SVMLIGHT' . | while read -r _file
50 do
51 sed -i.orig -e \
52 '/\#ifdef USE_SVMLIGHT/,/\#endif \/\/USE_SVMLIGHT/c \\' ${_file} && \
53@@ -41,7 +43,7 @@ do
54 rm -rf ${_file}.orig
55 done
56
57-for _file in `find . -depth -name 'CMakeLists.txt'`
58+find . -depth -name 'CMakeLists.txt' | while read -r _file
59 do
60 sed -i.orig -e 's!.*_sv[mr]light_.*!!g' ${_file} && \
61 touch -r ${_file}.orig ${_file} && \
62@@ -56,13 +58,7 @@ do
63 rm -rf ${_file}.orig
64 done
65
66-_file="src/interfaces/modular/Transfer_includes.i" && \
67-cp -a ${_file} ${_file}.orig && \
68-echo '%}' >> ${_file} && \
69-touch -r ${_file}.orig ${_file} && \
70-rm -rf ${_file}.orig
71-
72-_file="src/interfaces/modular/Machine.i" && \
73+_file="src/interfaces/swig/Machine.i" && \
74 sed -i.orig -e '/.*CSVRLight.*/d' ${_file} && \
75 touch -r ${_file}.orig ${_file} && \
76 rm -rf ${_file}.orig