Commit Graph

59 Commits

Author SHA1 Message Date
Grégoire Deveaux 40bfcc104c Add author to planet feed 2021-12-20 21:18:10 +01:00
Justin ! c6cf91a40d Fix pep8 errors 2020-11-11 22:23:29 +01:00
Jelle van der Waa 6914af850d
Use Release models torrent data for feeds
When a new Release is done, the iso and torrent file might not be
rsync'd yet to the archweb server, which makes torrent clients which
watch the feed unable to retrieve the torrent file and give up. As this
behaviour is unwanted use the Release model torrent data which is always
availabe.
2020-07-09 21:52:26 +02:00
Jelle van der Waa 17a12f07fb Introduce planet functionality in archweb
This change introduces a replacment for planet.archlinux.org which uses
a python 2 project to generate static html from multiple RSS feed
sources. For archweb a set of 'static' feeds can be created in the
django admin view for the Arch forums and other static feeds, archweb
users can add their own blog rss feed in their profile which will create
a Feed model.

When running the update_planet command, all Feed models are iterated
over and the rss feed is parsed. The latest FeedItem is queried matching
the current Feed model and every newer entry in the RSS feed is added as
new FeedItem. Since the body is also stored in the FeedItem there is a
limit to the amount of FeedItems per Feed configured in settings.py of
which the default is 25.

When a user is marked as inactive his Feed model and items are
removed automatically to avoid keeping stale data around.

Closes: #261
2020-02-03 21:25:31 +01:00
Michal Donat 864864ae88 add packages rss feeds for "all stable repos" and "all testing repos"
https://bugs.archlinux.org/task/59329
2019-12-18 17:26:04 +01:00
Jelle van der Waa 4dc419db90 feeds.py: join of bytes to a str 2019-01-21 21:19:58 +01:00
Jelle van der Waa 7150691243 feeds.py: Change last_modified to SQLAlchemy
Change the last_modified check to SQLAlchemy so it works with SQLite
too.
2018-06-08 19:52:45 +02:00
Jelle van der Waa 2f55536485 feeds: Add package removal / deletion feed
Add new feeds for newly added packages and packages which where removed
from the repository's.
2018-06-08 19:52:45 +02:00
Dan McGee bd2bc6a1c5 Add last modified date to releases
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-26 22:26:25 -05:00
Dan McGee 9c701ebba1 Double batch size in BatchWritesWrapper
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-26 22:06:08 -05:00
Dan McGee 8e990ca945 Kill now unneeded workaround for Django issue #9800
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-26 21:56:24 -05:00
Dan McGee 15bb0e7101 Remove Etag header from feeds
We have Last-Modified here, and from what I can tell with some more
reading and playing with caching, it isn't necessarily wise to set both
of them in the same response. Set the one that we actually trust.

Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-26 21:44:11 -05:00
Dan McGee f7d1940a73 Remove usage of templates for RSS feeds
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-19 18:30:32 -05:00
Dan McGee 1ff2e37e04 Simplify last modified and etags processing for feeds
We had this elaborate system set up with caching and invalidation, which
is overkill since we cache the result of the view anyway. Just hit the
database when needed to find the last change to the respective model
class and be done with it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-19 14:19:05 -05:00
Dan McGee 3827215fa3 Speed up feeds generation by batching writes
The XML generation underlying our package feeds was doing 1600+ calls to
the write() method on the outfile. For some reason, the Python standard
library insists on calling flush() after every write, which really makes
performance take a nosedive. Wrap the write calls and do them in batches
to remove some of the overhead and make feed generation a bit snappier.

