Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package karchive for openSUSE:Factory 
checked in at 2021-08-16 10:07:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/karchive (Old)
 and      /work/SRC/openSUSE:Factory/.karchive.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "karchive"

Mon Aug 16 10:07:28 2021 rev:93 rq:912110 version:5.85.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/karchive/karchive.changes        2021-07-16 
00:00:56.069294910 +0200
+++ /work/SRC/openSUSE:Factory/.karchive.new.1899/karchive.changes      
2021-08-16 10:11:18.779117726 +0200
@@ -1,0 +2,14 @@
+Fri Aug  6 12:11:23 UTC 2021 - Christophe Giboudeaux <[email protected]>
+
+- Update to 5.85.0
+  * New feature release
+  * For more details please see:
+  * https://kde.org/announcements/frameworks/5/5.85.0
+- Changes since 5.84.0:
+  * Only pkg_check_modules() if PkgConfig is found
+  * Add support for static builds
+  * Use official gzip MIME/Media type application/gzip
+  * Report KArchive_HAVE_ZSTD in CMake Config file to consumers
+  * Deprecate remaining KFilterDev API in favour of KCompressionDevice
+
+-------------------------------------------------------------------

Old:
----
  karchive-5.84.0.tar.xz
  karchive-5.84.0.tar.xz.sig

New:
----
  karchive-5.85.0.tar.xz
  karchive-5.85.0.tar.xz.sig

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ karchive.spec ++++++
--- /var/tmp/diff_new_pack.yTJFgp/_old  2021-08-16 10:11:19.635116721 +0200
+++ /var/tmp/diff_new_pack.yTJFgp/_new  2021-08-16 10:11:19.635116721 +0200
@@ -17,7 +17,7 @@
 
 
 %define lname   libKF5Archive5
-%define _tar_path 5.84
+%define _tar_path 5.85
 # Full KF5 version (e.g. 5.33.0)
 %{!?_kf5_version: %global _kf5_version %{version}}
 # Last major and minor KF5 version (e.g. 5.33)
@@ -25,7 +25,7 @@
 # Only needed for the package signature condition
 %bcond_without lang
 Name:           karchive
-Version:        5.84.0
+Version:        5.85.0
 Release:        0
 Summary:        Qt 5 addon providing access to numerous types of archives
 License:        LGPL-2.1-or-later


++++++ karchive-5.84.0.tar.xz -> karchive-5.85.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/CMakeLists.txt 
new/karchive-5.85.0/CMakeLists.txt
--- old/karchive-5.84.0/CMakeLists.txt  2021-07-01 17:25:31.000000000 +0200
+++ new/karchive-5.85.0/CMakeLists.txt  2021-07-30 12:23:48.000000000 +0200
@@ -1,10 +1,10 @@
 cmake_minimum_required(VERSION 3.16)
 
-set(KF_VERSION "5.84.0") # handled by release scripts
+set(KF_VERSION "5.85.0") # handled by release scripts
 project(KArchive VERSION ${KF_VERSION})
 
 include(FeatureSummary)
-find_package(ECM 5.84.0  NO_MODULE)
+find_package(ECM 5.85.0  NO_MODULE)
 set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake 
Modules." URL "https://commits.kde.org/extra-cmake-modules";)
 feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND 
FATAL_ON_MISSING_REQUIRED_PACKAGES)
 
@@ -45,7 +45,9 @@
 )
 
 find_package(PkgConfig)
