[Merge] ~nteodosio/update-manager:no-ua-shell into update-manager:main

Grant Orndorff mp+456088 at code.launchpad.net
Fri Dec 1 16:42:13 UTC 2023


Some small questions and comments but generally looks good!

Diff comments:

> diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py
> index 2e6aed4..9c4219d 100644
> --- a/UpdateManager/UpdateManager.py
> +++ b/UpdateManager/UpdateManager.py
> @@ -276,36 +277,34 @@ class UpdateManager(Gtk.Window):
>              if fnmatch.fnmatch(pkg.name, "oem-*-meta") and pkg.installed:
>                  self.oem_metapackages.add(pkg)
>  
> +    def _fetch_ua_updates(self):
> +        self.ua_updates = ua.updates().updates
> +

We might as well start calling things "pro" instead of "ua" while we're here IMO, unless you want to do that all at once in a separate refactor.

    def _fetch_pro_updates(self):
        self.pro_updates = pro_updates_v1.updates().updates

>      def _get_ua_security_status(self):
>          self.ua_security_packages = []
> -        try:
> -            p = subprocess.Popen(['pro', 'security-status', '--format=json'],
> -                                 stdout=subprocess.PIPE)
> -        except OSError:
> -            pass
> -        else:
> -            while p.poll() is None:
> -                while Gtk.events_pending():
> -                    Gtk.main_iteration()
> -                time.sleep(0.05)
> -            s = json.load(p.stdout)
> -            for package in s.get('packages', []):
> -                if package.get('service_name', '') == 'standard-security':
> -                    continue
> -                status = package.get('status', '')
> -                if (
> -                    status == 'pending_attach'
> -                    or status == 'pending_enable'
> -                    or status == 'upgrade_available'
> -                ):
> -                    name = package.get('package', '')
> -                    version = package.get('version', '')
> -                    size = package.get('download_size', 0)
> -                    downloadable = status == 'upgrade_available'
> -                    self.ua_security_packages.append(
> -                        (name, version, size, downloadable)
> -                    )
> -            self.cache.create_pro_cache(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':

it could also be "standard-updates" which you'll want to exclude as well

> +                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'

This should only be true if the machine is attached and has the service enabled, but if that is true, then I believe update-manager should already know about that update because it will get it from apt. Unless this is used later to label available updates as coming from pro?

> +                self.ua_security_packages.append(
> +                    (name, version, size, downloadable)
> +                )
> +        self.cache.create_pro_cache(self.ua_security_packages)
>  
>      def _make_available_pane(
>          self,


-- 
https://code.launchpad.net/~nteodosio/update-manager/+git/update-manager/+merge/456088
Your team Ubuntu Core Development Team is subscribed to branch update-manager:main.




More information about the Ubuntu-reviews mailing list