summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-29 20:21:14 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-04 15:03:54 +0100
commit1c37bbab4ffa20e4f88197283f48d9ab4acefad9 (patch)
tree9facccd58d445ee87a08c5c2c781b5d3e5fbad39
parent58298e97176008dd4d88e702340d1c4e522f6fe6 (diff)
downloadpoky-1c37bbab4ffa20e4f88197283f48d9ab4acefad9.tar.gz
image-artifact-names: Use SOURCE_DATE_EPOCH when making reproducible builds for deploy
Using DATETIME means the do_deploy output is not deterministic. Use SDE when using reproducible builds since it is consistent for given input data. (From OE-Core rev: 0e2fbdb32bae67e71e904a036a38395efb6ec6a6) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/image-artifact-names.bbclass9
1 files changed, 8 insertions, 1 deletions
diff --git a/meta/classes/image-artifact-names.bbclass b/meta/classes/image-artifact-names.bbclass
index 3ac8dd731a..67f04e8165 100644
--- a/meta/classes/image-artifact-names.bbclass
+++ b/meta/classes/image-artifact-names.bbclass
@@ -4,7 +4,7 @@
4 4
5IMAGE_BASENAME ?= "${PN}" 5IMAGE_BASENAME ?= "${PN}"
6IMAGE_VERSION_SUFFIX ?= "-${DATETIME}" 6IMAGE_VERSION_SUFFIX ?= "-${DATETIME}"
7IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME" 7IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME SOURCE_DATE_EPOCH"
8IMAGE_NAME ?= "${IMAGE_BASENAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}" 8IMAGE_NAME ?= "${IMAGE_BASENAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
9IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}" 9IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}"
10 10
@@ -13,3 +13,10 @@ IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}"
13# by default) followed by additional suffices which describe the format (.ext4, 13# by default) followed by additional suffices which describe the format (.ext4,
14# .ext4.xz, etc.). 14# .ext4.xz, etc.).
15IMAGE_NAME_SUFFIX ??= ".rootfs" 15IMAGE_NAME_SUFFIX ??= ".rootfs"
16
17python () {
18 if bb.data.inherits_class('reproducible_build', d) and bb.data.inherits_class('deploy', d) and d.getVar("IMAGE_VERSION_SUFFIX") == "-${DATETIME}":
19 import datetime
20 d.setVar("IMAGE_VERSION_SUFFIX", "-" + datetime.datetime.fromtimestamp(int(d.getVar("SOURCE_DATE_EPOCH")), datetime.timezone.utc).strftime('%Y%m%d%H%M%S'))
21 d.setVarFlag("IMAGE_VERSION_SUFFIX", "vardepvalue", "")
22}