public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2 3/3] deb_add_changelog: use SOURCE_DATE_EPOCH
@ 2023-01-09 10:39 Felix Moessbauer
  0 siblings, 0 replies; only message in thread
From: Felix Moessbauer @ 2023-01-09 10:39 UTC (permalink / raw)
  To: isar-users; +Cc: jan.kiszka, henning.schild, venkata.pyla, Felix Moessbauer

In case the SOURCE_DATE_EPOCH bb variable is set, use that value
both for the auto-generated changelog as well as when appending to
an existing changelog.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/debianize.bbclass | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index a6694a0..3d5d934 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -14,7 +14,7 @@ MAINTAINER ??= "Unknown maintainer <unknown@example.com>"
 
 deb_add_changelog() {
 	changelog_v="${CHANGELOG_V}"
-	timestamp=3600
+	timestamp=${@ d.getVar('SOURCE_DATE_EPOCH', True) or '3600' }
 	if [ -f ${S}/debian/changelog ]; then
 		if [ ! -f ${WORKDIR}/changelog.orig ]; then
 			cp ${S}/debian/changelog ${WORKDIR}/changelog.orig
@@ -23,9 +23,11 @@ deb_add_changelog() {
 		if [ -s ${WORKDIR}/changelog.orig ]; then
 			orig_version=$(dpkg-parsechangelog -l ${WORKDIR}/changelog.orig -S Version)
 			changelog_v=$(echo "${changelog_v}" | sed 's/<orig-version>/'${orig_version}'/')
-			orig_date=$(dpkg-parsechangelog -l ${WORKDIR}/changelog.orig -S Date)
-			orig_seconds=$(date --date="${orig_date}" +'%s')
-			timestamp=$(expr ${orig_seconds} + 42)
+			if [ -z "${SOURCE_DATE_EPOCH}" ]; then
+				orig_date=$(dpkg-parsechangelog -l ${WORKDIR}/changelog.orig -S Date)
+				orig_seconds=$(date --date="${orig_date}" +'%s')
+				timestamp=$(expr ${orig_seconds} + 42)
+			fi
 		fi
 	fi
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-09 10:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 10:39 [PATCH v2 3/3] deb_add_changelog: use SOURCE_DATE_EPOCH Felix Moessbauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox