Skip to content
Snippets Groups Projects

Move the logger in a submodule

Merged Loic Hausammann requested to merge test into master

A lot of changes here, but it is mostly a big git rm -rf logger. The submodule is now hosted here https://gitlab.cosma.dur.ac.uk/lhausammann/csds-reader

The interesting changes are:

  • Adding a submodule called CSDS
  • autogen.sh is now updating the submodules (it is required due to the way AC_CONFIG_FILES is working)
  • When running ./configure --enable-csds, I am also updating the submodule to be safe
  • I am adding an old script from Peter to update the submodules

Due to the changes in the structure, some scripts for the logger might be broken now. As I am planning to rename everything, I will test and fix everything once the renaming is done.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Matthieu Schaller assigned to @pdraper and unassigned @matthieu

    assigned to @pdraper and unassigned @matthieu

  • Do we need the autogen.sh to pull the sub-module? It seems to me that would defy the whole purpose of having a submodule in the first place if it always gets pulled.

  • I agree with you, but when you define an AC_CONFIG_FILES, the files need to be defined even if it is inside an if. If you have another suggestion, I will happily implement it.

  • If you really want to pull the submodule later then you need to have configure in logger as well and use the AC_CONFIG_SUBDIRS() macro to call it or not, see:

    https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Subdirectories.html

  • It seems that with AC_CONFIG_SUBDIRS, I need to redefine everything that is done in SWIFT.

    My current csds/configure.ac:

    AC_INIT([CSDS], [1.0])
    AC_CONFIG_AUX_DIR([.])
    AM_INIT_AUTOMAKE([subdir-objects])
    AC_PROG_CC
    AM_PROG_AR
    AC_PROG_RANLIB
    AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
    AC_OUTPUT

    The output when I run ./autogen.sh:

    
    Makefile.am: error: required file './NEWS' not found
    Makefile.am: error: required file './README' not found
    Makefile.am: error: required file './AUTHORS' not found
    Makefile.am: error: required file './ChangeLog' not found
    src/Makefile.am:48: error: HAVE_STARS_BASIC does not appear in AM_CONDITIONAL
    src/Makefile.am:51: error: HAVE_STARS_GEAR does not appear in AM_CONDITIONAL
    src/Makefile.am:56: error: HAVE_SPHENIX does not appear in AM_CONDITIONAL
    src/Makefile.am:59: error: HAVE_GADGET2 does not appear in AM_CONDITIONAL
    src/Makefile.am:64: error: HAVE_CHEMISTRY_NONE does not appear in AM_CONDITIONAL
    src/Makefile.am:67: error: HAVE_CHEMISTRY_GEAR does not appear in AM_CONDITIONAL
    src/Makefile.am:72: error: HAVE_STAR_FORMATION_DEFAULT does not appear in AM_CONDITIONAL
    src/Makefile.am:75: error: HAVE_STAR_FORMATION_GEAR does not appear in AM_CONDITIONAL
    src/Makefile.am:89: error: HAVEPYTHON does not appear in AM_CONDITIONAL
    src/Makefile.am:93: error: HAVEPYTHON does not appear in AM_CONDITIONAL
    src/Makefile.am:40: error: Libtool library used but 'LIBTOOL' is undefined
    src/Makefile.am:40:   The usual way to define 'LIBTOOL' is to add 'LT_INIT'
    src/Makefile.am:40:   to 'configure.ac' and run 'aclocal' and 'autoconf' again.
    src/Makefile.am:40:   If 'LT_INIT' is in 'configure.ac', make sure
    src/Makefile.am:40:   its definition is in aclocal's search path.
    
    autoreconf: automake failed with exit status: 1

    Do you have a way to avoid the copy?

  • No, you will need to make logger a thirdparty code to work like this. Most submodules are that, code from other projects that you want to include by default, so also have an independent life.

    How about: https://www.gnu.org/software/automake/manual/html_node/Usage-of-Conditionals.html as an approach instead?

  • (see the bottom)

  • Unfortunately, you need the file in order to call autoreconf (even if you are not using it). A solution could be to write empty files just before calling autoreconf but then the issue will be to remove the files when updating the submodule.

  • And that is probably autoconf not automake, so unlikely to have a workaround. git is very fussy about having content in the submodule directories, so I suspect that will never work, as well as being unpleasant.

    So you're stuck with adding all the missing configure stuff, or always having the submodule pulled and present.

  • added 1 commit

    • 4b78b764 - Trick autoconf with submodule

    Compare with previous version

  • With the following trick, it seems to work and I keep a clean submodule directory.

    autogen.sh:

    #! /bin/sh
    
    #  Update generated configuration files, i.e. do work so that a
    #  developer checkout can be configured.
    
    if [ -f csds/Makefile.am ]; then
        fake_sub=0
    else
        echo Creating fake files
        fake_sub=1
        mkdir csds/src csds/tests
        touch csds/Makefile.am csds/src/Makefile.am csds/tests/Makefile.am
    fi
    
    autoreconf --install --symlink
    
    if [ $fake_sub -eq 1 ]; then
        echo Removing fake files
        rm -rf csds/src csds/tests
        rm csds/Makefile.am csds/Makefile.in
    fi
    
    exit
  • So what happens when you then pull in the logger submodule? I'd guess it works as make will then rerun autoconf?

  • If you recall autogen.sh, everything is fine. I will try to do it with ./configure --enable-csds and a make later (I will be without internet for a few hours).

  • added 1 commit

    • 6b912b8a - Ensure that everything is alright with the submodule

    Compare with previous version

  • To ensure that everything is alright, I am now checking if csds/Makefile.in exists and if it is not the case, I am aborting configure and print a message saying that autogen.sh should be run again.

    if test "$with_csds" = "yes"; then
       AC_DEFINE([WITH_LOGGER], 1, [csds enabled])
       # Ensure that the submodule is initialized
       ${srcdir}/tools/update-modules csds
       # The csds requires that long long is a 64bit type, let's
       # check that.
       AC_CHECK_SIZEOF([long long int])
       if test "$ac_cv_sizeof_long_long_int" != "8"; then
          AC_MSG_ERROR([The CSDS requires that 'long long int' has size 8 bytes])
       fi
    
       # Ensure that everything is alright for the CSDS
       if test ! -f csds/Makefile.in; then
          AC_MSG_ERROR([It seems that the submodule "CSDS" was not initialized, please rerun autogen.sh and reconfigure.])
       fi
    
    fi
    AM_CONDITIONAL([HAVELOGGER],[test $with_csds = "yes"])
    AM_COND_IF([HAVELOGGER], [AC_CONFIG_FILES([csds/Makefile csds/src/Makefile csds/tests/Makefile])])

    What do you think?

  • added 1 commit

    • 10d67ede - Need execute permissions on script

    Compare with previous version

  • Seems to be working, a little hacky, so any comments from others?

  • I'll have a look on Monday. It seems more hacky than I feel it should be for commonly seen situation.

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading