Message ID | 20250404153448.2765425-1-sofiane.hamam@smile.fr |
---|---|
State | New |
Headers | show |
Series | [meta-oe] openocd : Fix non reproducible build | expand |
Hello Sofiane :) Le ven. 4 avr. 2025 à 17:34, Sofiane HAMAM <sofiane.hamam@smile.fr> a écrit : > This package defines PKGBLDDATE as build timestamp which makes > it non reproducible. Use SOURCE_DATE_EPOCH if it is found, otherwise > use build timestamp. Following best practices, see : > https://reproducible-builds.org/docs/source-date-epoch/ > > Co-developed-by: Yoann Congal <yoann.congal@smile.fr> > Signed-off-by: Yoann Congal <yoann.congal@smile.fr> > Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr> > --- > ...SOURCE_DATE_EPOCH-environment-variab.patch | 38 +++++++++++++++++++ > .../recipes-devtools/openocd/openocd_git.bb | 1 + > 2 files changed, 39 insertions(+) > create mode 100644 > meta-oe/recipes-devtools/openocd/openocd/0001-Makefile.am-Use-SOURCE_DATE_EPOCH-environment-variab.patch > > diff --git > a/meta-oe/recipes-devtools/openocd/openocd/0001-Makefile.am-Use-SOURCE_DATE_EPOCH-environment-variab.patch > b/meta-oe/recipes-devtools/openocd/openocd/0001-Makefile.am-Use-SOURCE_DATE_EPOCH-environment-variab.patch > new file mode 100644 > index 000000000..0f90cac91 > --- /dev/null > +++ > b/meta-oe/recipes-devtools/openocd/openocd/0001-Makefile.am-Use-SOURCE_DATE_EPOCH-environment-variab.patch > @@ -0,0 +1,38 @@ > +From 65969a2b73ce93db4c80f1706677351b0e57fa72 Mon Sep 17 00:00:00 2001 > +From: Sofiane HAMAM <sofiane.hamam@smile.fr> > +Date: Fri, 28 Mar 2025 12:31:17 +0100 > +Subject: [PATCH] Makefile.am: Use SOURCE_DATE_EPOCH environment variable > + > +This package defines PKGBLDDATE as build timestamp which makes > +it non reproducible. Use SOURCE_DATE_EPOCH if it is found, otherwise > +use build timestamp. Following best practices, see : > +https://reproducible-builds.org/docs/source-date-epoch/ > + > +The patch is BSD compatible too. > + > +Change-Id: I26c1a00f2e8059ae31fe72a794b5962af5a84f44 > +Co-developed-by: default avatarYoann Congal <yoann.congal@smile.fr> > +Signed-off-by: default avatarYoann Congal <yoann.congal@smile.fr> > You forgot to cleanup the "default avatar" in this patch. > +Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr> > + > +Upstream-Status: Submitted [https://review.openocd.org/c/openocd/+/8619] > +--- > + src/Makefile.am | 5 ++++- > + 1 file changed, 4 insertions(+), 1 deletion(-) > + > +diff --git a/src/Makefile.am b/src/Makefile.am > +index 6d79cd631..9ca697407 100644 > +--- a/src/Makefile.am > ++++ b/src/Makefile.am > +@@ -30,7 +30,10 @@ if RELEASE > + else > + %C%_libopenocd_la_CPPFLAGS += -DRELSTR=\"`$(top_srcdir)/guess-rev.sh > $(top_srcdir)`\" > + %C%_libopenocd_la_CPPFLAGS += -DGITVERSION=\"`cd $(top_srcdir) && git > describe`\" > +-%C%_libopenocd_la_CPPFLAGS += -DPKGBLDDATE=\"`date +%F-%R`\" > ++%C%_libopenocd_la_CPPFLAGS += -DPKGBLDDATE=\"`DATE_FMT=+%F-%R; \ > ++ SOURCE_DATE_EPOCH="$${SOURCE_DATE_EPOCH:-$$(date +%s)}"; \ > ++ date -u -d "@$$SOURCE_DATE_EPOCH" "$$DATE_FMT" 2>/dev/null || \ > ++ date -u -r "$$SOURCE_DATE_EPOCH" "$$DATE_FMT" 2>/dev/null || date > -u "$$DATE_FMT"`\" > + endif > + > + # add default CPPFLAGS > diff --git a/meta-oe/recipes-devtools/openocd/openocd_git.bb > b/meta-oe/recipes-devtools/openocd/openocd_git.bb > index 559fe29ff..b1ce2ec16 100644 > --- a/meta-oe/recipes-devtools/openocd/openocd_git.bb > +++ b/meta-oe/recipes-devtools/openocd/openocd_git.bb > @@ -9,6 +9,7 @@ SRC_URI = " \ > git:// > repo.or.cz/r/git2cl.git;protocol=http;destsuffix=tools/git2cl;name=git2cl;branch=master > \ > git:// > github.com/msteveb/jimtcl.git;protocol=https;destsuffix=git/jimtcl;name=jimtcl;branch=master > \ > git:// > repo.or.cz/r/libjaylink.git;protocol=http;destsuffix=git/src/jtag/drivers/libjaylink;name=libjaylink;branch=master > \ > + > file://0001-Makefile.am-Use-SOURCE_DATE_EPOCH-environment-variab.patch \ > " > > SRCREV_FORMAT = "openocd" >
diff --git a/meta-oe/recipes-devtools/openocd/openocd/0001-Makefile.am-Use-SOURCE_DATE_EPOCH-environment-variab.patch b/meta-oe/recipes-devtools/openocd/openocd/0001-Makefile.am-Use-SOURCE_DATE_EPOCH-environment-variab.patch new file mode 100644 index 000000000..0f90cac91 --- /dev/null +++ b/meta-oe/recipes-devtools/openocd/openocd/0001-Makefile.am-Use-SOURCE_DATE_EPOCH-environment-variab.patch @@ -0,0 +1,38 @@ +From 65969a2b73ce93db4c80f1706677351b0e57fa72 Mon Sep 17 00:00:00 2001 +From: Sofiane HAMAM <sofiane.hamam@smile.fr> +Date: Fri, 28 Mar 2025 12:31:17 +0100 +Subject: [PATCH] Makefile.am: Use SOURCE_DATE_EPOCH environment variable + +This package defines PKGBLDDATE as build timestamp which makes +it non reproducible. Use SOURCE_DATE_EPOCH if it is found, otherwise +use build timestamp. Following best practices, see : +https://reproducible-builds.org/docs/source-date-epoch/ + +The patch is BSD compatible too. + +Change-Id: I26c1a00f2e8059ae31fe72a794b5962af5a84f44 +Co-developed-by: default avatarYoann Congal <yoann.congal@smile.fr> +Signed-off-by: default avatarYoann Congal <yoann.congal@smile.fr> +Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr> + +Upstream-Status: Submitted [https://review.openocd.org/c/openocd/+/8619] +--- + src/Makefile.am | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/Makefile.am b/src/Makefile.am +index 6d79cd631..9ca697407 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -30,7 +30,10 @@ if RELEASE + else + %C%_libopenocd_la_CPPFLAGS += -DRELSTR=\"`$(top_srcdir)/guess-rev.sh $(top_srcdir)`\" + %C%_libopenocd_la_CPPFLAGS += -DGITVERSION=\"`cd $(top_srcdir) && git describe`\" +-%C%_libopenocd_la_CPPFLAGS += -DPKGBLDDATE=\"`date +%F-%R`\" ++%C%_libopenocd_la_CPPFLAGS += -DPKGBLDDATE=\"`DATE_FMT=+%F-%R; \ ++ SOURCE_DATE_EPOCH="$${SOURCE_DATE_EPOCH:-$$(date +%s)}"; \ ++ date -u -d "@$$SOURCE_DATE_EPOCH" "$$DATE_FMT" 2>/dev/null || \ ++ date -u -r "$$SOURCE_DATE_EPOCH" "$$DATE_FMT" 2>/dev/null || date -u "$$DATE_FMT"`\" + endif + + # add default CPPFLAGS diff --git a/meta-oe/recipes-devtools/openocd/openocd_git.bb b/meta-oe/recipes-devtools/openocd/openocd_git.bb index 559fe29ff..b1ce2ec16 100644 --- a/meta-oe/recipes-devtools/openocd/openocd_git.bb +++ b/meta-oe/recipes-devtools/openocd/openocd_git.bb @@ -9,6 +9,7 @@ SRC_URI = " \ git://repo.or.cz/r/git2cl.git;protocol=http;destsuffix=tools/git2cl;name=git2cl;branch=master \ git://github.com/msteveb/jimtcl.git;protocol=https;destsuffix=git/jimtcl;name=jimtcl;branch=master \ git://repo.or.cz/r/libjaylink.git;protocol=http;destsuffix=git/src/jtag/drivers/libjaylink;name=libjaylink;branch=master \ + file://0001-Makefile.am-Use-SOURCE_DATE_EPOCH-environment-variab.patch \ " SRCREV_FORMAT = "openocd"