From e18686e91c039be48238524f3f46c76e43d98902 Mon Sep 17 00:00:00 2001 From: Ding-Yi Chen Date: Wed, 7 Apr 2010 05:30:40 +0000 Subject: [PATCH] Upstream update to 2.91 --- import.log | 1 + libsvm-2.90.patch => libsvm-2.91.patch | 193 +++++++------------------ libsvm.spec | 16 +- log | 18 ++- sources | 2 +- 5 files changed, 86 insertions(+), 144 deletions(-) rename libsvm-2.90.patch => libsvm-2.91.patch (67%) diff --git a/import.log b/import.log index 4e039a7..40264dd 100644 --- a/import.log +++ b/import.log @@ -1,3 +1,4 @@ libsvm-2_89-4_fc11:EL-5:libsvm-2.89-4.fc11.src.rpm:1253237689 libsvm-2_90-1_fc11:EL-5:libsvm-2.90-1.fc11.src.rpm:1257318817 libsvm-2_90-2_fc11:EL-5:libsvm-2.90-2.fc11.src.rpm:1257397446 +libsvm-2_91-1_el5:EL-5:libsvm-2.91-1.el5.src.rpm:1270618213 diff --git a/libsvm-2.90.patch b/libsvm-2.91.patch similarity index 67% rename from libsvm-2.90.patch rename to libsvm-2.91.patch index 7fe6126..9867ae9 100644 --- a/libsvm-2.90.patch +++ b/libsvm-2.91.patch @@ -1,6 +1,6 @@ diff -up ./java/Makefile.orig ./java/Makefile --- ./java/Makefile.orig 2009-02-18 10:41:04.000000000 +1000 -+++ ./java/Makefile 2009-11-04 14:13:41.000000000 +1000 ++++ ./java/Makefile 2010-04-07 11:28:04.000000000 +1000 @@ -4,13 +4,21 @@ FILES = libsvm/svm.class libsvm/svm_mode libsvm/svm_print_interface.class \ svm_train.class svm_predict.class svm_toy.class svm_scale.class @@ -51,33 +51,32 @@ diff -up ./java/Makefile.orig ./java/Makefile rm *.class libsvm/*.class diff -up ./java/test_applet.html.orig ./java/test_applet.html --- ./java/test_applet.html.orig 2003-07-12 14:07:32.000000000 +1000 -+++ ./java/test_applet.html 2009-11-04 14:13:41.000000000 +1000 ++++ ./java/test_applet.html 2010-04-07 11:28:04.000000000 +1000 @@ -1 +1,3 @@ - + + + diff -up ./Makefile.orig ./Makefile ---- ./Makefile.orig 2009-07-01 07:13:50.000000000 +1000 -+++ ./Makefile 2009-11-04 14:13:41.000000000 +1000 -@@ -1,11 +1,40 @@ --CXX ?= g++ +--- ./Makefile.orig 2010-03-19 00:54:02.000000000 +1000 ++++ ./Makefile 2010-04-07 11:28:04.000000000 +1000 +@@ -1,11 +1,39 @@ + CXX ?= g++ -CFLAGS = -Wall -Wconversion -O3 -fPIC -+CXX ? = g++ +CFLAGS = ${RPM_CFLAGS} -Wall -Wconversion -O3 -fPIC SHVER = 1 +MAKE = make +DOT_LIBS=.libs +LIBS= -L${DOT_LIBS} -lsvm +export LIBSVM_VER - --all: svm-train svm-predict svm-scale ++ +ifndef DESTDIR +INSTDIR=/usr +else +INSTDIR=${DESTDIR}/usr +endif -+ + +-all: svm-train svm-predict svm-scale +export INSTDIR + +IS_64=$(shell /bin/uname -i | awk '/64/ {print 64}') @@ -95,32 +94,33 @@ diff -up ./Makefile.orig ./Makefile +export LIBDIR +export LIB_INSTDIR + -+ +all: lib svm-train svm-predict svm-scale svm-python svm-java svm-toy-gtk svm-toy-qt lib: svm.o -- $(CXX) -shared svm.o -o libsvm.so.$(SHVER) +- $(CXX) -shared -dynamiclib svm.o -o libsvm.so.$(SHVER) + $(CXX) -shared -Wl,-soname,libsvm.so.$(SHVER) svm.o -o libsvm.so.$(SHVER) + ln -sf libsvm.so.$(SHVER) libsvm.so svm-predict: svm-predict.c svm.o $(CXX) $(CFLAGS) svm-predict.c svm.o -o svm-predict -lm -@@ -16,4 +45,65 @@ svm-scale: svm-scale.c +@@ -16,4 +44,65 @@ svm-scale: svm-scale.c svm.o: svm.cpp svm.h $(CXX) $(CFLAGS) -c svm.cpp clean: -- rm -f *~ svm.o svm-train svm-predict svm-scale +- rm -f *~ svm.o svm-train svm-predict svm-scale libsvm.so.$(SHVER) + rm -f *~ svm.o svm-train svm-predict svm-scale svm-toy/gtk/svm-toy-gtk svm-toy/qt/svm-toy-qt + ${MAKE} -C python clean + ${MAKE} -C java clean +svm-python: + ${MAKE} -C python ++ +svm-java: +ifneq ("${NO_JAVA}","NO_JAVA") + ${MAKE} -C java +endif +svm-toy-gtk: + ${MAKE} -C svm-toy/gtk ++ +svm-toy-qt: + ${MAKE} -C svm-toy/qt + @@ -170,14 +170,30 @@ diff -up ./Makefile.orig ./Makefile +endif + rm -f ${INSTDIR}/bin/svm-toy-gtk + rm -f ${INSTDIR}/bin/svm-toy-qt +diff -up ./python/Makefile.orig ./python/Makefile +--- ./python/Makefile.orig 2010-03-19 01:57:28.000000000 +1000 ++++ ./python/Makefile 2010-04-07 11:28:04.000000000 +1000 +@@ -1,4 +1,15 @@ +-all = lib ++PYTHON_PATH ?= python${PYTHON_VERSION}/site-packages/libsvm ++PYTHON_TARGETDIR=${LIB_INSTDIR}/${PYTHON_PATH} + ++all: lib + + lib: ../svm.cpp ../svm.h + cd ..; make lib; cd - + -diff -up ./python/Makefile.orig ./python/Makefile ---- ./python/Makefile.orig 2009-09-16 23:37:45.000000000 +1000 -+++ ./python/Makefile 2009-11-04 14:15:06.000000000 +1000 -@@ -1,10 +1,12 @@ --CXX ?= g++ -+CXX ? = g++ ++install: all ++ mkdir -p ${PYTHON_TARGETDIR} ++ install -m 755 *.py ${PYTHON_TARGETDIR} ++ install -m 755 ../tools/*.py ${PYTHON_TARGETDIR} ++ ++uninstall: ++ rm -fr ${LIBDIR}/${PYTHON_PATH} +diff -up ./python_old/Makefile.orig ./python_old/Makefile +--- ./python_old/Makefile.orig 2009-09-16 23:37:45.000000000 +1000 ++++ ./python_old/Makefile 2010-04-07 11:28:04.000000000 +1000 +@@ -2,9 +2,11 @@ CXX ?= g++ SWIG ?= swig #Windows: see ../README ../Makefile.win @@ -186,32 +202,15 @@ diff -up ./python/Makefile.orig ./python/Makefile +PYTHON_TARGETDIR=${LIB_INSTDIR}/python${PYTHON_VERSION}/site-packages/libsvm CFLAGS = -O3 -I$(PYTHON_INCLUDEDIR) -I.. -+CFLAGS_PYTHON = ${CFLAGS} -O3 -I$(PYTHON_INCLUDEDIR) -I.. ++ LDFLAGS = -shared # Mac OS # LDFLAGS = -framework Python -bundle -@@ -15,16 +17,31 @@ svmc.so: svmc_wrap.o ../svm.o - $(CXX) $(LDFLAGS) -o svmc.so svmc_wrap.o ../svm.o - - svmc_wrap.o: svmc_wrap.c ../svm.h -- $(CXX) $(CFLAGS) -fPIC -c svmc_wrap.c -+ $(CXX) $(CFLAGS_PYTHON) -fPIC -c svmc_wrap.c - - svmc_wrap.c: svmc.i - $(SWIG) -python -noproxy svmc.i +@@ -28,3 +30,16 @@ clean: - ../svm.o: ../svm.cpp ../svm.h -- cd ..; $(CXX) $(CFLAGS) -fPIC -c svm.cpp -+ cd ..; $(CXX) $(CFLAGS_PYTHON) -fPIC -c svm.cpp - - clean: - rm -f *~ *.o *.so *.pyc *.pyo - --cleaner: clean -+cleaner: clean + cleaner: clean rm -f svmc_wrap.c + -+ +install: all + mkdir -p ${PYTHON_TARGETDIR} + install -m 755 cross_validation.py ${PYTHON_TARGETDIR} @@ -224,10 +223,9 @@ diff -up ./python/Makefile.orig ./python/Makefile + +uninstall: + rm -fr ${LIBDIR}/python${PYTHON_VERSION}/site-packages/libsvm -+ diff -up ./svm-toy/gtk/callbacks.cpp.orig ./svm-toy/gtk/callbacks.cpp --- ./svm-toy/gtk/callbacks.cpp.orig 2006-03-04 17:40:12.000000000 +1000 -+++ ./svm-toy/gtk/callbacks.cpp 2009-11-04 14:13:41.000000000 +1000 ++++ ./svm-toy/gtk/callbacks.cpp 2010-04-07 11:28:04.000000000 +1000 @@ -2,6 +2,7 @@ #include #include @@ -238,7 +236,7 @@ diff -up ./svm-toy/gtk/callbacks.cpp.orig ./svm-toy/gtk/callbacks.cpp #include "../../svm.h" diff -up ./svm-toy/gtk/Makefile.orig ./svm-toy/gtk/Makefile --- ./svm-toy/gtk/Makefile.orig 2007-10-14 16:29:12.000000000 +1000 -+++ ./svm-toy/gtk/Makefile 2009-11-04 14:13:41.000000000 +1000 ++++ ./svm-toy/gtk/Makefile 2010-04-07 11:28:04.000000000 +1000 @@ -2,21 +2,27 @@ CC? = gcc CXX? = g++ CFLAGS = -Wall -O3 -g `gtk-config --cflags` @@ -277,7 +275,7 @@ diff -up ./svm-toy/gtk/Makefile.orig ./svm-toy/gtk/Makefile + rm -f *~ callbacks.o svm-toy-gtk main.o interface.o callbacks.o diff -up ./svm-toy/qt/Makefile.orig ./svm-toy/qt/Makefile --- ./svm-toy/qt/Makefile.orig 2008-12-19 16:42:05.000000000 +1000 -+++ ./svm-toy/qt/Makefile 2009-11-04 14:13:41.000000000 +1000 ++++ ./svm-toy/qt/Makefile 2010-04-07 11:28:04.000000000 +1000 @@ -1,17 +1,21 @@ CXX? = g++ -CFLAGS = -Wall -O3 -I$(INCLUDE) -I$(INCLUDE)/QtGui -lQtGui @@ -310,7 +308,7 @@ diff -up ./svm-toy/qt/Makefile.orig ./svm-toy/qt/Makefile diff -up ./tools/easy.py.orig ./tools/easy.py --- ./tools/easy.py.orig 2009-05-14 15:09:29.000000000 +1000 -+++ ./tools/easy.py 2009-11-04 14:13:41.000000000 +1000 ++++ ./tools/easy.py 2010-04-07 11:28:04.000000000 +1000 @@ -2,6 +2,7 @@ import sys @@ -335,17 +333,9 @@ diff -up ./tools/easy.py.orig ./tools/easy.py else: # example for windows diff -up ./tools/grid.py.orig ./tools/grid.py ---- ./tools/grid.py.orig 2009-05-14 15:09:29.000000000 +1000 -+++ ./tools/grid.py 2009-11-04 14:13:41.000000000 +1000 -@@ -1,7 +1,5 @@ - #!/usr/bin/env python - -- -- - import os, sys, traceback - import getpass - from threading import Thread -@@ -17,7 +15,7 @@ else: +--- ./tools/grid.py.orig 2009-11-20 22:29:46.000000000 +1000 ++++ ./tools/grid.py 2010-04-07 14:14:21.000000000 +1000 +@@ -17,7 +17,7 @@ else: is_win32 = (sys.platform == 'win32') if not is_win32: @@ -354,107 +344,36 @@ diff -up ./tools/grid.py.orig ./tools/grid.py gnuplot_exe = "/usr/bin/gnuplot" else: # example for windows -@@ -74,7 +72,7 @@ Usage: grid.py [-log2c begin,end,step] [ - i = i + 1 - fold = argv[i] - elif argv[i] in ('-c','-g'): -- print("Option -c and -g are renamed.") -+ print "Option -c and -g are renamed." - print(usage) - sys.exit(1) - elif argv[i] == '-svmtrain': -@@ -93,7 +91,8 @@ Usage: grid.py [-log2c begin,end,step] [ - pass_through_options.append(argv[i]) - i = i + 1 - -- pass_through_string = " ".join(pass_through_options) -+ pass_through_string = " ".join(pass_through_options," ") -+ print 'dataset_pathname=%s' % dataset_pathname - assert os.path.exists(svmtrain_exe),"svm-train executable not found" - assert os.path.exists(gnuplot_exe),"gnuplot executable not found" - assert os.path.exists(dataset_pathname),"dataset not found" -@@ -127,7 +126,9 @@ def permute_sequence(seq): - - def redraw(db,best_param,tofile=False): - if len(db) == 0: return -- begin_level = round(max(x[2] for x in db)) - 3 -+ begin_level = round(max(x[2] for x in db)) - 3 -+ -+ begin_level = round(max(map(lambda(x):x[2],db))) - 3 - step_size = 0.5 - - best_log2c,best_log2g,best_rate = best_param -@@ -158,12 +159,12 @@ def redraw(db,best_param,tofile=False): +@@ -158,10 +158,10 @@ def redraw(db,best_param,tofile=False): gnuplot.write(("set label \"C = %s gamma = %s\"" " at screen 0.5,0.8 center\n" % (2**best_log2c, 2**best_log2g)).encode()) gnuplot.write("splot \"-\" with lines\n".encode()) - -- -- + + - -+ -+ -+ -+ ++ ++ db.sort(key = lambda x:(x[0], -x[1])) -- -+ + prevc = db[0][0] - for line in db: - if prevc != line[0]: -@@ -222,9 +223,7 @@ class Worker(Thread): +@@ -222,9 +222,9 @@ class Worker(Thread): if rate is None: raise "get no rate" except: # we failed, let others do that and we just quit - ++ traceback.print_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]) - ++ self.job_queue.put((cexp,gexp)) print('worker %s quit.' % self.name) break -@@ -251,8 +250,8 @@ class SSHWorker(Worker): - svmtrain_exe,c,g,fold,pass_through_string,dataset_pathname) - result = Popen(cmdline,shell=True,stdout=PIPE).stdout - for line in result.readlines(): -- if str(line).find("Cross") != -1: -- return float(line.split()[-1][0:-1]) -+ if find(line,"Cross") != -1: -+ return float(split(line)[-1][0:-1]) - - class TelnetWorker(Worker): - def __init__(self,name,job_queue,result_queue,host,username,password): -@@ -302,7 +301,6 @@ def main(): +@@ -331,7 +331,6 @@ def main(): - job_queue._put = job_queue.queue.appendleft - -- - # fire telnet workers - - if telnet_workers: -@@ -328,10 +326,8 @@ def main(): - - done_jobs = {} - -- result_file = open(out_filename, 'w') - db = [] best_rate = -1 best_c1,best_g1 = None,None -@@ -343,13 +339,14 @@ def main(): - done_jobs[(c1,g1)] = rate - result_file.write('%s %s %s\n' %(c1,g1,rate)) - result_file.flush() -+ print "[%s] %s %s %s" % (worker,c1,g1,rate), - if (rate > best_rate) or (rate==best_rate and g1==best_g1 and c1 - 2.91-1 +- Fixed Bug 564887 - FTBFS libsvm-2.90-3.fc13 +- Upstream update: + * completely new python interface using ctype + * new way to set the print_string function + * Java: able to load model from a BufferedReader directly + * fix grid.py so -log2c can be run under python 2.6 or after + * Thu Nov 05 2009 Ding-Yi Chen - 2.90-2 - Obsoletes libsvm-java for ppc and ppc64. diff --git a/log b/log index 330b6e3..607ab9d 100644 --- a/log +++ b/log @@ -166,8 +166,22 @@ file updated. easy.py: popel.communiate() to avoid some deadlock (if lots of outputs when #classes is large) -2.9: 2009/11/? +2.9: 2009/11/1 tools/*.py can be run under python 3.0 svm_set_quiet() in python interface to disable outputs check gamma < 0 - internal functions to be static \ No newline at end of file + internal functions to be static + +2.91: 2010/04/01 + completely new python interface using ctype + new way to set the print_string function + Java: able to load model from a BufferedReader directly + fix grid.py so -log2c can be run under python 2.6 or after + +------------------ + +Future plan: +?.?: + old python interface is removed + + update make.m of matlab interface to use max(...) \ No newline at end of file diff --git a/sources b/sources index ad1329e..d04a0f0 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ aae7a8f7e357e86e1c893b706bb02a63 guide.pdf -c48109c825d8326d71c8c8564589736d libsvm-2.9.tar.gz +aec07b9142ce585c95854ed379538154 libsvm-2.91.tar.gz