Remove temporary symlinks from pre-5.0 tool names
authorMark Abraham <mark.j.abraham@gmail.com>
Thu, 8 Jan 2015 07:41:22 +0000 (08:41 +0100)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Wed, 14 Jan 2015 06:33:18 +0000 (07:33 +0100)
Change-Id: I6c09eba804008294813f9445737602f563f9f944

CMakeLists.txt
docs/doxygen/lib/wrapperbinary.md
docs/install-guide/install-guide.md
src/gromacs/commandline/cmdlinemodulemanager.cpp
src/gromacs/commandline/tests/cmdlinemodulemanager.cpp
src/programs/CMakeLists.txt
src/programs/CreateLinks.cmake.cmakein [deleted file]

index dece7054da707afd13cfee5606f9256d7910d3bc..0d3e6d03f12a7c9e5cef22b2bdaed03390477edc 100644 (file)
@@ -220,9 +220,6 @@ option(GMX_OPENMP "Enable OpenMP-based multithreading" ON)
 
 option(GMX_USE_TNG "Use the TNG library for trajectory I/O" ON)
 
-if(UNIX)
-    option(GMX_SYMLINK_OLD_BINARY_NAMES "Create symbolic links for pre-5.0 binary names" ON)
-endif()
 option(GMX_BUILD_MDRUN_ONLY "Build and install only the mdrun binary" OFF)
 
 option(GMX_CYCLE_SUBCOUNTERS "Enable cycle subcounters to get a more detailed cycle timings" OFF)
