Compare commits

..

No commits in common. "rawhide" and "f40" have entirely different histories.

16 changed files with 82 additions and 178 deletions

View file

@ -1 +0,0 @@
1

1
.gitignore vendored
View file

@ -10,4 +10,3 @@
/OpenCC-ver.1.1.2.tar.gz
/OpenCC-ver.1.1.4.tar.gz
/OpenCC-ver.1.1.7.tar.gz
/OpenCC-ver.1.1.9.tar.gz

View file

@ -1,30 +0,0 @@
commit 01d0b4c88711daf697223be1aee78940f82b983e
Author: Peng Wu <pwu@redhat.com>
Date: Mon Aug 11 16:22:12 2025 +0800
Update for https://fedoraproject.org/wiki/Changes/CMake_drop_install_vars
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b79e5b5..d5974f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,7 @@ cmake_minimum_required(VERSION 3.5)
set (PACKAGE_NAME opencc)
project (${PACKAGE_NAME} CXX)
include (CTest)
+include(GNUInstallDirs)
######## Options
option(BUILD_DOCUMENTATION "Use Doxygen to create the HTML based API documentation" OFF)
@@ -78,6 +79,11 @@ endif()
######## Directory
+set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "")
+if(CMAKE_INSTALL_LIBDIR MATCHES "lib64$")
+ set(LIB_SUFFIX 64)
+endif()
+
set (DIR_PREFIX ${CMAKE_INSTALL_PREFIX})
set (DIR_INCLUDE ${DIR_PREFIX}/include)
set (DIR_SHARE ${DIR_PREFIX}/share)

View file

@ -1,22 +0,0 @@
Index: OpenCC-ver.1.1.9/CMakeLists.txt
===================================================================
--- OpenCC-ver.1.1.9.orig/CMakeLists.txt
+++ OpenCC-ver.1.1.9/CMakeLists.txt
@@ -154,7 +154,7 @@ add_definitions(
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_definitions(
- -std=c++14
+ -std=c++17
-Wall
)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
@@ -163,7 +163,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "
endif ()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_definitions(
- -std=c++14
+ -std=c++17
-Wall
)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")

View file

@ -1,13 +0,0 @@
Index: OpenCC-ver.1.1.9/src/SerializedValues.hpp
===================================================================
--- OpenCC-ver.1.1.9.orig/src/SerializedValues.hpp
+++ OpenCC-ver.1.1.9/src/SerializedValues.hpp
@@ -18,6 +18,8 @@
#pragma once
+#include <cstdint>
+
#include "Common.hpp"
#include "SerializableDict.hpp"

View file

@ -1,44 +0,0 @@
commit cfe3ced00bbf764f68f10222b9d2a6367c2c3f82
Author: Peng Wu <pwu@redhat.com>
Date: Tue Mar 25 13:43:05 2025 +0800
Fix crash when read the config file
diff --git a/src/Config.cpp b/src/Config.cpp
index a8392b1..5c768c0 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -16,6 +16,7 @@
* limitations under the License.
*/
+#include <sys/stat.h>
#include <fstream>
#include <list>
#include <unordered_map>
@@ -216,6 +217,16 @@ std::string GetParentDirectory(const std::string& path) {
return path.substr(0, pos + 1);
}
+bool isRegularFile(const std::string& path) {
+ struct stat info;
+
+ if (stat(path.c_str(), &info) != 0)
+ return false;
+
+ // Check if it's a regular file
+ return (info.st_mode & S_IFMT) == S_IFREG;
+}
+
} // namespace
Config::Config() : internal(new ConfigInternal()) {}
@@ -241,6 +252,8 @@ ConverterPtr Config::NewFromFile(const std::string& fileName,
impl->paths.push_back(PACKAGE_DATA_DIRECTORY);
}
std::string prefixedFileName = impl->FindConfigFile(fileName);
+ if (!isRegularFile(prefixedFileName))
+ throw FileNotFound(prefixedFileName);
std::ifstream ifs(UTF8Util::GetPlatformString(prefixedFileName));
std::string content(std::istreambuf_iterator<char>(ifs),
(std::istreambuf_iterator<char>()));

View file

