Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-61012

Instantiation of TEMPLATE rule sometimes has a command in generated ninja

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.2.0, 5.1.2, 5.0.6
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v5.1, v5.0
    • Dev Platform 2021-11-01, Dev Platform 2021-11-15

      The TEMPLATE rule doesn't care about your `cmd` value:

      rule TEMPLATE
        command = $SCONS_INVOCATION $out
        description = Rendering $out
        pool = scons_pool
        restat = 1
      

      But if you have a stanza like this in your SCons:

      env.Command(
          target=[
              'feature_flag_test.idl',
          ],
          source=[
              '#buildscripts/cheetah_source_generator.py',
              'feature_flag_test.idl.tpl',
              '$BUILD_DIR/mongo/util/version/releases.yml',
          ],
          action=[
              '$PYTHON ${SOURCES[0]} -o ${TARGETS[0]} ${SOURCES[1]} ${SOURCES[2]} ${MONGO_VERSION}',
          ],
          # Ensure that that SCons is used to produce this file rather than Ninja, to avoid spurious
          # dependency cycles due to how we manage generated sources with Ninja.
          NINJA_TEMPLATE=True,
      )
      

      It ends up in the `cmd` stanza of the sole invocation of the `TEMPLATE` rule:

      build build/aib_make_archive.py build/cached/mongo/config.h $
          build/cached/mongo/idl/feature_flag_test.idl build/cached/mongo/util/version_constants.h $
          build/cached/resmoke.ini build/cached/third_party/third_party_shim.cpp $
          build/cached/third_party/wiredtiger/wiredtiger.h: TEMPLATE src/mongo/config.h.in $
          buildscripts/cheetah_source_generator.py src/mongo/idl/feature_flag_test.idl.tpl $
          src/mongo/util/version/releases.yml src/mongo/util/version_constants.h.in $
          src/third_party/wiredtiger/src/include/wiredtiger.in | $
          buildscripts/cheetah_source_generator.py src/mongo/util/version/releases.yml $
          src/mongo/idl/feature_flag_test.idl.tpl @install_dir@$ install//usr/locala/bin
        cmd = /Users/acm/.virtualenvs/mongo/bin/python buildscripts/cheetah_source_generator.py -o $
            build/cached/mongo/idl/feature_flag_test.idl src/mongo/idl/feature_flag_test.idl.tpl $
            src/mongo/util/version/releases.yml 5.1.0-alpha-1746-g1cf0b1f
        env = export PATH='/usr/local/bin:/opt/bin:/bin:/usr/bin';export $
            PATHOSX='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin';
      

      This is harmless, since TEMPLATE isn't going to honor it, but it is confusing when reading the generated ninja file and is probably something we should avoid doing.

            Assignee:
            daniel.moody@mongodb.com Daniel Moody
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: