From 7b8717ba4e10a1b4416a4f6ed262b8d3d97d52ce Mon Sep 17 00:00:00 2001
From: François Andriot <albator78@libertysurf.fr>
Date: Mon, 28 Sep 2026 20:24:11 +0200
Subject: RPM: update build scripts (merge from r14.1.x branch)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: François Andriot <albator78@libertysurf.fr>
---
 redhat/Makefile                                  | 148 +++++++++++++----------
 redhat/build/build_rpm_package.sh                |   2 +-
 redhat/build/gather_rpm_sources.sh               |  20 ++-
 redhat/build/get_latest_built_package_version.sh |   6 +-
 redhat/build/get_rpm_package_name.sh             |   9 +-
 redhat/build/get_source_files.sh                 |   2 +-
 redhat/build/install_rpm_package.sh              |   4 +-
 redhat/build/rpmdist.sh                          |   8 +-
 redhat/build/update_repository.sh                |  15 ++-
 9 files changed, 123 insertions(+), 91 deletions(-)

diff --git a/redhat/Makefile b/redhat/Makefile
index d0eb0d7ce..7b7701d82 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -24,39 +24,36 @@ buildpkg = \
 
 
 all: dependencies core libraries applications i18n meta external
-dependencies: tde-cmake tqt3 tqtinterface akode arts libart_lgpl libcaldav libcarddav polkit-tqt pytqt sip4-tqt tqca tqscintilla avahi-tqt dbus-tqt dbus-1-tqt
+dependencies: tde-cmake tqt akode arts libart_lgpl libcaldav libcarddav polkit-tqt pytqt sip4-tqt tqca tqscintilla avahi-tqt dbus-1-tqt
 core: tdelibs tdebase tdeaccessibility tdeadmin tdegames tdemultimedia tdepim tdetoys tdevelop tdeaddons tdeartwork tdebindings tdeedu tdegraphics tdenetwork tdesdk tdeutils tdewebdev
 libraries: kipi-plugins libkdcraw libkexiv2 libkipi libksquirrel libtdeldap libtqt-perl pytdeextensions pytde
-applications: abakus amarok basket bibletime codeine digikam dolphin filelight gtk3-tqt-engine gtk-qt-engine gwenview k3b k9copy kaffeine kaffeine-mozilla kasablanca katapult kbarcode kbfx kbibtex kbiff kbookreader kchmviewer kcmautostart kcmldap kcmldapcontroller kcmldapmanager kcpuload kdbg kdbusnotification kdiff3 kdirstat keep kerberostray keximdb kftpgrabber kile kima kiosktool kkbswitch klamav klcddimmer kmplayer kmyfirewall kmymoney knemo knetload knetstats knights knmap knowit knutclient koffice kommando kompose konversation kooldock kopete-otr kpicosim kpilot kplayer krecipes krename krusader kscope ksensors kshowmail kshutdown ksplash-engine-moodin ksquirrel kstreamripper ksystemlog ktechlab ktorrent kvirc kvkbd kvpnc kxmleditor mathemagics mplayerthumbs piklab polkit-agent-tde potracegui qalculate-tde qt4-tqt-theme-engine rosegarden smartcardauth smb4k soundkonverter tdebluez tde-guidance tdeio-appinfo tdeio-apt tdeio-ftps tdeio-gopher tastymenu tdedocker tdeio-locate tdeio-sword tdeio-umountwrapper tdenetworkmanager tdepacman tdepowersave tderadio tdesshaskpass tde-style-baghira tde-style-domino tde-style-ia-ora tde-style-lipstik tde-style-polyester tde-style-qtcurve tdesudo tdesvn tde-systemsettings tdmtheme tellico tork twin-style-crystal twin-style-dekorator twin-style-fahrenheit twin-style-machbunt twin-style-suse2 wlassistant yakuake
+applications: abakus amarok basket bibletime codeine digikam dolphin filelight gtk3-tqt-engine gtk-qt-engine gwenview k3b k9copy kaffeine kasablanca katapult kbarcode kbfx kbibtex kbiff kbookreader kchmviewer kcmautostart kcmldap kcmldapcontroller kcmldapmanager kcpuload kdbg kdbusnotification kdiff3 kdirstat keep kerberostray keximdb kftpgrabber kile kima kiosktool kkbswitch klamav klcddimmer kmplayer kmyfirewall kmymoney knemo knetload knetstats knights knmap knowit knutclient koffice kommando kompose konversation kooldock kopete-otr kpicosim kpilot kplayer krecipes krename krusader kscope ksensors kshowmail kshutdown ksplash-engine-moodin ksquirrel kstreamripper ksystemlog ktechlab ktorrent kvirc kvkbd kvpnc kxmleditor mathemagics mplayerthumbs piklab polkit-agent-tde potracegui qalculate-tde qt4-tqt-theme-engine rosegarden smartcardauth smb4k soundkonverter tdebluez tde-guidance tdeio-appinfo tdeio-apt tdeio-ftps tdeio-gopher tastymenu tdedocker tdeio-locate tdeio-sword tdeio-umountwrapper tdenetworkmanager tdepacman tdepowersave tderadio tdesshaskpass tde-style-baghira tde-style-domino tde-style-ia-ora tde-style-lipstik tde-style-polyester tde-style-qtcurve tdesudo tdesvn tde-systemsettings tdmtheme tellico tork twin-style-crystal twin-style-dekorator twin-style-fahrenheit twin-style-machbunt twin-style-suse2 wlassistant yakuake
 i18n: gwenview-i18n k3b-i18n koffice-i18n tde-i18n
 
 ### Trinity Dependencies
 
