mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2026-01-10 23:18:59 -05:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98b4fb3cdf | ||
|
|
33bdf56bdd | ||
|
|
4556262c87 | ||
|
|
cb2159b114 | ||
|
|
5b45e1898b | ||
|
|
f6128b9079 | ||
|
|
ba64c1637e | ||
|
|
3a0e87d8ea | ||
|
|
9ca2b9fc16 | ||
|
|
f5932bf5d3 | ||
|
|
018df0d563 | ||
|
|
76ac5ce93f | ||
|
|
d0847525c6 | ||
|
|
7f0c1d8a3f | ||
|
|
bd9e67f48e | ||
|
|
a4cc4ba55b | ||
|
|
1a1274012f | ||
|
|
74712ff022 | ||
|
|
3c6971fced |
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -14,10 +14,10 @@ jobs:
|
||||
- win32_dyn
|
||||
include:
|
||||
- target: native_static
|
||||
image_variant: bionic
|
||||
image_variant: focal
|
||||
lib_postfix: '/x86_64-linux-gnu'
|
||||
- target: native_dyn
|
||||
image_variant: bionic
|
||||
image_variant: focal
|
||||
lib_postfix: '/x86_64-linux-gnu'
|
||||
- target: win32_static
|
||||
image_variant: f35
|
||||
|
||||
9
.github/workflows/package.yml
vendored
9
.github/workflows/package.yml
vendored
@@ -8,7 +8,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
distro:
|
||||
- ubuntu-kinetic
|
||||
- ubuntu-jammy
|
||||
- ubuntu-focal
|
||||
steps:
|
||||
@@ -41,14 +40,6 @@ jobs:
|
||||
args: --no-sign
|
||||
ppa: ${{ steps.ppa.outputs.ppa }}
|
||||
|
||||
- uses: legoktm/gh-action-build-deb@ubuntu-kinetic
|
||||
if: matrix.distro == 'ubuntu-kinetic'
|
||||
name: Build package for ubuntu-kinetic
|
||||
id: build-ubuntu-kinetic
|
||||
with:
|
||||
args: --no-sign
|
||||
ppa: ${{ steps.ppa.outputs.ppa }}
|
||||
|
||||
- uses: legoktm/gh-action-build-deb@ubuntu-focal
|
||||
if: matrix.distro == 'ubuntu-focal'
|
||||
name: Build package for ubuntu-focal
|
||||
|
||||
21
.readthedocs.yaml
Normal file
21
.readthedocs.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
# Read the Docs configuration file
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
# Required
|
||||
version: 2
|
||||
|
||||
# Set the version of Python and other tools you might need
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.11"
|
||||
|
||||
# Build documentation in the docs/ directory with Sphinx
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
|
||||
# We recommend specifying your dependencies to enable reproducible builds:
|
||||
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
||||
python:
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
||||
@@ -1,7 +1,10 @@
|
||||
Unreleased
|
||||
==========
|
||||
kiwix-tools 3.6.0
|
||||
=================
|
||||
|
||||
* Additional docker images archs for armv6 and i386.
|
||||
* Improved kiwix-serve man page (@iArchitSharma #626)
|
||||
* C++17 compliant code base (@mgautierfr #636)
|
||||
* Support of libkiwix13 (@mgautierfr #633)
|
||||
* Additional docker images archs for armv6 and i386 (@rgaudin #622)
|
||||
|
||||
kiwix-tools 3.5.0
|
||||
=================
|
||||
|
||||
10
README.md
10
README.md
@@ -4,7 +4,7 @@ Kiwix tools
|
||||
The Kiwix tools is a collection of [Kiwix](https://kiwix.org) related
|
||||
command line tools:
|
||||
* kiwix-manage: Manage XML based library of ZIM files
|
||||
* kiwix-search: Fulltext search in ZIM files
|
||||
* kiwix-search: Full text search in ZIM files
|
||||
* kiwix-serve: HTTP daemon serving ZIM files
|
||||
|
||||
[](https://download.kiwix.org/release/kiwix-tools/)
|
||||
@@ -29,8 +29,8 @@ Preamble
|
||||
--------
|
||||
|
||||
Although the Kiwix tools can be compiled/cross-compiled on/for many
|
||||
sytems, the following documentation explains how to do it on POSIX
|
||||
ones. It is primarly thought for GNU/Linux systems and has been tested
|
||||
systems, the following documentation explains how to do it on POSIX
|
||||
ones. It is primarily thought for GNU/Linux systems and has been tested
|
||||
on recent releases of
|
||||
[Debian](https://debian.org)/[Ubuntu](https://ubuntu.com) and
|
||||
[Fedora](https://getfedora.org).
|
||||
@@ -62,7 +62,7 @@ Environment
|
||||
-------------
|
||||
|
||||
The Kiwix tools build using [Meson](http://mesonbuild.com/) version
|
||||
0.43 or higher. Meson relies itself on Ninja, pkg-config and few other
|
||||
0.43 or higher. Meson relies itself on Ninja, pkg-config and a few other
|
||||
compilation tools. Install them first:
|
||||
* [Meson](http://mesonbuild.com/)
|
||||
* [Ninja](https://ninja-build.org/)
|
||||
@@ -96,7 +96,7 @@ ninja -C build install
|
||||
```
|
||||
|
||||
You might need to run the command as `root` (or using `sudo`),
|
||||
depending where you want to install the Kiwix tools. After the
|
||||
depending on where you want to install the Kiwix tools. After the
|
||||
installation succeeded, you may need to run ldconfig (as `root`).
|
||||
|
||||
Uninstallation
|
||||
|
||||
@@ -42,7 +42,12 @@ Build an image for an ARM based GNU/Linux:
|
||||
docker build . -t ghcr.io/kiwix/kiwix-serve:latest --build-arg ARCH="arm32v7/"
|
||||
```
|
||||
|
||||
You can also deploy kiwix with [`docker-compose`](https://docs.docker.com/compose/). Check out a sample at [docker-compose.yml.example](docker-compose.yml.example)
|
||||
Docker Compose
|
||||
--------------
|
||||
|
||||
You can also deploy kiwix with
|
||||
[`docker-compose`](https://docs.docker.com/compose/). Check out a
|
||||
sample at [docker-compose.yml.example](docker-compose.yml.example).
|
||||
|
||||
Screenshots
|
||||
-----------
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
project('kiwix-tools', 'cpp',
|
||||
version : '3.5.0',
|
||||
version : '3.6.0',
|
||||
license : 'GPL',
|
||||
default_options: ['c_std=c11', 'cpp_std=c++11', 'werror=true'])
|
||||
default_options: ['c_std=c11', 'cpp_std=c++17', 'werror=true'])
|
||||
|
||||
compiler = meson.get_compiler('cpp')
|
||||
|
||||
@@ -16,7 +16,7 @@ if static_linkage
|
||||
endif
|
||||
|
||||
thread_dep = dependency('threads')
|
||||
kiwixlib_dep = dependency('kiwix', version:'>=12.0.0', static:static_linkage)
|
||||
kiwixlib_dep = dependency('kiwix', version:'>=13.0.0', static:static_linkage)
|
||||
libzim_dep = dependency('libzim', version:'>=8.1.0', static:static_linkage)
|
||||
|
||||
all_deps = [thread_dep, kiwixlib_dep, libzim_dep]
|
||||
|
||||
@@ -29,10 +29,10 @@ using namespace std;
|
||||
|
||||
enum supportedAction { NONE, ADD, SHOW, REMOVE };
|
||||
|
||||
void show(kiwix::Library* library, const std::string& bookId)
|
||||
void show(const kiwix::Library& library, const std::string& bookId)
|
||||
{
|
||||
try {
|
||||
auto& book = library->getBookById(bookId);
|
||||
auto& book = library.getBookById(bookId);
|
||||
std::cout << "id:\t\t" << book.getId() << std::endl
|
||||
<< "path:\t\t" << book.getPath() << std::endl
|
||||
<< "url:\t\t" << book.getUrl() << std::endl
|
||||
@@ -96,7 +96,7 @@ void usage()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
int handle_show(kiwix::Library* library, const std::string& libraryPath,
|
||||
int handle_show(const kiwix::Library& library, const std::string& libraryPath,
|
||||
int argc, char* argv[])
|
||||
{
|
||||
if (argc > 3 ) {
|
||||
@@ -105,7 +105,7 @@ int handle_show(kiwix::Library* library, const std::string& libraryPath,
|
||||
show(library, bookId);
|
||||
}
|
||||
} else {
|
||||
auto booksIds = library->getBooksIds();
|
||||
auto booksIds = library.getBooksIds();
|
||||
for(auto& bookId: booksIds) {
|
||||
show(library, bookId);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ int handle_show(kiwix::Library* library, const std::string& libraryPath,
|
||||
return(0);
|
||||
}
|
||||
|
||||
int handle_add(kiwix::Library* library, const std::string& libraryPath,
|
||||
int handle_add(kiwix::LibraryPtr library, const std::string& libraryPath,
|
||||
int argc, char* argv[])
|
||||
{
|
||||
string zimPath;
|
||||
@@ -182,11 +182,11 @@ int handle_add(kiwix::Library* library, const std::string& libraryPath,
|
||||
return(resultCode);
|
||||
}
|
||||
|
||||
int handle_remove(kiwix::Library* library, const std::string& libraryPath,
|
||||
int handle_remove(kiwix::Library& library, const std::string& libraryPath,
|
||||
int argc, char* argv[])
|
||||
{
|
||||
std::string bookId;
|
||||
const unsigned int totalBookCount = library->getBookCount(true, true);
|
||||
const unsigned int totalBookCount = library.getBookCount(true, true);
|
||||
int exitCode = 0;
|
||||
|
||||
if (argc <= 3) {
|
||||
@@ -203,7 +203,7 @@ int handle_remove(kiwix::Library* library, const std::string& libraryPath,
|
||||
for (int i = 3; i<argc; i++) {
|
||||
bookId = argv[i];
|
||||
|
||||
if (!library->removeBookById(bookId)) {
|
||||
if (!library.removeBookById(bookId)) {
|
||||
std::cerr << "Invalid book id '" << bookId << "'." << std::endl;
|
||||
exitCode = 1;
|
||||
}
|
||||
@@ -216,7 +216,7 @@ int main(int argc, char** argv)
|
||||
{
|
||||
string libraryPath = "";
|
||||
supportedAction action = NONE;
|
||||
kiwix::Library library;
|
||||
auto library = kiwix::Library::create();
|
||||
|
||||
/* General argument parsing */
|
||||
static struct option long_options[] = {
|
||||
@@ -261,7 +261,7 @@ int main(int argc, char** argv)
|
||||
libraryPath = kiwix::isRelativePath(libraryPath)
|
||||
? kiwix::computeAbsolutePath(kiwix::getCurrentDirectory(), libraryPath)
|
||||
: libraryPath;
|
||||
kiwix::Manager manager(&library);
|
||||
kiwix::Manager manager(library);
|
||||
if (!manager.readFile(libraryPath, false)) {
|
||||
if (kiwix::fileExists(libraryPath) || action!=ADD) {
|
||||
std::cerr << "Cannot read the library " << libraryPath << std::endl;
|
||||
@@ -273,13 +273,13 @@ int main(int argc, char** argv)
|
||||
int exitCode = 0;
|
||||
switch (action) {
|
||||
case SHOW:
|
||||
exitCode = handle_show(&library, libraryPath, argc, argv);
|
||||
exitCode = handle_show(*library, libraryPath, argc, argv);
|
||||
break;
|
||||
case ADD:
|
||||
exitCode = handle_add(&library, libraryPath, argc, argv);
|
||||
exitCode = handle_add(library, libraryPath, argc, argv);
|
||||
break;
|
||||
case REMOVE:
|
||||
exitCode = handle_remove(&library, libraryPath, argc, argv);
|
||||
exitCode = handle_remove(*library, libraryPath, argc, argv);
|
||||
break;
|
||||
case NONE:
|
||||
break;
|
||||
@@ -292,7 +292,7 @@ int main(int argc, char** argv)
|
||||
/* Rewrite the library file */
|
||||
if (action == REMOVE || action == ADD) {
|
||||
// writeToFile return true (1) if everything is ok => exitCode is 0
|
||||
if (!library.writeToFile(libraryPath)) {
|
||||
if (!library->writeToFile(libraryPath)) {
|
||||
std::cerr << "Cannot write the library " << libraryPath << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ int main(int argc, char** argv)
|
||||
#endif
|
||||
|
||||
std::string rootLocation = "/";
|
||||
kiwix::Library library;
|
||||
auto library = kiwix::Library::create();
|
||||
unsigned int nb_threads = DEFAULT_THREADS;
|
||||
std::vector<std::string> zimPathes;
|
||||
std::string libraryPath;
|
||||
@@ -331,7 +331,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
/* Setup the library manager and get the list of books */
|
||||
kiwix::Manager manager(&library);
|
||||
kiwix::Manager manager(library);
|
||||
std::vector<std::string> libraryPaths;
|
||||
if (libraryFlag) {
|
||||
libraryPaths = kiwix::split(libraryPath, ";");
|
||||
@@ -340,7 +340,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
/* Check if the library is not empty (or only remote books)*/
|
||||
if (library.getBookCount(true, false) == 0) {
|
||||
if (library->getBookCount(true, false) == 0) {
|
||||
std::cerr << "The XML library file '" << libraryPath
|
||||
<< "' is empty (or has only remote books)." << std::endl;
|
||||
}
|
||||
@@ -376,8 +376,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
kiwix::UpdatableNameMapper nameMapper(library, noDateAliasesFlag);
|
||||
kiwix::Server server(&library, &nameMapper);
|
||||
auto nameMapper = std::make_shared<kiwix::UpdatableNameMapper>(library, noDateAliasesFlag);
|
||||
kiwix::Server server(library, nameMapper);
|
||||
|
||||
if (!customIndexPath.empty()) {
|
||||
try {
|
||||
@@ -447,7 +447,7 @@ int main(int argc, char** argv)
|
||||
if ( libraryMustBeReloaded && !libraryPaths.empty() ) {
|
||||
libraryFileTimestamp = curLibraryFileTimestamp;
|
||||
reloadLibrary(manager, libraryPaths);
|
||||
nameMapper.update();
|
||||
nameMapper->update();
|
||||
libraryMustBeReloaded = false;
|
||||
}
|
||||
} while (waiting);
|
||||
|
||||
Reference in New Issue
Block a user