mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-22 01:46:15 +01:00
Support SOURCE_DATE_EPOCH in some places
This commit is contained in:
parent
99bdb12a60
commit
ff0a8cec14
@ -388,6 +388,10 @@ class Dist(Context.Context):
|
||||
|
||||
for x in files:
|
||||
archive_name = self.get_base_name() + '/' + x.path_from(self.base_path)
|
||||
if os.environ.get('SOURCE_DATE_EPOCH'):
|
||||
# TODO: parse that timestamp
|
||||
zip.writestr(zipfile.ZipInfo(archive_name), x.read(), zipfile.ZIP_DEFLATED)
|
||||
else:
|
||||
zip.write(x.abspath(), archive_name, zipfile.ZIP_DEFLATED)
|
||||
zip.close()
|
||||
else:
|
||||
@ -425,6 +429,8 @@ class Dist(Context.Context):
|
||||
tinfo.gid = 0
|
||||
tinfo.uname = 'root'
|
||||
tinfo.gname = 'root'
|
||||
if os.environ.get('SOURCE_DATE_EPOCH'):
|
||||
tinfo.mtime = int(os.environ.get('SOURCE_DATE_EPOCH'))
|
||||
|
||||
if os.path.isfile(p):
|
||||
with open(p, 'rb') as f:
|
||||
|
@ -101,6 +101,8 @@ class package(Context.Context):
|
||||
tarinfo.uid = tarinfo.gid = 0
|
||||
tarinfo.uname = tarinfo.gname = 'root'
|
||||
tarinfo.size = os.stat(x).st_size
|
||||
if os.environ.get('SOURCE_DATE_EPOCH'):
|
||||
tarinfo.mtime = int(os.environ.get('SOURCE_DATE_EPOCH'))
|
||||
|
||||
# TODO - more archive creation options?
|
||||
if kw.get('bare', True):
|
||||
|
2
wscript
2
wscript
@ -293,6 +293,8 @@ def create_waf(self, *k, **kw):
|
||||
tarinfo = tarfile.TarInfo(x)
|
||||
tarinfo.uid = tarinfo.gid = 0
|
||||
tarinfo.uname = tarinfo.gname = 'root'
|
||||
if os.environ.get('SOURCE_DATE_EPOCH'):
|
||||
tarinfo.mtime = int(os.environ.get('SOURCE_DATE_EPOCH'))
|
||||
(code, size, cnt) = sfilter(x)
|
||||
tarinfo.size = size
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user