-akode: tqtinterface trinity-filesystem
+akode: tqt trinity-filesystem
 	$(call buildpkg,dependencies/akode)
 
-arts: tqtinterface trinity-filesystem
+arts: tqt trinity-filesystem
 	$(call buildpkg,dependencies/arts)
 
-avahi-tqt: tqtinterface
+avahi-tqt: tqt
 	$(call buildpkg,dependencies/avahi-tqt)
 
-dbus-1-tqt: tqtinterface
+dbus-1-tqt: tqt
 	$(call buildpkg,dependencies/dbus-1-tqt)
 
-dbus-tqt: tqtinterface
-	$(call buildpkg,dependencies/dbus-tqt)
-
-libart_lgpl: tqtinterface
+libart_lgpl: tqt
 	$(call buildpkg,dependencies/libart-lgpl)
 
-libcaldav: tqtinterface
+libcaldav: tqt
 	$(call buildpkg,dependencies/libcaldav)
 
-libcarddav: tqtinterface
+libcarddav: tqt
 	$(call buildpkg,dependencies/libcarddav)
 
-polkit-tqt: tqtinterface dbus-1-tqt
+polkit-tqt: tqt dbus-1-tqt
 ifeq (,$(filter $(DIST), .el5 .el6 ))
 	$(call buildpkg,dependencies/polkit-tqt)
 endif
@@ -70,17 +67,14 @@ sip4-tqt:
 tde-cmake:
 	$(call buildpkg,dependencies/tde-cmake)
 
-tqca: tqtinterface
+tqca: tqt
 	$(call buildpkg,dependencies/tqca)
 
 tqscintilla: tqca tdelibs
 	$(call buildpkg,dependencies/tqscintilla)
 
-tqt3:
-	$(call buildpkg,dependencies/tqt3)
-
-tqtinterface: tqt3
-	$(call buildpkg,dependencies/tqtinterface)
+tqt:
+	$(call buildpkg,dependencies/tqt)
 
 # Core packages
 tdeaccessibility: tdebase tdemultimedia
@@ -110,7 +104,7 @@ tdegames: tdebase tdemultimedia
 tdegraphics: tdebase lcms
 	$(call buildpkg,core/tdegraphics)
 
-tdelibs: brp-check-trinity tqt3 tqtinterface arts dbus-tqt dbus-1-tqt avahi-tqt fileshareset trinity-filesystem libart_lgpl tde-cmake
+tdelibs: brp-check-trinity tqt arts dbus-1-tqt avahi-tqt fileshareset trinity-filesystem libart_lgpl tde-cmake
 	$(call buildpkg,core/tdelibs)
 
 tdemultimedia: tdebase akode
@@ -134,7 +128,7 @@ tdeutils: tdebase
 tdevelop: tdebase tdesdk
 	$(call buildpkg,core/tdevelop)
 
-tdewebdev: tdebase tdesdk
+tdewebdev: tdebase tdesdk tdeutils
 	$(call buildpkg,core/tdewebdev)
 
 ### 3rd party libraries and tools
