Skyedra / UnspamifyUbuntu

Remove spam from Ubuntu
MIT License
152 stars 9 forks source link

"Patch Update Manager (for Ubuntu 23.04+ Desktop only)" doesn't seem to work for 24.04 #18

Open gc-user opened 1 month ago

gc-user commented 1 month ago

After installing UnspamifyUbuntu on Xubuntu 24.04 (well, maybe it was preserved during the upgrade from 22.04) the settings of the update manager aren't accessible anymore. Just like in 22.04. I tried applying the "Patch Update Manager (for Ubuntu 23.04+ Desktop only)" patch, but the dry run gave 2 errors, just like here.

Hunk #1 FAILED at 44. Hunk #2 FAILED at 278. Hunk #3 succeeded at 481 (offset 22 lines).

I tried to manually comment out the respective lines (which are now slightly different from what the patch is looking for), but that didn't help. So, for now, I ran out ideas of what to test next...

Thanks for looking into this!

Btw., the respective lines in /usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py now read:

1: instead of 4-44:

   from uaclient.api.u.pro.packages.updates.v1 import updates

now: 28:

   import uaclient.api.u.pro.packages.updates.v1 as ua

2: instead of 278-288:

   def _get_ua_security_status(self):
     self.ua_security_packages = []
     try:
         update_result = updates()
     except (IOError, OSError):
         return
     for info in update_result.updates:
         if info.status == "pending_attach":
             self.ua_security_packages.append(
                 (info.package, info.version, info.download_size)
             )

now: 283-310:

   def _get_ua_security_status(self):
    self.ua_security_packages = []
    t = threading.Thread(target=self._fetch_ua_updates, daemon=True)
    t.start()
    while t.is_alive():
        while Gtk.events_pending():
            Gtk.main_iteration()
        time.sleep(0.05)
    for package in self.ua_updates:
        if (
            package.provided_by == 'standard-security'
            or package.provided_by == 'standard-updates'
        ):
            continue
        status = package.status
        if (
            status == 'pending_attach'
            or status == 'pending_enable'
            or status == 'upgrade_available'
        ):
            name = package.package
            version = package.version
            size = package.download_size
            downloadable = status == 'upgrade_available'
            self.ua_security_packages.append(
                (name, version, size, downloadable)
            )
    self.cache.create_pro_cache(self.ua_security_packages)

3 is the the same, but in line 481 instead of 459:

    self._get_ua_security_status()