Compare commits

..

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

12 changed files with 419 additions and 90 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

3
.gitignore vendored
View File

@ -1 +1,2 @@
SOURCES/hyph_pt_PT.zip
/hyph_pt_PT.zip
/hyphptBR-213.zip

View File

@ -1 +0,0 @@
525c6f794a8a16c6c07c41edce905036ce8c7a14 SOURCES/hyph_pt_PT.zip

View File

@ -1,88 +0,0 @@
Name: hyphen-pt
Summary: Portuguese hyphenation rules
%global upstreamid 20021021
Version: 0.%{upstreamid}
Release: 17%{?dist}
Source: http://download.services.openoffice.org/contrib/dictionaries/hyph_pt_PT.zip
URL: http://wiki.services.openoffice.org/wiki/Dictionaries
License: GPL+
BuildArch: noarch
Requires: hyphen
Supplements: (hyphen and langpacks-pt)
%description
Portuguese hyphenation rules.
%prep
%autosetup -c
%build
chmod -x *
%install
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/hyphen
cp -p *.dic $RPM_BUILD_ROOT/%{_datadir}/hyphen
pushd $RPM_BUILD_ROOT/%{_datadir}/hyphen/
pt_PT_aliases="pt_BR pt_AO"
for lang in $pt_PT_aliases; do
ln -s hyph_pt_PT.dic "hyph_"$lang".dic"
done
%files
%doc README_hyph_pt_PT.txt
%{_datadir}/hyphen/*
%changelog
* Fri Jul 06 2018 Parag Nemade <pnemade AT fedoraproject DOT org> - 0.20021021-17
- Update Source tag
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Feb 19 2016 Parag Nemade <pnemade AT redhat DOT com> - 0.20021021-13
- Add Supplements: tag for langpacks naming guidelines
- Clean the specfile to follow current packaging guidelines
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Tue Apr 10 2012 Caolán McNamara <caolanm@redhat.com> - 0.20021021-6
- Angola
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Wed Jan 14 2009 Caolán McNamara <caolanm@redhat.com> - 0.20021021-1
- initial version

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}

180
hyphen-pt.spec Normal file
View File

@ -0,0 +1,180 @@
Name: hyphen-pt
Summary: Portuguese hyphenation rules
%global upstreamid 20140727
Version: 0.%{upstreamid}
Release: 11%{?dist}
# latest seen in Hifenizador section of https://pt-br.libreoffice.org/projetos/vero/
Source0: https://pt-br.libreoffice.org/assets/Uploads/PT-BR-Documents/VERO/hyphptBR-213.zip
# The contents of Source1 are the same rules that are currently (2022-05-16) in
# use for pt-PT at https://cgit.freedesktop.org/libreoffice/dictionaries/tree/pt_PT
# so we continue to use those rules in the absence of a contrary opinion
Source1: http://download.services.openoffice.org/contrib/dictionaries/hyph_pt_PT.zip
URL: https://pt-br.libreoffice.org/projetos/vero/
License: LGPL-3.0-only AND GPL-1.0-or-later
BuildArch: noarch
Requires: hyphen
Supplements: (hyphen and langpacks-pt)
%description
Portuguese hyphenation rules.
%package BR
Summary: Brazilian Portuguese hyphenation rules
Requires: hyphen
Supplements: (hyphen and langpacks-pt_BR)
%description BR
Brazilian Portuguese hyphenation rules.
%prep
%autosetup -c
unzip -q -o %{SOURCE1}
# Fix world writable permission on files
chmod 644 hyph_pt_PT.dic README_hyph_pt_PT.txt
for i in README_hyph_pt_BR.txt; do
if ! iconv -f utf-8 -t utf-8 -o /dev/null $i > /dev/null 2>&1; then
iconv -f ISO-8859-1 -t UTF-8 $i > $i.new
touch -r $i $i.new
mv -f $i.new $i
fi
tr -d '\r' < $i > $i.new
touch -r $i $i.new
mv -f $i.new $i
done
%build
#nothing to build here
%install
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/hyphen
cp -p *.dic $RPM_BUILD_ROOT/%{_datadir}/hyphen
pushd $RPM_BUILD_ROOT/%{_datadir}/hyphen/
pt_PT_aliases="pt_AO"
for lang in $pt_PT_aliases; do
ln -s hyph_pt_PT.dic "hyph_"$lang".dic"
done
%files
%doc README_hyph_pt_PT.txt
%{_datadir}/hyphen/hyph_pt_*.dic
%exclude %{_datadir}/hyphen/hyph_pt_BR.dic
%files BR
%doc README_hyph_pt_BR.txt
%{_datadir}/hyphen/hyph_pt_BR.dic
%changelog
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 0.20140727-11
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Mon Jul 15 2024 Parag Nemade <pnemade AT redhat DOT com> - 0.20140727-10
- Resolves: RHEL-46908 - Fix file hyph_pt_PT.dic permission
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 0.20140727-9
- Bump release for June 2024 mass rebuild
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.20140727-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jan 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.20140727-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.20140727-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Feb 23 2023 Caolán McNamara <caolanm@redhat.com> - 0.20140727-5
- migrated to SPDX license
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.20140727-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.20140727-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon May 16 2022 Caolán McNamara <caolanm@redhat.com> - 0.20140727-2
- provide a pt-BR subpackage for consistency with hunspell-pt-BR
* Mon May 16 2022 Caolán McNamara <caolanm@redhat.com> - 0.20140727-1
- rhbz#2085482 update to latest available hyphenation rules
- rhbz#2084587 add Supplements: langpacks-pt_BR
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Jul 06 2018 Parag Nemade <pnemade AT fedoraproject DOT org> - 0.20021021-17
- Update Source tag
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Feb 19 2016 Parag Nemade <pnemade AT redhat DOT com> - 0.20021021-13
- Add Supplements: tag for langpacks naming guidelines
- Clean the specfile to follow current packaging guidelines
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.20021021-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Tue Apr 10 2012 Caolán McNamara <caolanm@redhat.com> - 0.20021021-6
- Angola
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.20021021-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Wed Jan 14 2009 Caolán McNamara <caolanm@redhat.com> - 0.20021021-1
- initial version

5
plans/hyphen-pt.fmf Normal file
View File

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

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (hyphptBR-213.zip) = dfcd0d1ae9e757891c319a1ff457172b4bf37c84421ab35ecd1d7079fc08b0da18c72c0cd29bffb5b247c652dcf0725de85f5389d7462663032a3965456bdc01
SHA512 (hyph_pt_PT.zip) = f1a272e81fc25f763e353c70f45edda2aa068ee92d5ee4efaf7cef59f8580cd915abb2cb8ba152f2e619f451adf9c247469e9d3489a3496582c3c10e9730ef8c

4
tests/Portuguese Normal file
View File

@ -0,0 +1,4 @@
ambicioso
Niloptal Dutt
Coordenador
Santuário

210
tests/test-hyphen.c Normal file
View File

@ -0,0 +1,210 @@
#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;
}

2
tests/test-hyphen.sh Executable file
View File

@ -0,0 +1,2 @@
gcc test-hyphen.c -lhyphen -o test-hyphen
./test-hyphen -d /usr/share/hyphen/hyph_pt_PT.dic Portuguese

View File

@ -0,0 +1,7 @@
require:
- hyphen-devel
- hyphen-pt
- gcc
test: bash ./test-hyphen.sh
framework: shell