@@ -144,7 +138,7 @@ ifneq (,$(filter $(DIST), .oss151 .oss152 .oss153 .oss154 .oss155 .oss156 .osstw
 endif
 
 htdig:
-ifneq (,$(filter $(DIST), .el7 .el8 .el9 .fc38 .fc39 .fc40 .mga6 .mga7 .mga8 .mga9 .omv2490 .omv5000 ))
+ifneq (,$(filter $(DIST), .el7 .el8 .el9 .el10 .fc38 .fc39 .fc40 .fc41 .fc42 .fc43 .fc44 .fc45 .fc46 .mga6 .mga7 .mga8 .mga9 .mga10 .omv2490 .omv6000 .oss160 .osstw ))
 	$(call buildpkg,extras/htdig)
 endif
 
@@ -154,26 +148,15 @@ ifneq (,$(filter $(DIST), .mga6 .mga7 .oss151 .osstw ))
 endif
 
 lcms:
-ifneq (,$(filter $(DIST), .el7 .el8 .el9 .mga7 .mga8 .mga9 .oss151 .oss152 .oss153 .oss154 .oss155 .oss156 .osstw ))
+ifneq (,$(filter $(DIST), .el7 .el8 .el9 .mga7 .mga8 .mga9 .mga10 .oss151 .oss152 .oss153 .oss154 .oss155 .oss156 .oss160 .osstw ))
 	$(call buildpkg,3rdparty/lcms)
 endif
 
-mp4v2:
-ifneq (,$(filter $(DIST), .el9 .oss151 .oss152 .oss153 .oss154 .oss155 .oss156 .osstw ))
-	$(call buildpkg,3rdparty/mp4v2)
-endif
-
 rdesktop:
 ifneq (,$(filter $(DIST), .oss150 ))
 	$(call buildpkg,3rdparty/rdesktop)
 endif
 
-rdiff-backup:
-# Only for PCLINUXOS
-ifneq ($(wildcard /etc/pclinuxos-release),)
-	$(call buildpkg,3rdparty/rdiff-backup)
-endif
-
 recode:
 # Build on OpenSUSE >= 15.0 only (not tw)
 ifneq (,$(filter $(DIST),.oss150 .oss151))
@@ -181,40 +164,40 @@ ifneq (,$(filter $(DIST),.oss150 .oss151))
 endif
 
 wv2:
-ifneq (,$(filter $(DIST), .el5 .el6 .el7 .el8 .el9 .fc30 .fc31 .fc32 .fc33 .fc34 .fc35 .fc36 .fc37 .fc38 .fc39 .fc40))
+ifneq (,$(filter $(DIST), .el5 .el6 .el7 .el8 .el9 .el10 .fc30 .fc31 .fc32 .fc33 .fc34 .fc35 .fc36 .fc37 .fc38 .fc39 .fc40 .fc41 .fc42 .omv2490 .omv6000 .oss160 .osstw))
 	$(call buildpkg,3rdparty/wv2)
 endif
 
 
 ### Trinity Libraries
-kipi-plugins: tqtinterface tdelibs tdepim libkdcraw libkexiv2 libkipi
+kipi-plugins: tqt tdelibs tdepim libkdcraw libkexiv2 libkipi
 	$(call buildpkg,libraries/kipi-plugins)
 
-libkdcraw: tqtinterface lcms
+libkdcraw: tqt lcms tdelibs
 	$(call buildpkg,libraries/libkdcraw)
 
-libkexiv2: tqtinterface tdelibs
+libkexiv2: tqt tdelibs
 	$(call buildpkg,libraries/libkexiv2)
 
-libkipi: tqtinterface
+libkipi: tqt
 	$(call buildpkg,libraries/libkipi)
 
 libksquirrel: tdelibs
 	$(call buildpkg,libraries/libksquirrel)
 
-libtdeldap: tqtinterface
+libtdeldap: tqt libheimdal
 	$(call buildpkg,libraries/libtdeldap)
 
-libtqt-perl: tqtinterface
+libtqt-perl: tqt
 	$(call buildpkg,libraries/libtqt-perl)
 
-mlt: tqtinterface
+mlt: tqt
 	$(call buildpkg,libraries/mlt)
 
-pytdeextensions: tqtinterface pytde
+pytdeextensions: tqt pytde
 	$(call buildpkg,libraries/pytdeextensions)
 
-pytde: tqtinterface pytqt sip4-tqt
+pytde: tqt pytqt sip4-tqt
 	$(call buildpkg,libraries/pytde)
 
 ### Trinity Applications
@@ -224,7 +207,7 @@ abakus: tdebase
 adept: tdebase
 	$(call buildpkg,applications/system/adept)
 
-amarok: tdebase mp4v2
+amarok: tdebase
 	$(call buildpkg,applications/multimedia/amarok)
 
 basket: tdebase tdepim
@@ -258,12 +241,12 @@ fusion-icon: tdebase
 	$(call buildpkg,applications/misc/fusion-icon)
 
 gtk3-tqt-engine: tdebase
-ifeq (,$(filter $(DIST),.el5 .el6))
+ifeq (,$(filter $(DIST), .el5 .el6))
 	$(call buildpkg,applications/themes/gtk3-tqt-engine)
 endif
 
 gtk-qt-engine: tdebase
-ifeq (,$(filter $(DIST),.el5))
+ifeq (,$(filter $(DIST), .el5 .fc42 .fc43 .fc44 .fc45 .oss160 .pclos2026))
 	$(call buildpkg,applications/themes/gtk-qt-engine)
 endif
 
@@ -279,9 +262,6 @@ k9copy: tdebase k3b
 kaffeine: tdebase
 	$(call buildpkg,applications/multimedia/kaffeine)
 
-kaffeine-mozilla: tdebase kaffeine
-	$(call buildpkg,applications/multimedia/kaffeine-mozilla)
-
 kasablanca: tdebase
 	$(call buildpkg,applications/internet/kasablanca)
 
@@ -295,7 +275,7 @@ kbfx: tdebase
 	$(call buildpkg,applications/system/kbfx)
 
 kbibtex: tdebase
-	#$(call buildpkg,applications/office/kbibtex)
+	$(call buildpkg,applications/office/kbibtex)
 
 kbiff: tdebase
 	$(call buildpkg,applications/internet/kbiff)
@@ -336,8 +316,10 @@ kdirstat: tdebase
 kdpkg: tdebase
 	$(call buildpkg,applications/settings/kdpkg)
 
-keep: tdebase rdiff-backup
+keep: tdebase
+ifeq (,$(filter $(DIST), .pclos2026))
 	$(call buildpkg,applications/utilities/keep)
+endif
 
 kerberostray: tdebase
 	$(call buildpkg,applications/misc/kerberostray)
@@ -424,7 +406,7 @@ kpicosim: tdebase
 	$(call buildpkg,applications/development/kpicosim)
 
 kpilot: tdebase tdepim
-ifeq (,$(filter $(DIST),.el5 .oss154 .oss155 .oss156 .osstw))
+ifeq (,$(filter $(DIST), .el5 .el10 .oss154 .oss155 .oss156 .oss160 .osstw))
 	$(call buildpkg,applications/office/kpilot)
 endif
 
@@ -474,7 +456,7 @@ ktorrent: tdebase
 	$(call buildpkg,applications/internet/ktorrent)
 
 kvirc: tdebase
-	#$(call buildpkg,applications/internet/kvirc)
+	$(call buildpkg,applications/internet/kvirc)
 
 kvkbd: tdebase
 	$(call buildpkg,applications/system/kvkbd)
@@ -502,16 +484,16 @@ endif
 potracegui: tdebase
 	$(call buildpkg,applications/graphics/potracegui)
 
-qalculate-tde:
+qalculate-tde: tdebase
 	$(call buildpkg,applications/utilities/qalculate-tde)
 
 qt4-tqt-theme-engine: tdebase
-ifeq (,$(filter $(DIST),.el5 .el6 .el8 .el9 .omv2490 .omv5000 .oss153 .oss154 .oss155 .oss156 .osstw))
+ifeq (,$(filter $(DIST),.el5 .el6 .el8 .el9 .el10 .omv2490 .omv6000 .oss153 .oss154 .oss155 .oss156 .oss160 .osstw))
 	$(call buildpkg,applications/themes/qt4-tqt-theme-engine)
 endif
 
 rosegarden: tdebase
-ifeq (,$(filter $(DIST),.el5 .el6 .el7 .el8 .el9))
+ifeq (,$(filter $(DIST),.el5 .el6 .el7 .el8 .el9 .el10))
 	$(call buildpkg,applications/multimedia/rosegarden)
 endif
 
@@ -524,15 +506,21 @@ smb4k: tdebase
 soundkonverter: tdebase
 	$(call buildpkg,applications/multimedia/soundkonverter)
 
-tastymenu:
+tastymenu: tdebase
 	$(call buildpkg,applications/system/tastymenu)
 
-tdebluez:
+tdebluez: tdebase
 	$(call buildpkg,applications/system/tdebluez)
 
+tdealternatives: tdebase
+	$(call buildpkg,applications/system/tdealternatives)
+
 tdedocker: tdebase
 	$(call buildpkg,applications/system/tdedocker)
 
+tde-ebook-reader:
+	$(call buildpkg,applications/office/tde-ebook-reader)
+
 tde-guidance: tdebase pytdeextensions
 	$(call buildpkg,applications/settings/tde-guidance)
 
@@ -559,12 +547,15 @@ tdeio-sword: tdebase
 tdeio-umountwrapper: tdebase
 	$(call buildpkg,applications/tdeio/tdeio-umountwrapper)
 
+tdeknighttour: tdebase
+	$(call buildpkg,applications/games/tdeknighttour)
+
 tdenetworkmanager: tdebase
 ifeq (,$(filter $(DIST),.el5 .el6))
 	$(call buildpkg,applications/settings/tdenetworkmanager)
 endif
 
-tdepacman: tdebase
+tdepacman: tdebase tdegames
 	$(call buildpkg,applications/games/tdepacman)
 
 tdepowersave: tdebase
@@ -605,6 +596,12 @@ tdesvn: tdebase
 tde-systemsettings: tdebase
 	$(call buildpkg,applications/settings/tde-systemsettings)
 
+tdexsldbg: tdebase
+# https://mirror.git.trinitydesktop.org/gitea/TDE/tdexsldbg/issues/2
+ifeq (,$(filter $(DIST), .mga10 .osstw))
+#	$(call buildpkg,applications/development/tdexsldbg)
+endif
+
 tdmtheme: tdebase
 	$(call buildpkg,applications/tdmtheme)
 
@@ -626,13 +623,20 @@ twin-style-fahrenheit: tdebase
 twin-style-machbunt: tdebase
 	$(call buildpkg,applications/themes/twin-style-machbunt)
 
+twin-style-mallory: tdebase
+	$(call buildpkg,applications/themes/twin-style-mallory)
+
 twin-style-suse2: tdebase
 	$(call buildpkg,applications/themes/twin-style-suse2)
 
+universal-indent-gui-tqt: tdebase
+	$(call buildpkg,applications/development/universal-indent-gui-tqt)
+
 wlassistant: tdebase
-ifeq (,$(filter $(DIST), .omv2490 .omv5000 ))
 	$(call buildpkg,applications/settings/wlassistant)
-endif
+
+xdg-desktop-portal-tde: tdebase
+	$(call buildpkg,applications/system/xdg-desktop-portal-tde)
 
 yakuake: tdebase
 	$(call buildpkg,applications/system/yakuake)
@@ -658,9 +662,14 @@ meta:
 fileshareset:
 	$(call buildpkg,extras/fileshareset)
 
-pinentry-tqt: tqtinterface
-ifeq (,$(filter $(DIST), .el5 .el6 .el7 .omv2490 .omv5000 ))
-	$(call buildpkg,extras/pinentry-tqt)
+libheimdal:
+ifneq (,$(filter $(DIST), .oss160 .osstw ))
+	$(call buildpkg,extras/libheimdal)
+endif
+
+pinentry-tqt: tqt
+ifeq (,$(filter $(DIST), .el5 .el6 .el7 ))
+#	$(call buildpkg,extras/pinentry-tqt)
 endif
 
 trinity-filesystem:
@@ -671,9 +680,18 @@ trinity-filesystem:
 git:
 	cd "$(TDE_GIT_DIR)" && ./scripts/switch_all_submodules_to_head_and_clean anonymous
 
+heimdal-applications: libtdeldap kcmldap kcmldapcontroller kcmldapmanager kerberostray
+
+repos:
+	./build/configure_repository.sh $(TDE_VERSION)
+	./build/update_repository.sh
+
 tarballs:
 	cd "$(TDE_GIT_DIR)" && COMPRESS=pigz SUFFIX=0 TARBALLS_BASE="${HOME}/tde/tarballs/${TDE_VERSION}" ./scripts/create_all_tarballs
 
+clean:
+	rm -rfv "${HOME}/rpmbuild/RPMS.tde-$(TDE_VERSION)/"*
+	rm -rfv "${HOME}/rpmbuild/SRPMS.tde-$(TDE_VERSION)/"*
 
 # External packages
 external:
diff --git a/redhat/build/build_rpm_package.sh b/redhat/build/build_rpm_package.sh
index 2033996d7..95371a2ac 100755
--- a/redhat/build/build_rpm_package.sh
+++ b/redhat/build/build_rpm_package.sh
@@ -27,7 +27,7 @@ export TEMPDIR="$(mktemp -d)"
 gather_rpm_sources.sh "${PKGNAME}" "${TDE_VERSION}" "${TEMPDIR}"
 specfile="${TEMPDIR}/${SPECFILE##*/}"
 
-if [ "${DIST}" = ".omv2490" ]; then
+if [ "${DIST}" = ".omv2490" ] || [ "${DIST}" = ".osstw" ]; then
   sed -i "${specfile}" -e "s|^%patch|%patch |"
 fi
 
diff --git a/redhat/build/gather_rpm_sources.sh b/redhat/build/gather_rpm_sources.sh
index d1ecdb3b0..fd4abaee7 100755
--- a/redhat/build/gather_rpm_sources.sh
+++ b/redhat/build/gather_rpm_sources.sh
@@ -1,11 +1,11 @@
 #!/bin/bash
 
 # Usage: gather_rpm_sources.sh <TDE_PACKAGE> <TDE_VERSION> <DESTINATION>
-# Example: gather_rpm_sources.sh tdebase 14.1.2 /tmp/tdebase
+# Example: gather_rpm_sources.sh tdebase 14.2.0 /tmp/tdebase
 
 PKGNAME="${1%/}"
 PKGNAME="${PKGNAME##*/}"
-TDE_VERSION="${2:-${TDE_VERSION:-14.1.2}}"
+TDE_VERSION="${2:-${TDE_VERSION:-14.2.0}}"
 TARGETDIR="${3:-/tmp/${PKGNAME}-${TDE_VERSION}}"
 DIST="$(rpmdist.sh --dist)"
 
@@ -29,9 +29,12 @@ cp -f ${SPECFILE} ${SOURCES} ${TARBALL} "${TARGETDIR}"
 
 ### Check for patches
 
-PATCHDIR="${HOME}/tde/patches/${TDE_VERSION}/$1"
-if [ -d "${PATCHDIR}" ]; then
-  cat "${PATCHDIR}/"*".patch" "${PATCHDIR}/"*".patch${DIST}" >>"${TARGETDIR}/one.patch" 2>/dev/null
+if [ -z "${PATCH_DIR}" ]; then
+  PATCH_DIR="${HOME}/tde/patches/${TDE_VERSION}"
+fi
+
+if [ -d "${PATCH_DIR}/$1" ]; then
+  cat "${PATCH_DIR}/$1/"*".patch" "${PATCH_DIR}/$1/"*".patch${DIST}" >>"${TARGETDIR}/one.patch" 2>/dev/null
   if [ "$(cat "${TARGETDIR}/one.patch" | wc -c)" = 0 ]; then
     rm -f "${TARGETDIR}/one.patch"
   else
@@ -41,4 +44,9 @@ if [ -d "${PATCHDIR}" ]; then
   fi
 fi
 
-exit $RET
+if [ "${DIST}" = ".fc41" ] || [ "${DIST}" = ".fc42" ] || [ "${DIST}" = ".fc43" ] || [ "${DIST}" = ".fc44" ] || [ "${DIST}" = ".fc45" ] || [ "${DIST}" = ".fc46" ] || [ "${DIST}" = ".mga9" ] || [ "${DIST}" = ".mga10" ] || [ "${DIST:0:4}" = ".omv" ] || [ "${DIST}" = ".oss160" ] || [ "${DIST}" = ".osstw" ] || [ "${DIST:0:6}" = ".pclos" ]; then
+  sed -i "${TARGETDIR}/"*".spec" \
+      -e "s|%patch|%patch -P |g"
+fi
+
+exit 0
diff --git a/redhat/build/get_latest_built_package_version.sh b/redhat/build/get_latest_built_package_version.sh
index 2526f4d55..6739f3980 100755
--- a/redhat/build/get_latest_built_package_version.sh
+++ b/redhat/build/get_latest_built_package_version.sh
@@ -12,9 +12,9 @@ RPM=$(get_latest_built_package_filename.sh "${PKGNAME}" ${TDE_VERSION})
 pkg_version="$(rpm -qp --qf "%{version}" "${RPM}")"
 pkg_release="$(rpm -qp --qf "%{release}" "${RPM}")"
 
-# Application packages: version does not match TDE version
-if [[ "${pkg_release}" =~ ^0_ ]] || [[ "${pkg_release}" =~ _0_ ]]; then
-  # Preversion
+# Preversion
+if [ "${pkg_release:0:2}" = "0_" ] || [[ "${pkg_release}" =~ _0_ ]]; then
+  # Application packages: version does not match TDE version
   if [[ "${pkg_release}" =~ ${TDE_VERSION}_ ]] ; then
      # Likely application package
     eval VERSION="${pkg_release/0_/\~}"
diff --git a/redhat/build/get_rpm_package_name.sh b/redhat/build/get_rpm_package_name.sh
index 507ec499a..80910097d 100755
--- a/redhat/build/get_rpm_package_name.sh
+++ b/redhat/build/get_rpm_package_name.sh
@@ -20,9 +20,9 @@ case "${PKGNAME}" in
   # In case prefix is already there, don't add it again.
   "trinity-"*) PREFIX="";;
   # Most TDE dependencies have no prefix
-  "avahi-tqt"|"dbus-tqt"|"dbus-1-tqt"|"libart-lgpl"|"libcaldav"|"libcarddav"|"polkit-tqt"|"pytqt"|"sip4-tqt"|"qt3"|"tqscintilla"|"tqt3"|"tqtinterface"|"tqca"|"tqca-tls") PREFIX="";;
+  "avahi-tqt"|"dbus-tqt"|"dbus-1-tqt"|"libart-lgpl"|"libcaldav"|"libcarddav"|"polkit-tqt"|"pytqt"|"sip4-tqt"|"qt3"|"tqscintilla"|"tqt"|"tqtinterface"|"tqca"|"tqca-tls") PREFIX="";;
   # 3rd party dependencies
-  "cscope"|"dirmngr"|"esound"|"exempi"|"exiv2"|"file"|"fileshareset"|"gmime"|"hk_classes"|"intltool"|"lcms"|"libbeagle"|"mp4v2"|"pinentry-tqt"|"python-qt3"|"rdesktop"|"recode"|"rdiff-backup"|"sword"|"tar") PREFIX="";;
+  "cscope"|"dirmngr"|"esound"|"exempi"|"exiv2"|"file"|"fileshareset"|"gmime"|"hk_classes"|"intltool"|"lcms"|"libbeagle"|"libheimdal"|"mp4v2"|"pinentry-tqt"|"python-qt3"|"rdesktop"|"recode"|"rdiff-backup"|"sword"|"tar") PREFIX="";;
   # Extra build stuff
   "autoconf"|"automake"|"brp-check-trinity"|"gnuchess"|"htdig"|"imlib1"|"libconfig"|"libotr3"|"libr"|"libtool2"|"lilypond"|"m4"|"mftrace"|"pan"|"pcsc-perl"|"torsocks"|"wv2"|"yaz") PREFIX="";;  # Other
   "curl") PREFIX="trinity-lib";;
@@ -53,6 +53,7 @@ case "${PKGNAME}" in
   "libbeagle")        PKGRUNTIME="${lib}beagle1";;
   "libcaldav")        PKGRUNTIME="${lib}caldav0";;
   "libcarddav")       PKGRUNTIME="${lib}carddav0";;
