Compare commits

...

No commits in common. "c8" and "c10s" have entirely different histories.
c8 ... c10s

11 changed files with 274 additions and 108 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

22
.gitignore vendored
View File

@ -1 +1,21 @@
SOURCES/libvoikko-4.1.1.tar.gz
libvoikko-3.0.tar.gz
/libvoikko-3.1.tar.gz
/libvoikko-3.2.tar.gz
/libvoikko-3.2.1.tar.gz
/libvoikko-3.3.tar.gz
/libvoikko-3.3.1rc1.tar.gz
/libvoikko-3.4.tar.gz
/libvoikko-3.4.1.tar.gz
/libvoikko-3.5.tar.gz
/libvoikko-3.6.tar.gz
/libvoikko-3.6.1.tar.gz
/libvoikko-3.7.tar.gz
/libvoikko-3.7.1.tar.gz
/libvoikko-3.8.tar.gz
/libvoikko-4.1.1.tar.gz
/libvoikko-4.3.tar.gz
/libvoikko-4.3.tar.gz.asc
/libvoikko-4.3.1.tar.gz
/libvoikko-4.3.1.tar.gz.asc
/libvoikko-4.3.2.tar.gz
/libvoikko-4.3.2.tar.gz.asc

View File

@ -1 +0,0 @@
c59bbb4dd08d63bbc1cd0bd36408931b20220b4d SOURCES/libvoikko-4.1.1.tar.gz

View File

