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

Warn on stale build due to kernel changed #485

Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 24 additions & 5 deletions kerl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,13 @@ error() {

warn() {
# $1: log entry
# $2: use 'noprefix' if you want to omit WARNING:

l=warn stderr "WARNING: $1"
if [ "$2" != "noprefix" ]; then
l=warn stderr "WARNING: $1"
else
l=warn stderr "$1"
fi
}

notice() {
Expand Down Expand Up @@ -1060,8 +1065,12 @@ _do_build() {

# Check to see if configuration options need to be stored or have changed
TMPOPT="${TMP_DIR}/kerloptions.$$"
echo "${CFLAGS:-}" >"$TMPOPT"
echo "$KERL_CONFIGURE_OPTIONS" >>"$TMPOPT"
{
echo "This is kerl's control file for build configuration."
jadeallenx marked this conversation as resolved.
Show resolved Hide resolved
echo "CFLAGS: ${CFLAGS:-}"
echo "KERL_CONFIGURE_OPTIONS: $KERL_CONFIGURE_OPTIONS"
echo "uname -r: $(uname -r)"
} >>"$TMPOPT"
SUM=$($MD5SUM "$TMPOPT" | cut -d ' ' -f "$MD5SUM_FIELD")
# Check for a .kerl_config.md5 file
if [ -e ./"$KERL_CONFIG_STORAGE_FILENAME".md5 ]; then
Expand All @@ -1078,8 +1087,8 @@ _do_build() {
fi
else
# no file exists, so write one
mv "$TMPOPT" .kerl_config
echo "$SUM" >.kerl_config.md5
mv "$TMPOPT" "$KERL_CONFIG_STORAGE_FILENAME"
echo "$SUM" >"$KERL_CONFIG_STORAGE_FILENAME".md5
paulo-ferraz-oliveira marked this conversation as resolved.
Show resolved Hide resolved
fi

# Don't apply patches to "custom" git builds. We have no idea if they will apply
Expand Down Expand Up @@ -1618,6 +1627,16 @@ do_install() {
ERL_TOP="$KERL_BUILD_DIR/$build_name/otp_src_$rel"
cd "$ERL_TOP" || exit_install
init_install_logfile "$rel" "$build_name"

prev_build_kernel_release=$(grep <"$ERL_TOP"/"$KERL_CONFIG_STORAGE_FILENAME" -o '^uname -r: \(.*\)$' | sed -n 's|^uname -r: \(.*\)$|\1|p')
paulo-ferraz-oliveira marked this conversation as resolved.
Show resolved Hide resolved
if [ "$(uname -r)" != "$prev_build_kernel_release" ]; then
warn "this Erlang/OTP build appears to be stale. It was created with kernel release"
warn " '$prev_build_kernel_release' while currently your system's kernel release is" "noprefix"
warn " '$(uname -r)'." "noprefix"
warn " You should consider removing the build with 'kerl delete build ...' and" "noprefix"
warn " re-installing it with 'kerl build-install ...'" "noprefix"
fi
paulo-ferraz-oliveira marked this conversation as resolved.
Show resolved Hide resolved

if ! log_install_cmd "ERL_TOP=$ERL_TOP ./otp_build release -a $absdir && cd $absdir && ./Install $INSTALL_OPT $absdir"; then
show_install_logfile "install of Erlang/OTP $rel ($build_name), in $absdir, failed!"
exit_install
Expand Down