Skip to content

Commit

Permalink
Replace 'otp_build patch_app' with 'otp_patch_apply'
Browse files Browse the repository at this point in the history
  • Loading branch information
rickard-green committed Mar 31, 2014
1 parent c9b28ca commit ffa3930
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 147 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -98,6 +98,8 @@ lib/wx/c_src/win32/
lib/wx/priv/win32/
lib/wx/win32/
make/win32/
make/otp_built
make/otp_doc_built

# OSE
*.d
Expand Down
5 changes: 5 additions & 0 deletions Makefile.in
Expand Up @@ -422,6 +422,10 @@ endif
cd $(ERL_TOP)/system/doc && \
PATH=$(BOOT_PREFIX)"$${PATH}" \
ERL_TOP=$(ERL_TOP) $(MAKE) TESTROOT="$(RELEASE_ROOT)" DOCGEN=$(BOOTSTRAP_ROOT)/bootstrap/lib/erl_docgen $@
ifneq ($(OTP_SMALL_BUILD),true)
echo "OTP doc built" > $(ERL_TOP)/make/otp_doc_built
endif


mod2app:
PATH=$(BOOT_PREFIX)"$${PATH}" escript $(BOOTSTRAP_ROOT)/bootstrap/lib/erl_docgen/priv/bin/xref_mod_app.escript -topdir $(ERL_TOP) -outfile $(ERL_TOP)/make/$(TARGET)/mod2app.xml
Expand All @@ -447,6 +451,7 @@ else
$(make_verbose)cd lib && \
ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)"$${PATH}" \
$(MAKE) opt BUILD_ALL=true
echo "OTP built" > $(ERL_TOP)/make/otp_built
endif
kernel:
$(make_verbose)cd lib/kernel && \
Expand Down
141 changes: 0 additions & 141 deletions otp_build
Expand Up @@ -52,9 +52,6 @@ usage ()
echo " release [-a] <target_dir> - creates full release to <target_dir>"
echo " smp [-a] - build an Erlang system, smp flavor only"
echo " tests <dir> - Build testsuites to <dir>"
echo " patch_app [-f] <target_dir> <app1>... - build given apps to <target_dir>"
echo " If core apps are patched, new start scripts will be created"
echo " and 'Install' must be run again."
echo ""
echo "These are for cleaning up an open source distribution"
echo "with prebuilt files, so that it resembles the clean developers"
Expand Down Expand Up @@ -1192,141 +1189,6 @@ do_release ()
release || exit 1
}

