From 6f361e1b0532258e3367989634a75036d450de0f Mon Sep 17 00:00:00 2001 From: Wojtek Mach Date: Mon, 3 Feb 2020 17:34:17 +0100 Subject: [PATCH 1/2] Add vendor_hex_core.sh We're planning to move the vendor.sh script from hex_core to hex, but if you'd prefer it stays there it's not a problem. Thought by moving it here I think it's a bit easier to use anyway. --- vendor_hex_core.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 vendor_hex_core.sh diff --git a/vendor_hex_core.sh b/vendor_hex_core.sh new file mode 100755 index 000000000..c4ce5cbe1 --- /dev/null +++ b/vendor_hex_core.sh @@ -0,0 +1,66 @@ +#!/bin/bash +set -e + +if [[ -z "$1" ]]; then + echo "Usage: vendor.sh PATH_TO_HEX_CORE" + exit 1 +fi + +source_dir=$1/src +target_dir=src +prefix=r3_ +hex_core_version=`cat $source_dir/hex_core.hrl | grep HEX_CORE_VERSION | cut -d'"' -f2` + +filenames="hex_core.hrl \ + hex_core.erl \ + hex_erl_tar.erl \ + hex_erl_tar.hrl \ + hex_filename.erl \ + hex_pb_names.erl \ + hex_pb_package.erl \ + hex_pb_signed.erl \ + hex_pb_versions.erl \ + hex_tarball.erl \ + hex_registry.erl \ + hex_http_httpc.erl \ + hex_http.erl \ + hex_repo.erl \ + hex_api.erl \ + hex_api_key.erl \ + hex_api_package.erl \ + hex_api_package_owner.erl \ + hex_api_release.erl \ + hex_api_user.erl \ + safe_erl_term.xrl" + +search_to_replace="hex_core: \ + hex_core) \ + hex_core.hrl \ + hex_erl_tar \ + hex_filename \ + hex_pb_names \ + hex_pb_package \ + hex_pb_signed \ + hex_pb_versions \ + hex_registry \ + hex_tarball \ + hex_http \ + hex_repo \ + hex_api \ + safe_erl_term" + +rm -f $target_dir/$prefix* + +for filename in $filenames; do + source_path=$source_dir/$filename + target_path=$target_dir/$prefix$filename + + echo "%% Vendored from hex_core v$hex_core_version, do not edit manually" > $target_path + echo >> $target_path + cat $source_path >> $target_path + + for word in $search_to_replace; do + sed -i.bak s/$word/$prefix$word/g $target_path + rm $target_path.bak + done +done From 34f4fd74eb2f6a1e3aedfc1b9592fb9f8e2c6864 Mon Sep 17 00:00:00 2001 From: Wojtek Mach Date: Mon, 3 Feb 2020 17:38:15 +0100 Subject: [PATCH 2/2] Update vendor_hex_core.sh --- vendor_hex_core.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor_hex_core.sh b/vendor_hex_core.sh index c4ce5cbe1..d95261b9e 100755 --- a/vendor_hex_core.sh +++ b/vendor_hex_core.sh @@ -2,7 +2,7 @@ set -e if [[ -z "$1" ]]; then - echo "Usage: vendor.sh PATH_TO_HEX_CORE" + echo "Usage: vendor_hex_core.sh PATH_TO_HEX_CORE" exit 1 fi