* [PATCH v2 0/3] Fix reproducability issues in deb_add_changelog
@ 2023-01-09 10:16 Felix Moessbauer
2023-01-09 10:16 ` [PATCH v2 1/3] make deb_add_changelog idempotent Felix Moessbauer
2023-01-09 10:16 ` [PATCH v2 2/3] deb_add_changelog: set timestamp to valid epoch Felix Moessbauer
0 siblings, 2 replies; 3+ messages in thread
From: Felix Moessbauer @ 2023-01-09 10:16 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, henning.schild, venkata.pyla, Felix Moessbauer
This series fixes both reproducability and rebuild issues when using
the deb_add_changelog function.
p1, p2: fix the reproducability issue
p3: add support for SOURCE_DATE_EPOCH
Changes since v1:
- Fixed incorrect additional 'fi' (cherry-pick issue), thanks Jan
Best regards,
Felix
Felix Moessbauer (3):
make deb_add_changelog idempotent
deb_add_changelog: set timestamp to valid epoch
deb_add_changelog: use SOURCE_DATE_EPOCH
meta/classes/debianize.bbclass | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/3] make deb_add_changelog idempotent
2023-01-09 10:16 [PATCH v2 0/3] Fix reproducability issues in deb_add_changelog Felix Moessbauer
@ 2023-01-09 10:16 ` Felix Moessbauer
2023-01-09 10:16 ` [PATCH v2 2/3] deb_add_changelog: set timestamp to valid epoch Felix Moessbauer
1 sibling, 0 replies; 3+ messages in thread
From: Felix Moessbauer @ 2023-01-09 10:16 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, henning.schild, venkata.pyla, Felix Moessbauer
Previously, the deb_add_changelog function considered an auto-generated
changelog as a base to add changes on top. This behavior is not
idempontent on subsequent invocations of the function (e.g. on partial
rebuilds). This lead to both reproducability issues, as well as unclean
changelog files having multiple "generated by ISAR" entries.
This patch changes this implementation in a way to always create a
(possibly empty) orig changelog on the first invocation. On subequent
invocations, the orig changelog is only considered as provided by the
user, if it is not empty.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes/debianize.bbclass | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index d125256..ca7b520 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -19,11 +19,14 @@ deb_add_changelog() {
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)
+ # we have a non auto-generated original 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)
+ fi
fi
date=$(LANG=C date -R -d @${timestamp})
@@ -34,7 +37,10 @@ ${PN} (${changelog_v}) UNRELEASED; urgency=low
-- ${MAINTAINER} ${date}
EOF
- if [ -f ${WORKDIR}/changelog.orig ]; then
+ # ensure that we always start with the orig version of the
+ # changelog on repeated invocations (e.g. on partial rebuilds)
+ touch ${WORKDIR}/changelog.orig
+ if [ -s ${WORKDIR}/changelog.orig ]; then
# prepend our entry to the original changelog
echo >> ${S}/debian/changelog
cat ${WORKDIR}/changelog.orig >> ${S}/debian/changelog
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 2/3] deb_add_changelog: set timestamp to valid epoch
2023-01-09 10:16 [PATCH v2 0/3] Fix reproducability issues in deb_add_changelog Felix Moessbauer
2023-01-09 10:16 ` [PATCH v2 1/3] make deb_add_changelog idempotent Felix Moessbauer
@ 2023-01-09 10:16 ` Felix Moessbauer
1 sibling, 0 replies; 3+ messages in thread
From: Felix Moessbauer @ 2023-01-09 10:16 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, henning.schild, venkata.pyla, Felix Moessbauer
A changelog date of 0 (unix timestamp) is not considered a valid
timestamp for the SOURCE_DATE_EPOCH. By that, the debhelper scripts
set the SOURCE_DATE_EPOCH variable to the current time of the build,
breaking reproducability. By that, we get an inconsistency between the
debian changelog timestamp and the timestamp that the build tools encode
into the binary and the file timestamps.
Without having support to control the SOURCE_DATE_EPOCH variable
externally via bitbake, this always led to non-reproducible packages.
To fix this, we simply set the default timestamp to 1h later.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes/debianize.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index ca7b520..a6694a0 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=0
+ timestamp=3600
if [ -f ${S}/debian/changelog ]; then
if [ ! -f ${WORKDIR}/changelog.orig ]; then
cp ${S}/debian/changelog ${WORKDIR}/changelog.orig
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-09 10:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 10:16 [PATCH v2 0/3] Fix reproducability issues in deb_add_changelog Felix Moessbauer
2023-01-09 10:16 ` [PATCH v2 1/3] make deb_add_changelog idempotent Felix Moessbauer
2023-01-09 10:16 ` [PATCH v2 2/3] deb_add_changelog: set timestamp to valid 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