#771604 Add long description as a tooltip on top of the short description

#771604#5
Date:
2014-11-30 23:33:31 UTC
From:
To:
Hi,

The tracker page of gravitywars displays both the short and long
descriptions instead of the short description only:

https://tracker.debian.org/pkg/gravitywars

Thanks,
Vincent

#771604#10
Date:
2014-12-01 09:56:59 UTC
From:
To:
Control: tag -1 newcomer

Where?

I only see "gravitywars clone of Gravity Force" in the title. So the
long description is currently missing compared to the old tracker (where
it's displayed in a tooltip).

Is that what you are reporting?

Cheers,

#771604#17
Date:
2014-12-01 12:55:09 UTC
From:
To:
Control: retitle -1 Add long description as a tooltip on top of the short description
Control: severity -1 wishlist

Weird, maybe it was a bug in the package, because the tracker never
displayed the long description anywhere.

But this is actually a desirable feature. At least Paul Wise requested
it already.

So I'm keeping the bug but repurposing it to add the long description back
as a tooltip.

Cheers,

#771604#26
Date:
2014-12-01 12:47:51 UTC
From:
To:
Raphael Hertzog <hertzog@debian.org> writes:

Yes, you're right, I now only see the short description in the
title. But I reported this bug because if I'm not wrong, the long
description was also written in the <h4> title at least yesterday and a
few days ago when I first looked at this page. Pages for other packages
didn't have this bug.

I guess this bug can be closed, sorry for the noise.

Thanks,
Vincent

#771604#31
Date:
2014-12-02 11:43:59 UTC
From:
To:
Here is a patchset implementing half of this feature, I have not
yet figured out how to feed the long description in the tracker.

Cheers,
Christophe

#771604#36
Date:
2014-12-02 13:42:39 UTC
From:
To:
Hi Christophe,

Can you be more explicit at where you're stuck?

A quick look led me to
distro_tracker.core.utils.packages.extract_information_from_packages_entry()
to fix to inject the long description too.

That said I'm not sure how to retrieve the long description
from the "stanza" variable. A dump of the variable will hopefully give you
the answer ? (otherwise it might be documented in the python-apt doc?)

A few comments on your patch. It looks mostly good though:

This comment is not accurate. The fallback is to use the description of
the "only" package if there's only one package. There's no notion of the
first package any more.

Since the mistake probably comes from copy/paste, you should fix the
original comment too :-)

Don't we need something to encode quotes to avoid broken HTML if the long
description contains double quotes? Or is this already taken care of by
Django?

Cheers,

#771604#41
Date:
2014-12-02 18:24:05 UTC
From:
To:
Hi Raphaël,

In core.retrieve_data.UpdateRepositoriesTask._update_packages_file, the
long description is not returned by the following loop (line 375, only
the first line is retuned, i.e. the short description):

  for stanza in deb822.Packages.iter_paragraphs(packages_file):

Testing the same method locally succeeds in returning the long description:

  for pkg in deb822.Packages.iter_paragraphs(file('/var/lib/dpkg/status')):
      print pkg['Description']

You are right, we should use the escape template filter (or possibly
an autoescape tag on the first part of that template).

Thanks,
Christophe

#771604#46
Date:
2014-12-03 01:53:23 UTC
From:
To:
Django does that automatically according to this:

https://docs.djangoproject.com/en/dev/topics/templates/

#771604#51
Date:
2014-12-03 10:28:00 UTC
From:
To:
Hi,

This test is not very helpful:
- you use the status file which has the full description while we work on
  files downloaded by apt, those have descriptions split out in separate
  Translation-en files.
- did you test both in the same environment (i.e. same version of
  python-apt / python-debian) ?

In fact, I even wonder why we're getting short description at all...
since we're not accessing data directly via AptCache and instead we
are parsing the downloaded Packages files.

Cheers,

#771604#56
Date:
2014-12-11 08:12:01 UTC
From:
To:
Hi,

Raphael Hertzog wrote:

We could adapt AptCache (in core.utils.packages) and use apt_pkg for
retrieving version and descriptions (short and long) for binary
packages. But then it seems more coherent to use to same mechanism for
retrieving source packages informations. I wonder why we opted for
manually parsing the Packages and Sources files in the first place, and
what would be the impact on performances.

Christophe

#771604#61
Date:
2014-12-11 08:58:32 UTC
From:
To:
Hi,

The reason we parse individual files is that we want to only
process modified files since the last update (precisely for performance
reasons). apt_pkg doesn't let us extract a list of packages coming from a
specific Packages/Sources file.

But the whole retrieve_data.py really needs some better design and quite
likely a rewrite. Its huge resource consumption is also a problem.

Cheers,

#771604#66
Date:
2014-12-11 14:12:31 UTC
From:
To:
In the Debian derivatives census scripts I have a way to do that
(except I don't do the update check), basically you extract the
filenames of the Packages/Sources and then pass them to the deb822
module:

https://anonscm.debian.org/cgit/dex/census.git/tree/check-package-list