public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: <isar-users@googlegroups.com>
Cc: <Venkata.Pyla@toshiba-tsip.com>,
	Henning Schild <henning.schild@siemens.com>
Subject: [PATCH v2 1/3] debianize: make changelog date reproducible
Date: Tue, 14 Dec 2021 17:03:02 +0100	[thread overview]
Message-ID: <20211214160304.5027-1-henning.schild@siemens.com> (raw)

Deriving the date from the filesystem and git also does not always
produce the same result.

In case there is a changelog file and our version does not yet exist
in it, make the new entry 42s later. If there was no changelog use
"1970-01-01 00:00:00 UTC".

Reported-by: <Venkata.Pyla@toshiba-tsip.com>
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/debianize.bbclass | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index aa13b28d101b..d315b5bf44a9 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -14,20 +14,19 @@ MAINTAINER ??= "Unknown maintainer <unknown@example.com>"
 
 deb_add_changelog() {
 	changelog_v="${CHANGELOG_V}"
+	timestamp=0
 	if [ -f ${S}/debian/changelog ]; then
 		if [ ! -f ${WORKDIR}/changelog.orig ]; then
 			cp ${S}/debian/changelog ${WORKDIR}/changelog.orig
 		fi
 		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)
 	fi
 
-	timestamp=$(find ${S}/ -type f -not -path "${S}/debian/*" -printf "%T@\n"|sort -n -r|head -n 1)
-	if [ -n "${timestamp}" ]; then
-		date=$(LANG=C date -R -d @${timestamp})
-	else
-		date=$(LANG=C date -R)
-	fi
+	date=$(LANG=C date -R -d @${timestamp})
 	cat <<EOF > ${S}/debian/changelog
 ${PN} (${changelog_v}) UNRELEASED; urgency=low
 
-- 
2.32.0


             reply	other threads:[~2021-12-14 16:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14 16:03 Henning Schild [this message]
2021-12-14 16:03 ` [PATCH v2 2/3] debianize: prepend changelog entries Henning Schild
2021-12-14 16:03 ` [PATCH v2 3/3] isar-exclude-docs: include "native" package changelogs Henning Schild
2021-12-14 16:04 ` [PATCH v2 1/3] debianize: make changelog date reproducible Henning Schild
2021-12-21 13:04 ` Anton Mikanovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211214160304.5027-1-henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=Venkata.Pyla@toshiba-tsip.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox