diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-08-15 16:05:09 +0000 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-08-15 16:05:09 +0000 |
commit | 2ceb6f3abca081464614cf99a42ae76c396c8f26 (patch) | |
tree | 1b8dddf72f0e88e1c0a4a3c809089b3a99423697 /user/kfilemetadata | |
parent | f1086867c788eec4c8cd02317f8970105289efc0 (diff) | |
download | packages-2ceb6f3abca081464614cf99a42ae76c396c8f26.tar.gz packages-2ceb6f3abca081464614cf99a42ae76c396c8f26.tar.bz2 packages-2ceb6f3abca081464614cf99a42ae76c396c8f26.tar.xz packages-2ceb6f3abca081464614cf99a42ae76c396c8f26.zip |
user/[KDE Applications]: Bump to 19.08.0
Diffstat (limited to 'user/kfilemetadata')
-rw-r--r-- | user/kfilemetadata/APKBUILD | 9 | ||||
-rw-r--r-- | user/kfilemetadata/add-mimeutils.patch | 186 |
2 files changed, 190 insertions, 5 deletions
diff --git a/user/kfilemetadata/APKBUILD b/user/kfilemetadata/APKBUILD index c772977b2..b3437d091 100644 --- a/user/kfilemetadata/APKBUILD +++ b/user/kfilemetadata/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=kfilemetadata pkgver=5.54.0 -pkgrel=2 +pkgrel=3 pkgdesc="File metadata extraction framework" url="https://www.kde.org/" arch="all" @@ -15,10 +15,10 @@ makedepends="$depends_dev cmake extra-cmake-modules python3 doxygen graphviz subpackages="$pkgname-dev $pkgname-doc $pkgname-lang" source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kfilemetadata-$pkgver.tar.xz add-formatting-fn.patch + add-mimeutils.patch " build() { - cd "$builddir" if [ "$CBUILD" != "$CHOST" ]; then CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" fi @@ -35,14 +35,13 @@ build() { } check() { - cd "$builddir" CTEST_OUTPUT_ON_FAILURE=TRUE ctest } package() { - cd "$builddir" make DESTDIR="$pkgdir" install } sha512sums="bfa8287e5c8df363908a441419d377d33ea2cd93a4fc69fc47c69da80ad0e3a80e60f26b4856c3d3e04128e6ac59b214ee0613e37dda29f2537f502789bd4801 kfilemetadata-5.54.0.tar.xz -f6d8b9fe9353fdf380d073b8a7dfa4dd8c822a64c1a978dbe8ce13d0f8327d3af5d314be41f9cecc32afb19896711452289b78e09b6fffb010d8c89843ebc4e0 add-formatting-fn.patch" +f6d8b9fe9353fdf380d073b8a7dfa4dd8c822a64c1a978dbe8ce13d0f8327d3af5d314be41f9cecc32afb19896711452289b78e09b6fffb010d8c89843ebc4e0 add-formatting-fn.patch +c94c57b7dacfdf35c19db10f6a4b2724673fc542adac3dde57ac34cb4f09d063fd37404343d265075a88a397d3543da038b6b5832f481de3b05640279ef19a8c add-mimeutils.patch" diff --git a/user/kfilemetadata/add-mimeutils.patch b/user/kfilemetadata/add-mimeutils.patch new file mode 100644 index 000000000..5ea2cef37 --- /dev/null +++ b/user/kfilemetadata/add-mimeutils.patch @@ -0,0 +1,186 @@ +From 69c25514cf6a08ceaaacbc4092cc02ff40853228 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de> +Date: Mon, 25 Mar 2019 17:40:41 +0100 +Subject: Add helper function to determine mime type based on content and + extension + +Summary: +The QMimeDatabase::MatchDefault only falls back to content matching +if the extension is not known. This fails for e.g. Matroska files, where +the content allows to distinguish between audio and video files. + +CCBUG: 403902 + +Reviewers: #baloo, #frameworks, astippich, ngraham, poboiko + +Reviewed By: #baloo, astippich, ngraham + +Subscribers: kde-frameworks-devel + +Tags: #frameworks, #baloo + +Differential Revision: https://phabricator.kde.org/D20045 +--- + src/CMakeLists.txt | 1 + + src/mimeutils.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ + src/mimeutils.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 106 insertions(+) + create mode 100644 src/mimeutils.cpp + create mode 100644 src/mimeutils.h + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index c3cbe8c..fc4ce19 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -14,6 +14,7 @@ set(KF5FileMetaData_SRCS + writercollection.cpp + externalwriter.cpp + formatstrings.cpp ++ mimeutils.cpp + ) + ecm_qt_declare_logging_category(KF5FileMetaData_SRCS HEADER kfilemetadata_debug.h IDENTIFIER KFILEMETADATA_LOG CATEGORY_NAME kf5.kfilemetadata) + +diff --git a/src/mimeutils.cpp b/src/mimeutils.cpp +new file mode 100644 +index 0000000..7ea4dc8 +--- /dev/null ++++ b/src/mimeutils.cpp +@@ -0,0 +1,50 @@ ++/* ++ * This file is part of KFileMetaData ++ * Copyright (C) 2019 Stefan Brüns <stefan.bruens@rwth-aachen.de> ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ */ ++ ++#include "mimeutils.h" ++ ++namespace KFileMetaData { ++namespace MimeUtils { ++ ++QMimeType strictMimeType(const QString& filePath, const QMimeDatabase& db) ++{ ++ auto extensionMimes = db.mimeTypesForFileName(filePath); ++ auto contentMime = db.mimeTypeForFile(filePath, QMimeDatabase::MatchContent); ++ ++ if (extensionMimes.contains(contentMime)) { ++ // content based mime type is one of the types for the file extension, e.g.: ++ // *.ogg -> [ audio/ogg, audio/x-vorbis+ogg, ...] ++ // content -> audio/x-vorbis+ogg ++ return contentMime; ++ } ++ ++ for (auto mime : extensionMimes) { ++ // check if the content is generic and the extension is more specific, e.g.: ++ // *.mkv -> [ video/matroska ] ++ // content -> application/matroska ++ if (mime.inherits(contentMime.name())) { ++ return mime; ++ } ++ } ++ // content mime type does not match the extension, trust the content ++ return contentMime; ++} ++ ++}} // namespace KFileMetaData::MimeUtils +diff --git a/src/mimeutils.h b/src/mimeutils.h +new file mode 100644 +index 0000000..f33e100 +--- /dev/null ++++ b/src/mimeutils.h +@@ -0,0 +1,55 @@ ++/* ++ * This file is part of KFileMetaData ++ * Copyright (C) 2019 Stefan Brüns <stefan.bruens@rwth-aachen.de> ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ */ ++ ++#ifndef KFILEMETADATA_MIMEUTILS ++#define KFILEMETADATA_MIMEUTILS ++ ++#include <QMimeDatabase> ++#include "kfilemetadata_export.h" ++ ++namespace KFileMetaData ++{ ++namespace MimeUtils ++{ ++ ++/** ++ * Returns the mimetype for a file ++ * ++ * The function uses both content and filename to determine the ++ * \c QMimeType. In case the extension mimetype is more specific ++ * than the content mimetype, and the first inherits the latter, ++ * the extension mimetype is preferred. ++ * If the extension does not match the content, the content has ++ * higher priority. ++ * The file must exist and be readable. ++ * ++ * @since 5.57 ++ * ++ * \sa QMimeDatabase::mimeTypesForFileName ++ * \sa QMimeType::inherits ++ */ ++KFILEMETADATA_EXPORT ++QMimeType strictMimeType(const QString& filePath, const QMimeDatabase& db); ++ ++ ++} // namespace MimeUtils ++} // namespace KFileMetaData ++ ++#endif // KFILEMETADATA_MIMEUTILS +-- +cgit v1.1 + +From b56d0cb5b90baeef2ada6ba0cbaea91506df1270 Mon Sep 17 00:00:00 2001 +From: Alexander Stippich <a.stippich@gmx.net> +Date: Wed, 27 Mar 2019 20:41:49 +0100 +Subject: Generate header for new MimeUtils + +--- + src/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index fc4ce19..73bf7d0 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -75,6 +75,7 @@ ecm_generate_headers(KF5FileMetaData_CamelCase_HEADERS + WriterPlugin + WriterCollection + EmbeddedImageData ++ MimeUtils + + PREFIX kfilemetadata + REQUIRED_HEADERS KF5FileMetaData_HEADERS +-- +cgit v1.1 + |