From faac8129e160c133686e334a6b7e9497b6be1ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 2 Dec 2009 16:35:32 +0100 Subject: Determine which VCS is being used We want to add the ability for otp_build to determine which version control system (VCS) is being used, so that the commands for updating the primary bootstrap and pre-loaded modules can be updated to do different things depending on the VCS. In the beginning of the otp_build script, set the variable "version_controller" to either "none" (for no VCS), "git", or "clearcase". --- otp_build | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'otp_build') diff --git a/otp_build b/otp_build index cddb477db5..07edcb1d4d 100755 --- a/otp_build +++ b/otp_build @@ -189,7 +189,23 @@ target_contains () return $? } +determine_version_controller () +{ + version_controller=none + # The current directory is now $ERL_TOP. Check for + # either this directory being controlled by git or + # for the "otp_build" file being a Clearcase controlled + # object. + + if git rev-parse --git-dir 2>/dev/null >/dev/null; then + version_controller=git + else + if test -d "otp_build@@/"; then + version_controller=clearcase + fi + fi +} # Execution of the different options @@ -1144,6 +1160,8 @@ check_erltop cd $ERL_TOP +determine_version_controller + # Unset ERL_FLAGS and ERL__FLAGS to prevent, for instance, # a value of "-hybrid" to run the hybrid emulator during bootstrap. sys_vsn=`awk '/SYSTEM_VSN = / {print $3}' < erts/vsn.mk` -- cgit v1.2.3 From 3e4db417a616038c9f327e9746544127067aa96e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 2 Dec 2009 19:22:55 +0100 Subject: Support updating the primary bootstrap in a git repository The commands in otp_build for updating the checked-in primary bootstrap only works in ClearCase. Add support updating the bootstrap in a git repository as well. Check the $version_controller variable so that we can have "otp_build update_primary" do different things depending on whether it is run in a ClearCase view or a git repository. When run in a git repository, "otp_build update_primary" will update and commit the bootstrap (to undo the updating of the bootstrap, do "git reset --hard HEAD^"). Update the usage text to only show the commands relevant to the kind of VCS it is being run in. --- otp_build | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-) (limited to 'otp_build') diff --git a/otp_build b/otp_build index 07edcb1d4d..efd1cad849 100755 --- a/otp_build +++ b/otp_build @@ -68,15 +68,23 @@ usage () echo "Before trying to cross compile, set environment via the following option" echo "Please note that the path to the configuration file should be absolute." echo " env_cross - echo environment settings for cross compilation, use with eval" - echo "" - echo "The following options concern the primary bootstrap." - echo "{prepare,update,commit,cancel}_primary is for actually updating" - echo "the checked in derivates of the main code base, they are not for" - echo "managing a downloaded spource-tree." - echo " prepare_primary - prepares for building primary bootstrap (only in Clearcase)" - echo " update_primary - creates the primary bootstrap, the one shipped" - echo " commit_primary - commits a primary bootstrap (only in Clearcase)" - echo " cancel_primary - uncheckout a primary bootstrap (only in Clearcase)" + case $version_controller in + none) + ;; + clearcase) + echo "" + echo "Handle the primary bootstrap in Clearcase:" + echo " prepare_primary - prepare for building a primary bootstrap" + echo " update_primary - create the primary bootstrap" + echo " commit_primary - commit a primary bootstrap" + echo " cancel_primary - uncheckout a primary bootstrap" + ;; + git) + echo "" + echo "update_primary - build and commit a new primary bootstrap" + ;; + esac + echo "" echo "The following options concern preloaded code." echo "They are, like the primary bootstrap, mainly the concern of the" @@ -829,6 +837,23 @@ do_primary () fi } +do_primary_git () +{ + setup_make + if [ "x$OVERRIDE_TARGET" != "x" -a "x$OVERRIDE_TARGET" != "xwin32" ]; then + do_primary_cross + else + $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET primary_bootstrap || exit 1; + fi + git add -A bootstrap/lib/kernel \ + bootstrap/lib/stdlib \ + bootstrap/lib/compiler \ + bootstrap/lib/orber/include \ + bootstrap/bin + git commit -m 'Update primary bootstrap' +} + + do_prepare () { CT=`lookup_prog_in_path cleartool` @@ -1282,7 +1307,11 @@ case "$1" in prepare_primary) do_prepare;; update_primary) - do_primary;; + case $version_controller in + git) do_primary_git ;; + clearcase) do_primary ;; + none) do_primary ;; + esac ;; commit_primary) do_commit;; cancel_primary) -- cgit v1.2.3 From 9c1b2d0c4dde604e46edf8d45000ab1d71dd3fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 6 Jan 2010 13:26:20 +0100 Subject: Support updating preloaded files in a git repository The commands in otp_build for updating the checked-in preloaded modules only works in ClearCase. Add support updating the preloaded files in a git repository as well. Check the $version_controller variable so that we can have "otp_build update_preloaded" do different things depending on whether it is run in a ClearCase view or a git repository. When run in a git repository, "otp_build update_preloaded" will update and commit the preloaded modules (to undo the updating of the preloaded modules, do "git reset --hard HEAD^"). Update the usage text to only show the commands relevant to the kind of VCS it is being run in. --- otp_build | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) (limited to 'otp_build') diff --git a/otp_build b/otp_build index efd1cad849..186c6c6363 100755 --- a/otp_build +++ b/otp_build @@ -85,14 +85,22 @@ usage () ;; esac - echo "" - echo "The following options concern preloaded code." - echo "They are, like the primary bootstrap, mainly the concern of the" - echo "main developers." - echo " prepare_preloaded - prepares for building preloaded code (only in Clearcase)" - echo " update_preloaded - creates the preloaded beam code, the one shipped" - echo " commit_preloaded - commits the preloaded code (only in Clearcase)" - echo " cancel_preloaded - uncheckout preloaded code (only in Clearcase)" + case $version_controller in + none) + ;; + clearcase) + echo "" + echo "Handle the preloaded modules in Clearcase:" + echo " prepare_preloaded - prepares for building preloaded code" + echo " update_preloaded - creates the preloaded code" + echo " commit_preloaded - commits the preloaded code" + echo " cancel_preloaded - uncheckout preloaded code" + ;; + git) + echo "" + echo "update_preloaded - build and commit the preloaded modules" + ;; + esac } export_cross_env () @@ -956,10 +964,6 @@ do_prepare_prel () do_update_prel () { CT=`lookup_prog_in_path cleartool` - if [ X"$CLEARCASE_ROOT" = X"" -o X"$CT" = X"" ]; then - echo "To prepare for update of preloaded code, you have to run in a Clearcase view" >&2 - return - fi if [ X"$ERL_TOP" = X"" ]; then echo "ERL_TOP is not set." >&2 @@ -975,6 +979,16 @@ do_update_prel () echo '*****************************************************' } +do_update_prel_git () +{ + setup_make + (cd $ERL_TOP/erts/preloaded/src && $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET clean) + $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET preloaded || exit 1 + (cd $ERL_TOP/erts/preloaded/src && $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET copy) + git add -A $ERL_TOP/erts/preloaded/ebin/*.beam + git commit -m 'Update preloaded modules' +} + do_commit_prel () { CT=`lookup_prog_in_path cleartool` @@ -1319,7 +1333,11 @@ case "$1" in prepare_preloaded) do_prepare_prel;; update_preloaded) - do_update_prel;; + case $version_controller in + git) do_update_prel_git ;; + clearcase) do_update_prel ;; + none) do_update_prel ;; + esac ;; commit_preloaded) do_commit_prel;; cancel_preloaded) -- cgit v1.2.3 From 812812e3f163a21640e51905baf42bca05acfdd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 6 Jan 2010 13:41:16 +0100 Subject: Fix spelling, remove obsolete command --- otp_build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'otp_build') diff --git a/otp_build b/otp_build index 186c6c6363..2503b09064 100755 --- a/otp_build +++ b/otp_build @@ -26,7 +26,7 @@ clearmake=false # Global configuration variables # -# NOTE: lazy_configure depends on '.' allways being last directory +# NOTE: lazy_configure depends on '.' always being last directory if [ -z "$ONLY_ERTS" ]; then AUTOCONF_SUBDIRS="lib lib/*" fi @@ -42,7 +42,6 @@ usage () echo " configure [] - does the actual configuration" echo " smp [-a] - build a small Erlang system, smp flavor" echo " hybrid [-a] - build a small Erlang system, hybrid flavor" - echo " nofrag [-a] - build a small Erlang system, nofrag flavor" echo " boot [-a] - bootstraps and build system (after configure)" echo " release - creates a small release to " echo " release [-a] - creates full release to " @@ -1309,7 +1308,7 @@ case "$1" in do_lazy_configure_target_clean;; opt) do_boot;; - plain|smp|hybrid|nofrag) + plain|smp|hybrid) if [ $minus_a_flag = false ]; then TYPE=opt fi; -- cgit v1.2.3