Honour the SOURCE_DATE_EPOCH environment variable
When the environment variable SOURCE_DATE_EPOCH is set, use it as the epoch of the date to be written in the output. This allows to build reproducibly packages depending on LDoc to build their documentation, without any change to their code and build process. See https://reproducible-builds.org/specs/source-date-epoch/
This commit is contained in:
parent
aa4cd9daf8
commit
707484790e
8
ldoc.lua
8
ldoc.lua
|
@ -803,10 +803,14 @@ ldoc.title = ldoc.title or args.title
|
||||||
ldoc.project = ldoc.project or args.project
|
ldoc.project = ldoc.project or args.project
|
||||||
ldoc.package = args.package:match '%a+' and args.package or nil
|
ldoc.package = args.package:match '%a+' and args.package or nil
|
||||||
|
|
||||||
if args.date == 'system' then
|
if os.getenv("SOURCE_DATE_EPOCH") == nil then
|
||||||
|
if args.date == 'system' then
|
||||||
ldoc.updatetime = os.date("%Y-%m-%d %H:%M:%S")
|
ldoc.updatetime = os.date("%Y-%m-%d %H:%M:%S")
|
||||||
else
|
else
|
||||||
ldoc.updatetime = args.date
|
ldoc.updatetime = args.date
|
||||||
|
end
|
||||||
|
else
|
||||||
|
ldoc.updatetime = os.date("!%Y-%m-%d %H:%M:%S",os.getenv("SOURCE_DATE_EPOCH"))
|
||||||
end
|
end
|
||||||
|
|
||||||
local html = require 'ldoc.html'
|
local html = require 'ldoc.html'
|
||||||
|
|
Loading…
Reference in New Issue