You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bb...@apache.org on 2019/09/18 10:52:41 UTC

[mesos] 04/09: Added separate script to install developer setup.

This is an automated email from the ASF dual-hosted git repository.

bbannier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit a138c2bd7cb3749f1dceb0e520e1138536abb531
Author: Benjamin Bannier <bb...@apache.org>
AuthorDate: Wed Sep 18 11:37:13 2019 +0200

    Added separate script to install developer setup.
    
    This patch breaks the installation of developer tools (i.e., linter
    configuration files and git hooks) out of `./bootstrap`. This not only
    simplifies and streamlines the setup, but will allow us to add
    developer-only features without breaking users who are just interested
    in building a distribution tarball.
    
    Review: https://reviews.apache.org/r/71299/
---
 bootstrap                              | 78 ----------------------------------
 docs/advanced-contribution.md          |  2 +-
 docs/beginner-contribution.md          |  2 +-
 docs/clang-format.md                   |  5 ++-
 support/gitignore                      | 12 +++---
 support/llvm/README.md                 | 14 +++---
 bootstrap.bat => support/setup-dev.bat |  2 +-
 bootstrap => support/setup-dev.sh      | 58 ++++++++-----------------
 8 files changed, 38 insertions(+), 135 deletions(-)

diff --git a/bootstrap b/bootstrap
index e88e8cb..5727550 100755
--- a/bootstrap
+++ b/bootstrap
@@ -10,84 +10,6 @@ __EOF__
     exit 1
 fi
 
-# Helper functions to get the absolute path of a directory as well as compute
-# the relative path between two directories.
-# Unfortunately these functions are not as readable as, say, python's
-# os.path.relpath method, but they allow us to avoid a hard dependence on
-# python or other tools during bootstrap.
-abspath() {
-    cd "`dirname "${1}"`"
-    echo "${PWD}"/"`basename "${1}"`"
-    cd "${OLDPWD}"
-}
-relpath() {
-  local from to up
-  from="`abspath "${1%/}"`" to="`abspath "${2%/}"/`"
-  while test "${to}"  = "${to#"${from}"/}" \
-          -a "${to}" != "${from}"; do
-    from="${from%/*}" up="../${up}"
-  done
-  to="${up%/}${to#${from}}"
-  echo "${to:-.}"
-}
-
-# Grab a reference to the repo's git directory. Usually this is simply .git in
-# the repo's top level directory. However, when submodules are used, it may
-# appear elsewhere. The most up-to-date way of finding this directory is to use
-# `git rev-parse --git-common-dir`. This is necessary to support things like
-# git worktree in addition to git submodules. However, as of January 2016,
-# support for the '--git-common-dir' flag is fairly new, forcing us to fall
-# back to the older '--git-dir' flag if '--git-common-dir' is not supported. We
-# do this by checking the output of `git rev-parse --git-common-dir` and seeing
-# if it gives us a valid directory back. If not, we set the git directory using
-# the '--git-dir' flag instead.
-_gitdir=`git rev-parse --git-common-dir`
-if test ! -d "${_gitdir}"; then
-  _gitdir=`git rev-parse --git-dir`
-fi
-
-# Grab a reference to the git hooks directory as well as the relative path from
-# the git hooks directory to the current directory.
-_hooksdir=${_gitdir}/hooks
-_relpath=`relpath "${_hooksdir}" "${PWD}"`
-
-# Install mesos default hooks and gitignore template.
-if test ! -e "${_hooksdir}/pre-commit"; then
-  ln -s "${_relpath}/support/hooks/pre-commit" "${_hooksdir}/pre-commit"
-fi
-
-if test ! -e "${_hooksdir}/post-rewrite"; then
-  ln -s "${_relpath}/support/hooks/post-rewrite" "${_hooksdir}/post-rewrite"
-fi
-
-if test ! -e "${_hooksdir}/commit-msg"; then
-  ln -s "${_relpath}/support/hooks/commit-msg" "${_hooksdir}/commit-msg"
-fi
-
-if test ! -e .gitignore; then
-  ln -s support/gitignore .gitignore
-fi
-
-if test ! -e .reviewboardrc; then
-  ln -s support/reviewboardrc .reviewboardrc
-fi
-
-if test ! -e .clang-format; then
-  ln -s support/clang-format .clang-format
-fi
-
-if test ! -e .clang-tidy; then
-  ln -s support/clang-tidy .clang-tidy
-fi
-
-if test ! -e CPPLINT.cfg; then
-  ln -s support/CPPLINT.cfg CPPLINT.cfg
-fi
-
-if test ! -e .gitlint; then
-  ln -s support/gitlint .gitlint
-fi
-
 if [ -n "$AUTOMAKE" ] || [ -n "$ACLOCAL" ] ; then
     if [ -z "$ACLOCAL" ] || [ -z "$AUTOMAKE" ] ; then
         _present="AUTOMAKE"