+  "libheimdal")       PKGRUNTIME="${lib}hdb9";;
   "libkdcraw")        PKGRUNTIME="${lib}kdcraw4";;
   "libkexiv2")        PKGRUNTIME="${lib}kexiv2-5";;
   "libkipi")          PKGRUNTIME="${lib}kipi0";;
@@ -62,7 +63,7 @@ case "${PKGNAME}" in
   "tqscintilla")      PKGRUNTIME="${lib}tqscintilla7";;
   "tqca")             PKGRUNTIME="${lib}tqca1";;
   "tqca-tls")         PKGRUNTIME="${lib}tqt3-mt-tqca-tls";;
-  "tqt3")             PKGRUNTIME="${lib}tqt3-mt";;
+  "tqt"|"tqt3")       PKGRUNTIME="${lib}tqt3-mt";;
   "tqtinterface")     PKGRUNTIME="${lib}tqt4";;
   "trinity-desktop")  PKGRUNTIME="${PKGNAME}-all";;
   "yaz")              PKGRUNTIME="${lib}yaz";;
@@ -115,7 +116,7 @@ if [ -n "${DEVEL}" ]; then
     "polkit-tqt")  PKGDEVEL="${lib}polkit-tqt-devel";;
     "tqca")        PKGDEVEL="${lib}tqca-devel";;
     "tqscintilla") PKGDEVEL="${lib}tqscintilla-devel";;
-    "tqt3")        PKGDEVEL="tqt3-dev-tools tqt3-apps-devel ${lib}tqt3-mt-sqlite3";;
+    "tqt"|"tqt3")  PKGDEVEL="tqt3-dev-tools tqt3-apps-devel ${lib}tqt3-mt-sqlite3";;
     "yaz")         PKGDEVEL="${lib}yaz-devel";;
     # Default case: development package has same name as runtime package, plus '-devel' suffix.
     *)             PKGDEVEL="${PKGRUNTIME}-devel";;
diff --git a/redhat/build/get_source_files.sh b/redhat/build/get_source_files.sh
index bf8487ed7..00b59dd7a 100755
--- a/redhat/build/get_source_files.sh
+++ b/redhat/build/get_source_files.sh
@@ -39,4 +39,4 @@ while read var val; do
       done
     ;;
   esac
-done < "${SPECFILE}"
+done < "${SPECFILE}" | sort -u
diff --git a/redhat/build/install_rpm_package.sh b/redhat/build/install_rpm_package.sh
index d70bcc5c0..8dc9e303c 100755
--- a/redhat/build/install_rpm_package.sh
+++ b/redhat/build/install_rpm_package.sh
@@ -10,14 +10,14 @@ PKGNAME="${1}"
 
 if [ -x /usr/sbin/urpmi ]; then
   PKGINST='sudo urpmi --auto --no-verify-rpm'
