Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz
authorDennis Schafroth <dennis@indexdata.com>
Fri, 18 Feb 2011 12:48:18 +0000 (13:48 +0100)
committerDennis Schafroth <dennis@indexdata.com>
Fri, 18 Feb 2011 12:48:18 +0000 (13:48 +0100)
NEWS
configure.ac
debian/changelog
doc/entities.ent
src/Makefile.am
src/seshigh.c
test/.gitignore
test/Makefile.am
test/test_libstemmer.c [new file with mode: 0644]
yaz-config.in
yaz.spec

diff --git a/NEWS b/NEWS
index 86e4e39..ff42413 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,20 @@
+--- 4.1.3 2011/01/27
+
+Update yaz.spec to operate on both SLES11 / Centos 5.5.
+
+RPM: Release includes 'indexdata' name. Use indexdata in release name so
+this package can be distinguished from other vendors.
+
+yaz-config: Use exec_prefix, libdir, includedir .  Use these variables
+as determined by configure
+
+yaz-config: set YAZ_VERSION env. php_yaz relies on it.
+
+GFS: Z_PresentStatus_partial_4 for missing record. If bend_fetch handler
+returns no error and no record, the present request is considered
+partial (only a subset of the records could be returned by backend), and
+so it is appropriate to set Present Status to partial-4.
+
 --- 4.1.2 2010/11/02
 
 Move yaz-config man pages to section 1.
index 02c118f..d6cd276 100644 (file)
@@ -1,7 +1,7 @@
 dnl This file is part of the YAZ toolkit.
 dnl Copyright (C) 1995-2011 Index Data
 AC_PREREQ([2.60])
-AC_INIT([yaz],[4.1.2],[yaz-help@indexdata.dk])
+AC_INIT([yaz],[4.1.3],[yaz-help@indexdata.dk])
 AC_CONFIG_HEADERS(include/config.h)
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_AUX_DIR([config])
index 7bc857c..b3d30a9 100644 (file)
@@ -1,3 +1,9 @@
+yaz (4.1.3-1indexdata) unstable; urgency=low
+
+  * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk>  Thu, 27 Jan 2011 13:56:54 +0100
+
 yaz (4.1.2-1indexdata) unstable; urgency=low
 
   * Upstream.
index c5afda8..5f310e9 100644 (file)
@@ -26,4 +26,4 @@
 <!ENTITY gfs-synopsis-app "application">
 <!ENTITY reference-tools-cql-map "<xref linkend='cql.to.rpn'/>">
 <!ENTITY reference-tools-ccl-qualifiers "<xref linkend='ccl.qualifiers'/>">
-<!ENTITY copyright-year "1995-2010">
+<!ENTITY copyright-year "1995-2011">
index 365e2f0..5aeb22c 100644 (file)
@@ -28,7 +28,7 @@ YAZCOMP_I = $(YAZCOMP) -d $(srcdir)/ill.tcl -i yaz -I$(top_srcdir)/include
 AM_CPPFLAGS=-I$(top_srcdir)/include $(XML2_CFLAGS) $(SSL_CFLAGS) 
 libyaz_la_LIBADD = $(SSL_LIBS) $(TCPD_LIBS)
 libyaz_server_la_LIBADD = libyaz.la
-libyaz_icu_la_CPPFLAGS = $(AM_CPPFLAGS) $(ICU_CPPFLAGS) -I../libstemmer_c/include
+libyaz_icu_la_CPPFLAGS = $(AM_CPPFLAGS) $(ICU_CPPFLAGS) -I$(top_srcdir)/libstemmer_c/include
 libyaz_icu_la_LIBADD = libyaz.la $(ICU_LIBS)
 
 AM_YFLAGS=-p cql_
index 5d2df23..e739d3a 100644 (file)
@@ -2505,6 +2505,7 @@ static Z_Records *pack_records(association *a, char *setname, Odr_int start,
         }
         if (freq.record == 0)  /* no error and no record ? */
         {
+            *pres = Z_PresentStatus_partial_4;
             *next = 0;   /* signal end-of-set and stop */
             break;
         }
index 90d4151..cc7ce27 100644 (file)
@@ -34,6 +34,7 @@ test_oid
 test_file_glob
 test_log_thread
 test_mutex
+test_libstemmer
 *.log
 *.o
 *~
index 1974a30..5e92f72 100644 (file)
@@ -7,7 +7,7 @@ check_PROGRAMS = test_xmalloc test_iconv test_nmem test_matchstr test_wrbuf \
  test_comstack test_filepath test_record_conv test_retrieval test_tpath \
  test_timing test_query_charset test_oid test_icu test_match_glob \
  test_rpn2cql test_rpn2solr test_json test_xml_include test_file_glob \
- test_shared_ptr
+ test_shared_ptr test_libstemmer
 
 check_SCRIPTS = tstmarc.sh tstmarccol.sh tstcql2xcql.sh tstcql2pqf.sh tsticu.sh
 
@@ -48,8 +48,9 @@ dist-hook:
 test_odrcodec.c test_odrcodec.h: tstodr.asn $(YAZCOMP)
        cd $(srcdir); $(YAZCOMP) tstodr.asn
 
-LDADD = ../src/libyaz.la
+LDADD = ../src/libyaz.la 
 test_icu_LDADD = ../src/libyaz_icu.la ../src/libyaz.la $(ICU_LIBS)
+test_libstemmer_LDADD = ../src/libyaz_icu.la ../src/libyaz.la $(ICU_LIBS)
 
 CONFIG_CLEAN_FILES=*.log
 