diff --git a/docs/advanced-contribution.md b/docs/advanced-contribution.md
index 573138d..6582849 100644
--- a/docs/advanced-contribution.md
+++ b/docs/advanced-contribution.md
@@ -66,7 +66,7 @@ Here is the standard procedure for proposing and making changes to Mesos:
 2. Make your changes to the code (using whatever IDE/editor you choose) to actually fix the bug or implement the feature.
     1. Before beginning, please read the [Mesos C++ Style Guide](c++-style-guide.md). It is recommended to use the git pre-commit hook (`support/hooks/pre-commit`) to automatically check for style errors. See the hook script for instructions to enable it.
     2. Most of your changes will probably be to files inside of `BASE_MESOS_DIR`
-    3. From inside of the root Mesos directory: `./bootstrap` (Only required if building from git repository).
+    3. From inside of the root Mesos directory: `./bootstrap` and `./support/setup-dev.sh`.
     4. To build, we recommend that you don't build inside of the src directory. We recommend you do the following:
         1. From inside of the root Mesos directory: `mkdir build && cd build`
         2. `../configure`
diff --git a/docs/beginner-contribution.md b/docs/beginner-contribution.md
index 471f5dd..3a49862 100644
--- a/docs/beginner-contribution.md
+++ b/docs/beginner-contribution.md
@@ -19,7 +19,7 @@ First, download the latest development version of the Mesos codebase. In order t
 
 If you're proposing a documentation-only change, then you don't need to build Mesos to get started.
 
-If you're making a functional change to the code, then you should build Mesos first. Once you have the Mesos source code on your local machine, you can install the necessary dependencies and build it. Instructions for this process can be found in the [building](building.md) page. Note that the `bootstrap` script in the repository's root directory will install git hooks which will help you adhere to Mesos style when committing.
+If you're making a functional change to the code, then you should build Mesos first. Once you have the Mesos source code on your local machine, you can install the necessary dependencies and build it. Instructions for this process can be found in the [building](building.md) page. Note that the `./support/setup-dev.sh` script will install git hooks which will help you adhere to Mesos style when committing.
 
 ## Find a Problem to Solve
 
diff --git a/docs/clang-format.md b/docs/clang-format.md
index 4289813..ff00685 100644
--- a/docs/clang-format.md
+++ b/docs/clang-format.md
@@ -36,8 +36,9 @@ layout: documentation
 
 By default, ClangFormat uses the configuration defined in a `.clang-format` or
 `_clang-format` file located in the nearest parent directory of the input file.
-The `bootstrap` script creates a `.clang-format` symlink at the top-level
-directory which points to `support/clang-format` for ClangFormat to find.
+The `./support/setup-dev.sh` script creates a `.clang-format` symlink at the
+top-level directory which points to `support/clang-format` for ClangFormat to
+find.
 
 
 ### Editor Integration
diff --git a/support/gitignore b/support/gitignore
index 3d53411..703b14b 100644
--- a/support/gitignore
+++ b/support/gitignore
@@ -2,11 +2,6 @@
 .gitignore
 
 # Files created by ./bootstrap.
-.clang-format
-.clang-tidy
-.reviewboardrc
-.gitlint
-CPPLINT.cfg
 Makefile.in
 aclocal.m4
 ar-lib
@@ -25,6 +20,13 @@ ltversion.m4
 lt~obsolete.m4
 missing
 
+# Files created by ./support/setup-dev.sh
+.clang-format
+.clang-tidy
+.reviewboardrc
+.gitlint
+CPPLINT.cfg
+
 # Recommended build directory.
 /build/
 
diff --git a/support/llvm/README.md b/support/llvm/README.md
index 1889302..7491c4e 100644
--- a/support/llvm/README.md
+++ b/support/llvm/README.md
@@ -28,9 +28,9 @@ and format selected regions of code.
 ### Configuration
 
 By default, [ClangFormat] uses the configuration defined in a `.clang-format`
