[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#753733: tracker.debian.org: Learn about auto-removals



Hi,

On Mon, 11 Aug 2014, Christophe Siraut wrote:
> The following patch should display the autoremoval notifications in the
> action needed panel.
[...]
> --- /dev/null
> +++ b/distro_tracker/vendor/debian/templates/debian/autoremoval-action-item.html
> @@ -0,0 +1,7 @@
> +{% spaceless %}
> +{% with version=item.extra_data.version %}
> +<div>
> +    <span>Version {{ version }} is marked for autoremoval from testing. You should try to prevent the removal from testing by fixing RC bugs.</span>

That's a bit short for a long explanation. Please include the reason why
the package will get removed, it can be either because it's affected by
one or more RC bug(s) or because it depends on one or more package(s)
which is/are itself affected by one or more RC bugs. And we want links
to the bugs and the packages.

I know the short description already contains links to the bugs but IMO
the long description should be useful on its own.

> +</div>
> +{% endwith %}
> +{% endspaceless %}
> diff --git a/distro_tracker/vendor/debian/tracker_tasks.py b/distro_tracker/vendor/debian/tracker_tasks.py
> index 920ac62..d03dfb9 100644
> --- a/distro_tracker/vendor/debian/tracker_tasks.py
> +++ b/distro_tracker/vendor/debian/tracker_tasks.py
> @@ -1686,6 +1686,84 @@ class UpdateUbuntuStatsTask(BaseTask):
>                      patch_diff=diff)
>  
>  
> +class UpdateAutoremovalStatsTask(BaseTask):
> +    """
> +    A task for updating autoremovals information on all packages.
> +    """
> +    ACTION_ITEM_TYPE_NAME = 'debian-autoremoval'
> +    ACTION_ITEM_TEMPLATE = 'debian/autoremoval-action-item.html'
> +    ITEM_DESCRIPTION = 'Marked for autoremoval on {removal_date}: {bugs}'
> +
> +    def __init__(self, force_update=False, *args, **kwargs):
> +        super(UpdateAutoremovalStatsTask, self).__init__(*args, **kwargs)
> +        self.force_update = force_update
> +        self.action_item_type = ActionItemType.objects.create_or_update(
> +            type_name=self.ACTION_ITEM_TYPE_NAME,
> +            full_description_template=self.ACTION_ITEM_TEMPLATE)
> +
> +    def set_parameters(self, parameters):
> +        if 'force_update' in parameters:
> +            self.force_update = parameters['force_update']
> +
> +    def _get_autoremoval_content(self):
> +        url = 'http://udd.debian.org/cgi-bin/autoremovals.yaml.cgi'
> +        cache = HttpCache(settings.DISTRO_TRACKER_CACHE_DIRECTORY)
> +        if not cache.is_expired(url):
> +            return
> +        response, updated = cache.update(url, force=self.force_update)
> +        if not updated:
> +            return
> +        return yaml.safe_load(six.BytesIO(response.content))

We have more and more tasks that work almost the same. Maybe it's time
to have a generic implementation of this typical task? (With a generic way
to test all children of the tasks)

> +    def get_autoremovals_stats(self):
> +        """
> +        Retrieves and parses the autoremoval stats for all packages.
> +        Autoremoval stats include the BTS bugs id.
> +
> +        :returns: A dict mapping package names to autoremoval stats.
> +        """
> +        return self._get_autoremoval_content()

Why do we need this method?

> +    def update_action_item(self, package, stats):
[...]
> +        action_item.extra_data = {
> +            'version': stats['version'],
> +            'removal_date': stats['removal_date']
> +        }

I would just keep the full "stats" dict in extra_data.

Thanks for your work on this feature! It's one of the most important
missing feature.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Discover the Debian Administrator's Handbook:
→ http://debian-handbook.info/get/


Reply to: