* [ISSUE] [RFC] set timestamps in a package only for files newer than commit date
@ 2021-08-22 20:57 tornaria
2021-08-23 18:32 ` Chocimier
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: tornaria @ 2021-08-22 20:57 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1427 bytes --]
New issue by tornaria on void-packages repository
https://github.com/void-linux/void-packages/issues/32638
Description:
The hook `pre-pkg/90-set-timestamps.sh` touches all files in a pkg to set the mtimes to the commit date. When a package installs files verbatim from its source, it might make sense to keep the original timestamp. This could be acomplished by using find predicate `-newermt` as in:
```diff
--- a/common/hooks/pre-pkg/90-set-timestamps.sh
+++ b/common/hooks/pre-pkg/90-set-timestamps.sh
@@ -5,6 +5,6 @@ hook() {
# If SOURCE_DATE_EPOCH is set, set mtimes to that timestamp.
if [ -n "$SOURCE_DATE_EPOCH" ]; then
msg_normal "$pkgver: setting mtimes to %s\n" "$(date --date "@$SOURCE_DATE_EPOCH")"
- find $PKGDESTDIR -print0 | xargs -0 touch -h --date "@$SOURCE_DATE_EPOCH"
+ find $PKGDESTDIR -newermt "@$SOURCE_DATE_EPOCH" -print0 | xargs -0 touch -h --date "@$SOURCE_DATE_EPOCH"
fi
}
```
I am thinking on a package like `pari-elldata` which ships only data files from its source. The alternative I found is to set `XBPS_USE_BUILD_MTIME=no` in the template, but (a) that is only good for this pkg because I know all the files in the package have a deterministic timestamp and (b) xlint complains when using this variable.
Rationale: the timestamp of the original files in the source is more canonical than the commit date.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] set timestamps in a package only for files newer than commit date
2021-08-22 20:57 [ISSUE] [RFC] set timestamps in a package only for files newer than commit date tornaria
@ 2021-08-23 18:32 ` Chocimier
2021-08-23 22:39 ` tornaria
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Chocimier @ 2021-08-23 18:32 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 365 bytes --]
New comment by Chocimier on void-packages repository
https://github.com/void-linux/void-packages/issues/32638#issuecomment-904013140
Comment:
Using commit date is not for canonicality but reproducibility. Time should be adjusted even when build machine clock is set eariler than commit date.
Are there any problems with `pari-elldata` files having build date?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] set timestamps in a package only for files newer than commit date
2021-08-22 20:57 [ISSUE] [RFC] set timestamps in a package only for files newer than commit date tornaria
2021-08-23 18:32 ` Chocimier
@ 2021-08-23 22:39 ` tornaria
2021-08-23 22:41 ` ericonr
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: tornaria @ 2021-08-23 22:39 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 754 bytes --]
New comment by tornaria on void-packages repository
https://github.com/void-linux/void-packages/issues/32638#issuecomment-904181484
Comment:
> Using commit date is not for canonicality but reproducibility. Time should be adjusted even when build machine clock is set eariler than commit date.
I wouldn't know how to avoid that in a simple way, is that a normal issue? Maybe the current date can be compared with the commit date and fail if it's older?
> Are there any problems with `pari-elldata` files having build date?
Not really. It just seemed a good idea to ship unmodified files with their original dates. Maybe I'm overthinking it. For the packages in question (PR #32641) I set `XBPS_USE_BUILD_MTIME=no`. Nothing breaks without this.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] set timestamps in a package only for files newer than commit date
2021-08-22 20:57 [ISSUE] [RFC] set timestamps in a package only for files newer than commit date tornaria
2021-08-23 18:32 ` Chocimier
2021-08-23 22:39 ` tornaria
@ 2021-08-23 22:41 ` ericonr
2021-08-23 23:05 ` tornaria
2021-08-23 23:05 ` [ISSUE] [CLOSED] " tornaria
4 siblings, 0 replies; 6+ messages in thread
From: ericonr @ 2021-08-23 22:41 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 248 bytes --]
New comment by ericonr on void-packages repository
https://github.com/void-linux/void-packages/issues/32638#issuecomment-904182460
Comment:
> XBPS_USE_BUILD_MTIME=no
I don't think it's good style to poke at such bits. It's not xbps-src "API".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] set timestamps in a package only for files newer than commit date
2021-08-22 20:57 [ISSUE] [RFC] set timestamps in a package only for files newer than commit date tornaria
` (2 preceding siblings ...)
2021-08-23 22:41 ` ericonr
@ 2021-08-23 23:05 ` tornaria
2021-08-23 23:05 ` [ISSUE] [CLOSED] " tornaria
4 siblings, 0 replies; 6+ messages in thread
From: tornaria @ 2021-08-23 23:05 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 344 bytes --]
New comment by tornaria on void-packages repository
https://github.com/void-linux/void-packages/issues/32638#issuecomment-904192538
Comment:
> > XBPS_USE_BUILD_MTIME=no
>
> I don't think it's good style to poke at such bits. It's not xbps-src "API".
Ok, I removed that in #32641, and I'm closing this now. Thanks for your feedback.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ISSUE] [CLOSED] [RFC] set timestamps in a package only for files newer than commit date
2021-08-22 20:57 [ISSUE] [RFC] set timestamps in a package only for files newer than commit date tornaria
` (3 preceding siblings ...)
2021-08-23 23:05 ` tornaria
@ 2021-08-23 23:05 ` tornaria
4 siblings, 0 replies; 6+ messages in thread
From: tornaria @ 2021-08-23 23:05 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1430 bytes --]
Closed issue by tornaria on void-packages repository
https://github.com/void-linux/void-packages/issues/32638
Description:
The hook `pre-pkg/90-set-timestamps.sh` touches all files in a pkg to set the mtimes to the commit date. When a package installs files verbatim from its source, it might make sense to keep the original timestamp. This could be acomplished by using find predicate `-newermt` as in:
```diff
--- a/common/hooks/pre-pkg/90-set-timestamps.sh
+++ b/common/hooks/pre-pkg/90-set-timestamps.sh
@@ -5,6 +5,6 @@ hook() {
# If SOURCE_DATE_EPOCH is set, set mtimes to that timestamp.
if [ -n "$SOURCE_DATE_EPOCH" ]; then
msg_normal "$pkgver: setting mtimes to %s\n" "$(date --date "@$SOURCE_DATE_EPOCH")"
- find $PKGDESTDIR -print0 | xargs -0 touch -h --date "@$SOURCE_DATE_EPOCH"
+ find $PKGDESTDIR -newermt "@$SOURCE_DATE_EPOCH" -print0 | xargs -0 touch -h --date "@$SOURCE_DATE_EPOCH"
fi
}
```
I am thinking on a package like `pari-elldata` which ships only data files from its source. The alternative I found is to set `XBPS_USE_BUILD_MTIME=no` in the template, but (a) that is only good for this pkg because I know all the files in the package have a deterministic timestamp and (b) xlint complains when using this variable.
Rationale: the timestamp of the original files in the source is more canonical than the commit date.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-08-23 23:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-22 20:57 [ISSUE] [RFC] set timestamps in a package only for files newer than commit date tornaria
2021-08-23 18:32 ` Chocimier
2021-08-23 22:39 ` tornaria
2021-08-23 22:41 ` ericonr
2021-08-23 23:05 ` tornaria
2021-08-23 23:05 ` [ISSUE] [CLOSED] " tornaria
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).