Public bug reported:

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.

** Affects: kpackage (Ubuntu)
     Importance: Undecided
         Status: New

** Patch added: "Patch from 
https://github.com/KDE/kpackage/commit/57ba435edb2fae1626581a769079b4cf8751044f";
   
https://bugs.launchpad.net/bugs/2039778/+attachment/5711123/+files/57ba435edb2fae1626581a769079b4cf8751044f.patch

** Summary changed:

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

-- 
You received this bug notification because you are a member of Kubuntu
Bugs, which is subscribed to kpackage in Ubuntu.
https://bugs.launchpad.net/bugs/2039778

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/kpackage/+bug/2039778/+subscriptions


-- 
kubuntu-bugs mailing list
kubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kubuntu-bugs

Reply via email to