index d40623c0bd840e36bb26cf4d453ffab6ad4c27c9..f3c5402a47e0b748beb485864322de32c41d48dd 100644 (file)
@@ -46,27 +46,21 @@ Command line manager {#section_wrapperbinary_manager}
 
 The core of the wrapper binary is the gmx::CommandLineModuleManager::run()
 method.  This method:
- 1. Checks whether the binary is invoked through a symlink.  If it is, it
-    searches the registered modules for names matching the name of the symlink
-    (with certain prefixes in the symlink name ignored).  If a match is found,
-    it continues as if the command was invoked as `gmx` _module_ `...`, where
-    _module_ is the name of the found module and `...` are the rest of the
-    arguments.
- 2. Parses the command line arguments before the module name as arguments to
+ 1. Parses the command line arguments before the module name as arguments to
     the wrapper binary.  Some arguments such as `-h` and `-version` cause rest
     of the command (the module name and all that follows) to be ignored.
3. If a module is specified, also checks the command line arguments after the
2. If a module is specified, also checks the command line arguments after the
     module name for the options understood by the wrapper binary, such as `-h`
     and `-version` (see below for details of how `-h` works).  Any such options
     are handled by the manager and removed from the command line for further
     processing.
4. Print the startup header (contents of which can be controlled by the
3. Print the startup header (contents of which can be controlled by the
     command line options).
5. If a command line option requests termination after the startup header
4. If a command line option requests termination after the startup header
     (such as `-version`), return.
6. Passes control to the selected module.  If there is no module specified,
5. Passes control to the selected module.  If there is no module specified,
     the help module is invoked (see below).
7. Print a quote at the end, and return the exit code from the module.
6. Print a quote at the end, and return the exit code from the module.
 
 Command line help
 -----------------
index 095db26641212c0303656e4d8f6fe8c657dd70dc..65e807a363583d37e7a269b793618d458ea65931 100644 (file)
@@ -643,7 +643,7 @@ the directories can be renamed by editing the installation paths in the main
 CMakeLists.txt.
 
 `bin/`
-  : The standard location for executables, some scripts, and some symlinks.
+  : The standard location for executables and some scripts.
     Some of the scripts hardcode the absolute installation prefix, which needs
     to be changed if the scripts are relocated.
 `include/gromacs/`
index 599041e9eaa4128e236f1ffb18438ad76745336b..d29a8212afe67c511256b1f9a8e409171660e315 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -43,8 +43,6 @@
 
 #include "cmdlinemodulemanager.h"
 
-#include "config.h"
-
 #include <cstdio>
 
 #include <string>
@@ -248,24 +246,6 @@ class CommandLineModuleManager::Impl
          */
         CommandLineModuleMap::const_iterator
         findModuleByName(const std::string &name) const;
-        /*! \brief
-         * Finds a module that the name of the binary.
-         *
-         * \param[in] invokedName  Name by which the program was invoked.
-         * \throws    std::bad_alloc if out of memory.
-         * \returns   Iterator to the found module, or
-         *      \c modules_.end() if not found.
-         *
-         * Checks whether the program is invoked through a symlink whose name
-         * is different from \a binaryName_, and if so, checks
-         * if a module name matches the name of the symlink.
-         *
-         * Note that the \p invokedName parameter is currently not necessary
-         * (as the program context object is also available and provides this
-         * value), but it clarifies the control flow.
-         */
-        CommandLineModuleMap::const_iterator
-        findModuleFromBinaryName(const char *invokedName) const;
 
         /*! \brief
          * Processes command-line options for the wrapper binary.
@@ -359,45 +339,12 @@ CommandLineModuleManager::Impl::findModuleByName(const std::string &name) const
     return modules_.find(name);
 }
 
-CommandLineModuleMap::const_iterator
-CommandLineModuleManager::Impl::findModuleFromBinaryName(
-        const char *invokedName) const
-{
-    std::string moduleName = invokedName;
-#ifdef GMX_BINARY_SUFFIX
-    moduleName = stripSuffixIfPresent(moduleName, GMX_BINARY_SUFFIX);
-#endif
-    if (moduleName == binaryName_)
-    {
-        return modules_.end();
-    }
-    if (startsWith(moduleName, "g_"))
-    {
-        moduleName.erase(0, 2);
-    }
-    if (startsWith(moduleName, "gmx"))
-    {
-        moduleName.erase(0, 3);
-    }
-    return findModuleByName(moduleName);
-}
-
 CommandLineModuleInterface *
 CommandLineModuleManager::Impl::processCommonOptions(
         CommandLineCommonOptionsHolder *optionsHolder, int *argc, char ***argv)
 {
     // Check if we are directly invoking a certain module.
     CommandLineModuleInterface *module = singleModule_;
-    if (module == NULL)
-    {
-        // Also check for invokation through named symlinks.
-        CommandLineModuleMap::const_iterator moduleIter
-            = findModuleFromBinaryName(programContext_.programName());
-        if (moduleIter != modules_.end())
-        {
-            module = moduleIter->second.get();
-        }
-    }
 
     // TODO: It would be nice to propagate at least the -quiet option to
     // the modules so that they can also be quiet in response to this.
index ebb3ee1f5fb67d5dce49bdaafc21b23baa943a41..6a420e921ed7bc7ae6ee98245156990013c12352 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -260,23 +260,6 @@ TEST_F(CommandLineModuleManagerTest, RunsModuleHelpWithDashH)
     ASSERT_EQ(0, rc);
 }
 
-TEST_F(CommandLineModuleManagerTest, RunsModuleHelpWithDashHWithSymLink)
-{
-    const char *const cmdline[] = {
-        "g_module", "-h"
-    };
-    CommandLine       args(cmdline);
-    initManager(args, "test");
-    MockModule       &mod1 = addModule("module", "First module");
-    addModule("other", "Second module");
-    using ::testing::_;
-    EXPECT_CALL(mod1, writeHelp(_));
-    mod1.setExpectedDisplayName("test module");
-    int rc = 0;
-    ASSERT_NO_THROW_GMX(rc = manager().run(args.argc(), args.argv()));
-    ASSERT_EQ(0, rc);
-}
-
 TEST_F(CommandLineModuleManagerTest, RunsModuleHelpWithDashHWithSingleModule)
 {
     const char *const cmdline[] = {
@@ -310,46 +293,6 @@ TEST_F(CommandLineModuleManagerTest, PrintsHelpOnTopic)
     ASSERT_EQ(0, rc);
 }
 
-TEST_F(CommandLineModuleManagerTest, RunsModuleBasedOnBinaryName)
-{
-    const char *const cmdline[] = {
-        "g_module", "-flag", "yes"
-    };
-    CommandLine       args(cmdline);
-    initManager(args, "test");
-    MockModule       &mod1 = addModule("module", "First module");
-    addModule("other", "Second module");
-    using ::testing::_;
-    using ::testing::Args;
-    using ::testing::ElementsAreArray;
-    EXPECT_CALL(mod1, init(_));
-    EXPECT_CALL(mod1, run(_, _))
-        .With(Args<1, 0>(ElementsAreArray(args.argv(), args.argc())));
-    int rc = 0;
-    ASSERT_NO_THROW_GMX(rc = manager().run(args.argc(), args.argv()));
-    ASSERT_EQ(0, rc);
-}
-
-TEST_F(CommandLineModuleManagerTest, RunsModuleBasedOnBinaryNameWithPathAndSuffix)
-{
-    const char *const cmdline[] = {
-        "/usr/local/gromacs/bin/g_module" GMX_BINARY_SUFFIX ".exe", "-flag", "yes"
-    };
-    CommandLine       args(cmdline);
-    initManager(args, "test");
-    MockModule       &mod1 = addModule("module", "First module");
-    addModule("other", "Second module");
-    using ::testing::_;
-    using ::testing::Args;
-    using ::testing::ElementsAreArray;
-    EXPECT_CALL(mod1, init(_));
-    EXPECT_CALL(mod1, run(_, _))
-        .With(Args<1, 0>(ElementsAreArray(args.argv(), args.argc())));
-    int rc = 0;
-    ASSERT_NO_THROW_GMX(rc = manager().run(args.argc(), args.argv()));
-    ASSERT_EQ(0, rc);
-}
-
 TEST_F(CommandLineModuleManagerTest, HandlesConflictingBinaryAndModuleNames)
 {
     const char *const cmdline[] = {
index d4643c9d94856b1687b9bdad30c371507fb71585..b6d6d44cbc074c97520f69ce0bd2ee6ceb9c7fe7 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+# Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -109,12 +109,6 @@ else()
     endif()
     gmx_cpack_add_generated_source_directory(completion)
 
-    if (GMX_SYMLINK_OLD_BINARY_NAMES)
-        configure_file(CreateLinks.cmake.cmakein CreateLinks.cmake @ONLY)
-        set(CREATE_LINKS_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/CreateLinks.cmake)
-        install(SCRIPT ${CREATE_LINKS_SCRIPT} COMPONENT links)
-    endif()
-
     if(BUILD_TESTING)
         add_subdirectory(mdrun/tests)
     endif()
diff --git a/src/programs/CreateLinks.cmake.cmakein b/src/programs/CreateLinks.cmake.cmakein
deleted file mode 100644 (file)
index 21579be..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-#
-# This file is part of the GROMACS molecular simulation package.
-#
-# Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
-# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
-# and including many others, as listed in the AUTHORS file in the
-# top-level source directory and at http://www.gromacs.org.
-#
-# GROMACS is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation; either version 2.1
-# of the License, or (at your option) any later version.
-#
-# GROMACS is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with GROMACS; if not, see
-# http://www.gnu.org/licenses, or write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
-#
-# If you want to redistribute modifications to GROMACS, please
-# consider that scientific software is very special. Version
-# control is crucial - bugs must be traceable. We will be happy to
-# consider code for inclusion in the official distribution, but
-# derived work must not be called official GROMACS. Details are found
-# in the README & COPYING files - if they are missing, get the
-# official version at http://www.gromacs.org.
-#
-# To help us fund GROMACS development, we humbly ask that you cite
-# the research papers on the package. Check out http://www.gromacs.org.
-
-# TODO: It would be nicer to have the list generated from the binary,
-# but this has some complications.  As the same list is also needed for
-# man page generation, this can wait for now.
-set(SYMLINK_NAMES
-    mdrun
-    gmxcheck
-    gmxdump
-    grompp
-    pdb2gmx
-    tpbconv
-    g_protonate
-    g_x2top
-    do_dssp
-    editconf
-    eneconv
-    genbox
-    genconf
-    genion
-    genrestr
-    make_edi
-    make_ndx
-    mk_angndx
-    trjcat
-    trjconv
-    trjorder
-    xpm2ps
-    g_anadock
-    g_anaeig
-    g_analyze
-    g_angle
-    g_bar
-    g_bond
-    g_bundle
-    g_chi
-    g_cluster
-    g_clustsize
-    g_confrms
-    g_covar
-    g_current
-    g_density
-    g_densmap
-    g_densorder
-    g_dielectric
-    g_dipoles
-    g_disre
-    g_dist
-    g_dos
-    g_dyecoupl
-    g_dyndom
-    g_enemat
-    g_energy
-    g_filter
-    g_gyrate
-    g_h2order
-    g_hbond
-    g_helix
-    g_helixorient
-    g_hydorder
-    g_lie
-    g_mdmat
-    g_mindist
-    g_morph
-    g_msd
-    g_nmeig
-    g_nmens
-    g_nmtraj
-    g_options
-    g_order
-    g_pme_error
-    g_polystat
-    g_potential
-    g_principal
-    g_rama
-    g_rms
-    g_rmsdist
-    g_rmsf
-    g_rotacf
-    g_rotmat
-    g_saltbr
-    g_sans
-    g_sas
-    g_saxs
-    g_select
-    g_sgangle
-    g_sham
-    g_sigeps
-    g_sorient
-    g_spatial
-    g_spol
-    g_tcaf
-    g_traj
-    g_tune_pme
-    g_vanhove
-    g_velacc
-    g_wham
-    g_wheel
-    )
-
-if (NOT DEFINED BINARY_DIRECTORY)
-    set(BINARY_DIRECTORY "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@BIN_INSTALL_DIR@")
-endif ()
-set(BINARY_SUFFIX "@GMX_BINARY_SUFFIX@@CMAKE_EXECUTABLE_SUFFIX@")
-set(GMX_NATIVE_WINDOWS "@GMX_NATIVE_WINDOWS@")
-
-foreach (linkname ${SYMLINK_NAMES})
-    set(linkpath ${BINARY_DIRECTORY}/${linkname}${BINARY_SUFFIX})
-    # Based on documentation, CMake only supports symbolic links on Unix,
-    # although NTFS also has those (since Windows Vista; they require admin
-    # permissions to create).
-    if (GMX_NATIVE_WINDOWS)
-        if (NOT QUIETLY)
-            message(STATUS "Installing: Creating alias binary ${linkpath}")
-        endif ()
-        execute_process(
-            COMMAND ${CMAKE_COMMAND} -E copy_if_different
-                ${BINARY_DIRECTORY}/gmx${BINARY_SUFFIX} ${linkpath})
-    else()
-        if (NOT QUIETLY)
-            message(STATUS "Installing: Creating symbolic link ${linkpath}")
-        endif ()
-        if (EXISTS ${linkpath})
-            FILE(REMOVE ${linkpath})
-        endif ()
-        execute_process(
-            COMMAND ${CMAKE_COMMAND} -E create_symlink
-                gmx${BINARY_SUFFIX} ${linkpath})
-    endif()
-endforeach ()