utils/add-custom-hashes: add script to manage global patch dir hashes
PATCH 1/1 utils/add-custom-hashes: add script to manage global patch dir hashes
Add a script to manage the .hash files in the BR2_GLOBAL_PATCH_DIR for packages using custom versions.
To use it, run in a configured Buildroot directory, E.G.
make foo_defconfig; ./utils/add-custom-hashes
We support multiple patch directories in BR2_GLOBAL_PATCH_DIR. If multiple directories are specified then use the last one as that is likely to be the most specific one.
--- docs/manual/customize-patches.adoc | 2 + utils/add-custom-hashes | 103 +++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100755 utils/add-custom-hashes
docs/manual/customize-patches.adoc +2 -0
@@ -79,3 +79,5 @@ the first file to exist is used to check a package download: * +<global-patch-dir>/<packagename>/<packageversion>/<packagename>.hash+ * +<global-patch-dir>/<packagename>/<packagename>.hash+ + +The +utils/add-custom-hashes+ script can be used to generate these files.
utils/add-custom-hashes new file +103 -0
103 lines not on this page · raw message
Signature · 6 lines
2.39.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 72 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Korsgaard <[email protected]> writes:
Add a script to manage the .hash files in the
BR2_GLOBAL_PATCH_DIRfor packages using custom versions.To use it, run in a configured Buildroot directory, E.G.
make
foo_defconfig; ./utils/add-custom-hashesWe support multiple patch directories in
BR2_GLOBAL_PATCH_DIR. If multiple directories are specified then use the last one as that is likely to be the most specific one.Signed-off-by Peter Korsgaard <[email protected]>--- docs/manual/customize-patches.adoc | 2 + utils/add-custom-hashes | 103 +++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100755 utils/add-custom-hashesdocs/manual/customize-patches.adoc +2
-0@@ -79,3 +79,5 @@ the first file to exist is used to check a package download: * +<global-patch-dir>/<packagename>/<packageversion>/<packagename>.hash+ * +<global-patch-dir>/<packagename>/<packagename>.hash+ + +The +utils/add-custom-hashes+ script can be used to generate these files.utils/add-custom-hashes new file +36
-0@@ -0,0 +1,103 @@ +#!/usr/bin/env bash +set -e + +# Add hash files for packages with custom versions for +# BR2_DOWNLOAD_FORCE_CHECK_HASHES=y +# +# Run in a configured Buildroot directory, E.G. +# make foo_defconfig; ./utils/add-custom-hashes + +# print BR-style message +# message <info message> +message() { + tput smso 2>/dev/null + echo "$*" + tput rmso 2>/dev/null +} + +# print error message and exit +# die <error message> +die() { + echo "Error: $*" >&2 + exit 1 +} + +# get package(s) for download file, if any +# get_pkgs <json> <file> +get_pkgs() { + jq --arg file "$2" -r \ + 'to_entries[] | select(.value.downloads[0].source == $file) | .key | strings' "$1" +} + +# get download dir for package +# get_pkg_dl_dir <json> <package> +get_pkg_dl_dir() { + jq --arg pkg "$2" -r '.[$pkg].dl_dir | strings' "$1" +}
utils/add-custom-hashes line 46
Quoted 10 lines
utils/add-custom-hashes new file +10
-0+ +# generate hash file for download file +# gen_hash <dir> <file> +gen_hash() { + ( + cd "$1" && printf '# Locally calculated\nsha256 ' && sha256sum "$2" + ) +} + +command -v jq || die 'Script needs jq'
Ups, this was a last minute addition, the stdout of command -v should be redirected to /dev/null.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Korsgaard <[email protected]> writes:
Add a script to manage the .hash files in the
BR2_GLOBAL_PATCH_DIRfor packages using custom versions.To use it, run in a configured Buildroot directory, E.G.
Quoted 7 lines
make
foo_defconfig; ./utils/add-custom-hashesWe support multiple patch directories in
BR2_GLOBAL_PATCH_DIR. If multiple directories are specified then use the last one as that is likely to be the most specific one.Signed-off-by Peter Korsgaard <[email protected]>
Committed after dropping the command -v output, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Korsgaard <[email protected]> writes:
Add a script to manage the .hash files in the
BR2_GLOBAL_PATCH_DIRfor packages using custom versions.To use it, run in a configured Buildroot directory, E.G.
Quoted 7 lines
make
foo_defconfig; ./utils/add-custom-hashesWe support multiple patch directories in
BR2_GLOBAL_PATCH_DIR. If multiple directories are specified then use the last one as that is likely to be the most specific one.Signed-off-by Peter Korsgaard <[email protected]>
Committed to 2023.02.x and 2023.08.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot