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,7 +388,11 @@ class Dist(Context.Context):
|
|||||||
|
|
||||||
for x in files:
|
for x in files:
|
||||||
archive_name = self.get_base_name() + '/' + x.path_from(self.base_path)
|
archive_name = self.get_base_name() + '/' + x.path_from(self.base_path)
|
||||||
zip.write(x.abspath(), archive_name, zipfile.ZIP_DEFLATED)
|
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()
|
zip.close()
|
||||||
else:
|
else:
|
||||||
self.fatal('Valid algo types are tar.bz2, tar.gz, tar.xz or zip')
|
self.fatal('Valid algo types are tar.bz2, tar.gz, tar.xz or zip')
|
||||||
@ -425,6 +429,8 @@ class Dist(Context.Context):
|
|||||||
tinfo.gid = 0
|
tinfo.gid = 0
|
||||||
tinfo.uname = 'root'
|
tinfo.uname = 'root'
|
||||||
tinfo.gname = '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):
|
if os.path.isfile(p):
|
||||||
with open(p, 'rb') as f:
|
with open(p, 'rb') as f:
|
||||||
|
@ -101,6 +101,8 @@ class package(Context.Context):
|
|||||||
tarinfo.uid = tarinfo.gid = 0
|
tarinfo.uid = tarinfo.gid = 0
|
||||||
tarinfo.uname = tarinfo.gname = 'root'
|
tarinfo.uname = tarinfo.gname = 'root'
|
||||||
tarinfo.size = os.stat(x).st_size
|
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?
|
# TODO - more archive creation options?
|
||||||
if kw.get('bare', True):
|
if kw.get('bare', True):
|
||||||
|
2
wscript
2
wscript
@ -293,6 +293,8 @@ def create_waf(self, *k, **kw):
|
|||||||
tarinfo = tarfile.TarInfo(x)
|
tarinfo = tarfile.TarInfo(x)
|
||||||
tarinfo.uid = tarinfo.gid = 0
|
tarinfo.uid = tarinfo.gid = 0
|
||||||
tarinfo.uname = tarinfo.gname = 'root'
|
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)
|
(code, size, cnt) = sfilter(x)
|
||||||
tarinfo.size = size
|
tarinfo.size = size
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user