[PATCH] debianize: Add placeholder for original version to CHANGELOG_V

5 views
Skip to first unread message

Jan Kiszka

unread,
Apr 23, 2020, 9:54:49 AM4/23/20
to isar-users, Henning Schild
From: Jan Kiszka <jan.k...@siemens.com>

This allows to append to the latest upstream version when using an
unpinned source version. The format of the placeholder is
"<orig-version>".

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
meta/classes/debianize.bbclass | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index da43a4e2..d317caf6 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -11,6 +11,9 @@ DESCRIPTION ?= "must not be empty"
MAINTAINER ?= "Unknown maintainer <unk...@example.com>"

deb_add_changelog() {
+ orig_version=$(dpkg-parsechangelog -l ${S}/debian/changelog | grep "Version:" | cut -d' ' -f2)
+ changelog_v=$(echo "${CHANGELOG_V}" | sed 's/<orig-version>/'${orig_version}'/')
+
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})
@@ -18,7 +21,7 @@ deb_add_changelog() {
date=$(LANG=C date -R)
fi
cat <<EOF > ${S}/debian/changelog
-${PN} (${CHANGELOG_V}) UNRELEASED; urgency=low
+${PN} (${changelog_v}) UNRELEASED; urgency=low

* generated by Isar

@@ -26,7 +29,7 @@ ${PN} (${CHANGELOG_V}) UNRELEASED; urgency=low
EOF
if [ -f ${WORKDIR}/changelog ]; then
if head -1 "${WORKDIR}"/changelog | \
- grep -q -e "^${PN} (${CHANGELOG_V})"
+ grep -q -e "^${PN} (${changelog_v})"
then
# entry for our version already there, use unmodified
rm ${S}/debian/changelog
--
2.16.4

Henning Schild

unread,
Apr 23, 2020, 10:40:41 AM4/23/20
to Jan Kiszka, isar-users
On Thu, 23 Apr 2020 15:54:47 +0200
Jan Kiszka <jan.k...@siemens.com> wrote:

> From: Jan Kiszka <jan.k...@siemens.com>
>
> This allows to append to the latest upstream version when using an
> unpinned source version. The format of the placeholder is
> "<orig-version>".
>
> Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
> ---
> meta/classes/debianize.bbclass | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/debianize.bbclass
> b/meta/classes/debianize.bbclass index da43a4e2..d317caf6 100644
> --- a/meta/classes/debianize.bbclass
> +++ b/meta/classes/debianize.bbclass
> @@ -11,6 +11,9 @@ DESCRIPTION ?= "must not be empty"
> MAINTAINER ?= "Unknown maintainer <unk...@example.com>"
>
> deb_add_changelog() {
> + orig_version=$(dpkg-parsechangelog -l ${S}/debian/changelog
> | grep "Version:" | cut -d' ' -f2)

-S Version, no grep no cut

> + changelog_v=$(echo "${CHANGELOG_V}" | sed
> 's/<orig-version>/'${orig_version}'/') +
> 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})
> @@ -18,7 +21,7 @@ deb_add_changelog() {
> date=$(LANG=C date -R)
> fi
> cat <<EOF > ${S}/debian/changelog
> -${PN} (${CHANGELOG_V}) UNRELEASED; urgency=low
> +${PN} (${changelog_v}) UNRELEASED; urgency=low
>
> * generated by Isar
>
> @@ -26,7 +29,7 @@ ${PN} (${CHANGELOG_V}) UNRELEASED; urgency=low
> EOF
> if [ -f ${WORKDIR}/changelog ]; then
> if head -1 "${WORKDIR}"/changelog | \
> - grep -q -e "^${PN} (${CHANGELOG_V})"
> + grep -q -e "^${PN} (${changelog_v})"
> then
> # entry for our version already there, use
> unmodified rm ${S}/debian/changelog

I am afraid that calling this many times will create many entries with
ever longer unique versions.

Henning

Jan Kiszka

unread,
Apr 23, 2020, 11:08:09 AM4/23/20
to Henning Schild, isar-users
On 23.04.20 16:40, Henning Schild wrote:
> On Thu, 23 Apr 2020 15:54:47 +0200
> Jan Kiszka <jan.k...@siemens.com> wrote:
>
>> From: Jan Kiszka <jan.k...@siemens.com>
>>
>> This allows to append to the latest upstream version when using an
>> unpinned source version. The format of the placeholder is
>> "<orig-version>".
>>
>> Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
>> ---
>> meta/classes/debianize.bbclass | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/meta/classes/debianize.bbclass
>> b/meta/classes/debianize.bbclass index da43a4e2..d317caf6 100644
>> --- a/meta/classes/debianize.bbclass
>> +++ b/meta/classes/debianize.bbclass
>> @@ -11,6 +11,9 @@ DESCRIPTION ?= "must not be empty"
>> MAINTAINER ?= "Unknown maintainer <unk...@example.com>"
>>
>> deb_add_changelog() {
>> + orig_version=$(dpkg-parsechangelog -l ${S}/debian/changelog
>> | grep "Version:" | cut -d' ' -f2)
>
> -S Version, no grep no cut

Ah! Was looking for that but missed it.

>
>> + changelog_v=$(echo "${CHANGELOG_V}" | sed
>> 's/<orig-version>/'${orig_version}'/') +
>> 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})
>> @@ -18,7 +21,7 @@ deb_add_changelog() {
>> date=$(LANG=C date -R)
>> fi
>> cat <<EOF > ${S}/debian/changelog
>> -${PN} (${CHANGELOG_V}) UNRELEASED; urgency=low
>> +${PN} (${changelog_v}) UNRELEASED; urgency=low
>>
>> * generated by Isar
>>
>> @@ -26,7 +29,7 @@ ${PN} (${CHANGELOG_V}) UNRELEASED; urgency=low
>> EOF
>> if [ -f ${WORKDIR}/changelog ]; then
>> if head -1 "${WORKDIR}"/changelog | \
>> - grep -q -e "^${PN} (${CHANGELOG_V})"
>> + grep -q -e "^${PN} (${changelog_v})"
>> then
>> # entry for our version already there, use
>> unmodified rm ${S}/debian/changelog
>
> I am afraid that calling this many times will create many entries with
> ever longer unique versions.

That is true. We need to preserve the original changelog_v, if any, and
use that as reference for the check.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

Jan Kiszka

unread,
Apr 23, 2020, 11:25:07 AM4/23/20
to isar-users, Henning Schild
From: Jan Kiszka <jan.k...@siemens.com>

This allows to append to the latest upstream version when using an
unpinned source version. The format of the placeholder is
"<orig-version>".

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---

Changes in v2:
- save and use original changelog for version placeholder
- use -S on dpkg-parsechangelog

meta/classes/debianize.bbclass | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index da43a4e2..eb64ebb9 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -11,6 +11,14 @@ DESCRIPTION ?= "must not be empty"
MAINTAINER ?= "Unknown maintainer <unk...@example.com>"

deb_add_changelog() {
+ 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}'/')
+ 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})
@@ -18,7 +26,7 @@ deb_add_changelog() {
date=$(LANG=C date -R)
fi
cat <<EOF > ${S}/debian/changelog
-${PN} (${CHANGELOG_V}) UNRELEASED; urgency=low
+${PN} (${changelog_v}) UNRELEASED; urgency=low

* generated by Isar

@@ -26,7 +34,7 @@ ${PN} (${CHANGELOG_V}) UNRELEASED; urgency=low
EOF
if [ -f ${WORKDIR}/changelog ]; then
if head -1 "${WORKDIR}"/changelog | \
- grep -q -e "^${PN} (${CHANGELOG_V})"
+ grep -q -e "^${PN} (${changelog_v})"
then
# entry for our version already there, use unmodified
rm ${S}/debian/changelog
--
2.16.4

Jan Kiszka

unread,
Apr 23, 2020, 11:39:46 AM4/23/20
to isar-users, Henning Schild
This is broken, v3 will follow - after it passed basic CI.

Jan

Jan Kiszka

unread,
Apr 23, 2020, 12:31:13 PM4/23/20
to isar-users, Henning Schild
From: Jan Kiszka <jan.k...@siemens.com>

This allows to append to the latest upstream version when using an
unpinned source version. The format of the placeholder is
"<orig-version>".

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---

Changes in v3:
- fix regression when placeholder was not used

meta/classes/debianize.bbclass | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index da43a4e2..e77be232 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -11,6 +11,15 @@ DESCRIPTION ?= "must not be empty"
MAINTAINER ?= "Unknown maintainer <unk...@example.com>"

deb_add_changelog() {
+ changelog_v="${CHANGELOG_V}"
+ 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}'/')
+ 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})
@@ -18,7 +27,7 @@ deb_add_changelog() {
date=$(LANG=C date -R)
fi
cat <<EOF > ${S}/debian/changelog
-${PN} (${CHANGELOG_V}) UNRELEASED; urgency=low
+${PN} (${changelog_v}) UNRELEASED; urgency=low

* generated by Isar

@@ -26,7 +35,7 @@ ${PN} (${CHANGELOG_V}) UNRELEASED; urgency=low
EOF
if [ -f ${WORKDIR}/changelog ]; then
if head -1 "${WORKDIR}"/changelog | \
- grep -q -e "^${PN} (${CHANGELOG_V})"
+ grep -q -e "^${PN} (${changelog_v})"
then
# entry for our version already there, use unmodified
rm ${S}/debian/changelog
--
2.16.4

Henning Schild

unread,
Apr 23, 2020, 12:43:34 PM4/23/20
to Jan Kiszka, isar-users
Might want to switch to dpkg-parsechangelog while at it.

Henning

Henning Schild

unread,
Apr 23, 2020, 12:47:10 PM4/23/20
to Jan Kiszka, isar-users
This looks nice and clean, consider putting this into the hello rebuild
example.

Henning

On Thu, 23 Apr 2020 18:31:10 +0200
Jan Kiszka <jan.k...@siemens.com> wrote:

Jan Kiszka

unread,
Apr 23, 2020, 12:50:56 PM4/23/20
to Henning Schild, isar-users
Should that still match both PN and the version? Would actually become
more complex, though conceptually cleaner.

Henning Schild

unread,
Apr 23, 2020, 1:32:43 PM4/23/20
to Jan Kiszka, isar-users
On Thu, 23 Apr 2020 18:50:54 +0200
Good catch, i think the PN was just in there because i decided to
"parse" myself. Prepending a changelog entry with another PN would be
pretty broken.

What i cared about here was "only" the case where someone already
created an entry with that PV, maybe because they wanted a nicer
"commit message", another author, prio, date ...

If we wanted to double-check, other places would need to do that as
well. I would drop it and wait for the first "fool" to change PN during
a rebuild.

Henning

> Jan
>

Jan Kiszka

unread,
Apr 24, 2020, 3:59:56 AM4/24/20
to Henning Schild, isar-users
OK. I will write a cleanup patch for that aspect on top of this one.

Baurzhan Ismagulov

unread,
May 7, 2020, 3:45:14 PM5/7/20
to isar-users
On Thu, Apr 23, 2020 at 06:31:10PM +0200, Jan Kiszka wrote:
> This allows to append to the latest upstream version when using an
> unpinned source version. The format of the placeholder is
> "<orig-version>".

Applied to next, thanks.

With kind regards,
Baurzhan.

Henning Schild

unread,
May 7, 2020, 4:02:27 PM5/7/20
to Baurzhan Ismagulov, isar-users
Am Thu, 7 May 2020 21:45:02 +0200
schrieb Baurzhan Ismagulov <i...@radix50.net>:

> On Thu, Apr 23, 2020 at 06:31:10PM +0200, Jan Kiszka wrote:
> > This allows to append to the latest upstream version when using an
> > unpinned source version. The format of the placeholder is
> > "<orig-version>".
>
> Applied to next, thanks.

The discussion was not finished, IMHO.

Jan went for another patch on top "meta-isar: hello: Use <orig-version>
in CHANGELOG_V" which raised more questions on this series.

The patch on top should have been included in a v4, which would now be
stuck.

Not sure how to deal with the premature merge now.

Henning

> With kind regards,
> Baurzhan.
>

Baurzhan Ismagulov

unread,
May 7, 2020, 4:28:37 PM5/7/20
to isar-users
On Thu, May 07, 2020 at 10:02:15PM +0200, Henning Schild wrote:
> The discussion was not finished, IMHO.
>
> Jan went for another patch on top "meta-isar: hello: Use <orig-version>
> in CHANGELOG_V" which raised more questions on this series.
>
> The patch on top should have been included in a v4, which would now be
> stuck.

Oops, I haven't seen the intention to do that, have I overlooked anything? I've
stated the reason in the next mail -- sorry for one-side decision. If there is
consensus on a working approach, I'd of course welcome that.


> Not sure how to deal with the premature merge now.

The final solution can be applied on top, or I can revert the patches if that
would help.


With kind regards,
Baurzhan.

Henning Schild

unread,
May 8, 2020, 1:45:18 AM5/8/20
to Baurzhan Ismagulov, isar-users
Am Thu, 7 May 2020 22:28:28 +0200
schrieb Baurzhan Ismagulov <i...@radix50.net>:

> On Thu, May 07, 2020 at 10:02:15PM +0200, Henning Schild wrote:
> > The discussion was not finished, IMHO.
> >
> > Jan went for another patch on top "meta-isar: hello: Use
> > <orig-version> in CHANGELOG_V" which raised more questions on this
> > series.
> >
> > The patch on top should have been included in a v4, which would now
> > be stuck.
>
> Oops, I haven't seen the intention to do that, have I overlooked
> anything? I've stated the reason in the next mail -- sorry for
> one-side decision. If there is consensus on a working approach, I'd
> of course welcome that.

It was hard to see. The follow up kind of questions this series and the
discussion is still ongoing.

> > Not sure how to deal with the premature merge now.
>
> The final solution can be applied on top, or I can revert the patches
> if that would help.

The feature will potentially vanish or work differently. That should be
clear for users. Since isar master is slow many users are on next. Next
does not seem to ever rebase.
So i say we need to finish the discussion eventually. Until then
potentially revert the commits to prevent users jumping on a feature
that will be harder to repair once its out there.

Let us see what Jan has to say. Maybe the discussion only seems open
because the points i raised are not valid in his opinion.

Jan Kiszka

unread,
May 8, 2020, 2:02:08 AM5/8/20
to [ext] Henning Schild, Baurzhan Ismagulov, isar-users
On 07.05.20 22:02, [ext] Henning Schild wrote:
> Am Thu, 7 May 2020 21:45:02 +0200
> schrieb Baurzhan Ismagulov <i...@radix50.net>:
>
>> On Thu, Apr 23, 2020 at 06:31:10PM +0200, Jan Kiszka wrote:
>>> This allows to append to the latest upstream version when using an
>>> unpinned source version. The format of the placeholder is
>>> "<orig-version>".
>>
>> Applied to next, thanks.
>
> The discussion was not finished, IMHO.
>

Regarding this patch, we are through IMHO. It makes sense to track at
least stable updates of debian packages, and it will be used for that in
production.

> Jan went for another patch on top "meta-isar: hello: Use <orig-version>
> in CHANGELOG_V" which raised more questions on this series.
>
> The patch on top should have been included in a v4, which would now be
> stuck.

Nope, nothing like that planned.

>
> Not sure how to deal with the premature merge now.
>

Keep it.

Baurzhan Ismagulov

unread,
May 8, 2020, 2:02:56 AM5/8/20
to isar-users
On Fri, May 08, 2020 at 07:45:05AM +0200, Henning Schild wrote:
> > Oops, I haven't seen the intention to do that, have I overlooked
> > anything? I've stated the reason in the next mail -- sorry for
> > one-side decision. If there is consensus on a working approach, I'd
> > of course welcome that.
>
> It was hard to see. The follow up kind of questions this series and the
> discussion is still ongoing.
>
> > > Not sure how to deal with the premature merge now.
> >
> > The final solution can be applied on top, or I can revert the patches
> > if that would help.
>
> The feature will potentially vanish or work differently. That should be
> clear for users. Since isar master is slow many users are on next. Next
> does not seem to ever rebase.
> So i say we need to finish the discussion eventually. Until then
> potentially revert the commits to prevent users jumping on a feature
> that will be harder to repair once its out there.
>
> Let us see what Jan has to say. Maybe the discussion only seems open
> because the points i raised are not valid in his opinion.

I see, thanks for the explanations. IMHO, your points are perfectly valid and
addressing them would be a good structural improvement. OTOH, Jan's use case
doesn't go away, and his change works as is. But I agree we should finish the
discussion.


With kind regards,
Baurzhan.

Baurzhan Ismagulov

unread,
May 8, 2020, 2:06:16 AM5/8/20
to isar-users
On Fri, May 08, 2020 at 08:02:05AM +0200, Jan Kiszka wrote:
> Keep it.

Makes sense for me.

With kind regards,
Baurzhan.
Reply all
Reply to author
Forward
0 new messages