Make gzip-1.2.4 and tar-1.12 not include timestamps
There is no way for gzip 1.2.4 and tar 1.12 to disable the inclusion of timestamps into the tarball/gzip, which creates non-reproducible tarballs and hence packages. While it is theoretically possible to set the timestamps to unix time 0 using touch, in reality this is not possible because mes libc does not support utime() which sets the timestamp of a file from userspace. So we need to ignore it rather than (re)set it.
This commit is contained in:
parent
634ec99771
commit
016b9511d2
|
@ -1 +1 @@
|
||||||
304cead634e6766db915155d422049269f66b2ff34a20a7f20819a0c69193d33 /usr/bin/gzip
|
062e34d3f2d4bcb339ce3be80a1b6bc0ff805d70c8c13d9a6ad6e7a93914a1bf /usr/bin/gzip
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <linux/syscall.h>
|
||||||
|
#include <linux/x86/syscall.h>
|
||||||
|
|
||||||
|
int _stat(const char *path, struct stat *buf) {
|
||||||
|
int rc = stat(path, buf);
|
||||||
|
if (rc == 0) {
|
||||||
|
buf->st_atime = 0;
|
||||||
|
buf->st_mtime = 0;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _lstat(const char *path, struct stat *buf) {
|
||||||
|
int rc = lstat(path, buf);
|
||||||
|
if (rc == 0) {
|
||||||
|
buf->st_atime = 0;
|
||||||
|
buf->st_mtime = 0;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define stat(a,b) _stat(a,b)
|
||||||
|
#define lstat(a,b) _lstat(a,b)
|
|
@ -11,11 +11,18 @@ set -ex
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
|
catm gzip.c.new ../../files/stat_override.c gzip.c
|
||||||
|
cp gzip.c.new gzip.c
|
||||||
|
|
||||||
# Extract
|
# Extract
|
||||||
ungz ../src/${pkg}.tar.gz
|
ungz ../src/${pkg}.tar.gz
|
||||||
untar ../src/${pkg}.tar
|
untar ../src/${pkg}.tar
|
||||||
cd ${pkg}
|
cd ${pkg}
|
||||||
|
|
||||||
|
# Prepare
|
||||||
|
catm gzip.c.new ../../files/stat_override.c gzip.c
|
||||||
|
cp gzip.c.new gzip.c
|
||||||
|
|
||||||
# Compile
|
# Compile
|
||||||
tcc -c -DNO_UTIME gzip.c
|
tcc -c -DNO_UTIME gzip.c
|
||||||
tcc -c bits.c
|
tcc -c bits.c
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
d4ac49a136cb18e47fa4be447657746b3620d6e5bc15daa0b825f44734945a7c /usr/bin/tar
|
3d67caa46470a7c1f3b00b8301977bc1093fab333943aabfd84afaa1bd77a609 /usr/bin/tar
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <linux/syscall.h>
|
||||||
|
#include <linux/x86/syscall.h>
|
||||||
|
|
||||||
|
int _stat(const char *path, struct stat *buf) {
|
||||||
|
int rc = stat(path, buf);
|
||||||
|
if (rc == 0) {
|
||||||
|
buf->st_atime = 0;
|
||||||
|
buf->st_mtime = 0;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _lstat(const char *path, struct stat *buf) {
|
||||||
|
int rc = lstat(path, buf);
|
||||||
|
if (rc == 0) {
|
||||||
|
buf->st_atime = 0;
|
||||||
|
buf->st_mtime = 0;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define stat(a,b) _stat(a,b)
|
||||||
|
#define lstat(a,b) _lstat(a,b)
|
|
@ -18,6 +18,8 @@ untar ../src/${pkg}.tar
|
||||||
cd ${pkg}
|
cd ${pkg}
|
||||||
|
|
||||||
cp ../../files/getdate_stub.c lib/getdate_stub.c
|
cp ../../files/getdate_stub.c lib/getdate_stub.c
|
||||||
|
catm src/create.c.new ../../files/stat_override.c src/create.c
|
||||||
|
cp src/create.c.new src/create.c
|
||||||
|
|
||||||
# Compile
|
# Compile
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue