Hello community, here is the log from the commit of package kpackage for openSUSE:Factory checked in at 2016-01-20 09:47:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kpackage (Old) and /work/SRC/openSUSE:Factory/.kpackage.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kpackage" Changes: -------- --- /work/SRC/openSUSE:Factory/kpackage/kpackage.changes 2015-12-29 12:54:02.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.kpackage.new/kpackage.changes 2016-01-20 09:47:20.000000000 +0100 @@ -1,0 +2,8 @@ +Sat Jan 2 17:44:46 UTC 2016 - [email protected] + +- Update to 5.18.0 + * Make it possible to provide the metadata in json + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.18.0.php + +------------------------------------------------------------------- Old: ---- kpackage-5.17.0.tar.xz New: ---- kpackage-5.18.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kpackage.spec ++++++ --- /var/tmp/diff_new_pack.1MZKRR/_old 2016-01-20 09:47:22.000000000 +0100 +++ /var/tmp/diff_new_pack.1MZKRR/_new 2016-01-20 09:47:22.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package kpackage # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,9 +17,9 @@ %bcond_without lang -%define _tar_path 5.17 +%define _tar_path 5.18 Name: kpackage -Version: 5.17.0 +Version: 5.18.0 Release: 0 %define kf5_version %{version} BuildRequires: cmake >= 2.8.12 ++++++ kpackage-5.17.0.tar.xz -> kpackage-5.18.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/CMakeLists.txt new/kpackage-5.18.0/CMakeLists.txt --- old/kpackage-5.17.0/CMakeLists.txt 2015-12-06 22:34:53.000000000 +0100 +++ new/kpackage-5.18.0/CMakeLists.txt 2016-01-02 17:45:20.000000000 +0100 @@ -4,7 +4,7 @@ # ECM setup include(FeatureSummary) -find_package(ECM 5.17.0 NO_MODULE) +find_package(ECM 5.18.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -19,8 +19,8 @@ include(ECMSetupVersion) include(KDEFrameworkCompilerSettings) -set(KF5_VERSION "5.17.0") # handled by release scripts -set(KF5_DEP_VERSION "5.17.0") # handled by release scripts +set(KF5_VERSION "5.18.0") # handled by release scripts +set(KF5_DEP_VERSION "5.18.0") # handled by release scripts ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX PACKAGE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/autotests/data/customcontent/contents/customcontent/CustomContentFile.qml new/kpackage-5.18.0/autotests/data/customcontent/contents/customcontent/CustomContentFile.qml --- old/kpackage-5.17.0/autotests/data/customcontent/contents/customcontent/CustomContentFile.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kpackage-5.18.0/autotests/data/customcontent/contents/customcontent/CustomContentFile.qml 2016-01-02 17:45:20.000000000 +0100 @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +Rectangle { + id: root + color: "darkblue" +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/autotests/data/customcontent/contents/ui/main.qml new/kpackage-5.18.0/autotests/data/customcontent/contents/ui/main.qml --- old/kpackage-5.17.0/autotests/data/customcontent/contents/ui/main.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kpackage-5.18.0/autotests/data/customcontent/contents/ui/main.qml 2016-01-02 17:45:20.000000000 +0100 @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +Rectangle { + id: root + color: "darkblue" +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/autotests/data/customcontent/metadata.desktop new/kpackage-5.18.0/autotests/data/customcontent/metadata.desktop --- old/kpackage-5.17.0/autotests/data/customcontent/metadata.desktop 1970-01-01 01:00:00.000000000 +0100 +++ new/kpackage-5.18.0/autotests/data/customcontent/metadata.desktop 2016-01-02 17:45:20.000000000 +0100 @@ -0,0 +1,37 @@ +[Desktop Entry] +Encoding=UTF-8 +Keywords= +Name=Custom Content +Name[ca]=Contingut personalitzat +Name[ca@valencia]=Contingut personalitzat +Name[en_GB]=Custom Content +Name[es]=Contenido personalizado +Name[fi]=Mukautettu sisältö +Name[gl]=Contido personalizado +Name[it]=Contenuto personalizzato +Name[nl]=Aangepaste inhoud +Name[pl]=Własna treść +Name[pt]=Conteúdo Personalizado +Name[pt_BR]=Conteúdo personalizado +Name[sk]=Vlastný obsah +Name[sl]=Vsebina po meri +Name[sr]=Посебан садржај +Name[sr@ijekavian]=Посебан садржај +Name[sr@ijekavianlatin]=Poseban sadržaj +Name[sr@latin]=Poseban sadržaj +Name[sv]=Eget innehåll +Name[uk]=Нетиповий вміст +Name[x-test]=xxCustom Contentxx +Name[zh_CN]=自定义内容 +Type=Service + +X-KDE-ServiceTypes=SimpleContent,CustomContent +X-KDE-ParentApp= +X-KDE-PluginInfo-Author=Joe Blow +X-KDE-PluginInfo-Category= [email protected] +X-KDE-PluginInfo-License=GPLv2+ +X-KDE-PluginInfo-Name=org.kde.customcontent +X-KDE-PluginInfo-Version= +X-KDE-PluginInfo-Website= +X-Plasma-MainScript=ui/main.qml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/autotests/data/simplecontent/contents/ui/main.qml new/kpackage-5.18.0/autotests/data/simplecontent/contents/ui/main.qml --- old/kpackage-5.17.0/autotests/data/simplecontent/contents/ui/main.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kpackage-5.18.0/autotests/data/simplecontent/contents/ui/main.qml 2016-01-02 17:45:20.000000000 +0100 @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +Rectangle { + id: root + color: "darkblue" +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/autotests/data/simplecontent/metadata.desktop new/kpackage-5.18.0/autotests/data/simplecontent/metadata.desktop --- old/kpackage-5.17.0/autotests/data/simplecontent/metadata.desktop 1970-01-01 01:00:00.000000000 +0100 +++ new/kpackage-5.18.0/autotests/data/simplecontent/metadata.desktop 2016-01-02 17:45:20.000000000 +0100 @@ -0,0 +1,37 @@ +[Desktop Entry] +Encoding=UTF-8 +Keywords= +Name=Simple Content +Name[ca]=Contingut simple +Name[ca@valencia]=Contingut simple +Name[en_GB]=Simple Content +Name[es]=Contenido sencillo +Name[fi]=Yksinkertainen sisältö +Name[gl]=Contido simple +Name[it]=Contenuto semplice +Name[nl]=Eenvoudige inhoud +Name[pl]=Prosta treść +Name[pt]=Conteúdo Simples +Name[pt_BR]=Conteúdo simples +Name[sk]=Jednoduchý obsah +Name[sl]=Preprosta vsebina +Name[sr]=Једноставан садржај +Name[sr@ijekavian]=Једноставан садржај +Name[sr@ijekavianlatin]=Jednostavan sadržaj +Name[sr@latin]=Jednostavan sadržaj +Name[sv]=Enkelt innehåll +Name[uk]=Простий вміст +Name[x-test]=xxSimple Contentxx +Name[zh_CN]=简单内容 +Type=Service + +X-KDE-ServiceTypes=SimpleContent +X-KDE-ParentApp= +X-KDE-PluginInfo-Author=Joe Blow +X-KDE-PluginInfo-Category= [email protected] +X-KDE-PluginInfo-License=GPLv2+ +X-KDE-PluginInfo-Name=org.kde.simplecontent +X-KDE-PluginInfo-Version= +X-KDE-PluginInfo-Website= +X-Plasma-MainScript=ui/main.qml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/autotests/data/testjsonmetadatapackage/contents/ui/main.qml new/kpackage-5.18.0/autotests/data/testjsonmetadatapackage/contents/ui/main.qml --- old/kpackage-5.17.0/autotests/data/testjsonmetadatapackage/contents/ui/main.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kpackage-5.18.0/autotests/data/testjsonmetadatapackage/contents/ui/main.qml 2016-01-02 17:45:20.000000000 +0100 @@ -0,0 +1,7 @@ +import QtQuick 2.0 + +Rectangle { + id: root + color: "darkblue" +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/autotests/data/testjsonmetadatapackage/metadata.json new/kpackage-5.18.0/autotests/data/testjsonmetadatapackage/metadata.json --- old/kpackage-5.17.0/autotests/data/testjsonmetadatapackage/metadata.json 1970-01-01 01:00:00.000000000 +0100 +++ new/kpackage-5.18.0/autotests/data/testjsonmetadatapackage/metadata.json 2016-01-02 17:45:20.000000000 +0100 @@ -0,0 +1,15 @@ +{ + "KPlugin": { + "Authors": [ + { + "Email": "[email protected]", + "Name": "Aleix" + } + ], + "Id": "org.kde.testjsonpackage", + "License": "GPLv2+", + "Name": "Test JSON Package", + "ServiceTypes": [ "KPackage/Generic" ] + }, + "X-Plasma-MainScript": "ui/main.qml" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/autotests/packagestructuretest.cpp new/kpackage-5.18.0/autotests/packagestructuretest.cpp --- old/kpackage-5.17.0/autotests/packagestructuretest.cpp 2015-12-06 22:34:53.000000000 +0100 +++ new/kpackage-5.18.0/autotests/packagestructuretest.cpp 2016-01-02 17:45:20.000000000 +0100 @@ -92,6 +92,26 @@ } }; +class SimpleContent : public KPackage::PackageStructure +{ +public: + void initPackage(KPackage::Package *package) + { + package->addDirectoryDefinition("ui", "ui/", i18n("User interface")); + } + void pathChanged(KPackage::Package *package) + { + if (!package->metadata().isValid()) { + return; + } + if (package->metadata().serviceTypes().contains("CustomContent")) { + package->addFileDefinition("customcontentfile", "customcontent/CustomContentFile.qml", i18n("Custom file only for packages that contain CustomContent in their servicetypes")); + } else { + package->removeDefinition("customcontentfile"); + } + } +}; + void PackageStructureTest::initTestCase() { m_packagePath = QFINDTESTDATA("data/testpackage"); @@ -326,5 +346,22 @@ QCOMPARE(ps.mimeTypes("theme"), mimeTypes); } +void PackageStructureTest::customContent() +{ + KPackage::Package p(new SimpleContent); + p.setPath(QFINDTESTDATA("data/simplecontent")); + QVERIFY(p.isValid()); + QCOMPARE(p.filePath("customcontentfile"), QString()); + + p.setPath(QFINDTESTDATA("data/customcontent")); + const QString expected = QFINDTESTDATA("data/customcontent") + "/contents/customcontent/CustomContentFile.qml"; + QCOMPARE(p.filePath("customcontentfile"), expected); + QVERIFY(p.isValid()); + + p.setPath(QFINDTESTDATA("data/simplecontent")); + QVERIFY(p.isValid()); + QCOMPARE(p.filePath("customcontentfile"), QString()); +} + QTEST_MAIN(PackageStructureTest) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/autotests/packagestructuretest.h new/kpackage-5.18.0/autotests/packagestructuretest.h --- old/kpackage-5.17.0/autotests/packagestructuretest.h 2015-12-06 22:34:53.000000000 +0100 +++ new/kpackage-5.18.0/autotests/packagestructuretest.h 2016-01-02 17:45:20.000000000 +0100 @@ -45,6 +45,7 @@ void name(); void required(); void mimeTypes(); + void customContent(); private: KPackage::Package ps; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/autotests/querytest.cpp new/kpackage-5.18.0/autotests/querytest.cpp --- old/kpackage-5.17.0/autotests/querytest.cpp 2015-12-06 22:34:53.000000000 +0100 +++ new/kpackage-5.18.0/autotests/querytest.cpp 2016-01-02 17:45:20.000000000 +0100 @@ -52,12 +52,12 @@ { ps.install(QFINDTESTDATA("data/testpackage")); ps.install(QFINDTESTDATA("data/testfallbackpackage")); + ps.install(QFINDTESTDATA("data/testjsonmetadatapackage")); } void QueryTest::query() { - //QEXPECT_FAIL("", "queries don't work yet", Continue); - QCOMPARE(KPackage::PackageLoader::self()->listPackages("KPackage/Generic").count(), 2); + QCOMPARE(KPackage::PackageLoader::self()->listPackages("KPackage/Generic").count(), 3); } QTEST_MAIN(QueryTest) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/src/kpackage/package.cpp new/kpackage-5.18.0/src/kpackage/package.cpp --- old/kpackage-5.17.0/src/kpackage/package.cpp 2015-12-06 22:34:53.000000000 +0100 +++ new/kpackage-5.18.0/src/kpackage/package.cpp 2016-01-02 17:45:20.000000000 +0100 @@ -910,7 +910,8 @@ void PackagePrivate::createPackageMetadata(const QString &path) { delete metadata; - QString metadataPath = path.endsWith("/metadata.desktop") ? path : (path + "/metadata.desktop"); + + QString metadataPath = QFileInfo(path).isFile() ? path : (path + "/metadata.desktop"); if (!QFile::exists(metadataPath)) { qWarning() << "No metadata file in the package, expected it at:" << metadataPath; metadata = new KPluginMetaData(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/src/kpackage/packageloader.cpp new/kpackage-5.18.0/src/kpackage/packageloader.cpp --- old/kpackage-5.17.0/src/kpackage/packageloader.cpp 2015-12-06 22:34:53.000000000 +0100 +++ new/kpackage-5.18.0/src/kpackage/packageloader.cpp 2016-01-02 17:45:20.000000000 +0100 @@ -242,7 +242,7 @@ //qDebug() << "Not cached"; // If there's no cache file, fall back to listing the directory const QDirIterator::IteratorFlags flags = QDirIterator::Subdirectories; - const QStringList nameFilters = QStringList(QStringLiteral("metadata.desktop")); + const QStringList nameFilters = QStringList(QStringLiteral("metadata.desktop")) << QStringLiteral("metadata.json"); QDirIterator it(plugindir, nameFilters, QDir::Files, flags); while (it.hasNext()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/src/kpackage/private/packagejobthread.cpp new/kpackage-5.18.0/src/kpackage/private/packagejobthread.cpp --- old/kpackage-5.17.0/src/kpackage/private/packagejobthread.cpp 2015-12-06 22:34:53.000000000 +0100 +++ new/kpackage-5.18.0/src/kpackage/private/packagejobthread.cpp 2016-01-02 17:45:20.000000000 +0100 @@ -135,6 +135,8 @@ return ok; } +Q_GLOBAL_STATIC_WITH_ARGS(QStringList, metaDataFiles, (QStringList(QLatin1String("metadata.desktop")) << QLatin1String("metadata.json"))) + bool indexDirectory(const QString& dir, const QString& dest) { QVariantMap vm; @@ -144,16 +146,14 @@ QJsonArray plugins; - int i = 0; - QDirIterator it(dir, QStringList()<<QStringLiteral("*.desktop"), QDir::Files, QDirIterator::Subdirectories); + QDirIterator it(dir, *metaDataFiles, QDir::Files, QDirIterator::Subdirectories); while (it.hasNext()) { it.next(); const QString path = it.fileInfo().absoluteFilePath(); QJsonObject obj = KPluginMetaData(path).rawData(); obj.insert("FileName", path); - plugins.insert(i, obj); - i++; + plugins.append(obj); } // Less than two plugin means it's not worth indexing @@ -162,23 +162,23 @@ return true; } - QJsonDocument jdoc; - jdoc.setArray(plugins); - QString destfile = dest; - const QFileInfo fi(dest); - if (!fi.isAbsolute()) { + if (!QDir::isAbsolutePath(dest)) { destfile = dir + '/' + dest; } + + QDir().mkpath(QFileInfo(destfile).dir().absolutePath()); QFile file(destfile); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { + if (!file.open(QIODevice::WriteOnly)) { qWarning() << "Failed to open " << destfile; return false; } + QJsonDocument jdoc; + jdoc.setArray(plugins); // file.write(jdoc.toJson()); file.write(jdoc.toBinaryData()); - qWarning() << "Generated " << destfile << " (" << i << " plugins)"; + qWarning() << "Generated " << destfile << " (" << plugins.count() << " plugins)"; return true; } @@ -288,16 +288,33 @@ delete archive; } - QString metadataPath = path + "metadata.desktop"; - if (!QFile::exists(metadataPath)) { - qDebug() << "No metadata file in package" << src << metadataPath; + QDir packageDir(path); + QFileInfoList entries = packageDir.entryInfoList(*metaDataFiles); + KPluginMetaData meta; + if (!entries.isEmpty()) { + const QString metadataFilePath = entries.first().filePath(); + if (metadataFilePath.endsWith(QLatin1String(".desktop"))) + meta = KPluginMetaData(metadataFilePath); + else { + QFile f(metadataFilePath); + if(!f.open(QIODevice::ReadOnly)){ + qWarning() << "Couldn't open metadata file" << src << path; + d->errorMessage = i18n("Could not open metadata file: %1", src); + d->errorCode = Package::JobError::MetadataFileMissingError; + return false; + } + QJsonObject metadataObject = QJsonDocument::fromJson(f.readAll()).object(); + meta = KPluginMetaData(metadataObject, QString(), metadataFilePath); + } + } + + if (!meta.isValid()) { + qDebug() << "No metadata file in package" << src << path; d->errorMessage = i18n("No metadata file in package: %1", src); d->errorCode = Package::JobError::MetadataFileMissingError; return false; } - KPluginMetaData meta(metadataPath); - QString pluginName = meta.pluginId(); qDebug() << "pluginname: " << meta.pluginId(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpackage-5.17.0/src/kpackage/private/packages.cpp new/kpackage-5.18.0/src/kpackage/private/packages.cpp --- old/kpackage-5.17.0/src/kpackage/private/packages.cpp 2015-12-06 22:34:53.000000000 +0100 +++ new/kpackage-5.18.0/src/kpackage/private/packages.cpp 2016-01-02 17:45:20.000000000 +0100 @@ -48,11 +48,9 @@ return; } - KDesktopFile config(package->path() + "/metadata.desktop"); - KConfigGroup cg = config.desktopGroup(); - QString mainScript = cg.readEntry(mainScriptConfigKey(), QString()); + QString mainScript = package->metadata().value(mainScriptConfigKey()); if (mainScript.isEmpty()) { - mainScript = cg.readEntry("X-Plasma-MainScript", QString()); + mainScript = package->metadata().value("X-Plasma-MainScript"); } if (!mainScript.isEmpty()) {