Signed-off-by: Dan McGee <dan@archlinux.org>
2014-01-11 13:07:40 -06:00
Dan McGee 67a0c0ac08 Remove remaining references to release file_size field
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-01-09 08:41:22 -06:00
Dan McGee 772a500534 Move simple feeds templates directly into feed classes
No need to call out to the template engine to format... nothing at all.
Just fetch the attribute directly and save the render step.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-07-13 09:50:45 -05:00
Dan McGee 1a7e5d22f1 Add basic release list and details views
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-19 12:08:31 -06:00
Dan McGee 8cfaa39a04 Add more metadata to releng Release model
Add a file_size field which we will use in the RSS feed, and also add a
field for future storage of the torrent data itself.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-19 10:59:18 -06:00
Dan McGee fbc153ed45 Initial cut of a Releases RSS feed
This is our first use of enclosures on the site as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-19 10:33:03 -06:00
Dan McGee 019785186c Add __name__ attribute to class-based Feeds views
This should hopefully allow these views to not be labeled as
'_wrapped_view' in performance monitoring output.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-13 21:43:11 -06:00
Dan McGee 554df3f8cf Remove explicit timezone handling from feeds
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-06 08:22:44 -06:00
Dan McGee 177b93ac21 Make guid feeds helper a @staticfunction
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-06 08:18:53 -06:00
Dan McGee c03b9c5f10 feeds: add all arches for repo feed
If you wanted to see all updates regardless of architecture for
[testing] before, there wasn't really a way to do so. Add one.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-31 00:16:36 -05:00
Dan McGee 0cc369e985 Update several bits and pieces for staging packages
This will prevent [staging] packages from cluttering normal user's view
on the website, but allow us to still import everything from this
repository for developer use.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-31 00:09:28 -05:00
Dan McGee d685d51e8c Ensure we use last_modified date from News in headers
We were actually using the postdate attribute rather than last_modified,
which means any News objects that get edited would not trigger an update
of the feed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-20 13:21:59 -05:00
Dan McGee 6218ccc570 Use python hashlib directly
Django hashcompat is now deprecated.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-23 19:54:40 -05:00
Dan McGee 4a9b6867a3 Refactor common select_related into manager method
For a Package object query, we almost always did .select_related('arch',
'repo). Refactor this into the manager as a 'normal()' method so we can
avoid sprinkling the same logic everywhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 15:50:14 -05:00
Dan McGee 77842a6c76 Consolidate caching black magic
Get the stuff used to retrieve and refresh the latest date values all in
the same place, and make it a bit more beautiful by refactoring it all
into a common set of methods.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:03:13 -05:00
Dan McGee 01db07bad8 Use UTC datetime objects everywhere
Rather than the twisted mix of local times and UTC times we currently have.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:03:00 -05:00
Dan McGee 0d3e1eb796 Add a horrible hack to allow feed guid value to not be a permalink
Django, you make the simplest things so damn hard sometimes.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:01:31 -05:00
Dan McGee 9f4902f9c9 Ensure feed GUIDs are unchanging and unique
Implement 'tag:' style URIs for the GUID field on our RSS feeds. This
ensures new package updates show up as new, and we aren't jumping back
and forth between generated GUIDs having 'http://' and 'https://'
prefixes.

Much of the work here is to attempt to keep old news GUIDs constant so
we don't once again make everything show up as new in newsreaders.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:01:16 -05:00
Dan McGee 8c5358e888 Use date from model in news feed
Now that this a datetime and not just a date, we can use it directly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-15 13:51:11 -06:00
Dan McGee 14c8833cf0 Fix feeds for case-sensitive databases
This worked in MySQL because of it's case-insensitive matching, but does
not work in other databases unless we coerce the value.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-11-27 15:04:44 -06:00
Dan McGee 97d1e4164b Connect post_save signals where they will always be triggered
We need to do this in the models.py files, otherwise the post_save signal
might not be connected right away on launch of the application. Move them
over there, add a dispatch_uid so it only gets hooked up once, and do some
other function moving around so we don't have circular imports.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:11:28 -05:00
Dan McGee 16b27bc9e1 Fix potential race conditions in caching
Use a 'set to None' sentinel to indicate data updates are in progress and we
need to hold off a bit on caching a new value. This logic is gleamed from
the "Scaling Django" slides presented by Mike Malone and available freely on
SlideShare.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-08 17:09:34 -05:00
Dan McGee f8c2a15510 Ensure last modified times use UTC
We were cheating before and using non-UTC times; adjust the values we get
back from the database as appropriate so our times are not bogus.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 19:57:31 -05:00
Dan McGee fc6e7113c4 Store package feed last modified date in memcached
Just like what we did for news items, we can do the same for packages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 19:52:31 -05:00
Dan McGee b2acd5cb94 Store latest news date in memcached
This saves two database queries each request, meaning no database hits at
all if we are just going to return a 304 response. It also requires adding a
post_save signal to ensure our cache is updated with the correct latest news
date upon saving a news item.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 19:43:13 -05:00
Dan McGee cf7bf2de29 Factor out common last modified code for news feed
This will set up retrieving this value from memcached as well as some other
changes to come.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 19:16:40 -05:00
Dan McGee 5dc5688d97 Improve request handling for feeds that haven't changed
By using the condition decorator (in a slightly odd way because these are
class-based views), we can cut down a lot on the response time for returning
304 status code for feeds that haven't changed. The decorator means we no
longer have to completely render the view to see if we can return a 304
status code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-14 17:42:12 -05:00
Dan McGee 04da5f03b2 Use arch.agnostic flag everywhere
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-08 11:12:43 -05:00
Dan McGee f637a1eb67 Move news model to an appropriate place
Never would have guessed it should actually be in news/models.py.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-08 00:23:55 -05:00
Dan McGee d57696c801 PyLint suggested cleanups
We had a bunch of extra imports, non-conventional variable names, spacing
issues, etc. that were relatively low-hanging fruit to clean up. Fix them
and make the code a bit cleaner in the process.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-28 11:41:19 -05:00
Dan McGee 1cfcf13e1b Remove an unnecessary iexact
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 16:10:48 -05:00
Dan McGee 89cae2bcb5 Update feeds to new 1.2 framework
Feeds are now views-based and don't need the dictionary anymore.
get_object() now takes named arguments as well making it a bit more
understandable when reading the code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-08 10:52:53 -05:00
Dan McGee 2b1256434c feeds: move link from method to attribute
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-04 10:03:00 -05:00
Dan McGee d709604102 Remove archweb prefix from all imports
Unnecessary, and lets us standardize on not using it everywhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-10 00:29:27 -06:00
Dan McGee 6fe8aec0ab feeds: add per arch, per repo feed ability
Make the feed framework a lot more flexible and give the possibility to have
a feed for each architecture. You can drill down even more than also get a
feed for a particular repo; some might find this helpful for something like
tracking [testing]. Implements FS#12939.

I also bumped up the number of items available in each of these feeds; since
it is full of a bunch of small items it might be more helpful to have more
available and it should also prevent fewer ones from being missed.

The UI isn't exactly spectacular, but I figured some sort of page is better
than none listing all the various feeds you can pull from.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-04 19:03:32 -06:00
Dan McGee cc93d3eda6 Make the feed titles more descriptive
FS#16752.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-31 15:36:42 -06:00