[Buildroot] [PATCH-NEXT v3 3/6] support/download/post-process-helpers: add helper function for post process scripts
Christian Stewart
christian at paral.in
Sun Oct 10 23:46:52 UTC 2021
From: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
download post process scripts will often need to unpack the source
code tarball, do some operation, and then repack it. In order to help
with this, post-process-helpers provide an unpack() function and a
repack() function.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Signed-off-by: Christian Stewart <christian at paral.in>
---
support/download/post-process-helpers | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100755 support/download/post-process-helpers
diff --git a/support/download/post-process-helpers b/support/download/post-process-helpers
new file mode 100755
index 0000000000..b3231207a6
--- /dev/null
+++ b/support/download/post-process-helpers
@@ -0,0 +1,26 @@
+# Helpers for the post-process step to re-pack vendored archives.
+
+. "${0%/*}/helpers"
+
+unpack() {
+ dest="$1"
+ tarball="$2"
+
+ mkdir ${dest}
+ tar -C ${dest} --strip-components=1 -xf ${tarball}
+}
+
+repack() {
+ local in_dir="${1}"
+ local base_dir="${2}"
+ local out="${3}"
+
+ # let's use a fixed hardcoded date to be reproducible
+ date="2020-02-06 01:02:03 +0000"
+
+ # use the helper to create a reproducible archive
+ mk_tar_gz "${in_dir}/${base_dir}" "${base_dir}" "${date}" "${out}"
+}
+
+# Keep this line and the following as last lines in this file.
+# vim: ft=bash
--
2.33.0
More information about the buildroot
mailing list