All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] image: Use ${COREBASE}/meta for timestamp, fallback to bitbake.conf
@ 2018-07-19 17:12 Alex Kiernan
  2018-07-19 17:21 ` Khem Raj
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Kiernan @ 2018-07-19 17:12 UTC (permalink / raw)
  To: openembedded-core

To handle the case where ${COREBASE} isn't the git directory, but
${COREBASE}/meta might be (since that's the layer that sets up the COREBASE
variable), use the timestamp from there. If that fails use the timestamp
from conf/bitbake.conf.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---

 meta/classes/image.bbclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index adc50c9..0afebff 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -651,7 +651,10 @@ POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usr
 reproducible_final_image_task () {
     if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
         if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
-            REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}" log -1 --pretty=%ct`
+            REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}/meta" log -1 --pretty=%ct 2>/dev/null` || true
+            if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" = "" ]; then
+                REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y ${@bb.utils.which(d.getVar("BBPATH"), "conf/bitbake.conf")}`
+            fi
         fi
         # Set mtime of all files to a reproducible value
         bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS"
-- 
2.7.4



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

* Re: [PATCH] image: Use ${COREBASE}/meta for timestamp, fallback to bitbake.conf
  2018-07-19 17:12 [PATCH] image: Use ${COREBASE}/meta for timestamp, fallback to bitbake.conf Alex Kiernan
@ 2018-07-19 17:21 ` Khem Raj
  2018-07-19 17:26   ` Alex Kiernan
  0 siblings, 1 reply; 5+ messages in thread
From: Khem Raj @ 2018-07-19 17:21 UTC (permalink / raw)
  To: Alex Kiernan, openembedded-core



On 7/19/18 10:12 AM, Alex Kiernan wrote:
> To handle the case where ${COREBASE} isn't the git directory, but
> ${COREBASE}/meta might be (since that's the layer that sets up the COREBASE
> variable), use the timestamp from there. If that fails use the timestamp
> from conf/bitbake.conf.

whats the chance that ${COREBASE}/meta might also not be a directory 
under git when compared to ${COREBASE} ?

> 
> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> ---
> 
>   meta/classes/image.bbclass | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index adc50c9..0afebff 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -651,7 +651,10 @@ POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usr
>   reproducible_final_image_task () {
>       if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
>           if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
> -            REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}" log -1 --pretty=%ct`
> +            REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}/meta" log -1 --pretty=%ct 2>/dev/null` || true
> +            if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" = "" ]; then
> +                REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y ${@bb.utils.which(d.getVar("BBPATH"), "conf/bitbake.conf")}`
> +            fi
>           fi
>           # Set mtime of all files to a reproducible value
>           bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS"
> 


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

* Re: [PATCH] image: Use ${COREBASE}/meta for timestamp, fallback to bitbake.conf
  2018-07-19 17:21 ` Khem Raj
@ 2018-07-19 17:26   ` Alex Kiernan
  2018-07-19 18:19     ` Khem Raj
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Kiernan @ 2018-07-19 17:26 UTC (permalink / raw)
  To: raj.khem; +Cc: openembedded-core

On Thu, Jul 19, 2018 at 6:21 PM Khem Raj <raj.khem@gmail.com> wrote:
>
>
>
> On 7/19/18 10:12 AM, Alex Kiernan wrote:
> > To handle the case where ${COREBASE} isn't the git directory, but
> > ${COREBASE}/meta might be (since that's the layer that sets up the COREBASE
> > variable), use the timestamp from there. If that fails use the timestamp
> > from conf/bitbake.conf.
>
> whats the chance that ${COREBASE}/meta might also not be a directory
> under git when compared to ${COREBASE} ?
>

About the same I expect, but if it's not then git will climb up to
${COREBASE} so I think we're better off.

And if it doesn't find one then it falls back to the timestamp on
bitbake.conf - I've just been testing a snapshot of the layers as a
tarball and building successfully inside that when there's no git
directories for it to find at all.

> >
> > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> > ---
> >
> >   meta/classes/image.bbclass | 5 ++++-
> >   1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> > index adc50c9..0afebff 100644
> > --- a/meta/classes/image.bbclass
> > +++ b/meta/classes/image.bbclass
> > @@ -651,7 +651,10 @@ POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usr
> >   reproducible_final_image_task () {
> >       if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
> >           if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
> > -            REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}" log -1 --pretty=%ct`
> > +            REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}/meta" log -1 --pretty=%ct 2>/dev/null` || true
> > +            if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" = "" ]; then
> > +                REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y ${@bb.utils.which(d.getVar("BBPATH"), "conf/bitbake.conf")}`
> > +            fi
> >           fi
> >           # Set mtime of all files to a reproducible value
> >           bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS"
> >



-- 
Alex Kiernan


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

* Re: [PATCH] image: Use ${COREBASE}/meta for timestamp, fallback to bitbake.conf
  2018-07-19 17:26   ` Alex Kiernan
@ 2018-07-19 18:19     ` Khem Raj
  2018-07-20  3:40       ` Alex Kiernan
  0 siblings, 1 reply; 5+ messages in thread
From: Khem Raj @ 2018-07-19 18:19 UTC (permalink / raw)
  To: Alex Kiernan; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 2377 bytes --]

