public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2] debianize: Add placeholder for original version to CHANGELOG_V
@ 2020-04-23 15:25 Jan Kiszka
  2020-04-23 15:39 ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2020-04-23 15:25 UTC (permalink / raw)
  To: isar-users, Henning Schild

From: Jan Kiszka <jan.kiszka@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.kiszka@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 <unknown@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


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-23 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23 15:25 [PATCH v2] debianize: Add placeholder for original version to CHANGELOG_V Jan Kiszka
2020-04-23 15:39 ` Jan Kiszka

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