Open piegamesde opened 3 years ago
We are relying on usable fstime to decide which AppImage is newer if we have 2 AppImages for the same applicatino.
Looks like SOURCE_DATE_EPOCH
was invented for reproducible builds, where as a result you cannot tell anymore which one of 2 AppImages is the newer one?
SOURCE_DATE_EPOCH
does not destroy the order relation of the appimages based on their fstime. Instead, it decouples it from the build process: Of two appimages, one is considered newer if its source is newer, regardless of when it was built. Two appimages built from the same source [with the same options] but at different times will be considered equal, which is actually what we want.
Regardless, this is opt-in, since most environments don't set SOURCE_DATE_EPOCH
. In that case, taking the current time is fine.
Looks like the code in question should go here:
If the environment variable SOURCE_DATE_EPOCH
is set, then we would have to set FSTime
to...?
I think the tooling only does all of this because it need to know the timestamp of the AppImage file for publishing or something. In my opinion, the best possible solution would be to let mksquashfs
deal with all of this and then simply read the timestamp from the produced file.
If this is not possible, the alternative is to replace time.Now()
with the value of SOURCE_DATE_EPOCH
if that environment variable is set. In that case, the call to mksquashfs
will not include the -fstime
either, since the tool will get the value from SROUCE_DATE_EPOCH
as well.
The way I would like this to work is that if SOURCE_DATE_EPOCH
is set, then we use its value for FSTime
. This way it is guaranteed that the exact same value ends up in the squashfs file and is used in other places of the tool, such as for publishing.
The only thing I do not know is how to convert the value of SOURCE_DATE_EPOCH
into something that Go can understand in place of time.Now()
.
PRs welcome.
See https://reproducible-builds.org/docs/source-date-epoch/.
The application uses the
-fstime
option onmksquashfs
. Its value is taken fromnow
, which is inherently impure. When I haveSOURCE_DATE_EPOCH
set,mksquashfs
fails withFATAL ERROR:SOURCE_DATE_EPOCH and command line options can't be used at the same time to set timestamp(s)
.