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

Casey Reeves casey at xogium.me
Thu Jan 19 12:10:03 UTC 2023


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 at 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

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 at 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 at 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
+
-- 
2.39.0




More information about the buildroot mailing list