public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: Henning Schild <henning.schild@siemens.com>, isar-users@googlegroups.com
Cc: Cedric Hombourger <Cedric_Hombourger@mentor.com>,
	Venkata.Pyla@toshiba-tsip.com
Subject: Re: [PATCH 1/3] debianize: make changelog date reproducible
Date: Tue, 7 Sep 2021 15:55:56 +0300	[thread overview]
Message-ID: <822cf024-6915-c86e-44ab-e79bd375fe35@ilbers.de> (raw)
In-Reply-To: <20210906083403.25163-1-henning.schild@siemens.com>

06.09.2021 11:34, Henning Schild wrote:
> 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 44867780f7b9..e6a300700a5f 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=$(echo "${orig_seconds}+42" | bc)
>   	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
>   

I suggest using expr instead of bc to avoid adding new Isar dependencies.

-- 
Anton Mikanovich
Promwad Ltd.
External service provider of ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn, Germany
+49 (89) 122 67 24-0
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov


      parent reply	other threads:[~2021-09-07 12:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-06  8:34 Henning Schild
2021-09-06  8:34 ` [PATCH 2/3] debianize: prepend changelog entries Henning Schild
2021-09-06  8:34 ` [PATCH 3/3] isar-exclude-docs: include "native" package changelogs Henning Schild
2021-09-21  7:24   ` Henning Schild
2021-09-07 12:55 ` Anton Mikanovich [this message]

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=822cf024-6915-c86e-44ab-e79bd375fe35@ilbers.de \
    --to=amikan@ilbers.de \
    --cc=Cedric_Hombourger@mentor.com \
    --cc=Venkata.Pyla@toshiba-tsip.com \
    --cc=henning.schild@siemens.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