Compare commits

...

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

13 changed files with 103 additions and 264 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

1
.gitignore vendored
View File

@ -1 +1,2 @@
/lv_LV-1.0.0.oxt
/lv_LV-1.4.0.oxt

View File

@ -1,6 +1,6 @@
--- !Policy
product_versions:
- rhel-8
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: desktop-qe.desktop-ci.tier1-gating.functional}

View File

@ -1,10 +1,16 @@
%if 0%{?rhel} && 0%{?rhel} > 9
%bcond_with mythes
%else
%bcond_without mythes
%endif
Name: openoffice-lv
Summary: Latvian linguistic dictionaries
Version: 1.0.0
Release: 7%{?dist}
Version: 1.4.0
Release: 10%{?dist}
Source: http://dict.dv.lv/download/lv_LV-%{version}.oxt
URL: http://dict.dv.lv/
License: LGPLv2+
License: LGPL-2.1-or-later
BuildArch: noarch
%description
@ -24,12 +30,14 @@ Requires: hyphen
%description -n hyphen-lv
Latvian hyphenation rules.
%if %{with mythes}
%package -n mythes-lv
Summary: Latvian thesaurus
Requires: mythes
%description -n mythes-lv
Latvian thesaurus.
%endif
%prep
%autosetup -c
@ -45,32 +53,94 @@ for i in README_lv_LV.txt README_hyph_lv_LV.txt; do
touch -r $i $i.new
mv -f $i.new $i
done
chmod -x *.dic
%install
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/myspell
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/hunspell
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/hyphen
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/mythes
cp -p lv_LV.dic lv_LV.aff $RPM_BUILD_ROOT/%{_datadir}/myspell
cp -p lv_LV.dic lv_LV.aff $RPM_BUILD_ROOT/%{_datadir}/hunspell
cp -p hyph_lv_LV.dic $RPM_BUILD_ROOT/%{_datadir}/hyphen
%if %{with mythes}
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/mythes
cp -p th_lv_LV_v2.* $RPM_BUILD_ROOT/%{_datadir}/mythes
%endif
%files -n hunspell-lv
%doc README_lv_LV.txt
%license license.txt
%{_datadir}/myspell/*
%{_datadir}/hunspell/*
%files -n hyphen-lv
%doc README_hyph_lv_LV.txt
%license license.txt
%{_datadir}/hyphen/*
%if %{with mythes}
%files -n mythes-lv
%doc package-description.txt
%license license.txt
%{_datadir}/mythes/*
%endif
%changelog
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.4.0-10
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.4.0-9
- Bump release for June 2024 mass rebuild
* Mon Apr 15 2024 Parag Nemade <pnemade AT redhat DOT com> - 1.4.0-8
- Resolves: RHEL-32831 - The mythes package is not present in RHEL10
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri Feb 24 2023 Caolán McNamara <caolanm@redhat.com> - 1.4.0-4
- migrated to SPDX license
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Sat Jan 29 2022 Parag Nemade <pnemade AT redhat DOT com> - 1.4.0-1
- Update to 1.4.0 release
- Update hunspell dictionary directory path
https://fedoraproject.org/wiki/Changes/Hunspell_dictionary_dir_change
- Added CI tests
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Jul 09 2018 Parag Nemade <pnemade AT fedoraproject DOT org> - 1.0.0-7
- Update to current Fedora packaging guidelines
- Dropped Group and defattr tag

5
plans/hunspell-lv.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Basic smoke test
discover:
how: fmf
execute:
how: tmt

View File

@ -1 +1 @@
SHA512 (lv_LV-1.0.0.oxt) = e9f3dea2ed3291a3448143261f3c812e1b6ea30036b8bf800727a9dbaa82beb59785811f00faf541cf1d38f46204704098d909b63da7c18fce42fd13f1ad845d
SHA512 (lv_LV-1.4.0.oxt) = e817d960c5d013cb2ffda49c20b955f7954124642ac6214ca81286065cf2443f5c3348af91105eaa070aecafe417376d078d851cdd8056a39e012ae6510a367a

View File

@ -1,23 +0,0 @@
#!/bin/bash
set -e
echo "=== Tests for hunspell-lv ==="
python3 test_dic_availability.py
echo ""
python3 test_suggest_words.py
echo ""
echo ""
echo "=== Tests for hyphen-lv ==="
gcc -Wall test-hyphen.c -o test-hyphen -lhyphen
echo "Test to hyphenate given word => pretpulksteņrādītājvirziens"
echo "pretpulksteņrādītājvirziens" | ./test-hyphen /usr/share/hyphen/hyph_lv_LV.dic /dev/stdin
echo ""
echo "Test to give all possible ways to hyphenate the given word => pretpulksteņrādītājvirziens"
echo "pretpulksteņrādītājvirziens" | ./test-hyphen -d /usr/share/hyphen/hyph_lv_LV.dic /dev/stdin

View File

@ -1,212 +0,0 @@
/* This test file is part of upstream hyphen project */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "hyphen.h"
#define BUFSIZE 1000
void help() {
fprintf(stderr,"correct syntax is:\n");
fprintf(stderr,"example [-d | -dd] hyphen_dictionary_file file_of_words_to_check\n");
fprintf(stderr,"-o = use old algorithm (without non-standard hyphenation)\n");
fprintf(stderr,"-d = hyphenation with listing of the possible hyphenations\n");
fprintf(stderr,"-n = print hyphenation vector\n");
}
/* get a pointer to the nth 8-bit or UTF-8 character of the word */
char * hindex(char * word, int n, int utf8) {
int j = 0;
while (j < n) {
j++;
word++;
while (utf8 && ((((unsigned char) *word) >> 6) == 2)) word++;
}
return word;
}
/* list possible hyphenations with -dd option (example for the usage of the hyphenate2() function) */
void single_hyphenations(char * word, char * hyphen, char ** rep, int * pos, int * cut, int utf8) {
int i, k, j = 0;
char r;
for (i = 0; (i + 1) < strlen(word); i++) {
if (utf8 && ((((unsigned char) word[i]) >> 6) == 2)) continue;
if ((hyphen[j] & 1)) {
if (rep && rep[j]) {
k = hindex(word, j - pos[j] + 1, utf8) - word;
r = word[k];
word[k] = 0;
printf(" - %s%s", word, rep[j]);
word[k] = r;
printf("%s\n", hindex(word + k, cut[j], utf8));
} else {
k = hindex(word, j + 1, utf8) - word;
r = word[k];
word[k] = 0;
printf(" - %s=", word);
word[k] = r;
printf("%s\n", word + k);
}
}
j++;
}
}
int
main(int argc, char** argv)
{
HyphenDict *dict;
int df;
int wtc;
FILE* wtclst;
int k, n, i, j, c;
char buf[BUFSIZE + 1];
int nHyphCount;
char *hyphens;
char *lcword;
char *hyphword;
char hword[BUFSIZE * 2];
int arg = 1;
int optd = 1;
int optn = 0;
int optdd = 0;
char ** rep;
int * pos;
int * cut;
/* first parse the command line options */
/* arg1 - hyphen dictionary file, arg2 - file of words to check */
if (argv[arg]) {
if (strcmp(argv[arg], "-o") == 0) {
optd = 0;
arg++;
}
if (strcmp(argv[arg], "-n") == 0) {
optn = 1;
arg++;
}
if (argv[arg] && strcmp(argv[arg], "-d") == 0) {
optd = 1;
optdd = 1;
arg++;
}
}
if (argv[arg]) {
df = arg++;
} else {
help();
exit(1);
}
if (argv[arg]) {
wtc = arg++;
} else {
help();
exit(1);
}
/* load the hyphenation dictionary */
if ((dict = hnj_hyphen_load(argv[df])) == NULL) {
fprintf(stderr, "Couldn't find file %s\n", argv[df]);
fflush(stderr);
exit(1);
}
/* open the words to check list */
wtclst = fopen(argv[wtc],"r");
if (!wtclst) {
fprintf(stderr,"Error - could not open file of words to check\n");
exit(1);
}
/* now read each word from the wtc file */
while(fgets(buf,BUFSIZE,wtclst) != NULL) {
k = strlen(buf);
if (k && buf[k - 1] == '\n') buf[k - 1] = '\0';
if (k >=2 && buf[k - 2] == '\r') buf[k-- - 2] = '\0';
/* set aside some buffers to hold lower cased */
/* and hyphen information */
lcword = (char *) malloc(k+1);
hyphens = (char *)malloc(k+5);
/* basic ascii lower-case, not suitable for real-world usage*/
for (i = 0; i < k; ++i) {
lcword[i] = buf[i];
if ( (lcword[i] >= 'A') && (lcword[i] <= 'Z') )
lcword[i] += 32;
}
/* first remove any trailing periods */
n = k-1;
while((n >=0) && (lcword[n] == '.')) n--;
n++;
/* now actually try to hyphenate the word */
rep = NULL;
pos = NULL;
cut = NULL;
hword[0] = '\0';
if ((!optd && hnj_hyphen_hyphenate(dict, lcword, n-1, hyphens)) ||
(optd && hnj_hyphen_hyphenate2(dict, lcword, n-1, hyphens, hword, &rep, &pos, &cut))) {
free(hyphens);
free(lcword);
fprintf(stderr, "hyphenation error\n");
exit(1);
}
if (optn) fprintf(stderr, "%s\n", hyphens);
if (!optd) {
/* now backfill hyphens[] for any removed periods */
for (c = n; c < k; c++) hyphens[c] = '0';
hyphens[k] = '\0';
/* now create a new char string showing hyphenation positions */
/* count the hyphens and allocate space for the new hypehanted string */
nHyphCount = 0;
for (i = 0; i < n; i++)
if (hyphens[i]&1)
nHyphCount++;
hyphword = (char *) malloc(k+1+nHyphCount);
j = 0;
for (i = 0; i < n; i++) {
hyphword[j++] = buf[i];
if (hyphens[i]&1) {
hyphword[j++] = '-';
}
}
hyphword[j] = '\0';
fprintf(stdout,"%s\n",hyphword);
fflush(stdout);
free(hyphword);
} else {
fprintf(stdout,"%s\n", hword);
if (optdd) single_hyphenations(lcword, hyphens, rep, pos, cut, dict->utf8);
if (rep) {
for (i = 0; i < n - 1; i++) {
if (rep[i]) free(rep[i]);
}
free(rep);
free(pos);
free(cut);
}
}
free(hyphens);
free(lcword);
}
fclose(wtclst);
hnj_hyphen_free(dict);
return 0;
}

View File

@ -0,0 +1,6 @@
require:
- python3-enchant
- hunspell-lv
test: python3 test_dic_availability.py
framework: shell

View File

@ -2,7 +2,7 @@
import enchant
lang = "lv"
lang = "lv_LV"
try:
dic = enchant.request_dict(lang)
print("Dictionary for {0} language is available for use".format(lang))

View File

@ -0,0 +1,6 @@
require:
- python3-enchant
- hunspell-lv
test: python3 test_suggest_words.py
framework: shell

View File

@ -2,9 +2,8 @@
import enchant
wdlst = [ "Sveikii", "atsēstis", "buķtes"]
dic = enchant.Dict("lv")
wdlst = [ "Pēšņi", "Padies", "Sviki"]
dic = enchant.Dict("lv_LV")
for wd in wdlst:
dic.check(wd)
print("input word = {0}, Suggestions => {1}".format(wd, dic.suggest(wd)))

View File

@ -1,14 +0,0 @@
- hosts: localhost
roles:
- role: standard-test-basic
required_packages:
- python3-enchant
- hyphen-devel
- gcc
tags:
- classic
tests:
- sample:
dir: scripts/
run: ./run_tests.sh