do_patch_app ()
{
# If target dir exists and has an installation of same major release, then
# build given apps.
# If patch includes erts, kernel, stdlib, sasl, then find latest
# erts, kernel, stdlib, sasl and create .rel files.
# Create .script/.boot

if [ $# -lt 2 ]; then
usage
exit 1
fi

setup_make
if [ X`$MAKE is_cross_configured` = Xyes ]; then
TARGET=`$MAKE target_configured`
fi
if [ "x$1" = "x-f" ]; then
force="-force"
shift
else
force=
fi
target_dir=$1
if [ ! -d "$target_dir/releases/$otp_major_vsn" ]; then
echo "No OTP $otp_major_vsn installation in $target_dir" 1>&2
exit 1
fi

shift

otp_version=`cat "$target_dir/releases/$otp_major_vsn/OTP_VERSION"` || { echo "Not able to read $target_dir/releases/$otp_major_vsn/OTP_VERSION" 1>&2; exit 1; }
{ echo "$otp_version" | sed "s|^\([^\*]*\)\**|\1\*\*|g" > "$target_dir/releases/$otp_major_vsn/OTP_VERSION"; } 2>/dev/null || { echo "Not able to update $target_dir/OTP_VERSION" 1>&2; exit 1; }

PATH="$ERL_TOP/bootstrap/bin:$PATH" $ERL_TOP/make/verify_runtime_dependencies -release "$otp_major_vsn" -source "$ERL_TOP" -target "$target_dir" $force "$@"

if [ $? -ne 0 ]; then
exit $?
fi

# Build all applications to target
for app in "$@"; do
if [ "$app" = "erts" ] && [ -d $ERL_TOP/$app ]; then
(cd $ERL_TOP/$app && $MAKE MAKE="$MAKE" TARGET=$TARGET \
TESTROOT="$target_dir" release) || exit 1
elif [ "$app" != "erts" ] && [ -d $ERL_TOP/lib/$app ]; then
(cd $ERL_TOP/lib/$app && $MAKE MAKE="$MAKE" TARGET=$TARGET \
TESTROOT="$target_dir" release) || exit 1
else
echo "Invalid application $app" 1>&2
exit 1
fi
done

# If erts, kernel, stdlib or sasl is included, find versions
for app in "$@"; do
if [ "$app" = "erts" ]; then
erts_vsn=`grep '^VSN' erts/vsn.mk | sed "s|^VSN.*=[^0-9]*\([0-9].*\)$|\1|g"`
update_rel=true
elif [ "$app" = "kernel" ]; then
kernel_vsn=`sed "s|^KERNEL_VSN[^=]*=[^0-9]*\([0-9].*\)$|\1|g" lib/kernel/vsn.mk`
update_rel=true
elif [ "$app" = "stdlib" ]; then
stdlib_vsn=`sed "s|^STDLIB_VSN[^=]*=[^0-9]*\([0-9].*\)$|\1|g" lib/stdlib/vsn.mk`
update_rel=true
elif [ "$app" = "sasl" ]; then
sasl_vsn=`sed "s|^SASL_VSN[^=]*=[^0-9]*\([0-9].*\)$|\1|g" lib/sasl/vsn.mk`
update_rel=true
fi
done

# and find the old versions for those not included
if [ "X$update_rel" != "X" ]; then
if [ "X$erts_vsn" = "X" ]; then
erts_vsns=`ls -d "$target_dir"/erts-* | sed "s|$target_dir/erts-\([0-9\.].*\)|\1|g"`
erts_vsn=`echo "$erts_vsns" | sort -t '.' -g | tail -n 1`
fi
if [ "X$kernel_vsn" = "X" ]; then
kernel_vsns=`ls -d "$target_dir"/lib/kernel-* | sed "s|$target_dir/lib/kernel-\([0-9\.].*\)|\1|g"`
kernel_vsn=`echo "$kernel_vsns" | sort -t '.' -g | tail -n 1`
fi
if [ "X$stdlib_vsn" = "X" ]; then
stdlib_vsns=`ls -d "$target_dir"/lib/stdlib-* | sed "s|$target_dir/lib/stdlib-\([0-9\.].*\)|\1|g"`
stdlib_vsn=`echo "$stdlib_vsns" | sort -t '.' -g | tail -n 1`
fi
if [ "X$sasl_vsn" = "X" ]; then
sasl_vsns=`ls -d "$target_dir"/lib/sasl-* | sed "s|$target_dir/lib/sasl-\([0-9\.].*\)|\1|g"`
sasl_vsn=`echo "$sasl_vsns" | sort -t '.' -g | tail -n 1`
fi

# Generate .rel, .script and .boot - to tmp dir
start_clean="{release, {\"Erlang/OTP\",\"$otp_major_vsn\"}, {erts, \"$erts_vsn\"},\n [{kernel,\"$kernel_vsn\"},\n {stdlib,\"$stdlib_vsn\"}]}.\n"
start_sasl="{release, {\"Erlang/OTP\",\"$otp_major_vsn\"}, {erts, \"$erts_vsn\"},\n [{kernel,\"$kernel_vsn\"},\n {stdlib,\"$stdlib_vsn\"},\n {sasl,\"$sasl_vsn\"}]}.\n"

tmp_dir="$target_dir/tmp";
if [ ! -d "$tmp_dir" ]; then
mkdir "$tmp_dir"
fi
echo "$start_sasl" > "$tmp_dir/start_sasl.rel"
echo "$start_clean" > "$tmp_dir/start_clean.rel"
echo "$start_clean" > "$tmp_dir/no_dot_erlang.rel"

erlc="$ERL_TOP/bootstrap/bin/erlc"
if [ ! -x "$erlc" ]; then
echo "erlc not found, can not create .script and .boot files" 1>&2
exit 1
fi

$erlc -I"$target_dir"/lib/*/ebin -o$tmp_dir $tmp_dir/start_sasl.rel || exit 1
$erlc -I"$target_dir"/lib/*/ebin -o$tmp_dir +no_warn_sasl $tmp_dir/start_clean.rel || exit 1
$erlc -I"$target_dir"/lib/*/ebin -o$tmp_dir +no_warn_sasl +no_dot_erlang $tmp_dir/no_dot_erlang.rel || exit 1

# Generate RELEASES file
erl="$ERL_TOP/bootstrap/bin/erl"
if [ ! -x "$erl" ]; then
echo "erl not found, can not create RELEASES file" 1>&2
exit 1
fi
"$erl" -noinput +B -eval "release_handler:create_RELEASES(\"%ERL_ROOT%\", \"$tmp_dir\", \"$tmp_dir/start_sasl.rel\", []), halt()" || exit 1

# If all good so far, move generated files into target area
mv "$tmp_dir/RELEASES" "$target_dir/releases/RELEASES.src"
mv "$tmp_dir"/* "$target_dir/releases/$otp_major_vsn"
rmdir "$tmp_dir"

# Remove old start scripts (forces a new run of Install)
rm -f "$target_dir"/releases/RELEASES
rm -f "$target_dir"/bin/*.script
rm -f "$target_dir"/bin/*.boot
rm -f "$target_dir"/bin/erl
fi

}


do_tests ()
{
setup_make
Expand Down Expand Up @@ -1587,9 +1449,6 @@ case "$1" in
shift
fi;
do_release "$2";;
patch_app)
shift;
do_patch_app "$@";;
tests)
if [ $minus_a_flag = true ]; then
shift
Expand Down
11 changes: 5 additions & 6 deletions system/doc/system_principles/versions.xml
Expand Up @@ -61,14 +61,13 @@
<c>filename:join([<seealso marker="kernel:code#root_dir/0">code:root_dir()</seealso>, "releases", <seealso marker="erts:erlang#system_info_otp_release">erlang:system_info(otp_release)</seealso>, "OTP_VERSION"]).</c></p>
<p>If the version read from the <c>OTP_VERSION</c> file in a
development system has a <c>**</c> suffix, the system has been
patched using the
<seealso marker="doc/installation_guide:PATCH-APP"><c>$ERL_TOP/otp_build patch_app</c></seealso>
tool. In this case, the system consists of application versions from
multiple OTP versions. The version preceding the <c>**</c>
patched using the <c>otp_patch_apply</c> tool available to
licensed customers. In this case, the system consists of application
versions from multiple OTP versions. The version preceding the <c>**</c>
suffix corresponds to the OTP version of the base system that
has been patched. Note that if a development system is updated by
other means than <c>$ERL_TOP/otp_build patch_app</c>, the
<c>OTP_VERSION</c> file may identify wrong OTP version.</p>
other means than <c>otp_patch_apply</c>, the <c>OTP_VERSION</c> file
may identify wrong OTP version.</p>

<p>No <c>OTP_VERSION</c> file will be placed in a
<seealso marker="create_target">target system</seealso> created
Expand Down

0 comments on commit ffa3930

Please sign in to comment.