Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement escript archives #9386

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ primary_bootstrap_copy:

# To remove modules left by the bootstrap building, but leave (restore)
# the modules in kernel which are needed for an emulator build
KERNEL_PRELOAD = erl_init init erl_prim_loader prim_inet prim_file zlib prim_zip erlang erts_code_purger
KERNEL_PRELOAD = erl_init init erl_prim_loader prim_inet prim_file zlib erlang erts_code_purger
KERNEL_PRELOAD_BEAMS=$(KERNEL_PRELOAD:%=$(BOOTSTRAP_TOP)/lib/kernel/ebin/%.beam)

start_scripts:
Expand Down
Binary file modified bootstrap/bin/no_dot_erlang.boot
Binary file not shown.
Binary file modified bootstrap/bin/start.boot
Binary file not shown.
Binary file modified bootstrap/bin/start_clean.boot
Binary file not shown.
Binary file modified bootstrap/lib/kernel/ebin/application_controller.beam
Binary file not shown.
Binary file modified bootstrap/lib/kernel/ebin/code.beam
Binary file not shown.
Binary file modified bootstrap/lib/kernel/ebin/code_server.beam
Binary file not shown.
114 changes: 59 additions & 55 deletions bootstrap/lib/kernel/ebin/kernel.appup
Original file line number Diff line number Diff line change
Expand Up @@ -19,66 +19,70 @@
%%
%% We allow upgrade from, and downgrade to all previous
%% versions from the following OTP releases:
%% - OTP 23
%% - OTP 24
%% - OTP 25
%% - OTP 26
%% - OTP 27
%%
%% We also allow upgrade from, and downgrade to all
%% versions that have branched off from the above
%% stated previous versions.
%%
{"8.4.1",
[{<<"^7\\.0$">>,[restart_new_emulator]},
{<<"^7\\.0\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^7\\.1$">>,[restart_new_emulator]},
{<<"^7\\.1\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^7\\.2$">>,[restart_new_emulator]},
{<<"^7\\.2\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^7\\.2\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^7\\.3$">>,[restart_new_emulator]},
{<<"^7\\.3\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^7\\.3\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.0$">>,[restart_new_emulator]},
{<<"^8\\.0\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.0\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.0\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.1$">>,[restart_new_emulator]},
{<<"^8\\.1\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.1\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.1\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.1\\.3(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.2$">>,[restart_new_emulator]},
{<<"^8\\.2\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.3$">>,[restart_new_emulator]},
{<<"^8\\.3\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.3\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.3\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{"10.2",
[{<<"^10\\.0$">>,[restart_new_emulator]},
{<<"^10\\.0\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^10\\.0\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^10\\.1$">>,[restart_new_emulator]},
{<<"^10\\.1\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^10\\.1\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^10\\.1\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.4$">>,[restart_new_emulator]},
{<<"^8\\.4\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]}],
[{<<"^7\\.0$">>,[restart_new_emulator]},
{<<"^7\\.0\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^7\\.1$">>,[restart_new_emulator]},
{<<"^7\\.1\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^7\\.2$">>,[restart_new_emulator]},
{<<"^7\\.2\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^7\\.2\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^7\\.3$">>,[restart_new_emulator]},
{<<"^7\\.3\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^7\\.3\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.0$">>,[restart_new_emulator]},
{<<"^8\\.0\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.0\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.0\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.1$">>,[restart_new_emulator]},
{<<"^8\\.1\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.1\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.1\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.1\\.3(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.2$">>,[restart_new_emulator]},
{<<"^8\\.2\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.3$">>,[restart_new_emulator]},
{<<"^8\\.3\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.3\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.3\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.4\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.4\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.4\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.5$">>,[restart_new_emulator]},
{<<"^8\\.5\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.5\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.5\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.5\\.3(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.5\\.4(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.0$">>,[restart_new_emulator]},
{<<"^9\\.0\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^9\\.0\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.0\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.1$">>,[restart_new_emulator]},
{<<"^9\\.1\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^9\\.2$">>,[restart_new_emulator]},
{<<"^9\\.2\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^9\\.2\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.2\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.2\\.3(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.2\\.4(?:\\.[0-9]+)*$">>,[restart_new_emulator]}],
[{<<"^10\\.0$">>,[restart_new_emulator]},
{<<"^10\\.0\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^10\\.0\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^10\\.1$">>,[restart_new_emulator]},
{<<"^10\\.1\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^10\\.1\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^10\\.1\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.4$">>,[restart_new_emulator]},
{<<"^8\\.4\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]}]}.
{<<"^8\\.4\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.4\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.4\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.5$">>,[restart_new_emulator]},
{<<"^8\\.5\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^8\\.5\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.5\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.5\\.3(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^8\\.5\\.4(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.0$">>,[restart_new_emulator]},
{<<"^9\\.0\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^9\\.0\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.0\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.1$">>,[restart_new_emulator]},
{<<"^9\\.1\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^9\\.2$">>,[restart_new_emulator]},
{<<"^9\\.2\\.0(?:\\.[0-9]+)+$">>,[restart_new_emulator]},
{<<"^9\\.2\\.1(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.2\\.2(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.2\\.3(?:\\.[0-9]+)*$">>,[restart_new_emulator]},
{<<"^9\\.2\\.4(?:\\.[0-9]+)*$">>,[restart_new_emulator]}]}.
Binary file modified bootstrap/lib/stdlib/ebin/escript.beam
Binary file not shown.
21 changes: 6 additions & 15 deletions erts/doc/references/escript_cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,12 @@ executable by prepending the file with the lines starting with `#!` and `%%!`
mentioned above. In a precompiled script, the `main/1` function must be
exported.

Another option is to have an entire Erlang archive in the script. In an archive
script, the interpretation of the script header is the same as in a script
containing source code. This means that you can make an archive file executable
by prepending the file with the lines starting with `#!` and `%%!` mentioned
above. In an archive script, the `main/1` function must be exported. By default
the `main/1` function in the module with the same name as the basename of the
`escript` file is invoked. This behavior can be overridden by setting flag
`-escript main Module` as one of the emulator flags. `Module` must be the name
of a module that has an exported `main/1` function. For more information about
archives and code loading, see `m:escript` and `m:code`.

It is often very convenient to have a header in the escript, especially on Unix
platforms. However, the header is optional, so you directly can "execute" an
Erlang module, Beam file, or archive file without adding any header to them. But
then you have to invoke the script as follows:
It is also possible to have multiple files in a script. See `escript:create/2`.

It is often convenient to have a header in the escript, especially on
Unix platforms. However, the header is optional, so you directly can
"execute" an Erlang module, Beam file, or archive file without adding
any header to them. But then you have to invoke the script as follows:

```text
$ escript factorial.erl 5
Expand Down
1 change: 0 additions & 1 deletion erts/emulator/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,6 @@ PRELOAD_BEAM = $(ERL_TOP)/erts/preloaded/ebin/erts_code_purger.beam \
$(ERL_TOP)/erts/preloaded/ebin/prim_file.beam \
$(ERL_TOP)/erts/preloaded/ebin/zlib.beam \
$(ESOCK_PRELOAD_BEAM) \
$(ERL_TOP)/erts/preloaded/ebin/prim_zip.beam \
$(ERL_TOP)/erts/preloaded/ebin/erl_prim_loader.beam \
$(ERL_TOP)/erts/preloaded/ebin/erlang.beam \
$(ERL_TOP)/erts/preloaded/ebin/erts_internal.beam \
Expand Down
Binary file modified erts/preloaded/ebin/counters.beam
Binary file not shown.
Binary file modified erts/preloaded/ebin/erl_prim_loader.beam
Binary file not shown.
Binary file modified erts/preloaded/ebin/erlang.beam
Binary file not shown.
Binary file modified erts/preloaded/ebin/erts_internal.beam
Binary file not shown.
Binary file modified erts/preloaded/ebin/init.beam
Binary file not shown.
Binary file modified erts/preloaded/ebin/socket_registry.beam
Binary file not shown.
Binary file modified erts/preloaded/ebin/zlib.beam
Binary file not shown.
2 changes: 0 additions & 2 deletions erts/preloaded/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ PRE_LOADED_ERL_MODULES = \
prim_inet \
$(PRE_LOADED_ERL_ESOCK_MODULES) \
zlib \
prim_zip \
erl_init \
erts_code_purger \
erlang \
Expand Down Expand Up @@ -176,5 +175,4 @@ dialyzer: $(DIA_PLT)
$(EBIN)/erl_prim_loader.beam: $(KERNEL_SRC)/inet_boot.hrl $(KERNEL_INCLUDE)/file.hrl
$(EBIN)/prim_file.beam: $(KERNEL_SRC)/file_int.hrl $(KERNEL_INCLUDE)/file.hrl
$(EBIN)/prim_inet.beam: $(KERNEL_SRC)/inet_int.hrl $(KERNEL_INCLUDE)/inet_sctp.hrl
$(EBIN)/prim_zip.beam: zip_internal.hrl $(KERNEL_INCLUDE)/file.hrl $(STDLIB_INCLUDE)/zip.hrl
$(EBIN)/init.beam: $(KERNEL_INCLUDE)/file.hrl
Loading
Loading