Commit Graph

29 Commits

Author SHA1 Message Date
Jelle van der Waa
d01193a2a9 packages: don't fetch rebuilderd status for non-logged in users
The rebuilderd status is only shown for logged in users so fetching this
is unneeded.
2024-07-20 17:19:22 +02:00
Jelle van der Waa
3d196f69f0 packages: avoid fetching rebuilderd status on HEAD requests 2024-07-20 17:19:22 +02:00
Jelle van der Waa
4a11883a7f ruff: enable prefer f-string rule 2023-11-03 12:35:59 +01:00
Jelle van der Waa
6b43ce1407 ruff: enable isort rule 2023-11-03 12:35:59 +01:00
Justin !
cf628634bb
Allow to download sig from "download from mirror" 2021-07-05 23:06:45 +02:00
Jelle van der Waa
b26768d6e7
Add rebuilderd status to the package details page
The reproducible status is now shown for logged in users, as the
reproducible effort is still much experimental and so to not confuse not
logged in users.
2021-05-26 22:38:47 +02:00
Jelle van der Waa
fdf5e3b6fc
Add links database reading and API
The $repo.links.tar.gz databases provided in the repositories are now
parsed by archweb, to be able to expose them via a simple API and to be
able to list the linked sonames in the package details overview.
2021-04-28 22:47:05 +02:00
Justin !
c6cf91a40d Fix pep8 errors 2020-11-11 22:23:29 +01:00
Jelle van der Waa
28a72732e5 rewrite len-as-condition 2019-04-15 21:33:09 +02:00
Jelle van der Waa
018bb49b20 packages: use Pythonic syntax instead of len()
not foo is preferred over len(foo) == 0.
2019-03-02 22:00:19 +01:00
Jelle van der Waa
cbee9abdc9 Update urlparse related imports 2019-01-21 21:19:58 +01:00
Dan McGee
b7b2474064 Various minor code cleanups and fixes
Most of these were suggested by PyCharm, and include everything from
little syntax issues and other bad smells to dead or bad code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-16 22:12:01 -05:00
Dan McGee
31d39e75ee Add shortcut for HEAD requests on slower views
We sometimes see some web bots and crawlers make HEAD requests to verify
existence of certain pages in the application. However, they are less
than kind as 20-50 requests might arrive at the same time, and package
search and details pages are some of the slowest rendering pages we have
due to the Django template engine.

Rather than waste time generating the content only to throw it away,
response as soon as we can with either a 404 or 200 response as
appropriate, omitting the 'Content-Length' header completely, which
seems to be acceptable by the HTTP spec.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-16 21:59:32 -05:00
Dan McGee
7fc8da7d95 Show replacments for package if it has been removed
This covers the case where we can't find the package in any other
repositories, but it was removed recently enough that we have a found
package update object.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-13 13:05:02 -05:00
Dan McGee
746023d529 Make page a query string parameter on package search
This is a bit silly to encode in the URL, or at least makes it much
harder to screen out via robots.txt and other such things.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-16 15:39:23 -06:00
Dan McGee
dc6cc49f6f Use more modern verison of string template formatting
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-23 09:20:19 -07:00
Dan McGee
a10798b756 Use querysets for calls to get_object_or_404(Package)
This works better in most cases since we need the architecture and
repository objects at some point during the view process.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-23 09:18:59 -07:00
Dan McGee
66850026ca Use content_type and not mimetype on HttpResponse()
Bug #16519 in Django deprecates mimetype, so update our code
accordingly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-13 22:34:33 -06:00
Dan McGee
2ee662c77c Extract some common architecture grabbing logic
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-10-26 17:05:39 -05:00
Dan McGee
f5d3c02eb1 Revert "Fall back to 410 Gone for package files view as well"
This reverts commit 9ab460c53a.

This seemed like the right thing to do, but it doesn't really play well
with our more general dispatch framework we now do on the package
details pages. Just let it 404 like it always did, as these pages are
less essential. We can perhaps add a full dispatcher later if we really
feel the need.
2012-07-31 19:49:37 -05:00
Dan McGee
5f85a1240d Reuse removed template for packages with multiple replacements
For example, bitcoin-git in the Arch repos is currently marked replaced
by both bitcoin-qt and bitcoin-daemon. This allows us to show a page
with both options listed instead of a blank 404 page.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-31 19:31:44 -05:00
Dan McGee
5f410c000e Add package details redirect for package replacements
This makes sense if there is only one available replacement. We could
get more sophisticated and show the removed page if there are multiple
replacements available.

Additionally, automatically redirect if there was only one matching
package for a given package update deletion object.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-31 19:12:27 -05:00
Dan McGee
0b7939ae1a Rework package details dispatch code
We had a variety of fallback paths that we took if a details page didn't
exist for the combination of URL parts passed in. Before I go adding a
few more possibilities, rework this so it is more flexible. It is now as
simple as adding a method to the dispatch options list in order to have
further fallback options.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-31 19:01:45 -05:00
Dan McGee
76c37ce3ac Replace deprecated direct_to_template() with render() shortcut
Now that Django actually provides a concise way to use a RequestContext
object without instantiating it, we can use that rather than the old
function-based generic view that worked well to do the same.
Additionally, these function-based generic views will be gone in Django
1.5, so might as well make the move now.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-24 19:57:20 -05:00
Dan McGee
9ab460c53a Fall back to 410 Gone for package files view as well
This is another thing that Google and other search engines try to crawl
that no longer exists at times, so we should handle it gracefully.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-23 21:47:43 -05:00
Dan McGee
211340c8bd Ensure package files JS can support corner cases
We should handle the cases dealing with no filelist available, outdated
filelist, or a package without files, just as the HTML server-side page
does. Add a bit more info to the JSON returned so we can do so.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-23 21:31:17 -05:00
Dan McGee
374bf53505 Remove files list AJAX conditionals
Now that we just generate this list in JS, we don't need this separate
code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-23 21:17:02 -05:00
Dan McGee
946d90d08f Add '410 Gone' support for packages moved out of repositories
This allows us to do better than a generic 404 handler when we know a
package previously existed in a given repository, and should also make
things a bit nicer when getting sent in from a search engine to a page
that no longer exists.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-23 09:55:46 -05:00
Dan McGee
872d4bcaa2 Split details/display package views into new module
This moves a lot of the package and group display logic into a new view
module, similar to what we already did earlier with a bunch of other
views.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-21 11:26:34 -05:00