+elif [ -x /usr/bin/apt-get ]; then
+  PKGINST='sudo apt install -y'
 elif [ -x /usr/bin/dnf ]; then
   PKGINST="sudo dnf install -y --nogpgcheck"
 elif [ -x /usr/bin/zypper ]; then
   PKGINST="sudo zypper install -y --allow-vendor-change"
 elif [ -x /usr/bin/yum ]; then
   PKGINST='sudo yum install -y'
-elif [ -x /usr/bin/apt-get ]; then
-  PKGINST='sudo apt-get install -y'
 fi
 
 # Gets RPM package name and development package (if any)
diff --git a/redhat/build/rpmdist.sh b/redhat/build/rpmdist.sh
index d7be81993..3653321d6 100755
--- a/redhat/build/rpmdist.sh
+++ b/redhat/build/rpmdist.sh
@@ -24,9 +24,10 @@ case $a in
     DIST=".mdv${d}"
     MDKVERSION="201100"
   ;;
+  # AlmaLinux release 10.0 (Purple Lion)
   # CentOS release 5.7 (Final)
   # CentOS Linux release 6.0 (Final)
-  CentOS*|Rocky*)
+  AlmaLinux*|CentOS*|Rocky*)
     if [ $c = "release" ]; then
       RHEL="${d%%.*}"; DIST=".el${RHEL}"
     else
@@ -47,6 +48,9 @@ case $a in
       DIST=".oss$((read a; read a b c; echo ${c//./}) </etc/SUSE-brand)"
     elif grep -q "tumbleweed" "/etc/os-release"; then
       DIST=".osstw"
+    elif [ -r "/etc/os-release" ]; then
+      . "/etc/os-release"
+      DIST=".oss${VERSION//./}"
     else
       DIST=".oss"
     fi
@@ -56,6 +60,8 @@ case $a in
     . /etc/os-release
     if [ "${VERSION_ID}" = "5.0" ]; then
       DIST=".omv5000" # 5.0 (Rock)
+    elif [ "${VERSION_ID}" = "6.0" ]; then
+      DIST=".omv6000" # 6.0 (Rock)
     else
       DIST=".omv2490" # Cooker
     fi
