Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[Django] #35593: collectstatic does not preserve source file timestamps

4 views
Skip to first unread message

Django

unread,
Jul 11, 2024, 7:05:22 AM7/11/24
to django-...@googlegroups.com
#35593: collectstatic does not preserve source file timestamps
------------------------+-----------------------------------------------
Reporter: kunkku | Type: Uncategorized
Status: new | Component: contrib.staticfiles
Version: 4.2 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+-----------------------------------------------
The `collectstatic` management command interacts badly with Linux package
managers.

When `collectstatic` copies files, the ''last modified'' timestamp of the
destination file gets set to the time when the command was run. If the
destination file already exists and the corresponding source file does not
have a newer timestamp, copying is skipped.

When files are installed by `pip`, the timestamps are set according to the
installation time. However, this may not be the case with other package
managers, such as `rpm` or `dpkg`. With native package mangers, the
timestamps often reflect the build time of the package instead of the
installation time. Therefore, `collectstatic` may skip source files that
were actually updated by the package manager if the source package was
built before the destination file was created.

To ensure correct operation, the destination directory must currently be
emptied if any of the source files comes from the Linux distro. The
suggested solution is to copy the timestamp of the source file to the
destination file instead of using the current time.
--
Ticket URL: <https://code.djangoproject.com/ticket/35593>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 12, 2024, 4:19:32 AM7/12/24
to django-...@googlegroups.com
#35593: collectstatic does not preserve source file timestamps
-------------------------------------+-------------------------------------
Reporter: Kaarle Ritvanen | Owner: (none)
Type: Uncategorized | Status: closed
Component: contrib.staticfiles | Version: 4.2
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* resolution: => needsinfo
* status: new => closed

Comment:

I'm not sure if the right approach would be to write a custom storage here
and updating the logic of
[https://docs.djangoproject.com/en/5.0/ref/files/storage/#django.core.files.storage.Storage.get_modified_time
Storage.get_modified_time()]
Can you provide some specific details on how to reproduce this? Maybe even
a test case?
--
Ticket URL: <https://code.djangoproject.com/ticket/35593#comment:1>
Reply all
Reply to author
Forward
0 new messages