@ -1,130 +1,79 @@
Name: libvoikko
Version: 4.1.1
Release: 3%{?dist}
Summary: Voikko is a library for spellcheckers and hyphenators
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.3.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Group: System Environment/Libraries
License: GPLv2+
URL: http://voikko.puimula.org
# The usual format of stable release URLs
Source0: http://www.puimula.org/voikko-sources/%{name}/%{name}-%{version}.tar.gz
# The usual format of test release URLs
#Source0: http://www.puimula.org/htp/testing/%%{name}-%%{version}rc1.tar.gz
* Wed Nov 30 2022 Mike FABIAN <mfabian@redhat.com> - 4.3.1-6
- Migrate license tag to SPDX
BuildRequires: gcc-c++
BuildRequires: python3-devel
# Require the Finnish morphology because Finnish is currently the only language
# supported by libvoikko in Fedora.
Requires: malaga-suomi-voikko
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.3.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
%description
This is libvoikko, library for spellcheckers and hyphenators using Malaga
natural language grammar development tool. The library is written in C.
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 4.3.1-4
- Rebuilt for Python 3.11
Currently only Finnish is supported, but the API of the library has been
designed to allow adding support for other languages later. Note however that
Malaga is rather low level tool that requires implementing the whole morphology
of a language as a left associative grammar. Therefore languages that have
simple or even moderately complex morphologies and do not require morphological
analysis in their hyphenators should be implemented using other tools such as
Hunspell.
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.3.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: pkgconfig
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
* Sun Jul 11 2021 Fedora Release Monitoring <release-monitoring@fedoraproject.org> - 4.3.1-1
- Update to 4.3.1 (#1936062)
%package -n voikko-tools
Summary: Test tools for %{name}
Group: Applications/Text
Requires: %{name}%{?_isa} = %{version}-%{release}
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 4.3-5
- Rebuilt for Python 3.10
%description -n voikko-tools
This package contains voikkospell and voikkohyphenate, small command line
tools for testing libvoikko. These tools may also be useful for shell
scripts.
* Fri Feb 19 2021 Mike FABIAN <mfabian@redhat.com> - 4.3-4
- Add Requires: voikko-fi
%package -n python3-libvoikko
Summary: Python interface to %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%{?python_provide:%python_provide python3-libvoikko}
* Sun Jan 31 2021 Ville-Pekka Vainio <vpvainio AT iki.fi> - 4.3-3
- The dictionary data directory will now be /usr/lib/voikko on all architectures
- Create and own /usr/lib/voikko, so different dictionary packages can own the subdirectories there
- This was suggested in the review of the voikko-fi package, see rhbz#1919688
- Use the license macro
%description -n python3-libvoikko
Python interface to libvoikko, library of Finnish language tools.
This module can be used to perform various natural language analysis
tasks on Finnish text.
* Sun Jan 24 2021 Ville-Pekka Vainio <vpvainio AT iki.fi> - 4.3-2
- Bump release for a new Copr build
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
%prep
%setup -q
* Sat Jan 16 2021 Ville-Pekka Vainio <vpvainio AT iki.fi> - 4.3-1
- Update to 4.3
- Add GPG signature check for the source
- Fix pycached stuff
- Remove old python_provide macro
- Remove ldconfig_scriptlets macro
- Only use VFST for now, HFST can be provided in a later update
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
%build
# The dictionary path must be the same where malaga-suomi-voikko is installed
# Use malaga for now, no hfst or vfst. We need to package foma for the vfst dictionaries.
%configure --with-dictionary-path=%{_libdir}/voikko --disable-hfst --disable-vfst --disable-buildtools --enable-malaga
# Remove rpath,
# https://fedoraproject.org/wiki/Packaging/Guidelines#Removing_Rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make %{?_smp_mflags} CXXFLAGS="$CXXFLAGS"
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 4.1.1-7
- Rebuilt for Python 3.9
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
%install
make install INSTALL="install -p" DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
# Remove static archive
find $RPM_BUILD_ROOT -name '*.a' -exec rm -f {} ';'
# Install the Python interface
install -d $RPM_BUILD_ROOT%{python3_sitelib}
install -pm 0644 python/libvoikko.py $RPM_BUILD_ROOT%{python3_sitelib}/
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 4.1.1-5
- Rebuilt for Python 3.8.0rc1 (#1748018)
%post -p /sbin/ldconfig
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 4.1.1-4
- Rebuilt for Python 3.8
%postun -p /sbin/ldconfig
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
%files
%doc ChangeLog COPYING README
%{_libdir}/*.so.*
* Fri Aug 3 2018 Ville-Pekka Vainio <vpvainio AT iki.fi> - 4.1.1-1
- New upstream release.
- Provide only python3-libvoikko, remove python2-libvoikko
- Use malaga for now, foma is not packaged for Fedora yet.
%files -n voikko-tools
%{_bindir}/voikkospell
%{_bindir}/voikkohyphenate
%{_bindir}/voikkogc
%{_mandir}/man1/voikkohyphenate.1*
%{_mandir}/man1/voikkospell.1*
%{_mandir}/man1/voikkogc.1*
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.8-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
%files devel
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/libvoikko.pc
%files -n python3-libvoikko
%{python3_sitelib}/%{name}.py*
%if ! 0%{?flatpak}
%{python3_sitelib}/__pycache__/*
%endif
%changelog
* Wed Jun 30 2021 Mike FABIAN <mfabian@redhat.com> - 4.1.1-3
- Resolves: rhbz#1975295 Bump release number
* Thu Nov 26 2020 Mike FABIAN <mfabian@redhat.com> - 4.1.1-2
- Fix man file names for Flatpak builds, exclude __pycache__ files from Flatpak builds
- Resolves: rhbz#1896322
* Thu Oct 04 2018 Mike FABIAN <mfabian@redhat.com> - 4.1.1-1
- Rebase to 4.1.1 from Fedora 29 (provides only python3-libvoikko,
removes python2-libvoikko)
- Resolves: rhbz#1636062
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.8-10
- Rebuilt for Python 3.7
* Wed May 23 2018 Mike FABIAN <mfabian@redhat.com> - 3.8-9
- Add python3-devel to BuildRequires.

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

Binary file not shown.

125
libvoikko.spec Normal file
View File

@ -0,0 +1,125 @@
%global _hardened_build 1
Name: libvoikko
Version: 4.3.2
Release: %autorelease
Summary: Voikko is a library for spellcheckers and hyphenators
License: GPL-2.0-or-later
URL: https://voikko.puimula.org
# The usual format of stable release URLs
Source0: https://www.puimula.org/voikko-sources/%{name}/%{name}-%{version}.tar.gz
# The usual format of test release URLs
#Source0: https://www.puimula.org/htp/testing/%%{name}-%%{version}rc1.tar.gz
# See https://voikko.puimula.org/sources.html for the key fingerprint.
# I did
# gpg --recv-keys "AC5D 65F1 0C85 96D7 E2DA E263 3D30 9B60 4AE3 942E"
# and then
# gpg2 --export --export-options export-minimal AC5D65F10C8596D7E2DAE2633D309B604AE3942E > gpgkey-AC5D65F10C8596D7E2DAE2633D309B604AE3942E.gpg
Source1: http://www.puimula.org/voikko-sources/%{name}/%{name}-%{version}.tar.gz.asc
Source2: gpgkey-AC5D65F10C8596D7E2DAE2633D309B604AE3942E.gpg
Requires: voikko-fi
BuildRequires: gcc-c++
BuildRequires: python3-devel
BuildRequires: make
BuildRequires: gnupg2
%description
This is libvoikko, library for spellcheckers and hyphenators using Malaga
natural language grammar development tool. The library is written in C.
Currently only Finnish is supported, but the API of the library has been
designed to allow adding support for other languages later. Note however that
Malaga is rather low level tool that requires implementing the whole morphology
of a language as a left associative grammar. Therefore languages that have
simple or even moderately complex morphologies and do not require morphological
analysis in their hyphenators should be implemented using other tools such as
Hunspell.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: pkgconfig
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package -n voikko-tools
Summary: Test tools for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n voikko-tools
This package contains voikkospell and voikkohyphenate, small command line
tools for testing libvoikko. These tools may also be useful for shell
scripts.
%package -n python3-libvoikko
Summary: Python interface to %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description -n python3-libvoikko
Python interface to libvoikko, library of Finnish language tools.
This module can be used to perform various natural language analysis
tasks on Finnish text.
%prep
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%autosetup
%build
# Use vfst for now, no hfst yet. We need to package hfst-ospell for the hfst dictionaries.
# Use /usr/lib/voikko for the dictionaries, this is where the voikko-fi package will put them.
# The dictonary path has been agreed on in reviews and fedora-devel discussions.
# This way the voikko-fi package can be noarch.
%configure --disable-hfst --with-dictionary-path=%{_prefix}/lib/voikko
# Remove rpath,
# https://fedoraproject.org/wiki/Packaging/Guidelines#Removing_Rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%make_build CXXFLAGS="$CXXFLAGS"
%install
make install INSTALL="install -p" DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
# Remove static archive
find $RPM_BUILD_ROOT -name '*.a' -exec rm -f {} ';'
# Install the Python interface
install -d $RPM_BUILD_ROOT%{python3_sitelib}
install -pm 0644 python/libvoikko.py $RPM_BUILD_ROOT%{python3_sitelib}/
# Make the directory for the dictionary data files, so this package can own it.
mkdir -p %{buildroot}%{_prefix}/lib/voikko
%files
%doc ChangeLog README
%license COPYING
%dir %{_prefix}/lib/voikko
%{_libdir}/libvoikko.so.1*
%files -n voikko-tools
%{_bindir}/voikkospell
%{_bindir}/voikkohyphenate
%{_bindir}/voikkogc
%{_bindir}/voikkovfstc
%{_mandir}/man1/voikkohyphenate.1*
%{_mandir}/man1/voikkospell.1*
%{_mandir}/man1/voikkogc.1*
%{_mandir}/man1/voikkovfstc.1*
%files devel
%{_includedir}/*
%{_libdir}/libvoikko.so
%{_libdir}/pkgconfig/libvoikko.pc
%files -n python3-libvoikko
%pycached %{python3_sitelib}/%{name}.py
%changelog
%autochangelog

9
plans/basic.fmf Normal file
View File

@ -0,0 +1,9 @@
summary: Basic smoke test
discover:
how: fmf
execute:
how: tmt
prepare:
how: shell
script:
- dnf config-manager --enable rhel-CRB --enable rhel-buildroot

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (libvoikko-4.3.2.tar.gz) = d510a9344501f86b2f644c1237faf8709f02b5d17bca76f7934c8422495aeee307f12c60dde47df15a39c24c3311253d3dea2d0648050fc3a056a22497de695c
SHA512 (libvoikko-4.3.2.tar.gz.asc) = 5416123b9610225e2baf26ebb8be27d98ac04d34af9c2ed9252fa6e2c2909276a47967a297fc9bf0b51a6bf8650a55919ea4071dd976752b26a3dfec271ddf0a

6
tests/main.fmf Normal file
View File

@ -0,0 +1,6 @@
require:
- libvoikko
- voikko-tools
- python3-libvoikko
test: python3 test_libvoikko.py -v
framework: shell

49
tests/test_libvoikko.py Normal file
View File

@ -0,0 +1,49 @@
import unittest
import sys
import subprocess
import libvoikko
class TestLibvoikko(unittest.TestCase):
def test_dummy(self):
self.assertEqual(True, True)
@unittest.expectedFailure
def test_expected_failure(self):
self.assertEqual(False, True)
def test_spell(self):
voikko = libvoikko.Voikko('fi')
self.assertEqual(voikko.spell('kissa'), True)
self.assertEqual(voikko.spell('kisssa'), False)
def test_suggest(self):
voikko = libvoikko.Voikko('fi')
self.assertEqual(
voikko.suggest('kisssa'),
['kissa', 'kissaa', 'kisassa', 'kisussa', 'Kiassa'])
def test_voikkospell(self):
cp = subprocess.run(['echo kissa | voikkospell'], encoding='UTF-8', text=True, shell=True, capture_output=True)
self.assertEqual(cp.stdout, 'C: kissa\n')
self.assertEqual(cp.stderr, '')
self.assertEqual(cp.returncode, 0)
cp = subprocess.run(['echo kisssa | voikkospell'], encoding='UTF-8', text=True, shell=True, capture_output=True)
self.assertEqual(cp.stdout, 'W: kisssa\n')
self.assertEqual(cp.stderr, '')
self.assertEqual(cp.returncode, 0)
def test_voikkohyphenate(self):
cp = subprocess.run(['echo kissa | voikkohyphenate'], encoding='UTF-8', text=True, shell=True, capture_output=True)
self.assertEqual(cp.stdout, 'kis-sa\n')
self.assertEqual(cp.stderr, '')
self.assertEqual(cp.returncode, 0)
def test_voikkogc_tokenize(self):
cp = subprocess.run(['echo "kissa." | voikkogc --tokenize'], encoding='UTF-8', text=True, shell=True, capture_output=True)
self.assertEqual(cp.stdout, 'W: "kissa"\nP: "."\n')
self.assertEqual(cp.stderr, '')
self.assertEqual(cp.returncode, 0)
if __name__ == "__main__":
unittest.main()