diff --git a/CHANGELOG.md b/CHANGELOG.md index 43c2a96..6260bff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- `rebar3 grisp deploy --tar` will not copy the release to the configured destination and will not execute `pre` and `post` scripts, usually defined in the `rebar.config` file. + +- the option `--destination` is ignored when using option `--tar` + +- Erlang/OTP-26 and older versions are now deprecated. A warning message will be print to inform trhe user. + +### Fixed + +- `rebar3 grisp firmware` command failure with latest rebar versions + ## [2.10.2] - 2026-01-15 ### Fixed diff --git a/rebar.config.script b/rebar.config.script index aee4858..661faf6 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -16,6 +16,9 @@ end. case OTPVersion of V when V < 27 -> + rebar_api:warn("You are running rebar3_grisp with Erlang/OTP-~p!~n" + "rebar3_grisp deprecates this OTP version and will drop support for it in the next releases!~n" + "Please upgrade to OTP 27 or newer before upgrading this plugin!",[OTPVersion]), NewOverrrides = {overrides, [EdifaOverride | Overrides]}, lists:keystore(overrides, 1, CONFIG, NewOverrrides); _ -> diff --git a/rebar.lock b/rebar.lock index cbf1b8f..0c925a6 100644 --- a/rebar.lock +++ b/rebar.lock @@ -4,8 +4,8 @@ {<<"edifa">>,{pkg,<<"edifa">>,<<"1.0.0">>},1}, {<<"erlexec">>,{pkg,<<"erlexec">>,<<"2.0.7">>},2}, {<<"grid">>,{pkg,<<"grid">>,<<"0.2.1">>},0}, - {<<"grisp_tools">>,{pkg,<<"grisp_tools">>,<<"2.8.0">>},0}, - {<<"grisp_update_packager">>,{pkg,<<"grisp_update_packager">>,<<"1.0.1">>},1}, + {<<"grisp_tools">>,{pkg,<<"grisp_tools">>,<<"2.8.1">>},0}, + {<<"grisp_update_packager">>,{pkg,<<"grisp_update_packager">>,<<"1.0.2">>},1}, {<<"hackney">>,{pkg,<<"hackney">>,<<"1.20.1">>},1}, {<<"idna">>,{pkg,<<"idna">>,<<"6.1.1">>},2}, {<<"mapz">>,{pkg,<<"mapz">>,<<"2.4.0">>},1}, @@ -25,8 +25,8 @@ {<<"edifa">>, <<"0F1A01A0C79B7135F334B3FCEEB624F0574C5ED3E4554B06C8664AADA6A339C8">>}, {<<"erlexec">>, <<"76D0BC7487929741B5BB9F74DA2AF5DAF1492134733CF9A05C7AAA278B6934C5">>}, {<<"grid">>, <<"4DCBF6155AB24131CB493D417F28093F019197ED7401F28BF82FF60E2C9B0D2C">>}, - {<<"grisp_tools">>, <<"23CF651214F1885B98325B8340E2CC4591785399FA0B4D5B291D0E66F07F1AD7">>}, - {<<"grisp_update_packager">>, <<"4548C7A5E0D4EBED0052E49F87E836D5A5C75FFDB76E793FDBDF5D11409CCBBE">>}, + {<<"grisp_tools">>, <<"8E882F0D75695B9EFF5AB4BC1E076246086D87DA095D5114F43451D11A2EE101">>}, + {<<"grisp_update_packager">>, <<"A74922B6602159A6718B1EE13045D3866BFF26D6A49C8C7A8EABC5F352E41BB9">>}, {<<"hackney">>, <<"8D97AEC62DDDDD757D128BFD1DF6C5861093419F8F7A4223823537BAD5D064E2">>}, {<<"idna">>, <<"8A63070E9F7D0C62EB9D9FCB360A7DE382448200FBBD1B106CC96D3D8099DF8D">>}, {<<"mapz">>, <<"77A8E38B69BAB16C5D3EBD44E6C619F8AF1F1598B0CAAE301D266605A0865756">>}, @@ -45,8 +45,8 @@ {<<"edifa">>, <<"A1E010561E7D236A24C668D95626BE2BFE082ED0331CE1E6798BE0CD43F59A7B">>}, {<<"erlexec">>, <<"AF2DD940BB8E32F5AA40A65CB455DCAA18F5334FD3507E9BFD14A021E9630897">>}, {<<"grid">>, <<"C8EA819A0E40631BECE3149FBA7D306DF6CF8BC35358089878F05B20E6D87D4C">>}, - {<<"grisp_tools">>, <<"0BA58D7C99010BEE9F599D9555B4FC0D75969C92995162CB0B12AF13DAF34692">>}, - {<<"grisp_update_packager">>, <<"B958039BEAD404A5E05D56E904B70C840F10F188070CFBFF0A9ADC92DE9E5451">>}, + {<<"grisp_tools">>, <<"D761A141D96B03FE182937434DE96D325923126F50606A0ADDE64864C5F469F7">>}, + {<<"grisp_update_packager">>, <<"6484C6910C7F4CF235119206A5FEFD16ED08BE2D3A16E62EC1820A207B4D5B20">>}, {<<"hackney">>, <<"FE9094E5F1A2A2C0A7D10918FEE36BFEC0EC2A979994CFF8CFE8058CD9AF38E3">>}, {<<"idna">>, <<"92376EB7894412ED19AC475E4A86F7B413C1B9FBB5BD16DCCD57934157944CEA">>}, {<<"mapz">>, <<"4B68DF5CF0522E0D6545DF7B681BC052865CDB78405AD4CC9C55FE45EE7B25BE">>}, diff --git a/src/rebar3_grisp_deploy.erl b/src/rebar3_grisp_deploy.erl index d115f90..cc5111e 100644 --- a/src/rebar3_grisp_deploy.erl +++ b/src/rebar3_grisp_deploy.erl @@ -33,7 +33,7 @@ init(State) -> {opts, [ {relname, $n, "relname", string, "Specify the name for the release that will be deployed"}, {relvsn, $v, "relvsn", string, "Specify the version of the release"}, - {tar, $t, "tar", {boolean, false}, "Create tarball with the release in _grisp/deploy"}, + {tar, $t, "tar", {boolean, false}, "Create a tarball with the release in _grisp/deploy, instead of deployng to 'destination'"}, {destination, $d, "destination", string, "Path to put deployed release in"}, {force, $f, "force", {boolean, false}, "Replace existing files"}, {pre_script, undefined, "pre-script", string, "Shell script to run before deploying begins"}, @@ -75,20 +75,15 @@ do(RState) -> try {RelName, RelVsn} = rebar3_grisp_util:select_release(RState2, RelNameArg, RelVsnArg), - DistSpec = case {Tar, CopyDest} of - {false, D} when D =:= undefined; D =:= "" -> - error(no_deploy_destination); - {true, D} when D =:= undefined; D =:= "" -> [ - bundle_dist_spec(RState2, RelName, RelVsn, Force) - ]; - {false, _} -> [ - copy_dist_spec(RState2, CopyDest, Force) - ]; - {true, _} -> [ - bundle_dist_spec(RState2, RelName, RelVsn, Force), - copy_dist_spec(RState2, CopyDest, Force) - ] - end, + DistOptions = #{ + destination => CopyDest, + pre_script => PreScript, + post_script => PostScript, + tar => Tar, + force => Force, + bundle => + rebar3_grisp_util:bundle_file_path(RState, RelName, RelVsn) + }, Profiles = [P || P <- rebar_state:current_profiles(RState2), P =/= default, P =/= grisp, P =/= test], DeploySpec = #{ @@ -97,13 +92,11 @@ do(RState) -> otp_version_requirement => OTPVersion, platform => Board, custom_build => CustomBuild, - distribute => DistSpec, + distribute => distribution_spec(DistOptions), release => #{ name => RelName, version => RelVsn, - profiles => Profiles, - tar => Tar, - force => Force + profiles => Profiles }, handlers => grisp_tools:handlers_init(#{ event => {fun event_handler/2, #{ @@ -112,11 +105,7 @@ do(RState) -> }}, shell => {fun rebar3_grisp_handler:shell/3, #{}}, release => {fun release_handler/2, RState2} - }), - scripts => #{ - pre_script => PreScript, - post_script => PostScript - } + }) }, State = grisp_tools:deploy(DeploySpec), #{release := RState3} = grisp_tools:handlers_finalize(State), @@ -235,9 +224,17 @@ format_error(Reason) -> %--- Internal ------------------------------------------------------------------ -copy_dist_spec(RState, CopyDest, Force) -> - PreScript = get_option(pre_script, [deploy, pre_script], RState, undefined), - PostScript = get_option(pre_script, [deploy, post_script], RState, undefined), +distribution_spec(#{tar := true} = DistOptions) -> + [bundle_dist_spec(DistOptions)]; +distribution_spec(#{tar := false} = DistOptions) -> + [copy_dist_spec(DistOptions)]. + +copy_dist_spec(#{destination := undefined}) -> + error(no_deploy_destination); +copy_dist_spec(#{destination := CopyDest, + pre_script := PreScript, + post_script := PostScript, + force := Force}) -> {copy, #{ type => copy, force => Force, @@ -248,8 +245,7 @@ copy_dist_spec(RState, CopyDest, Force) -> } }}. -bundle_dist_spec(RState, RelName, RelVsn, Force) -> - BundleFile = rebar3_grisp_util:bundle_file_path(RState, RelName, RelVsn), +bundle_dist_spec(#{bundle := BundleFile, force := Force}) -> {bundle, #{ type => archive, force => Force, diff --git a/src/rebar3_grisp_firmware.erl b/src/rebar3_grisp_firmware.erl index ade4e14..8adfa88 100644 --- a/src/rebar3_grisp_firmware.erl +++ b/src/rebar3_grisp_firmware.erl @@ -41,7 +41,7 @@ init(State) -> {image, $i, "image", {boolean, false}, "Generate an eMMC image firmware under _grisp/firmware"}, {bootloader, $b, "bootloader", {boolean, false}, "Generate a bootloader firmware under _grisp/firmware"}, {truncate, $t, "truncate", {boolean, true}, "Truncate the generated image firmware to contain only the first partition"}, - {quiet, $q, "quiet", {boolean, false}, "Do not show the instructions on how to burn the firmwares"} + {quiet, $q, "quiet", {boolean, false}, "Do not show the instructions on how to burn the firmwares"} ]}, {profiles, [grisp]}, {short_desc, "Generate GRiSP firmware image files"}, @@ -181,8 +181,7 @@ deploy_bundle(RState, Refresh, RelName, RelVsn, ExtraRelArgs) -> "deploy", "--tar", "--relname", atom_to_list(RelName), - "--relvsn", RelVsn, - "--destination", "" + "--relvsn", RelVsn ] ++ case Refresh =:= true of true -> ["--force"]; false -> []