diff mbox series

[1/2] package/lzop: provide a patch to allow overriding of modification time

Message ID 20230119121004.3416962-2-casey@xogium.me
State Changes Requested
Headers show
Series make barebox build reproducible | expand

Commit Message

Casey Reeves Jan. 19, 2023, 12:10 p.m. UTC
This patch allows lzop to override the modification time using
$SOURCE_DATE_EPOCH.
The original patch written by Florian Bäuerle is for lzop 1.04, and
hence needed to be backported to the 1.03 release buildroot is making
use of.

It is necessary to carry this patch in buildroot, as it appears that
lzop software has stagnated since the last release.

https://git.pengutronix.de/cgit/ptxdist/tree/patches/lzop-1.04/0002-allow-overriding-modification-time.patch

Signed-off-by: Casey Reeves <casey@xogium.me>
---
 ...3-allow-overriding-modification-time.patch | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 package/lzop/0003-allow-overriding-modification-time.patch

Comments

Thomas Petazzoni Feb. 5, 2023, 2:17 p.m. UTC | #1
Hello,

On Thu, 19 Jan 2023 13:10:03 +0100
Casey Reeves <casey@xogium.me> wrote:

> This patch allows lzop to override the modification time using
> $SOURCE_DATE_EPOCH.
> The original patch written by Florian Bäuerle is for lzop 1.04, and
> hence needed to be backported to the 1.03 release buildroot is making
> use of.

Any reason why we're not using lzop 1.04 ? Maybe we should bump lzop
1.04 first ?

> --- /dev/null
> +++ b/package/lzop/0003-allow-overriding-modification-time.patch
> @@ -0,0 +1,46 @@
> +From d3717065d4b4dd7dfa88ebc154185ce752127e93 Mon Sep 17 00:00:00 2001
> +From: Casey Reeves <casey@xogium.me>
> +Date: Thu, 19 Jan 2023 10:06:31 +0100
> +Subject: [PATCH] allow overriding modification time

Could you preserve the authorship of the original patch at
https://git.pengutronix.de/cgit/ptxdist/tree/patches/lzop-1.04/0002-allow-overriding-modification-time.patch
?

Your patch is pretty much exactly the same, so we really want to keep
the original authorship. The patch should still carry your
Signed-off-by and a reference to where the original patch was found.

Thanks!

Thomas
diff mbox series

Patch

diff --git a/package/lzop/0003-allow-overriding-modification-time.patch b/package/lzop/0003-allow-overriding-modification-time.patch
new file mode 100644
index 0000000000..17ad42da04
--- /dev/null
+++ b/package/lzop/0003-allow-overriding-modification-time.patch
@@ -0,0 +1,46 @@ 
+From d3717065d4b4dd7dfa88ebc154185ce752127e93 Mon Sep 17 00:00:00 2001
+From: Casey Reeves <casey@xogium.me>
+Date: Thu, 19 Jan 2023 10:06:31 +0100
+Subject: [PATCH] allow overriding modification time
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This patch is based on the work from Florian Bäuerle at Allegion and
+enables lzop to allow overriding modification time.
+
+Signed-off-by: Casey Reeves <casey@xogium.me>
+---
+ src/lzop.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/lzop.c b/src/lzop.c
+index 5571e89..94eec99 100644
+--- a/src/lzop.c
++++ b/src/lzop.c
+@@ -706,6 +706,7 @@ void init_compress_header(header_t *h, const file_t *fip, const file_t *fop)
+     assert(opt_method > 0);
+     assert(opt_level > 0);
+     assert(fip->st.st_mode == 0 || S_ISREG(fip->st.st_mode));
++    const char *source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+ 
+     memset(h,0,sizeof(header_t));
+ 
+@@ -742,7 +743,13 @@ void init_compress_header(header_t *h, const file_t *fip, const file_t *fop)
+ 
+     h->mode = fix_mode_for_header(fip->st.st_mode);
+ 
+-    if (fip->st.st_mtime)
++    if (source_date_epoch)
++    {
++        time_t mtime = strtoul(source_date_epoch, NULL, 0);
++        h->mtime_low  = (lzo_uint32) (mtime);
++        h->mtime_high = (lzo_uint32) ((mtime >> 16) >> 16);
++    }
++    else if (fip->st.st_mtime)
+     {
+         h->mtime_low = (lzo_uint32) (fip->st.st_mtime);
+         h->mtime_high = (lzo_uint32) (fip->st.st_mtime >> 16 >> 16);
+-- 
+2.39.0
+