diff --git a/redhat/build/update_repository.sh b/redhat/build/update_repository.sh
index f92b79520..97c3ea98c 100755
--- a/redhat/build/update_repository.sh
+++ b/redhat/build/update_repository.sh
@@ -11,7 +11,7 @@ done
 
 ARCH="$(rpm -E %{_target_cpu})"
 RPMDIR=$(rpm -E %{_rpmdir}.tde-${TDE_VERSION})
-DIST="$(rpmdist.sh --dist)"
+DIST="$(cd ${0%/*}; ./rpmdist.sh --dist)"
 
 [ -d "${RPMDIR}/noarch" ] || mkdir -p "${RPMDIR}/noarch"
 [ -d "${RPMDIR}/${ARCH}" ] || mkdir -p "${RPMDIR}/${ARCH}"
@@ -24,19 +24,18 @@ fi
 
 if [ -x /usr/sbin/urpmi ]; then
   REPOUPDATE='(cd ${RPMDIR}; genhdlist2 --clean --allow-empty noarch & genhdlist2 --clean --allow-empty ${ARCH} & wait; sudo urpmi.update rpmbuild.${ARCH} rpmbuild.noarch)'
+elif [ -x /usr/bin/apt-get ]; then
+  REPOUPDATE='(cd ${RPMDIR}; genpkglist $PWD noarch & genpkglist $PWD ${ARCH} & wait; genbasedir --topdir=$PWD i586 x86_64 noarch; sudo apt-get update)'
 elif [ -x /usr/bin/dnf ]; then
-  REPOUPDATE='(cd ${RPMDIR}; ${createrepo} --workers=${WORKERS} ${ARCH} & ${createrepo} --workers=${WORKERS} noarch & wait; sudo dnf --repo="rpmbuild*" clean expire-cache)'
+  REPOUPDATE='(cd ${RPMDIR}; rm -fr {${ARCH},noarch}/.repodata; ${createrepo} --workers=${WORKERS} ${ARCH} & ${createrepo} --workers=${WORKERS} noarch & wait; sudo dnf --repo="rpmbuild*" clean expire-cache)'
 elif [ -x /usr/bin/zypper ]; then
-  REPOUPDATE='(cd ${RPMDIR}; ${createrepo} --workers=${WORKERS} ${ARCH} & ${createrepo} --workers=${WORKERS} noarch & wait; sudo zypper refresh rpmbuild.${ARCH} rpmbuild.noarch)'
-  #REPOUPDATE='(rsync -av ${RPMDIR}/ /tmp/rpm${DIST}/ && cd /tmp/rpm${DIST}; umask 0000; ${createrepo} --workers=${WORKERS} ${ARCH} & ${createrepo} --workers=${WORKERS} noarch & wait; rsync -av /tmp/rpm${DIST}/ ${RPMDIR}/; sudo zypper refresh rpmbuild.${ARCH} rpmbuild.noarch)'
+  REPOUPDATE='(cd ${RPMDIR}; rm -rf */.repodata; rm -fr {${ARCH},noarch}/.repodata; ${createrepo} --workers=${WORKERS} ${ARCH} & ${createrepo} --workers=${WORKERS} noarch & wait; sudo zypper refresh rpmbuild.${ARCH} rpmbuild.noarch)'
 elif [ -x /usr/bin/yum ]; then
   if [ "${DIST}" = ".el5" ]; then
-    REPOUPDATE='(cd ${RPMDIR}; ${createrepo} ${ARCH} & ${createrepo} noarch & wait; sudo yum clean metadata --disablerepo="*" --enablerepo="rpmbuild*")'
+    REPOUPDATE='(cd ${RPMDIR}; rm -fr {${ARCH},noarch}/.repodata; ${createrepo} ${ARCH} & ${createrepo} noarch & wait; sudo yum clean metadata --disablerepo="*" --enablerepo="rpmbuild*")'
   else
-    REPOUPDATE='(cd ${RPMDIR}; ${createrepo} --workers=${WORKERS} ${ARCH} & ${createrepo} --workers=${WORKERS} noarch & wait; sudo yum clean metadata --disablerepo="*" --enablerepo="rpmbuild*")'
+    REPOUPDATE='(cd ${RPMDIR}; rm -fr {${ARCH},noarch}/.repodata; ${createrepo} --workers=${WORKERS} ${ARCH} & ${createrepo} --workers=${WORKERS} noarch & wait; sudo yum clean metadata --disablerepo="*" --enablerepo="rpmbuild*")'
   fi
-elif [ -x /usr/bin/apt-get ]; then
-  REPOUPDATE='(cd ${RPMDIR}; genpkglist $PWD noarch & genpkglist $PWD ${ARCH} & wait; genbasedir --topdir=$PWD i586 x86_64 noarch; sudo apt-get update)'
 fi
 
 eval "${REPOUPDATE}; rm -f ${LOCKFILE}" || exit 1
-- 
cgit v1.2.3

