!1 init package to openeuler

From: @loong-C 
Reviewed-by: @weidongkl 
Signed-off-by: @weidongkl
This commit is contained in:
openeuler-ci-bot 2022-07-25 07:15:13 +00:00 committed by Gitee
commit 6ee3a7b419
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 266 additions and 0 deletions

View File

@ -0,0 +1,78 @@
From 972c9cb37457c70530610c22a5f3ff68adf3bd5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= <vaclav@slavik.io>
Date: Tue, 3 Feb 2015 18:22:25 +0100
Subject: [PATCH 1/6] Fix FSDirectory::sync() to sync writes to disk
Contrary to the documentation, FSDirectory::sync() conversion to C++
omitted the most important line of the Java original: actually fsyncing
the file descriptor. As the result, its current code amounts to little
more than a little nonsensical noop dance.
Add the missing fsync() call. Use fsync() on Unix, its
FlushFileBuffers() equivalent on Windows, and F_FULLFSYNC on OS X where
fsync() is documented as not always sufficient. F_FULLFSYNC is more
expensive than fsync(), but guarantees physical write; SQLite uses it
too.
---
src/core/store/FSDirectory.cpp | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/core/store/FSDirectory.cpp b/src/core/store/FSDirectory.cpp
index 82b5736..2cb257a 100644
--- a/src/core/store/FSDirectory.cpp
+++ b/src/core/store/FSDirectory.cpp
@@ -5,7 +5,6 @@
/////////////////////////////////////////////////////////////////////////////
#include "LuceneInc.h"
-#include <boost/filesystem/fstream.hpp>
#include "FSDirectory.h"
#include "NativeFSLockFactory.h"
#include "SimpleFSDirectory.h"
@@ -14,6 +13,15 @@
#include "FileUtils.h"
#include "StringUtils.h"
+#if defined(_WIN32)
+ #include <windows.h>
+#elif defined(__APPLE__)
+ #include <fcntl.h>
+#else
+ #include <unistd.h>
+#endif
+#include <boost/iostreams/device/file_descriptor.hpp>
+
extern "C"
{
#include "../util/md5/md5.h"
@@ -148,15 +156,24 @@ void FSDirectory::sync(const String& name) {
bool success = false;
for (int32_t retryCount = 0; retryCount < 5; ++retryCount) {
- boost::filesystem::ofstream syncFile;
+ boost::iostreams::file_descriptor syncFile;
try {
- syncFile.open(path, std::ios::binary | std::ios::in | std::ios::out);
+ syncFile.open(boost::filesystem::path(path));
} catch (...) {
}
if (syncFile.is_open()) {
+ boost::iostreams::file_descriptor::handle_type fd = syncFile.handle();
+#if defined(_WIN32)
+ bool ok = ::FlushFileBuffers(fd) != 0;
+#elif defined(__APPLE__)
+ bool ok = fcntl(fd, F_FULLFSYNC) == 0;
+#else
+ bool ok = fsync(fd) == 0;
+#endif
syncFile.close();
- success = true;
+ if (ok)
+ success = true;
break;
}
--
2.3.6

View File

@ -0,0 +1,25 @@
From a02e5b6d422191a3674b13f1becf9c2ec90e83a5 Mon Sep 17 00:00:00 2001
From: gbjbaanb <gbjbaanb@users.sourceforce.net>
Date: Tue, 24 Mar 2015 15:17:28 +0000
Subject: [PATCH 2/6] minor fix to allow full lines to be input to demo queries
---
src/demo/searchfiles/main.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/demo/searchfiles/main.cpp b/src/demo/searchfiles/main.cpp
index de4d303..748003c 100644
--- a/src/demo/searchfiles/main.cpp
+++ b/src/demo/searchfiles/main.cpp
@@ -265,7 +265,7 @@ int main(int argc, char* argv[]) {
}
} else {
std::wcout << L"Enter query: ";
- std::wcin >> line;
+ getline(std::wcin, line);
}
boost::trim(line);
--
2.3.6

View File

@ -0,0 +1,25 @@
From 229f783749283d1ec2bed4593805f7a8458ab819 Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <uwelk@xhochy.com>
Date: Mon, 6 Apr 2015 16:48:16 +0200
Subject: [PATCH 5/6] Use maxSize of BooleanQuery as base for the queue size
---
src/core/search/FuzzyQuery.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/search/FuzzyQuery.cpp b/src/core/search/FuzzyQuery.cpp
index 5291995..38e1bf2 100644
--- a/src/core/search/FuzzyQuery.cpp
+++ b/src/core/search/FuzzyQuery.cpp
@@ -83,7 +83,7 @@ QueryPtr FuzzyQuery::rewrite(const IndexReaderPtr& reader) {
}
int32_t maxSize = BooleanQuery::getMaxClauseCount();
- ScoreTermQueuePtr stQueue(newLucene<ScoreTermQueue>(1024));
+ ScoreTermQueuePtr stQueue(newLucene<ScoreTermQueue>(maxSize + 1));
FilteredTermEnumPtr enumerator(getEnum(reader));
LuceneException finally;
try {
--
2.3.6

View File

@ -0,0 +1,54 @@
From dd6ba769ea8b411d6e09720dfe7f38d027d8f8fc Mon Sep 17 00:00:00 2001
From: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
Date: Tue, 28 Apr 2015 09:31:35 +0200
Subject: [PATCH 6/6] Fix packageconfig path. Rationale: LIB_DESTINATION is set
as CMAKE_INSTALL_FULL_LIBDIR. So repeating "{prefix}" results in a double
usr/usr inclusion
---
liblucene++-contrib.pc.cmake | 4 ++--
liblucene++.pc.cmake | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/liblucene++-contrib.pc.cmake b/liblucene++-contrib.pc.cmake
index 98b6381..21026e0 100644
--- a/liblucene++-contrib.pc.cmake
+++ b/liblucene++-contrib.pc.cmake
@@ -1,13 +1,13 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}/bin
-libdir=${prefix}/@LIB_DESTINATION@
+libdir=@LIB_DESTINATION@
includedir=${prefix}/include/lucene++
lib=lucene++-contrib
Name: liblucene++-contrib
Description: Contributions for Lucene++ - a C++ search engine, ported from the popular Apache Lucene
Version: @lucene++_VERSION@
-Libs: -L${prefix}/@LIB_DESTINATION@ -l${lib}
+Libs: -L@LIB_DESTINATION@ -l${lib}
Cflags: -I${includedir}
Requires: liblucene++ = @lucene++_VERSION@
diff --git a/liblucene++.pc.cmake b/liblucene++.pc.cmake
index c526d4a..32d16ad 100644
--- a/liblucene++.pc.cmake
+++ b/liblucene++.pc.cmake
@@ -1,12 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}/bin
-libdir=${prefix}/@LIB_DESTINATION@
+libdir=@LIB_DESTINATION@
includedir=${prefix}/include/lucene++
lib=lucene++
Name: liblucene++
Description: Lucene++ - a C++ search engine, ported from the popular Apache Lucene
Version: @lucene++_VERSION@
-Libs: -L${prefix}/@LIB_DESTINATION@ -l${lib}
+Libs: -L@LIB_DESTINATION@ -l${lib}
Cflags: -I${includedir}
--
2.3.6

View File

@ -0,0 +1,11 @@
--- LucenePlusPlus-rel_3.0.7/include/VariantUtils.h~ 2015-08-05 17:03:05.196684008 +0100
+++ LucenePlusPlus-rel_3.0.7/include/VariantUtils.h 2015-08-05 17:03:08.230687346 +0100
@@ -22,7 +22,7 @@
template <typename TYPE, typename VAR>
static TYPE get(VAR var) {
- return var.type() == typeid(TYPE) ? boost::get<TYPE>(var) : TYPE();
+ return var.type() == typeid(TYPE) ? boost::relaxed_get<TYPE>(var) : TYPE();
}
template <typename TYPE, typename VAR>

BIN
lucene++-3.0.7.tar.gz Normal file

Binary file not shown.

73
lucene++.spec Normal file
View File

@ -0,0 +1,73 @@
Name: lucene++
Summary: A high-performance, full-featured text search engine written in C++
Version: 3.0.7
Release: 1
License: ASL 2.0 or LGPLv3+
Url: https://github.com/luceneplusplus/LucenePlusPlus
Source: https://github.com/luceneplusplus/LucenePlusPlus/archive/rel_%{version}.tar.gz#/%{name}-%{version}.tar.gz
## upstream patches
Patch1: 0001-Fix-FSDirectory-sync-to-sync-writes-to-disk.patch
Patch2: 0002-minor-fix-to-allow-full-lines-to-be-input-to-demo-qu.patch
Patch5: 0005-Use-maxSize-of-BooleanQuery-as-base-for-the-queue-si.patch
Patch6: 0006-Fix-packageconfig-path.patch
Patch7: 0007-boost-1.58-variant.patch
BuildRequires: boost-devel
BuildRequires: cmake >= 2.8.6
BuildRequires: gcc-c++
BuildRequires: pkgconfig
BuildRequires: subversion
%description
An up to date C++ port of the popular Java Lucene library, a high-performance, full-featured text search engine.
%package devel
Summary: Development files for lucene++
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Development files for lucene++, a high-performance, full-featured text search engine written in C++
%prep
%autosetup -p1 -n LucenePlusPlus-rel_%{version}
%build
mkdir %{_target_platform}
pushd %{_target_platform}
%cmake .. \
-DCMAKE_BUILD_TYPE:String="release"
%make_build lucene++ lucene++-contrib
popd
%install
make install/fast DESTDIR=%{buildroot} -C %{_target_platform}
%ldconfig_scriptlets
%files
%doc AUTHORS README* REQUESTS
%license COPYING APACHE.license GPL.license LGPL.license
%{_libdir}/liblucene++.so.0*
%{_libdir}/liblucene++.so.%{version}
%{_libdir}/liblucene++-contrib.so.0*
%{_libdir}/liblucene++-contrib.so.%{version}
%files devel
%{_includedir}/lucene++/
%{_libdir}/liblucene++.so
%{_libdir}/liblucene++-contrib.so
%{_libdir}/pkgconfig/liblucene++.pc
%{_libdir}/pkgconfig/liblucene++-contrib.pc
%changelog
* Mon Jul 25 2022 loong_C <loong_c@yeah.net> - 3.0.7-1
- init package