On Thu, Jul 19, 2018 at 10:26 AM Alex Kiernan <alex.kiernan@gmail.com>
wrote:
>
> On Thu, Jul 19, 2018 at 6:21 PM Khem Raj <raj.khem@gmail.com> wrote:
> >
> >
> >
> > On 7/19/18 10:12 AM, Alex Kiernan wrote:
> > > To handle the case where ${COREBASE} isn't the git directory, but
> > > ${COREBASE}/meta might be (since that's the layer that sets up the
COREBASE
> > > variable), use the timestamp from there. If that fails use the
timestamp
> > > from conf/bitbake.conf.
> >
> > whats the chance that ${COREBASE}/meta might also not be a directory
> > under git when compared to ${COREBASE} ?
> >
>
> About the same I expect, but if it's not then git will climb up to
> ${COREBASE} so I think we're better off.
>
> And if it doesn't find one then it falls back to the timestamp on
> bitbake.conf - I've just been testing a snapshot of the layers as a
> tarball and building successfully inside that when there's no git
> directories for it to find at all.
>

OK lets stay with adding bitbake.conf as fallback.

> > >
> > > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> > > ---
> > >
> > >   meta/classes/image.bbclass | 5 ++++-
> > >   1 file changed, 4 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> > > index adc50c9..0afebff 100644
> > > --- a/meta/classes/image.bbclass
> > > +++ b/meta/classes/image.bbclass
> > > @@ -651,7 +651,10 @@ POPULATE_SDK_PRE_TARGET_COMMAND +=
"${@bb.utils.contains('DISTRO_FEATURES', 'usr
> > >   reproducible_final_image_task () {
> > >       if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
> > >           if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
> > > -            REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}" log
-1 --pretty=%ct`
> > > +            REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}/meta"
log -1 --pretty=%ct 2>/dev/null` || true
> > > +            if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" = "" ]; then
> > > +                REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y
${@bb.utils.which(d.getVar("BBPATH"), "conf/bitbake.conf")}`
> > > +            fi
> > >           fi
> > >           # Set mtime of all files to a reproducible value
> > >           bbnote "reproducible_final_image_task: mtime set to
$REPRODUCIBLE_TIMESTAMP_ROOTFS"
> > >
>
>
>
> --
> Alex Kiernan

[-- Attachment #2: Type: text/html, Size: 3401 bytes --]

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

* Re: [PATCH] image: Use ${COREBASE}/meta for timestamp, fallback to bitbake.conf
  2018-07-19 18:19     ` Khem Raj
@ 2018-07-20  3:40       ` Alex Kiernan
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Kiernan @ 2018-07-20  3:40 UTC (permalink / raw)
  To: raj.khem; +Cc: openembedded-core

On Thu, Jul 19, 2018 at 7:20 PM Khem Raj <raj.khem@gmail.com> wrote:
>
>
> On Thu, Jul 19, 2018 at 10:26 AM Alex Kiernan <alex.kiernan@gmail.com> wrote:
> >
> > On Thu, Jul 19, 2018 at 6:21 PM Khem Raj <raj.khem@gmail.com> wrote:
> > >
> > >
> > >
> > > On 7/19/18 10:12 AM, Alex Kiernan wrote:
> > > > To handle the case where ${COREBASE} isn't the git directory, but
> > > > ${COREBASE}/meta might be (since that's the layer that sets up the COREBASE
> > > > variable), use the timestamp from there. If that fails use the timestamp
> > > > from conf/bitbake.conf.
> > >
> > > whats the chance that ${COREBASE}/meta might also not be a directory
> > > under git when compared to ${COREBASE} ?
> > >
> >
> > About the same I expect, but if it's not then git will climb up to
> > ${COREBASE} so I think we're better off.
> >
> > And if it doesn't find one then it falls back to the timestamp on
> > bitbake.conf - I've just been testing a snapshot of the layers as a
> > tarball and building successfully inside that when there's no git
> > directories for it to find at all.
> >
>
> OK lets stay with adding bitbake.conf as fallback.
>

I've just re-read Richard's advice from before:

  I'd suggest the code checks for ${COREBASE}/.git and if that doesn't
  exist, fall back to the timestamp of the
  ${COREBASE}/meta/conf/bitbake.conf file.

Which it'd been my intention to follow; I'll swap it back to
${COREBASE}/.git and post V2.



> > > >
> > > > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> > > > ---
> > > >
> > > >   meta/classes/image.bbclass | 5 ++++-
> > > >   1 file changed, 4 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> > > > index adc50c9..0afebff 100644
> > > > --- a/meta/classes/image.bbclass
> > > > +++ b/meta/classes/image.bbclass
> > > > @@ -651,7 +651,10 @@ POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usr
> > > >   reproducible_final_image_task () {
> > > >       if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
> > > >           if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
> > > > -            REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}" log -1 --pretty=%ct`
> > > > +            REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}/meta" log -1 --pretty=%ct 2>/dev/null` || true
> > > > +            if [ "${REPRODUCIBLE_TIMESTAMP_ROOTFS}" = "" ]; then
> > > > +                REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y ${@bb.utils.which(d.getVar("BBPATH"), "conf/bitbake.conf")}`
> > > > +            fi
> > > >           fi
> > > >           # Set mtime of all files to a reproducible value
> > > >           bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS"
> > > >
> >
> >
> >
> > --
> > Alex Kiernan



--
Alex Kiernan


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

end of thread, other threads:[~2018-07-20  3:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 17:12 [PATCH] image: Use ${COREBASE}/meta for timestamp, fallback to bitbake.conf Alex Kiernan
2018-07-19 17:21 ` Khem Raj
2018-07-19 17:26   ` Alex Kiernan
2018-07-19 18:19     ` Khem Raj
2018-07-20  3:40       ` Alex Kiernan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.