commit b7deafacc1cdaf8689baa54238a7dcad286e5a3f Author: tigro Date: Fri Dec 29 16:37:37 2023 +0300 import kumir2-2.1.0-1.20230831git6165847.el9 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ffdc5c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/kumir2-61658473d05b1efbee9f050b4630ea648c9b7148.tar.gz diff --git a/.kumir2.metadata b/.kumir2.metadata new file mode 100644 index 0000000..36167ff --- /dev/null +++ b/.kumir2.metadata @@ -0,0 +1 @@ +68c2c00bd01752784343cdf8c55d5c167a233135 SOURCES/kumir2-61658473d05b1efbee9f050b4630ea648c9b7148.tar.gz diff --git a/SOURCES/0001-Change-lrelease-patch.patch b/SOURCES/0001-Change-lrelease-patch.patch new file mode 100644 index 0000000..a3f584d --- /dev/null +++ b/SOURCES/0001-Change-lrelease-patch.patch @@ -0,0 +1,25 @@ +From 97c06e8a8c5db20558fd0c4fc977eddcb84ce911 Mon Sep 17 00:00:00 2001 +From: tigro +Date: Fri, 29 Dec 2023 14:51:35 +0300 +Subject: [PATCH] Change lrelease patch + +--- + cmake/kumir2/kumir2_common.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmake/kumir2/kumir2_common.cmake b/cmake/kumir2/kumir2_common.cmake +index 28d206b..be71046 100644 +--- a/cmake/kumir2/kumir2_common.cmake ++++ b/cmake/kumir2/kumir2_common.cmake +@@ -20,7 +20,7 @@ endif(NOT DEFINED USE_QT) + if(${USE_QT} GREATER 4) + # Find Qt5 + find_package(Qt5 ${MINIMUM_QT5_VERSION} COMPONENTS Core Widgets REQUIRED) +- set(QT_LRELEASE_EXECUTABLE "${_qt5Core_install_prefix}/bin/lrelease") ++ set(QT_LRELEASE_EXECUTABLE "/usr/lib64/qt5/bin/lrelease") + else() + # Find Qt4 + set(QT_USE_QTMAIN 1) +-- +2.43.0 + diff --git a/SOURCES/kumir2-2.1.0-gcc13.patch b/SOURCES/kumir2-2.1.0-gcc13.patch new file mode 100644 index 0000000..e6e6534 --- /dev/null +++ b/SOURCES/kumir2-2.1.0-gcc13.patch @@ -0,0 +1,22 @@ +diff -urN kumir2-2.1.0/src/kumir2-libs/vm/vm_breakpoints_table.hpp kumir2-2.1.0-patched/src/kumir2-libs/vm/vm_breakpoints_table.hpp +--- kumir2-2.1.0/src/kumir2-libs/vm/vm_breakpoints_table.hpp 2020-12-13 21:14:22.000000000 +1000 ++++ kumir2-2.1.0-patched/src/kumir2-libs/vm/vm_breakpoints_table.hpp 2023-06-27 16:21:25.675093334 +1000 +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + + namespace VM + { +diff -urN kumir2-2.1.0/src/kumir2-libs/vm/vm_instruction.hpp kumir2-2.1.0-patched/src/kumir2-libs/vm/vm_instruction.hpp +--- kumir2-2.1.0/src/kumir2-libs/vm/vm_instruction.hpp 2020-12-13 21:14:22.000000000 +1000 ++++ kumir2-2.1.0-patched/src/kumir2-libs/vm/vm_instruction.hpp 2023-06-27 16:21:51.208426702 +1000 +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + + namespace Bytecode + { diff --git a/SOURCES/kumir2-alt-fix-LIB_BASENAME.patch b/SOURCES/kumir2-alt-fix-LIB_BASENAME.patch new file mode 100644 index 0000000..6eccc1b --- /dev/null +++ b/SOURCES/kumir2-alt-fix-LIB_BASENAME.patch @@ -0,0 +1,16 @@ +diff --git a/cmake/kumir2/kumir2_linux.cmake b/cmake/kumir2/kumir2_linux.cmake +index 6952b14a..5261955b 100644 +--- a/cmake/kumir2/kumir2_linux.cmake ++++ b/cmake/kumir2/kumir2_linux.cmake +@@ -2,11 +2,6 @@ + # should be placed into 'lib' subdirectory of /usr [/usr/local]. + # Some distributions have distinct lib64 directory for 64-bit libraries. + # LIB_BASENAME value is a correct 'lib' dir name for current distro. +-if((${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64") AND NOT (EXISTS /etc/ubuntu-release) AND NOT (EXISTS /etc/debian_version)) +- set(LIB_BASENAME lib64) +-else() +- set(LIB_BASENAME lib) +-endif() + + # Build filesystem layout, according to LSB + set(KUMIR2_EXEC_DIR "bin") # executable binaries diff --git a/SOURCES/port-to-python3.patch b/SOURCES/port-to-python3.patch new file mode 100644 index 0000000..5c25538 --- /dev/null +++ b/SOURCES/port-to-python3.patch @@ -0,0 +1,310 @@ +diff --git a/scripts/gen_actor_source.py b/scripts/gen_actor_source.py +index 8e0ffaf5..293734c9 100755 +--- a/scripts/gen_actor_source.py ++++ b/scripts/gen_actor_source.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # coding=utf-8 + + """ +@@ -403,15 +403,15 @@ class BaseType: + qualified_name = dict() + qualified_name["ascii"] = name + if name == "int": +- qualified_name["ru_RU"] = u"цел" ++ qualified_name["ru_RU"] = "цел" + elif name == "double": +- qualified_name["ru_RU"] = u"вещ" ++ qualified_name["ru_RU"] = "вещ" + elif name == "bool": +- qualified_name["ru_RU"] = u"лог" ++ qualified_name["ru_RU"] = "лог" + elif name == "char": +- qualified_name["ru_RU"] = u"сим" ++ qualified_name["ru_RU"] = "сим" + elif name == "string": +- qualified_name["ru_RU"] = u"лит" ++ qualified_name["ru_RU"] = "лит" + self._name = Name(qualified_name) + BaseType._typeTable[self._name.get_ascii_value()] = self + +@@ -727,14 +727,14 @@ class Argument: + """ + result = "" + if self.constant and not self.readable: +- result += u"арг " ++ result += "арг " + elif self.readable and self.reference: +- result += u"аргрез " ++ result += "аргрез " + elif self.reference: +- result += u"рез " ++ result += "рез " + result += self.base_type.get_kumir_name() + if self.dimension > 0: +- result += u"таб" ++ result += "таб" + result += " " + self.name.get_kumir_value() + if self.dimension > 0: + result += "[" + "0:0," * (self.dimension - 1) + "0:0]" +@@ -790,7 +790,7 @@ class Method: + rtype: unicode + return: Kumir header to be parsed by Kumir analizer as text program + """ +- result = u"алг " ++ result = "алг " + if self.return_type is not None: + rtype = self.return_type + assert isinstance(rtype, BaseType) +@@ -829,7 +829,7 @@ class Method: + else: + result += self.return_type.get_qt_name() + " " + result += class_name + "::run" + self.name.get_camel_case_cpp_value() +- body = u"/* алг " + kumir_return_type + self.name.get_kumir_value() ++ body = "/* алг " + kumir_return_type + self.name.get_kumir_value() + if self.arguments: + body += "(" + for index, argument in enumerate(self.arguments): +@@ -1669,9 +1669,9 @@ private: + assert isinstance(argument, Argument) + assert isinstance(argument.base_type, BaseType) + body += "result.last().arguments.push_back(Shared::ActorInterface::Argument());\n" +- if argument.get_kumir_argument_declaration().startswith(u'аргрез '): ++ if argument.get_kumir_argument_declaration().startswith('аргрез '): + body += "result.last().arguments.last().accessType = Shared::ActorInterface::InOutArgument;\n" +- elif argument.get_kumir_argument_declaration().startswith(u'рез '): ++ elif argument.get_kumir_argument_declaration().startswith('рез '): + body += "result.last().arguments.last().accessType = Shared::ActorInterface::OutArgument;\n" + else: + body += "result.last().arguments.last().accessType = Shared::ActorInterface::InArgument;\n" +diff --git a/scripts/get_bundle_name.py b/scripts/get_bundle_name.py +index e77eebf4..05e1387f 100644 +--- a/scripts/get_bundle_name.py ++++ b/scripts/get_bundle_name.py +@@ -9,13 +9,13 @@ if 3 == sys.version_info.major: + def to_str(x): + return x.decode("utf-8") + else: +- from urllib import unquote ++ from urllib.parse import unquote + def to_str(x): +- return unicode(x) ++ return str(x) + + + def get_version_information(top_level_dir): +- assert isinstance(top_level_dir, str) or isinstance(top_level_dir, unicode) ++ assert isinstance(top_level_dir, str) or isinstance(top_level_dir, str) + if os.path.exists(top_level_dir + os.path.sep + ".git"): + version_info = "" + try: +diff --git a/scripts/project_spider.py b/scripts/project_spider.py +index f988d309..0f8ae139 100644 +--- a/scripts/project_spider.py ++++ b/scripts/project_spider.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + class ProjectModel: + +@@ -150,11 +150,11 @@ def __scan_library(toplevel, specfilename): + target = basename[0:-8] + basename = basename.lower()[0:-8] + c.libs = [target] +- if spec.has_key("summary"): ++ if "summary" in spec: + c.summary = spec["summary"] +- if spec.has_key("description"): ++ if "description" in spec: + c.description = spec["description"] +- if spec.has_key("otherfiles"): ++ if "otherfiles" in spec: + c.filesmasks = spec["otherfiles"] + tsfiles = __translations_list(toplevel, target) + +@@ -169,14 +169,14 @@ def __scan_library(toplevel, specfilename): + + def __scan_plugin(toplevel, specfilename): + spec = __read_json(specfilename) +- if spec.has_key("nodeploy") and spec["nodeploy"]: ++ if "nodeploy" in spec and spec["nodeploy"]: + return None + c = Component() + c.name = "module-"+spec["name"] +- if spec.has_key("libexecs"): ++ if "libexecs" in spec: + c.libexecs = spec["libexecs"] +- if spec.has_key("requiresother"): +- c.requires_other = spec["requiresother"] ++ if "requiresother" in spec: ++ c.requires_other = spec["requiresother"] + srcdir = specfilename[len(toplevel)+5:] + if srcdir.startswith("actors"): + c.name = "actor-" +@@ -191,19 +191,19 @@ def __scan_plugin(toplevel, specfilename): + basename = basename[5:] + profilename = dirr+"/"+basename+".pro" + c.plugins += [target] +- if spec.has_key("libs"): ++ if "libs" in spec: + c.requires_libs = spec["libs"] + if not "ExtensionSystem" in c.requires_libs: + c.requires_libs += ["ExtensionSystem"] +- if spec.has_key("requires"): ++ if "requires" in spec: + c.requires_kumir2 = spec["requires"] +- if spec.has_key("provides"): ++ if "provides" in spec: + c.provides = spec["provides"] +- if spec.has_key("summary"): ++ if "summary" in spec: + c.summary = spec["summary"] +- if spec.has_key("description"): ++ if "description" in spec: + c.description = spec["description"] +- if spec.has_key("otherfiles"): ++ if "otherfiles" in spec: + c.filemasks = spec["otherfiles"] + tsfiles = __translations_list(toplevel, target) + for ts in tsfiles: +@@ -244,15 +244,15 @@ def __scan_application(toplevel, specfilename): + basename = basename.lower()[0:-8] + + c.bins += [target] +- if spec.has_key("win32_extradirs"): ++ if "win32_extradirs" in spec: + c.win32_extradirs = spec["win32_extradirs"] +- if spec.has_key("requires"): ++ if "requires" in spec: + c.requires_kumir2 = spec["requires"] +- if spec.has_key("webapps"): ++ if "webapps" in spec: + c.requires_web = spec["webapps"] + c.isconsole = spec["console"] + c.filesmasks += ["%bindir%/"+target] +- if spec.has_key("desktopfile"): ++ if "desktopfile" in spec: + c.desktopfiles += [spec["desktopfile"]] + c.filesmasks += ["%datadir%/applications/"+spec["desktopfile"]] + icon = __extract_icon_from_desktop_file(toplevel+"/"+spec["desktopfile"]) +@@ -263,9 +263,9 @@ def __scan_application(toplevel, specfilename): + c.filesmasks += ["%datadir%/icons"+d+"/"+f] + c.icons += [icon] + c.dirs += ["%datadir%/applications"] +- if spec.has_key("summary"): ++ if "summary" in spec: + c.summary = spec["summary"] +- if spec.has_key("description"): ++ if "description" in spec: + c.description = spec["description"] + return c + +@@ -280,15 +280,15 @@ def __scan_webapplication(toplevel, specfilename): + c.dirs += ["%datadir%/kumir2/webapps/"+basename+"/"] + c.filesmasks += ["%datadir%/kumir2/webapps/"+basename+"/*"] + +- if spec.has_key("extrafiles"): ++ if "extrafiles" in spec: + extrafiles = spec["extrafiles"] + for ef in extrafiles: + if not ef["targetdir"] in c.dirs: + c.dirs += [ef["targetdir"]] + c.isweb = True +- if spec.has_key("summary"): ++ if "summary" in spec: + c.summary = spec["summary"] +- if spec.has_key("description"): ++ if "description" in spec: + c.description = spec["description"] + return c + +@@ -348,7 +348,7 @@ def __merge_components(lst): + result = {} + for item in lst: + name = item.name +- if not result.has_key(name): ++ if name not in result: + result[name] = item + else: + c = result[name] +diff --git a/scripts/read_disabled_modules.py b/scripts/read_disabled_modules.py +index 46f9cd54..ff9593cb 100644 +--- a/scripts/read_disabled_modules.py ++++ b/scripts/read_disabled_modules.py +@@ -7,7 +7,7 @@ import sys + + + def get_version_information(top_level_dir): +- assert isinstance(top_level_dir, str) or isinstance(top_level_dir, unicode) ++ assert isinstance(top_level_dir, str) or isinstance(top_level_dir, str) + if os.path.exists(top_level_dir + os.path.sep + ".git"): + try: + version_info = subprocess.check_output( +diff --git a/scripts/update_translations.py b/scripts/update_translations.py +index 37643177..9da2f2b2 100755 +--- a/scripts/update_translations.py ++++ b/scripts/update_translations.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + TS_MODULES = { + "ExtensionSystem": "src/kumir2-libs/extensionsystem", +diff --git a/src/kumir2-libs/errormessages/scanmessages.py b/src/kumir2-libs/errormessages/scanmessages.py +index ea575b60..752a8f74 100644 +--- a/src/kumir2-libs/errormessages/scanmessages.py ++++ b/src/kumir2-libs/errormessages/scanmessages.py +@@ -131,7 +131,7 @@ def readRules(filename): + if f is None: + return result + if sys.version_info.major < 3: +- lines = unicode(f.read(), 'utf-8').split('\n') ++ lines = f.read().split('\n') + else: + lines = f.read().split('\n') + f.close() +@@ -214,7 +214,7 @@ def makeTable(database): + :returns: CSV table contents + :rtype: unicode + """ +- result = u'"Key";' ++ result = '"Key";' + for lang in database.keys(): + if len(lang) > 0: + result += '"%s";' % lang +@@ -277,7 +277,7 @@ if __name__ == "__main__": + + db_file = open(db_file_name, 'r', encoding="utf-8") + if sys.version_info.major < 3: +- source_csv_contents = unicode(db_file.read(), 'utf-8') ++ source_csv_contents = db_file.read() + else: + source_csv_contents = db_file.read() + db_file.close() +diff --git a/src/kumir2-libs/stdlib/table_generator.py b/src/kumir2-libs/stdlib/table_generator.py +index f6e2376a..58d49b07 100644 +--- a/src/kumir2-libs/stdlib/table_generator.py ++++ b/src/kumir2-libs/stdlib/table_generator.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python2.7 ++#!/usr/bin/python3 + #encoding=utf-8 + + TABLES = ["cp866", "koi8-r", "windows-1251"] +@@ -8,9 +8,9 @@ for table in TABLES: + ualph = [] + for elem in alph: + try: +- symbol = unicode(elem, table) ++ symbol = elem.encode(table) + except: +- symbol = u"\0" ++ symbol = "\0" + ualph += [symbol] + + ucodes = map(lambda x: ord(x), ualph) +-- +2.25.2 + diff --git a/SPECS/kumir2.spec b/SPECS/kumir2.spec new file mode 100644 index 0000000..8d9b1e3 --- /dev/null +++ b/SPECS/kumir2.spec @@ -0,0 +1,118 @@ +%global commit 61658473d05b1efbee9f050b4630ea648c9b7148 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global date 20230831 + +Summary: KUMIR education system +Name: kumir2 +Version: 2.1.0 +Release: 1.%{date}git%{shortcommit}%{?dist} + +License: GPLv2+ +Url: http://www.niisi.ru/kumir/ +Source0: https://github.com/a-a-maly/%{name}/archive/%{commit}/kumir2-%{commit}.tar.gz +Patch0: kumir2-2.1.0-gcc13.patch +Patch1: kumir2-alt-fix-LIB_BASENAME.patch +Patch2: port-to-python3.patch +Patch3: 0001-Change-lrelease-patch.patch + +BuildRequires: boost-devel +BuildRequires: fdupes +BuildRequires: git-core +BuildRequires: kf5-kiconthemes-devel +BuildRequires: kf5-ktextwidgets-devel +BuildRequires: kf5-kwidgetsaddons-devel +BuildRequires: kf5-kwindowsystem-devel +BuildRequires: kf5-kxmlgui-devel +BuildRequires: pkgconfig(Qt5Concurrent) +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(Qt5DBus) +BuildRequires: pkgconfig(Qt5Gui) +BuildRequires: pkgconfig(Qt5Network) +BuildRequires: pkgconfig(Qt5PrintSupport) +BuildRequires: pkgconfig(Qt5Qml) +BuildRequires: pkgconfig(Qt5Quick) +BuildRequires: pkgconfig(Qt5QuickWidgets) +BuildRequires: pkgconfig(Qt5Script) +BuildRequires: pkgconfig(Qt5Sensors) +BuildRequires: pkgconfig(Qt5Svg) +BuildRequires: pkgconfig(Qt5Test) +BuildRequires: pkgconfig(Qt5UiTools) +BuildRequires: pkgconfig(Qt5WaylandClient) +BuildRequires: pkgconfig(Qt5WaylandCompositor) +BuildRequires: pkgconfig(Qt5Widgets) +BuildRequires: pkgconfig(Qt5X11Extras) +BuildRequires: pkgconfig(Qt5Xml) +BuildRequires: python3 +BuildRequires: qt5-linguist + +%description +Complete KUMIR education system. + + +%package devel +Summary: Development files for Kumir +Requires: %{name} = %{version}-%{release} + + +%description devel +Development files for Kumir. + + +%prep +%autosetup -p1 -n %{name}-%{commit} + +sed -i "s/^Categories=.*$/Categories=Education;Qt;ComputerScience;/" *.desktop +# Remove bundled boost +rm -rf src/3rdparty/boost* + +%build +export PATH=%_qt5_bindir:$PATH +%cmake \ + -DUSE_QT=5 \ + -DLIB_BASENAME=%{_lib} \ + -DPROVIDED_VERSION_INFO=TRUE \ + -DGIT_HASH=4aa5e175 \ + -DGIT_TIMESTAMP=20200922 \ + -DGIT_TAG=2.1.0-rc10 \ + -DGIT_BRANCH=master +%cmake_build + +%install +%cmake_install +%fdupes -s %{buildroot} + + +%files +%{_bindir}/docbook2latex +%{_bindir}/kumir2-bc +%{_bindir}/kumir2-checkcourse +%{_bindir}/kumir2-classic +%{_bindir}/kumir2-courseeditor +%{_bindir}/kumir2-ide +%{_bindir}/kumir2-open +%{_bindir}/kumir2-run +%{_bindir}/kumir2-teacher +%{_bindir}/kumir2-xrun +%{_bindir}/pictomir2course +%{_libdir}/kumir2 +%{_datadir}/applications/kumir2-classic.desktop +%{_datadir}/applications/kumir2-ide.desktop +%{_datadir}/applications/kumir2-teacher.desktop +%{_datadir}/kumir2 +%{_datadir}/mime/packages/kumir2-mimetypes.xml +%{_datadir}/icons/hicolor/*/apps/*.{png,svg} +%{_datadir}/icons/hicolor/*/mimetypes/*.{png,svg} + + +%files devel +%{_includedir}/kumir2-libs +%{_includedir}/kumir2 +%{_libdir}/cmake/Kumir2 + + +%changelog +* Fri Dec 29 2023 Arkady L. Shane - 2.1.0-1.20230831git6165847 +- Rebuilt for MSVSphere 9.3 + +* Fri Dec 29 2023 Arkady L. Shane - 2.10-1.20230831git61658473 +- initial build