Use reproducible timestamp during build

During build svg images of the calendar widget are generated, which
differ based on the current date.
By honouring the environment variable SOURCE_DATE_EPOCH, which is
set by distributions during build, a deterministic date can be used
at build time while keeping the normal behaviour during runtime.

See also: https://reproducible-builds.org/specs/source-date-epoch/
This commit is contained in:
Reiner Herrmann 2017-09-29 20:00:21 +02:00
parent cce65aa6d3
commit 9d7eaf020d
9 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,11 @@
local source_date_epoch = os.getenv("SOURCE_DATE_EPOCH")
if source_date_epoch then
local old_osdate = os.date
os.date = function(format, timestamp) -- luacheck: ignore
if timestamp then
return old_osdate(format, timestamp)
end
format = "!" .. format
return old_osdate(format, source_date_epoch)
end
end

View File

@ -3,6 +3,7 @@ local wibox = require("wibox") --DOC_HIDE
local gears = require("gears") --DOC_HIDE
local beautiful = require( "beautiful" ) --DOC_HIDE
local Pango = require("lgi").Pango --DOC_HIDE
require("_date") --DOC_HIDE
-- Beautiful fake get_font --DOC_HIDE
local f = Pango.FontDescription.from_string("monospace 10") --DOC_HIDE

View File

@ -2,6 +2,7 @@ local parent = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local beautiful = require( "beautiful" ) --DOC_HIDE
local Pango = require("lgi").Pango --DOC_HIDE
require("_date") --DOC_HIDE
-- Beautiful fake get_font --DOC_HIDE
local f = Pango.FontDescription.from_string("sans 12") --DOC_HIDE

View File

@ -2,6 +2,7 @@ local parent = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local beautiful = require( "beautiful" ) --DOC_HIDE
local Pango = require("lgi").Pango --DOC_HIDE
require("_date") --DOC_HIDE
-- Beautiful fake get_font --DOC_HIDE
local f = Pango.FontDescription.from_string("monospace 10") --DOC_HIDE

View File

@ -2,6 +2,7 @@ local parent = ... --DOC_HIDE_ALL
local wibox = require("wibox") --DOC_HIDE
local beautiful = require( "beautiful" ) --DOC_HIDE
local Pango = require("lgi").Pango --DOC_HIDE
require("_date") --DOC_HIDE
-- Beautiful fake get_font --DOC_HIDE
local f = Pango.FontDescription.from_string("monospace 10") --DOC_HIDE

View File

@ -2,6 +2,7 @@ local parent = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local beautiful = require( "beautiful" ) --DOC_HIDE
local Pango = require("lgi").Pango --DOC_HIDE
require("_date") --DOC_HIDE
-- Beautiful fake get_font --DOC_HIDE
local f = Pango.FontDescription.from_string("monospace 10") --DOC_HIDE

View File

@ -2,6 +2,7 @@ local parent = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local beautiful = require( "beautiful" ) --DOC_HIDE
local Pango = require("lgi").Pango --DOC_HIDE
require("_date") --DOC_HIDE
-- Beautiful fake get_font --DOC_HIDE
local f = Pango.FontDescription.from_string("monospace 10") --DOC_HIDE

View File

@ -2,6 +2,7 @@ local parent = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local beautiful = require( "beautiful" ) --DOC_HIDE
local Pango = require("lgi").Pango --DOC_HIDE
require("_date") --DOC_HIDE
-- Beautiful fake get_font --DOC_HIDE
local f = Pango.FontDescription.from_string("monospace 10") --DOC_HIDE

View File

@ -2,6 +2,7 @@ local parent = ... --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
local beautiful = require( "beautiful" ) --DOC_HIDE
local Pango = require("lgi").Pango --DOC_HIDE
require("_date") --DOC_HIDE
-- Beautiful fake get_font --DOC_HIDE
local f = Pango.FontDescription.from_string("monospace 10") --DOC_HIDE