@ -0,0 +1,13 @@
Index: OpenCC-ver.1.1.7/src/Segments.hpp
===================================================================
--- OpenCC-ver.1.1.7.orig/src/Segments.hpp
+++ OpenCC-ver.1.1.7/src/Segments.hpp
@@ -32,7 +32,7 @@ public:
Segments() {}
Segments(std::initializer_list<const char*> initList) {
- for (const std::string& item : initList) {
+ for (const std::string item : initList) {
AddSegment(item);
}
}

View file

@ -1,14 +1,11 @@
Name: opencc
Version: 1.1.9
Release: 5%{?dist}
Version: 1.1.7
Release: 1%{?dist}
Summary: Libraries for Simplified-Traditional Chinese Conversion
License: Apache-2.0
URL: https://github.com/BYVoid/OpenCC
Source0: https://github.com/BYVoid/OpenCC/archive/ver.%{version}.tar.gz#/OpenCC-ver.%{version}.tar.gz
Patch0: opencc-fixes-compile.patch
Patch1: opencc-fixes-crash.patch
Patch2: opencc-fixes-cmake.patch
Patch3: opencc-fixes-cmake-vars.patch
Patch0: opencc-fixes-std-initializer-list.patch
BuildRequires: gcc-c++
BuildRequires: gettext
@ -49,7 +46,8 @@ developing applications that use %{name}.
%prep
%autosetup -n OpenCC-ver.%{version} -p1
%setup -q -n OpenCC-ver.%{version}
%patch -P0 -p1 -b .compile
%build
%cmake -DENABLE_GETTEXT:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=ON -DUSE_SYSTEM_MARISA:BOOL=ON -DUSE_SYSTEM_RAPIDJSON:BOOL=ON
@ -82,30 +80,6 @@ developing applications that use %{name}.
%{_libdir}/cmake/opencc/OpenCC*.cmake
%changelog
* Thu Aug 21 2025 Peng Wu <pwu@redhat.com> - 1.1.9-5
- Update CI tests
- Resolves: RHBZ#2382996
* Tue Aug 12 2025 Peng Wu <pwu@redhat.com> - 1.1.9-4
- Update for https://fedoraproject.org/wiki/Changes/CMake_drop_install_vars
- Resolves: RHBZ#2381327
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Thu Jul 17 2025 Peng Wu <pwu@redhat.com> - 1.1.9-2
- Update for marisa 0.3.0
* Thu Feb 6 2025 Peng Wu <pwu@redhat.com> - 1.1.9-1
- Update to 1.1.9
- Resolves: RHBZ#2340967
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Fri Feb 2 2024 Peng Wu <pwu@redhat.com> - 1.1.7-1
- Update to 1.1.7
- Resolves: RHBZ#2261417

View file

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

View file

@ -1 +1 @@
SHA512 (OpenCC-ver.1.1.9.tar.gz) = 713cf00931d7616994eb455eef3bc893096b5cd6d42b346aa1130591752d9612891ea3ed035bd7bd4ec7df1c90425e86375f5b3337fac11663c656c79a8f33e9
SHA512 (OpenCC-ver.1.1.7.tar.gz) = 26e4b12238f853b0fa91f9f0d9af7985bf04a0763185cc3b50b69ba99a2d80091b8c3160176d0d4cd348fbf1a680bfd80dc740dc60c938a256dc2dac8ef49f15

View file

@ -1,5 +0,0 @@
test: ./runtest.sh
duration: 50m
framework: beakerlib
require:
- opencc-tools

View file

@ -0,0 +1,2 @@
role_pkgs_req:
- rsync

View file

@ -0,0 +1,4 @@
---
dependencies:
- role: str-common-init

View file

@ -0,0 +1,47 @@
---
- name: Check if opencc is installed
register: opencc_testing_runner
find:
paths: "{{ ansible_env.PATH.split(':') }}"
pattern: opencc
- name: Install opencc-tools
when: opencc_testing_runner.matched == 0
block:
- name: Installing opencc-tools
package:
name:
- opencc-tools
- name: Start opencc tests
block:
- name: Execute tests
shell: |
set -e
log_file="{{ remote_artifacts }}/{{ installed_test_name }}.log"
exec 2>>$log_file 1>>$log_file
echo "Starting opencc tests"
TEST=opencc
status="FAIL"
opencc >> "{{ remote_artifacts }}/test.log" <<EOF
测试
EOF
grep "測試" "{{ remote_artifacts }}/test.log"
if [ $? -eq 0 ]; then
status="PASS"
fi
echo "${status} $TEST" >> {{ remote_artifacts }}/test.log
- name: Check the results
shell: grep "^FAIL" {{ remote_artifacts }}/test.log
register: test_fails
failed_when: False
- name: Set role result
set_fact:
role_result_failed: "{{ (test_fails.stdout|d|length > 0) or (test_fails.stderr|d|length > 0) }}"
role_result_msg: "{{ test_fails.stdout|d('tests failed.') }}"
- include_role:
name: str-common-final

View file

@ -1,25 +0,0 @@
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh || exit 1
rlJournalStart
rlPhaseStartSetup
rlShowPackageVersion opencc
rlRun -t -l "VERSION=$(rpm -q opencc --queryformat='%{version}')" 0 "Get VERSION"
FEDORA_VERSION=$(rlGetDistroRelease)
rlLog "FEDORA_VERSION=${DISTRO_RELEASE}"
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "pushd $tmp"
rlPhaseEnd
rlPhaseStartTest
rlRun "set -o pipefail"
rlRun "echo '测试'>input.txt" 0 "Generate input.txt"
rlRun "opencc -i input.txt -o output.txt" 0 "Run opencc tool"
rlRun "grep '測試' output.txt" 0 "Check output.txt"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd

10
tests/tests.yml Normal file
View file

@ -0,0 +1,10 @@
- hosts: localhost
roles:
- role: opencc-testing-role
installed_test_name: opencc
tags:
- classic
- gating
required_packages:
- opencc-tools