@@ -84,3 +85,4 @@ test_json_SOURCES = test_json.c
 test_xml_include_SOURCES = test_xml_include.c
 test_file_glob_SOURCES = test_file_glob.c
 test_shared_ptr_SOURCES = test_shared_ptr.c
+test_libstemmer_SOURCES = test_libstemmer.c
diff --git a/test/test_libstemmer.c b/test/test_libstemmer.c
new file mode 100644 (file)
index 0000000..a2ea678
--- /dev/null
@@ -0,0 +1,83 @@
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2011 Index Data
+ * See the file LICENSE for details.
+ */
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <yaz/test.h>
+
+#if YAZ_HAVE_ICU
+#include <yaz/stemmer.h>
+
+int test_stemmer_stem(yaz_stemmer_p stemmer, const char* to_stem, const char *expected) 
+{
+    struct icu_buf_utf16 *src  = icu_buf_utf16_create(0);
+    struct icu_buf_utf16 *dst  = icu_buf_utf16_create(0);
+    struct icu_buf_utf8  *dst8 = icu_buf_utf8_create(0);
+
+    UErrorCode status; 
+    const char *result;
+    icu_utf16_from_utf8_cstr(src, to_stem, &status);
+    yaz_stemmer_stem(stemmer, dst, src, &status); 
+    /* Assume fail */
+    int rc = 0;
+    if (status == U_ZERO_ERROR) {
+        icu_utf16_to_utf8(dst8, dst, &status);
+        result = icu_buf_utf8_to_cstr(dst8);
+        rc = strcmp(result, expected) == 0;
+    }
+    icu_buf_utf8_destroy(dst8);
+    icu_buf_utf16_destroy(src);
+    icu_buf_utf16_destroy(dst);
+    return rc;
+}
+
+
+static void tst(void)
+{
+    UErrorCode status;
+    //== U_ZERO_ERROR; 
+    yaz_stemmer_p stemmer = yaz_stemmer_create("en", "porter", &status);
+    YAZ_CHECK(stemmer); 
+
+    /* fail  */
+    YAZ_CHECK(test_stemmer_stem(stemmer, "beer", "water") == 0 ); 
+
+    /* Same */
+    YAZ_CHECK(test_stemmer_stem(stemmer, "adadwwr", "adadwwr")); 
+
+    /* Remove S */
+    YAZ_CHECK(test_stemmer_stem(stemmer, "beers", "beer")); 
+    YAZ_CHECK(test_stemmer_stem(stemmer, "persons", "person")); 
+
+    /* Remove s and ing  */
+    YAZ_CHECK(test_stemmer_stem(stemmer, "runs", "run")); 
+    YAZ_CHECK(test_stemmer_stem(stemmer, "running", "run")); 
+
+    yaz_stemmer_destroy(stemmer);
+}
+#endif
+
+int main (int argc, char **argv)
+{
+    YAZ_CHECK_INIT(argc, argv);
+#if YAZ_HAVE_ICU
+    tst();
+#endif
+    YAZ_CHECK_TERM;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 0fc5208..9553d94 100644 (file)
@@ -19,6 +19,7 @@ ICU_CPPFLAGS="@ICU_CPPFLAGS@"
 SSL_LIBS="@SSL_LIBS@"
 LIBS="@LIBS@"
 VERSION=@VERSION@
+YAZVERSION=$VERSION
 VERSION_SHA1=@VERSION_SHA1@
 
 usage()
index a5205c4..e0c1052 100644 (file)
--- a/yaz.spec
+++ b/yaz.spec
@@ -1,7 +1,18 @@
-Summary: Z39.50 Programs
+# This file is part of the YAZ toolkit
+# Copyright (C) 1995-2011 Index Data
+#
+# spec file for YAZ
+
 Name: yaz
-Version: 4.1.2
-Release: 1
+Summary: Z39.50 Programs
+Version: 4.1.3
+Release: 1indexdata
+
+# determine system
+%define is_mandrake %(test -e /etc/mandrake-release && echo 1 || echo 0)
+%define is_suse %(test -e /etc/SuSE-release >/dev/null && echo 1 || echo 0)
+%define is_suse11 %(grep 'VERSION = 11' /etc/SuSE-release >/dev/null 2>&1 && echo 1 || echo 0)
+%define is_fedora %(test -e /etc/fedora-release && echo 1 || echo 0)
 Requires: libxslt, gnutls, readline, libyaz4 = %{version}
 License: BSD
 Group: Applications/Internet
@@ -9,12 +20,30 @@ Vendor: Index Data ApS <info@indexdata.dk>
 Source: yaz-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 Prefix: %{_prefix}
-%define TCPWRAPPER tcpd-devel
-%if "%{_vendor}" == "redhat"
-# Fedora requires tcp_wrappers-devel .
+
 %define TCPWRAPPER tcp_wrappers
+
+%if %is_fedora
+%define TCPWRAPPER tcp_wrappers-devel
 %endif
-BuildRequires: pkgconfig, libxml2-devel, libxslt-devel, gnutls-devel, readline-devel, libicu-devel, %{TCPWRAPPER}
+
+%if %is_suse
+%define TCPWRAPPER tcpd-devel
+%endif
+
+BuildRequires: %{TCPWRAPPER}
+
+%if %is_suse11
+BuildRequires: libgnutls-devel
+%else
+BuildRequires: gnutls-devel
+%endif
+
+BuildRequires: pkgconfig
+BuildRequires: libxml2-devel
+BuildRequires: libxslt-devel
+BuildRequires: readline-devel
+BuildRequires: libicu-devel
 Packager: Adam Dickmeiss <adam@indexdata.dk>
 URL: http://www.indexdata.com/yaz