-file located in the nearest parent directory of the input file.
-The `bootstrap` script creates a `.clang-format` symlink at `<MESOS_DIR>`
-which points to `support/clang-format` for [ClangFormat] to find.
+file located in the nearest parent directory of the input file. The
+`support/setup-dev.sh` script creates a `.clang-format` symlink at
+`<MESOS_DIR>` which points to `support/clang-format` for [ClangFormat] to find.
 
 ### Integration
 
@@ -55,10 +55,10 @@ Refer to https://clang.llvm.org/docs/ClangFormat.html#vim-integration
 
 ### Configuration
 
-By default, [ClangTidy] uses the configuration defined in a `.clang-tidy`
-file located in the nearest parent directory of the input file.
-The `bootstrap` script creates a `.clang-tidy` symlink at `<MESOS_DIR>`
-which points to `support/clang-tidy` for [ClangTidy] to find.
+By default, [ClangTidy] uses the configuration defined in a `.clang-tidy` file
+located in the nearest parent directory of the input file. The
+`./support/setup-dev.sh` script creates a `.clang-tidy` symlink at
+`<MESOS_DIR>` which points to `support/clang-tidy` for [ClangTidy] to find.
 
 ### Invocation
 
diff --git a/bootstrap.bat b/support/setup-dev.bat
similarity index 96%
rename from bootstrap.bat
rename to support/setup-dev.bat
index 7ca6449..3f4154a 100644
--- a/bootstrap.bat
+++ b/support/setup-dev.bat
@@ -70,7 +70,7 @@ goto:eof
 :: If we are not in the root directory, print error and exit.
 :not_in_root
 echo. 1>&2
-echo You must run bootstrap from the root of the distribution. 1>&2
+echo You must run support/setup-dev.bat from the root of the distribution. 1>&2
 echo. 1>&2
 
 exit /b 1
diff --git a/bootstrap b/support/setup-dev.sh
similarity index 70%
copy from bootstrap
copy to support/setup-dev.sh
index e88e8cb..183effa 100755
--- a/bootstrap
+++ b/support/setup-dev.sh
@@ -1,10 +1,26 @@
 #!/bin/sh
 
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 # Make sure that we are in the right directory.
 if test ! -f configure.ac; then
     cat >&2 <<__EOF__
 
-You must run bootstrap from the root of the distribution.
+You must run 'support/setup-dev.sh' from the root of the distribution.
 
 __EOF__
     exit 1
@@ -64,6 +80,7 @@ if test ! -e "${_hooksdir}/commit-msg"; then
   ln -s "${_relpath}/support/hooks/commit-msg" "${_hooksdir}/commit-msg"
 fi
 
+
 if test ! -e .gitignore; then
   ln -s support/gitignore .gitignore
 fi
@@ -87,42 +104,3 @@ fi
 if test ! -e .gitlint; then
   ln -s support/gitlint .gitlint
 fi
-
-if [ -n "$AUTOMAKE" ] || [ -n "$ACLOCAL" ] ; then
-    if [ -z "$ACLOCAL" ] || [ -z "$AUTOMAKE" ] ; then
-        _present="AUTOMAKE"
-        _missing="ACLOCAL"
-
-        [ -n "$ACLOCAL" ] && _present="ACLOCAL" && _missing="AUTOMAKE"
-
-        cat >&2 <<__EOF__
-
-[ERROR]: You are providing the path to ${_present}
-through your environment but no reference to ${_missing}.
-To fix this error please specify ${_missing} too.
-
-As an example, if you are using automake-1.12 and have
-available aclocal-1.12 you will want to do the following:
-
-    AUTOMAKE="/usr/local/bin/automake-1.12" \\
-    ACLOCAL="/usr/local/bin/aclocal-1.12"   \\
-    ./bootstrap
-
-Your current environment has:
-    AUTOMAKE="$AUTOMAKE"
-    ACLOCAL="$ACLOCAL"
-
-__EOF__
-        exit 1
-    fi
-else
-    AUTOMAKE="$(which automake)"
-fi
-
-
-# Note that we don't use '--no-recursive' because older versions of
-# autoconf/autoreconf bail with that option. Unfortunately this means
-# that we'll modify a lot of files in 3rdparty/libprocess, but that
-# may change in the future.
-
-autoreconf --install -Wall --verbose "${@}"