Cannot update plasmoids ("The new package has a different type from the old version already installed")

Bug #2039778 reported by Matteo Italia
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kpackage (Ubuntu)
New
Undecided
Unassigned

Bug Description

Ubuntu 22.04 AMD64, KPackage 5.92 (libkf5package5_5.92.0-0ubuntu1, kflibkf5package-data_5.92.0-0ubuntu1)

Every time Plasma Discover tries to update a Plasmoid I installed ("Resources Monitor - fork", from https://store.kde.org/p/1527636) it fails, saying "The new package has a different type from the old version already installed."; I get the same message when trying to update it from the "Install new stuff" dialog in the "Add objects" mode or however it's called in English; letting it download the package automatically vs providing the zip manually doesn't change the result. The only way I have to update it is to uninstall it and re-install the updated version. The updated version does have the same type as the old one of course.

Investigating the issue, I traced the message to KPackage, and specifically to src/kpackage/private/packagejobthread.cpp, that (line 264) goes like this:

    if (QFile::exists(targetName)) {
        if (operation == Update) {
            KPluginMetaData oldMeta(targetName + QLatin1String("/metadata.desktop"));

            if (readKPackageTypes(oldMeta) != readKPackageTypes(meta)) {
                d->errorMessage = i18n("The new package has a different type from the old version already installed.");
                d->errorCode = Package::JobError::UpdatePackageTypeMismatchError;

however, at line 78 it refers to some alternative metaDataFiles that may be present, in particular metadata.json:

Q_GLOBAL_STATIC_WITH_ARGS(QStringList, metaDataFiles, (QStringList(QLatin1String("metadata.desktop")) << QLatin1String("metadata.json")))

Indeed, looking under ~/.local/share/plasma/plasmoids/org.kde.resourcesMonitor-fork I see that there's no metadata.desktop, but only metadata.json (that, from what I gather, seems to be the preferred format nowadays).

Apparently, this code wasn't updated to look also for the JSON by mistake, as here https://github.com/KDE/kpackage/commit/57ba435edb2fae1626581a769079b4cf8751044f an extra check was added. Indeed, applying that patch, rebulding and installing the new packages (libkf5package5, libkf5package-data) fixed the issue.

My proposal here is to backport that patch (that applies cleanly) to the version shipped with Ubuntu 22.04 (5.92), otherwise I expect more and more stuff installed through knewstuff to become non-updateable with this obscure error.

Tags: patch
Revision history for this message
Matteo Italia (matteo-mitalia) wrote :
summary: Cannot update plasmoids ("The new package has a different type from the
- old version already installed"
+ old version already installed")
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch from https://github.com/KDE/kpackage/commit/57ba435edb2fae1626581a769079b4cf8751044f" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.