-pkg_check_modules(LibZstd IMPORTED_TARGET "libzstd")
+if (PkgConfig_FOUND)
+    pkg_check_modules(LibZstd IMPORTED_TARGET "libzstd")
+endif()
 add_feature_info(LibZstd LibZstd_FOUND
                 "Support for zstd compressed files and data streams"
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/KF5ArchiveConfig.cmake.in 
new/karchive-5.85.0/KF5ArchiveConfig.cmake.in
--- old/karchive-5.84.0/KF5ArchiveConfig.cmake.in       2021-07-01 
17:25:31.000000000 +0200
+++ new/karchive-5.85.0/KF5ArchiveConfig.cmake.in       2021-07-30 
12:23:48.000000000 +0200
@@ -4,8 +4,29 @@
 find_dependency(Qt5Core @REQUIRED_QT_VERSION@)
 
 
+set(KArchive_HAVE_ZLIB  "@ZLIB_FOUND@")
 set(KArchive_HAVE_BZIP2 "@BZIP2_FOUND@")
 set(KArchive_HAVE_LZMA  "@LIBLZMA_FOUND@")
+set(KArchive_HAVE_ZSTD  "@LibZstd_FOUND@")
+
+if (NOT @BUILD_SHARED_LIBS@)
+    if (@ZLIB_FOUND@)
+        find_dependency(ZLIB)
+    endif()
+
+    if (@BZIP2_FOUND@)
+        find_dependency(BZip2)
+    endif()
+
+    if (@LIBLZMA_FOUND@)
+        find_dependency(LibLZMA)
+    endif()
+
+    if (@LibZstd_FOUND@)
+        find_package(PkgConfig)
+        pkg_check_modules(LibZstd IMPORTED_TARGET "libzstd")
+    endif()
+endif()
 
 include("${CMAKE_CURRENT_LIST_DIR}/KF5ArchiveTargets.cmake")
 @PACKAGE_INCLUDE_QCHTARGETS@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/autotests/karchivetest.cpp 
new/karchive-5.85.0/autotests/karchivetest.cpp
--- old/karchive-5.84.0/autotests/karchivetest.cpp      2021-07-01 
17:25:31.000000000 +0200
+++ new/karchive-5.85.0/autotests/karchivetest.cpp      2021-07-30 
12:23:48.000000000 +0200
@@ -22,7 +22,7 @@
 #include <QSaveFile>
 #include <QStandardPaths>
 #include <QTemporaryDir>
-#include <kfilterdev.h>
+#include <kcompressiondevice.h>
 
 #ifndef Q_OS_WIN
 #include <cerrno>
@@ -348,7 +348,7 @@
     QTest::addColumn<QString>("mimeType");
 
     QTest::newRow(".tar.gz") << "karchivetest.tar.gz"
-                             << "application/x-gzip";
+                             << "application/gzip";
 #if HAVE_BZIP2_SUPPORT
     QTest::newRow(".tar.bz2") << "karchivetest.tar.bz2"
                               << "application/x-bzip";
@@ -568,7 +568,7 @@
 
     // testCreateTar must have been run first.
     QVERIFY(QFile::exists(fileName));
-    KFilterDev filterDev(fileName);
+    KCompressionDevice filterDev(fileName);
     QByteArray buffer;
     buffer.resize(8 * 1024);
     // qDebug() << "buffer.size()=" << buffer.size();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/autotests/kfiltertest.cpp 
new/karchive-5.85.0/autotests/kfiltertest.cpp
--- old/karchive-5.84.0/autotests/kfiltertest.cpp       2021-07-01 
17:25:31.000000000 +0200
+++ new/karchive-5.85.0/autotests/kfiltertest.cpp       2021-07-30 
12:23:48.000000000 +0200
@@ -14,8 +14,8 @@
 #include <QRandomGenerator>
 #include <QSaveFile>
 
+#include "kcompressiondevice.h"
 #include "kfilterbase.h"
-#include "kfilterdev.h"
 #include <QDebug>
 #include <QDir>
 #include <QFile>
@@ -47,7 +47,7 @@
 
 void KFilterTest::test_block_write(const QString &fileName, const QByteArray 
&data)
 {
-    KFilterDev dev(fileName);
+    KCompressionDevice dev(fileName);
     bool ok = dev.open(QIODevice::WriteOnly);
     QVERIFY(ok);
 
@@ -110,7 +110,7 @@
         compressedSize = QFileInfo(outFile).size();
         qDebug() << data.size() << "compressed into" << compressedSize;
         // Test data is valid
-        test_readall(outFile, QString::fromLatin1("application/x-gzip"), data);
+        test_readall(outFile, QString::fromLatin1("application/gzip"), data);
 
         data.append((char)(generator->bounded(256)));
     }
@@ -118,7 +118,7 @@
 
 void KFilterTest::test_block_read(const QString &fileName)
 {
-    KFilterDev dev(fileName);
+    KCompressionDevice dev(fileName);
     bool ok = dev.open(QIODevice::ReadOnly);
     QVERIFY(ok);
 
@@ -171,7 +171,7 @@
 
 void KFilterTest::test_getch(const QString &fileName)
 {
-    KFilterDev dev(fileName);
+    KCompressionDevice dev(fileName);
     bool ok = dev.open(QIODevice::ReadOnly);
     QVERIFY(ok);
     QByteArray read;
@@ -206,7 +206,7 @@
 
 void KFilterTest::test_textstream(const QString &fileName)
 {
-    KFilterDev dev(fileName);
+    KCompressionDevice dev(fileName);
     bool ok = dev.open(QIODevice::ReadOnly);
     QVERIFY(ok);
     QTextStream ts(&dev);
@@ -240,7 +240,7 @@
 void KFilterTest::test_readall(const QString &fileName, const QString 
&mimeType, const QByteArray &expectedData)
 {
     QFile file(fileName);
-    KCompressionDevice::CompressionType type = 
KFilterDev::compressionTypeForMimeType(mimeType);
+    KCompressionDevice::CompressionType type = 
KCompressionDevice::compressionTypeForMimeType(mimeType);
     KCompressionDevice flt(&file, false, type);
     bool ok = flt.open(QIODevice::ReadOnly);
     QVERIFY(ok);
@@ -261,7 +261,7 @@
 void KFilterTest::test_readall()
 {
     qDebug() << " -- test_readall gzip -- ";
-    test_readall(pathgz, QString::fromLatin1("application/x-gzip"), testData);
+    test_readall(pathgz, QString::fromLatin1("application/gzip"), testData);
 #if HAVE_BZIP2_SUPPORT
     qDebug() << " -- test_readall bzip2 -- ";
     test_readall(pathbz2, QString::fromLatin1("application/x-bzip"), testData);
@@ -284,11 +284,11 @@
 
 void KFilterTest::test_uncompressed()
 {
-    // Can KFilterDev handle uncompressed data even when using gzip 
decompression?
+    // Can KCompressionDevice handle uncompressed data even when using gzip 
decompression?
     qDebug() << " -- test_uncompressed -- ";
     QBuffer buffer(&testData);
     buffer.open(QIODevice::ReadOnly);
-    KCompressionDevice::CompressionType type = 
KFilterDev::compressionTypeForMimeType(QString::fromLatin1("application/x-gzip"));
+    KCompressionDevice::CompressionType type = 
KCompressionDevice::compressionTypeForMimeType(QString::fromLatin1("application/gzip"));
     KCompressionDevice flt(&buffer, false, type);
     bool ok = flt.open(QIODevice::ReadOnly);
     QVERIFY(ok);
@@ -303,7 +303,7 @@
     QTest::addColumn<KCompressionDevice::CompressionType>("type");
 
     // direct mimetype name
-    QTest::newRow("application/x-gzip") << 
QString::fromLatin1("application/x-gzip") << KCompressionDevice::GZip;
+    QTest::newRow("application/gzip") << 
QString::fromLatin1("application/gzip") << KCompressionDevice::GZip;
 #if HAVE_BZIP2_SUPPORT
     QTest::newRow("application/x-bzip") << 
QString::fromLatin1("application/x-bzip") << KCompressionDevice::BZip2;
     QTest::newRow("application/x-bzip2") << 
QString::fromLatin1("application/x-bzip2") << KCompressionDevice::BZip2;
@@ -324,7 +324,7 @@
     QFETCH(QString, mimeType);
     QFETCH(KCompressionDevice::CompressionType, type);
 
-    KCompressionDevice::CompressionType compressionType = 
KFilterDev::compressionTypeForMimeType(mimeType);
+    KCompressionDevice::CompressionType compressionType = 
KCompressionDevice::compressionTypeForMimeType(mimeType);
     QCOMPARE(compressionType, type);
 }
 
@@ -345,7 +345,7 @@
 
 #if 0 // Can't use KFilterDev for this, we need to call 
KGzipFilter::init(QIODevice::ReadOnly, KGzipFilter::ZlibHeader);
     QBuffer buffer(&deflatedData);
-    QIODevice *flt = KFilterDev::device(&buffer, "application/x-gzip", false);
+    QIODevice *flt = KFilterDev::device(&buffer, "application/gzip", false);
     static_cast<KFilterDev *>(flt)->setSkipHeaders();
     bool ok = flt->open(QIODevice::ReadOnly);
     QVERIFY(ok);
@@ -384,7 +384,7 @@
     QByteArray firstData(compressed.constData(), firstChunkSize);
     QBuffer inBuffer(&firstData);
     QVERIFY(inBuffer.open(QIODevice::ReadWrite));
-    KCompressionDevice::CompressionType type = 
KFilterDev::compressionTypeForMimeType(QString::fromLatin1("application/x-gzip"));
+    KCompressionDevice::CompressionType type = 
KCompressionDevice::compressionTypeForMimeType(QString::fromLatin1("application/gzip"));
     KCompressionDevice flt(&inBuffer, false, type);
     QVERIFY(flt.open(QIODevice::ReadOnly));
     QByteArray read = flt.readAll();
@@ -444,7 +444,7 @@
         QCOMPARE(QString::fromUtf8(reader.readLine()), 
QString(lineTemplate.arg(i) + '\n'));
         expectedFullData += QString(lineTemplate.arg(i) + '\n');
     }
-    KFilterDev otherReader(outFile);
+    KCompressionDevice otherReader(outFile);
     QVERIFY(otherReader.open(QIODevice::ReadOnly));
     QCOMPARE(QString::fromLatin1(otherReader.readAll()), expectedFullData);
     QVERIFY(otherReader.atEnd());
@@ -457,7 +457,7 @@
     // echo foo > foo; echo bar > bar ; gzip -c foo > twofiles.gz; gzip -c bar 
>> twofiles.gz
     // as documented in the gzip manpage
     QString data = QFINDTESTDATA("data/twofiles.gz");
-    KFilterDev dev(data);
+    KCompressionDevice dev(data);
     QVERIFY(dev.open(QIODevice::ReadOnly));
     QByteArray extractedData = dev.readAll();
     QByteArray expectedData{"foo\nbar\n"};
@@ -469,7 +469,7 @@
     // Generated similarly to the one above
     // This catches the case where there's more than two streams available in 
the same buffer fed to KGzipFilter
     QString data = QFINDTESTDATA("data/threefiles.gz");
-    KFilterDev dev(data);
+    KCompressionDevice dev(data);
     QVERIFY(dev.open(QIODevice::ReadOnly));
     QByteArray extractedData = dev.readAll();
     QByteArray expectedData{"foo\nbar\nbaz\n"};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/CMakeLists.txt 
new/karchive-5.85.0/src/CMakeLists.txt
--- old/karchive-5.84.0/src/CMakeLists.txt      2021-07-01 17:25:31.000000000 
+0200
+++ new/karchive-5.85.0/src/CMakeLists.txt      2021-07-30 12:23:48.000000000 
+0200
@@ -7,6 +7,7 @@
 set(HAVE_ZSTD_SUPPORT ${LibZstd_FOUND})
 
 configure_file(config-compression.h.cmake 
${CMAKE_CURRENT_BINARY_DIR}/config-compression.h)
+set(deprecated_HEADER_NAMES)
 
 add_library(KF5Archive)
 add_library(KF5::Archive ALIAS KF5Archive)
@@ -31,7 +32,6 @@
     kar.cpp
     kcompressiondevice.cpp
     kfilterbase.cpp
-    kfilterdev.cpp
     kgzipfilter.cpp
     klimitediodevice.cpp
     knonefilter.cpp
@@ -40,6 +40,12 @@
     krcc.cpp
 )
 
+if(NOT EXCLUDE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT" AND
+   EXCLUDE_DEPRECATED_BEFORE_AND_AT VERSION_LESS 5.85.0)
+    list(APPEND deprecated_HEADER_NAMES KFilterDev)
+    target_sources(KF5Archive PRIVATE kfilterdev.cpp)
+endif()
+
 ecm_qt_declare_logging_category(KF5Archive
     HEADER loggingcategory.h
     IDENTIFIER KArchiveLog
@@ -55,7 +61,7 @@
     GROUP_BASE_NAME KF
     VERSION ${KF_VERSION}
     DEPRECATED_BASE_VERSION 0
-    DEPRECATION_VERSIONS 5.0
+    DEPRECATION_VERSIONS 5.0 5.85
     EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
 )
 
@@ -85,11 +91,11 @@
     KAr
     KCompressionDevice
     KFilterBase
-    KFilterDev
     KRcc
     KTar
     KZip
     KZipFileEntry
+    ${deprecated_HEADER_NAMES}
 
     REQUIRED_HEADERS KArchive_HEADERS
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/k7zip.cpp 
new/karchive-5.85.0/src/k7zip.cpp
--- old/karchive-5.84.0/src/k7zip.cpp   2021-07-01 17:25:31.000000000 +0200
+++ new/karchive-5.85.0/src/k7zip.cpp   2021-07-30 12:23:48.000000000 +0200
@@ -427,7 +427,7 @@
 
     QVector<Folder *> folders;
     QVector<FileInfo *> fileInfos;
-    // File informations
+    // File information
     QVector<bool> cTimesDefined;
     QVector<quint64> cTimes;
     QVector<bool> aTimesDefined;
@@ -2745,7 +2745,7 @@
         dictSize = kMinReduceSize;
     }
 
-    // k_LZMA2 mehtod
+    // k_LZMA2 method
     int dict;
     for (dict = 0; dict < 40; dict++) {
         if (dictSize <= LZMA2_DIC_SIZE_FROM_PROP(dict)) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/k7zip.h 
new/karchive-5.85.0/src/k7zip.h
--- old/karchive-5.84.0/src/k7zip.h     2021-07-01 17:25:31.000000000 +0200
+++ new/karchive-5.85.0/src/k7zip.h     2021-07-30 12:23:48.000000000 +0200
@@ -30,7 +30,7 @@
 
     /**
      * Creates an instance that operates on the given device.
-     * The device can be compressed (KFilterDev) or not (QFile, etc.).
+     * The device can be compressed (KCompressionDevice) or not (QFile, etc.).
      * @warning Do not assume that giving a QFile here will decompress the 
file,
      * in case it's compressed!
      * @param dev the device to read from. If the source is compressed, the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kar.cpp 
new/karchive-5.85.0/src/kar.cpp
--- old/karchive-5.84.0/src/kar.cpp     2021-07-01 17:25:31.000000000 +0200
+++ new/karchive-5.85.0/src/kar.cpp     2021-07-30 12:23:48.000000000 +0200
@@ -13,7 +13,7 @@
 
 #include <limits>
 
-#include "kfilterdev.h"
+#include "kcompressiondevice.h"
 //#include "klimitediodevice_p.h"
 
 // As documented in QByteArray
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kar.h 
new/karchive-5.85.0/src/kar.h
--- old/karchive-5.84.0/src/kar.h       2021-07-01 17:25:31.000000000 +0200
+++ new/karchive-5.85.0/src/kar.h       2021-07-30 12:23:48.000000000 +0200
@@ -31,7 +31,7 @@
 
     /**
      * Creates an instance that operates on the given device.
-     * The device can be compressed (KFilterDev) or not (QFile, etc.).
+     * The device can be compressed (KCompressionDevice) or not (QFile, etc.).
      * @param dev the device to read from
      */
     KAr(QIODevice *dev);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kbzip2filter.h 
new/karchive-5.85.0/src/kbzip2filter.h
--- old/karchive-5.84.0/src/kbzip2filter.h      2021-07-01 17:25:31.000000000 
+0200
+++ new/karchive-5.85.0/src/kbzip2filter.h      2021-07-30 12:23:48.000000000 
+0200
@@ -14,7 +14,7 @@
 #include "kfilterbase.h"
 
 /**
- * Internal class used by KFilterDev
+ * Internal class used by KCompressionDevice
  * @internal
  */
 class KBzip2Filter : public KFilterBase
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kcompressiondevice.cpp 
new/karchive-5.85.0/src/kcompressiondevice.cpp
--- old/karchive-5.84.0/src/kcompressiondevice.cpp      2021-07-01 
17:25:31.000000000 +0200
+++ new/karchive-5.85.0/src/kcompressiondevice.cpp      2021-07-30 
12:23:48.000000000 +0200
@@ -26,6 +26,7 @@
 
 #include <QDebug>
 #include <QFile>
+#include <QMimeDatabase>
 
 #include <assert.h>
 #include <stdio.h> // for EOF
@@ -72,6 +73,90 @@
     // ... we have no generic way to propagate errors from other kinds of 
iodevices. Sucks, heh? :(
 }
 
+static KCompressionDevice::CompressionType findCompressionByFileName(const 
QString &fileName)
+{
+    if (fileName.endsWith(QLatin1String(".gz"), Qt::CaseInsensitive)) {
+        return KCompressionDevice::GZip;
+    }
+#if HAVE_BZIP2_SUPPORT
+    if (fileName.endsWith(QLatin1String(".bz2"), Qt::CaseInsensitive)) {
+        return KCompressionDevice::BZip2;
+    }
+#endif
+#if HAVE_XZ_SUPPORT
+    if (fileName.endsWith(QLatin1String(".lzma"), Qt::CaseInsensitive) || 
fileName.endsWith(QLatin1String(".xz"), Qt::CaseInsensitive)) {
+        return KCompressionDevice::Xz;
+    }
+#endif
+#if HAVE_ZSTD_SUPPORT
+    if (fileName.endsWith(QLatin1String(".zst"), Qt::CaseInsensitive)) {
+        return KCompressionDevice::Zstd;
+    }
+#endif
+    else {
+        // not a warning, since this is called often with other MIME types 
(see #88574)...
+        // maybe we can avoid that though?
+        // qCDebug(KArchiveLog) << "findCompressionByFileName : no compression 
found for " << fileName;
+    }
+
+    return KCompressionDevice::None;
+}
+
+KCompressionDevice::CompressionType 
KCompressionDevice::compressionTypeForMimeType(const QString &mimeType)
+{
+    if (mimeType == QLatin1String("application/gzip") //
+        || mimeType == QLatin1String("application/x-gzip") // legacy name, 
kept for compatibility
+    ) {
+        return KCompressionDevice::GZip;
+    }
+#if HAVE_BZIP2_SUPPORT
+    if (mimeType == QLatin1String("application/x-bzip") //
+        || mimeType == QLatin1String("application/x-bzip2") // old name, kept 
for compatibility
+    ) {
+        return KCompressionDevice::BZip2;
+    }
+#endif
+#if HAVE_XZ_SUPPORT
+    if (mimeType == QLatin1String("application/x-lzma") // legacy name, still 
used
+        || mimeType == QLatin1String("application/x-xz") // current naming
+    ) {
+        return KCompressionDevice::Xz;
+    }
+#endif
+#if HAVE_ZSTD_SUPPORT
+    if (mimeType == QLatin1String("application/zstd")) {
+        return KCompressionDevice::Zstd;
+    }
+#endif
+    QMimeDatabase db;
+    const QMimeType mime = db.mimeTypeForName(mimeType);
+    if (mime.isValid()) {
+        // use legacy MIME type for now, see comment in impl. of KTar(const 
QString &, const QString &_mimetype)
+        if (mime.inherits(QStringLiteral("application/x-gzip"))) {
+            return KCompressionDevice::GZip;
+        }
+#if HAVE_BZIP2_SUPPORT
+        if (mime.inherits(QStringLiteral("application/x-bzip"))) {
+            return KCompressionDevice::BZip2;
+        }
+#endif
+#if HAVE_XZ_SUPPORT
+        if (mime.inherits(QStringLiteral("application/x-lzma"))) {
+            return KCompressionDevice::Xz;
+        }
+
+        if (mime.inherits(QStringLiteral("application/x-xz"))) {
+            return KCompressionDevice::Xz;
+        }
+#endif
+    }
+
+    // not a warning, since this is called often with other MIME types (see 
#88574)...
+    // maybe we can avoid that though?
+    // qCDebug(KArchiveLog) << "no compression found for" << mimeType;
+    return KCompressionDevice::None;
+}
+
 KFilterBase 
*KCompressionDevice::filterForCompressionType(KCompressionDevice::CompressionType
 type)
 {
     switch (type) {
@@ -123,6 +208,11 @@
     }
 }
 
+KCompressionDevice::KCompressionDevice(const QString &fileName)
+    : KCompressionDevice(fileName, findCompressionByFileName(fileName))
+{
+}
+
 KCompressionDevice::~KCompressionDevice()
 {
     if (isOpen()) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kcompressiondevice.h 
new/karchive-5.85.0/src/kcompressiondevice.h
--- old/karchive-5.84.0/src/kcompressiondevice.h        2021-07-01 
17:25:31.000000000 +0200
+++ new/karchive-5.85.0/src/kcompressiondevice.h        2021-07-30 
12:23:48.000000000 +0200
@@ -55,6 +55,13 @@
     KCompressionDevice(const QString &fileName, CompressionType type);
 
     /**
+     * Constructs a KCompressionDevice for a given @p fileName.
+     * @param fileName the name of the file to filter.
+     * @since 5.85
+     */
+    KCompressionDevice(const QString &fileName);
+
+    /**
      * Destructs the KCompressionDevice.
      * Calls close() if the filter device is still open.
      */
@@ -107,6 +114,13 @@
     static KFilterBase *filterForCompressionType(CompressionType type);
 
     /**
+     * Returns the compression type for the given MIME type, if possible. 
Otherwise returns None.
+     * This handles simple cases like application/gzip, but also 
application/x-compressed-tar, and inheritance.
+     * @since 5.85
+     */
+    static CompressionType compressionTypeForMimeType(const QString &mimetype);
+
+    /**
      * Returns the error code from the last failing operation.
      * This is especially useful after calling close(), which unfortunately 
returns void
      * (see https://bugreports.qt.io/browse/QTBUG-70033), to see if the 
flushing done by close
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kfilterbase.h 
new/karchive-5.85.0/src/kfilterbase.h
--- old/karchive-5.84.0/src/kfilterbase.h       2021-07-01 17:25:31.000000000 
+0200
+++ new/karchive-5.85.0/src/kfilterbase.h       2021-07-30 12:23:48.000000000 
+0200
@@ -20,7 +20,7 @@
  *
  * This is the base class for compression filters
  * such as gzip and bzip2. It's pretty much internal.
- * Don't use directly, use KFilterDev instead.
+ * Don't use directly, use KCompressionDevice instead.
  * @internal
  */
 class KARCHIVE_EXPORT KFilterBase
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kfilterdev.cpp 
new/karchive-5.85.0/src/kfilterdev.cpp
--- old/karchive-5.84.0/src/kfilterdev.cpp      2021-07-01 17:25:31.000000000 
+0200
+++ new/karchive-5.85.0/src/kfilterdev.cpp      2021-07-30 12:23:48.000000000 
+0200
@@ -5,95 +5,17 @@
 */
 
 #include "kfilterdev.h"
-#include "loggingcategory.h"
 
-#include <config-compression.h>
-
-#include <QDebug>
-#include <QMimeDatabase>
-
-static KCompressionDevice::CompressionType findCompressionByFileName(const 
QString &fileName)
-{
-    if (fileName.endsWith(QLatin1String(".gz"), Qt::CaseInsensitive)) {
-        return KCompressionDevice::GZip;
-    }
-#if HAVE_BZIP2_SUPPORT
-    if (fileName.endsWith(QLatin1String(".bz2"), Qt::CaseInsensitive)) {
-        return KCompressionDevice::BZip2;
-    }
-#endif
-#if HAVE_XZ_SUPPORT
-    if (fileName.endsWith(QLatin1String(".lzma"), Qt::CaseInsensitive) || 
fileName.endsWith(QLatin1String(".xz"), Qt::CaseInsensitive)) {
-        return KCompressionDevice::Xz;
-    }
-#endif
-#if HAVE_ZSTD_SUPPORT
-    if (fileName.endsWith(QLatin1String(".zst"), Qt::CaseInsensitive)) {
-        return KCompressionDevice::Zstd;
-    }
-#endif
-    else {
-        // not a warning, since this is called often with other mimetypes (see 
#88574)...
-        // maybe we can avoid that though?
-        // qCDebug(KArchiveLog) << "findCompressionByFileName : no compression 
found for " << fileName;
-    }
-
-    return KCompressionDevice::None;
-}
+#if KARCHIVE_BUILD_DEPRECATED_SINCE(5, 85)
 
 KFilterDev::KFilterDev(const QString &fileName)
-    : KCompressionDevice(fileName, findCompressionByFileName(fileName))
+    : KCompressionDevice(fileName)
 {
 }
 
 KCompressionDevice::CompressionType 
KFilterDev::compressionTypeForMimeType(const QString &mimeType)
 {
-    if (mimeType == QLatin1String("application/x-gzip")) {
-        return KCompressionDevice::GZip;
-    }
-#if HAVE_BZIP2_SUPPORT
-    if (mimeType == QLatin1String("application/x-bzip") //
-        || mimeType == QLatin1String("application/x-bzip2") // old name, kept 
for compatibility
-    ) {
-        return KCompressionDevice::BZip2;
-    }
-#endif
-#if HAVE_XZ_SUPPORT
-    if (mimeType == QLatin1String("application/x-lzma") // legacy name, still 
used
-        || mimeType == QLatin1String("application/x-xz") // current naming
-    ) {
-        return KCompressionDevice::Xz;
-    }
-#endif
-#if HAVE_ZSTD_SUPPORT
-    if (mimeType == QLatin1String("application/zstd")) {
-        return KCompressionDevice::Zstd;
-    }
-#endif
-    QMimeDatabase db;
-    const QMimeType mime = db.mimeTypeForName(mimeType);
-    if (mime.isValid()) {
-        if (mime.inherits(QStringLiteral("application/x-gzip"))) {
-            return KCompressionDevice::GZip;
-        }
-#if HAVE_BZIP2_SUPPORT
-        if (mime.inherits(QStringLiteral("application/x-bzip"))) {
-            return KCompressionDevice::BZip2;
-        }
-#endif
-#if HAVE_XZ_SUPPORT
-        if (mime.inherits(QStringLiteral("application/x-lzma"))) {
-            return KCompressionDevice::Xz;
-        }
-
-        if (mime.inherits(QStringLiteral("application/x-xz"))) {
-            return KCompressionDevice::Xz;
-        }
-#endif
-    }
-
-    // not a warning, since this is called often with other mimetypes (see 
#88574)...
-    // maybe we can avoid that though?
-    // qCDebug(KArchiveLog) << "no compression found for" << mimeType;
-    return KCompressionDevice::None;
+    return KCompressionDevice::compressionTypeForMimeType(mimeType);
 }
+
+#endif // KARCHIVE_BUILD_DEPRECATED_SINCE(5, 85)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kfilterdev.h 
new/karchive-5.85.0/src/kfilterdev.h
--- old/karchive-5.84.0/src/kfilterdev.h        2021-07-01 17:25:31.000000000 
+0200
+++ new/karchive-5.85.0/src/kfilterdev.h        2021-07-30 12:23:48.000000000 
+0200
@@ -11,6 +11,8 @@
 
 #include <QString>
 
+#if KARCHIVE_ENABLE_DEPRECATED_SINCE(5, 85)
+
 class QFile;
 class KFilterBase;
 
@@ -26,22 +28,26 @@
  * provides compatibility methods for KDE 4 code.
  *
  * @author David Faure <[email protected]>
+ * @deprecated Since 5.85, use KCompressionDevice directly
  */
 class KARCHIVE_EXPORT KFilterDev : public KCompressionDevice
 {
     Q_OBJECT
 public:
     /**
-     * @since 5.0
      * Constructs a KFilterDev for a given FileName.
      * @param fileName the name of the file to filter.
+     * @since 5.0
+     * @deprecated Since 5.85, use KCompressionDevice(const QString &)
      */
     KFilterDev(const QString &fileName);
 
     /**
      * Returns the compression type for the given mimetype, if possible. 
Otherwise returns None.
-     * This handles simple cases like application/x-gzip, but also 
application/x-compressed-tar, and inheritance.
+     * This handles simple cases like application/gzip, but also 
application/x-compressed-tar, and inheritance.
+     * @deprecated Since 5.85, use 
KCompressionDevice::compressionTypeForMimeType(const QString &)
      */
+    KARCHIVE_DEPRECATED_VERSION(5, 85, "Use 
KCompressionDevice::compressionTypeForMimeType(const QString &)")
     static CompressionType compressionTypeForMimeType(const QString &mimetype);
 
 #if KARCHIVE_ENABLE_DEPRECATED_SINCE(5, 0)
@@ -64,7 +70,7 @@
      * (gzip/bzip2 etc.) will automatically be used.
      *
      * The compression filter to be used is determined from the @p fileName
-     * if @p mimetype is empty. Pass "application/x-gzip" or 
"application/x-bzip"
+     * if @p mimetype is empty. Pass "application/gzip" or "application/x-bzip"
      * to force the corresponding decompression filter, if available.
      *
      * Warning: application/x-bzip may not be available.
@@ -117,7 +123,7 @@
      * (gzip/bzip2 etc.) will automatically be used.
      *
      * The compression filter to be used is determined @p mimetype .
-     * Pass "application/x-gzip" or "application/x-bzip"
+     * Pass "application/gzip" or "application/x-bzip"
      * to use the corresponding decompression filter.
      *
      * Warning: application/x-bzip may not be available.
@@ -142,4 +148,6 @@
 #endif
 };
 
+#endif // KARCHIVE_ENABLE_DEPRECATED_SINCE(5, 85)
+
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kgzipfilter.h 
new/karchive-5.85.0/src/kgzipfilter.h
--- old/karchive-5.84.0/src/kgzipfilter.h       2021-07-01 17:25:31.000000000 
+0200
+++ new/karchive-5.85.0/src/kgzipfilter.h       2021-07-30 12:23:48.000000000 
+0200
@@ -10,7 +10,7 @@
 #include "kfilterbase.h"
 
 /**
- * Internal class used by KFilterDev
+ * Internal class used by KCompressionDevice
  *
  * This header is not installed.
  *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/knonefilter.h 
new/karchive-5.85.0/src/knonefilter.h
--- old/karchive-5.84.0/src/knonefilter.h       2021-07-01 17:25:31.000000000 
+0200
+++ new/karchive-5.85.0/src/knonefilter.h       2021-07-30 12:23:48.000000000 
+0200
@@ -13,7 +13,7 @@
 #include "kfilterbase.h"
 
 /**
- * Internal class used by KFilterDev
+ * Internal class used by KCompressionDevice
  *
  * This header is not installed.
  *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/ktar.cpp 
new/karchive-5.85.0/src/ktar.cpp
--- old/karchive-5.84.0/src/ktar.cpp    2021-07-01 17:25:31.000000000 +0200
+++ new/karchive-5.85.0/src/ktar.cpp    2021-07-30 12:23:48.000000000 +0200
@@ -7,8 +7,8 @@
 
 #include "ktar.h"
 #include "karchive_p.h"
+#include "kcompressiondevice.h"
 #include "kfilterbase.h"
-#include "kfilterdev.h"
 #include "loggingcategory.h"
 
 #include <QDebug>
@@ -25,12 +25,19 @@
 ////////////////////////////////////////////////////////////////////////
 
 // Mime types of known filters
-static const char application_gzip[] = "application/x-gzip";
 static const char application_bzip[] = "application/x-bzip";
 static const char application_lzma[] = "application/x-lzma";
 static const char application_xz[] = "application/x-xz";
 static const char application_zstd[] = "application/zstd";
 
+/* clang-format off */
+namespace MimeType
+{
+QString application_gzip()     { return QStringLiteral("application/gzip"); }
+QString application_gzip_old() { return QStringLiteral("application/x-gzip"); }
+}
+/* clang-format on */
+
 class Q_DECL_HIDDEN KTar::KTarPrivate
 {
 public:
@@ -63,7 +70,15 @@
     : KArchive(fileName)
     , d(new KTarPrivate(this))
 {
-    d->mimetype = _mimetype;
+    // shared-mime-info < 1.1 does not know about application/gzip.
+    // While Qt has optionally a copy of shared-mime-info (1.10 for 5.15.0),
+    // it uses the system one if it exists.
+    // Once shared-mime-info 1.1 is required or can be assumed on all targeted
+    // platforms (right now RHEL/CentOS 6 as target of appimage-based apps
+    // bundling also karchive does not meet this requirement)
+    // switch to use the new application/gzip id instead when interacting with 
QMimeDatabase
+    // For now: map new name to legacy name and use that
+    d->mimetype = (_mimetype == MimeType::application_gzip()) ? 
MimeType::application_gzip_old() : _mimetype;
 }
 
 KTar::KTar(QIODevice *dev)
@@ -97,9 +112,9 @@
 
         // qCDebug(KArchiveLog) << mode << mime->name();
 
-        if (mime.inherits(QStringLiteral("application/x-compressed-tar")) || 
mime.inherits(QString::fromLatin1(application_gzip))) {
+        if (mime.inherits(QStringLiteral("application/x-compressed-tar")) || 
mime.inherits(MimeType::application_gzip_old())) {
             // gzipped tar file (with possibly invalid file name), ask for 
gzip filter
-            d->mimetype = QString::fromLatin1(application_gzip);
+            d->mimetype = MimeType::application_gzip_old();
         } else if 
(mime.inherits(QStringLiteral("application/x-bzip-compressed-tar")) || 
mime.inherits(QString::fromLatin1(application_bzip))) {
             // bzipped2 tar file (with possibly invalid file name), ask for 
bz2 filter
             d->mimetype = QString::fromLatin1(application_bzip);
@@ -123,8 +138,8 @@
         }
         if (!d->mimetype.isEmpty()) {
             // Create a compression filter on top of the QSaveFile device that 
KArchive created.
-            // qCDebug(KArchiveLog) << "creating KFilterDev for" << 
d->mimetype;
-            KCompressionDevice::CompressionType type = 
KFilterDev::compressionTypeForMimeType(d->mimetype);
+            // qCDebug(KArchiveLog) << "creating KCompressionDevice for" << 
d->mimetype;
+            KCompressionDevice::CompressionType type = 
KCompressionDevice::compressionTypeForMimeType(d->mimetype);
             d->compressionDevice = new KCompressionDevice(device(), false, 
type);
             setDevice(d->compressionDevice);
         }
@@ -315,7 +330,7 @@
 
     // qCDebug(KArchiveLog) << "filling tmpFile of mimetype" << mimetype;
 
-    KCompressionDevice::CompressionType compressionType = 
KFilterDev::compressionTypeForMimeType(mimetype);
+    KCompressionDevice::CompressionType compressionType = 
KCompressionDevice::compressionTypeForMimeType(mimetype);
     KCompressionDevice filterDev(fileName, compressionType);
 
     QFile *file = tmpFile;
@@ -546,8 +561,12 @@
     // qCDebug(KArchiveLog) << "Write temporary file to compressed file" << 
fileName << mimetype;
 
     bool forced = false;
-    if (QLatin1String(application_gzip) == mimetype || 
QLatin1String(application_bzip) == mimetype || QLatin1String(application_lzma) 
== mimetype
-        || QLatin1String(application_xz) == mimetype) {
+    /* clang-format off */
+    if (MimeType::application_gzip_old() == mimetype ||
+        QLatin1String(application_bzip) == mimetype ||
+        QLatin1String(application_lzma) == mimetype ||
+        QLatin1String(application_xz) == mimetype) {
+        /* clang-format on */
         forced = true;
     }
 
@@ -555,7 +574,7 @@
     // (KArchive uses QSaveFile by default, but the temp-uncompressed-file 
trick
     // circumvents that).
 
-    KFilterDev dev(fileName);
+    KCompressionDevice dev(fileName);
     QFile *file = tmpFile;
     if (!dev.open(QIODevice::WriteOnly)) {
         file->close();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/ktar.h 
new/karchive-5.85.0/src/ktar.h
--- old/karchive-5.84.0/src/ktar.h      2021-07-01 17:25:31.000000000 +0200
+++ new/karchive-5.85.0/src/ktar.h      2021-07-30 12:23:48.000000000 +0200
@@ -29,8 +29,8 @@
      * using the compression filter associated to given mimetype.
      *
      * @param filename is a local path (e.g. "/home/weis/myfile.tgz")
-     * @param mimetype "application/x-gzip", "application/x-bzip" or
-     * "application/x-xz"
+     * @param mimetype "application/gzip" (before 5.85: "application/x-gzip"), 
"application/x-bzip",
+     * "application/x-xz", "application/zstd" (since 5.82)
      * Do not use application/x-compressed-tar or similar - you only need to
      * specify the compression layer !  If the mimetype is omitted, it
      * will be determined from the filename.
@@ -39,7 +39,7 @@
 
     /**
      * Creates an instance that operates on the given device.
-     * The device can be compressed (KFilterDev) or not (QFile, etc.).
+     * The device can be compressed (KCompressionDevice) or not (QFile, etc.).
      * @warning Do not assume that giving a QFile here will decompress the 
file,
      * in case it's compressed!
      * @param dev the device to read from. If the source is compressed, the
@@ -56,7 +56,7 @@
     /**
      * Special function for setting the "original file name" in the gzip 
header,
      * when writing a tar.gz file. It appears when using in the "file" command,
-     * for instance. Should only be called if the underlying device is a 
KFilterDev!
+     * for instance. Should only be called if the underlying device is a 
KCompressionDevice!
      * @param fileName the original file name
      */
     void setOrigFileName(const QByteArray &fileName);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kxzfilter.h 
new/karchive-5.85.0/src/kxzfilter.h
--- old/karchive-5.84.0/src/kxzfilter.h 2021-07-01 17:25:31.000000000 +0200
+++ new/karchive-5.85.0/src/kxzfilter.h 2021-07-30 12:23:48.000000000 +0200
@@ -17,7 +17,7 @@
 #include "kfilterbase.h"
 
 /**
- * Internal class used by KFilterDev
+ * Internal class used by KCompressionDevice
  * @internal
  */
 class KXzFilter : public KFilterBase
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kzip.cpp 
new/karchive-5.85.0/src/kzip.cpp
--- old/karchive-5.84.0/src/kzip.cpp    2021-07-01 17:25:31.000000000 +0200
+++ new/karchive-5.85.0/src/kzip.cpp    2021-07-30 12:23:48.000000000 +0200
@@ -7,7 +7,7 @@
 
 #include "kzip.h"
 #include "karchive_p.h"
-#include "kfilterdev.h"
+#include "kcompressiondevice.h"
 #include "klimitediodevice_p.h"
 #include "loggingcategory.h"
 
@@ -1192,7 +1192,7 @@
     }
 
     // Prepare device for writing the data
-    // Either device() if no compression, or a KFilterDev to compress
+    // Either device() if no compression, or a KCompressionDevice to compress
     if (d->m_compression == 0) {
         d->m_currentDev = device();
         return true;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kzip.h 
new/karchive-5.85.0/src/kzip.h
--- old/karchive-5.84.0/src/kzip.h      2021-07-01 17:25:31.000000000 +0200
+++ new/karchive-5.85.0/src/kzip.h      2021-07-30 12:23:48.000000000 +0200
@@ -49,7 +49,7 @@
 
     /**
      * Creates an instance that operates on the given device.
-     * The device can be compressed (KFilterDev) or not (QFile, etc.).
+     * The device can be compressed (KCompressionDevice) or not (QFile, etc.).
      * @warning Do not assume that giving a QFile here will decompress the 
file,
      * in case it's compressed!
      * @param dev the device to access
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/karchive-5.84.0/src/kzstdfilter.h 
new/karchive-5.85.0/src/kzstdfilter.h
--- old/karchive-5.84.0/src/kzstdfilter.h       2021-07-01 17:25:31.000000000 
+0200
+++ new/karchive-5.85.0/src/kzstdfilter.h       2021-07-30 12:23:48.000000000 
+0200
@@ -16,7 +16,7 @@
 #include <memory>
 
 /**
- * Internal class used by KFilterDev
+ * Internal class used by KCompressionDevice
  * @internal
  */
 class KZstdFilter : public KFilterBase

Reply via email to