Re: [OE-core] [PATCH v3 02/11] image-prelink.bbclass: support binary reproducibility

2017-08-17 Thread Leonardo Sandoval
On Wed, 2017-08-09 at 10:48 -0700, Juro Bystricky wrote:
> Conditionally support binary reproducibility in built images.
> If BUILD_REPRODUCIBLE_BINARIES = 1 then:
> 
> 1. Do not randomize library addresses
> 2. Set/export PRELINK_TIMESTAMP to a reproducible value.
>If REPRODUCIBLE_TIMESTAMP_ROOTFS is specified, then the value will
>be used. Otherwise the timestamp will be derived from the top git commit.
> 
> Signed-off-by: Juro Bystricky 
> ---
>  meta/classes/image-prelink.bbclass | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/image-prelink.bbclass 
> b/meta/classes/image-prelink.bbclass
> index 4157df0..e833d47 100644
> --- a/meta/classes/image-prelink.bbclass
> +++ b/meta/classes/image-prelink.bbclass
> @@ -36,7 +36,17 @@ prelink_image () {
>   dynamic_loader=$(linuxloader)
>  
>   # prelink!
> - ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -amR -N -c 
> ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
> + if [ "$BUILD_REPRODUCIBLE_BINARIES" = "1" ]; then
> + bbnote " prelink: BUILD_REPRODUCIBLE_BINARIES..."
> + if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
> + export PRELINK_TIMESTAMP=`git log -1 --pretty=%ct `


as Chris suggested in other email, better to used $() instead of ``



> + else
> + export PRELINK_TIMESTAMP=$REPRODUCIBLE_TIMESTAMP_ROOTFS
> + fi
> + ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -am -N 
> -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
> + else
> + ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -amR 
> -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
> + fi
>  
>   # Remove the prelink.conf if we had to add it.
>   if [ "$dummy_prelink_conf" = "true" ]; then
> -- 
> 2.7.4
> 


-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3 02/11] image-prelink.bbclass: support binary reproducibility

2017-08-09 Thread Juro Bystricky
Conditionally support binary reproducibility in built images.
If BUILD_REPRODUCIBLE_BINARIES = 1 then:

1. Do not randomize library addresses
2. Set/export PRELINK_TIMESTAMP to a reproducible value.
   If REPRODUCIBLE_TIMESTAMP_ROOTFS is specified, then the value will
   be used. Otherwise the timestamp will be derived from the top git commit.

Signed-off-by: Juro Bystricky 
---
 meta/classes/image-prelink.bbclass | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/meta/classes/image-prelink.bbclass 
b/meta/classes/image-prelink.bbclass
index 4157df0..e833d47 100644
--- a/meta/classes/image-prelink.bbclass
+++ b/meta/classes/image-prelink.bbclass
@@ -36,7 +36,17 @@ prelink_image () {
dynamic_loader=$(linuxloader)
 
# prelink!
-   ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -amR -N -c 
${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
+   if [ "$BUILD_REPRODUCIBLE_BINARIES" = "1" ]; then
+   bbnote " prelink: BUILD_REPRODUCIBLE_BINARIES..."
+   if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
+   export PRELINK_TIMESTAMP=`git log -1 --pretty=%ct `
+   else
+   export PRELINK_TIMESTAMP=$REPRODUCIBLE_TIMESTAMP_ROOTFS
+   fi
+   ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -am -N 
-c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
+   else
+   ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -amR 
-N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
+   fi
 
# Remove the prelink.conf if we had to add it.
if [ "$dummy_prelink_conf" = "true" ]; then
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core