BUILD_DESC_FROM_UNKNOWN in src/version.cpp #4745

issue MarkPfennig opened this issue on August 21, 2014
  1. MarkPfennig commented at 5:19 AM on August 21, 2014: none

    version.cpp currently applies one of three version suffixes

    • -BUILD_SUFFIX, when building from an untagged commit
    • -gtag-dirty, when building from an archive
    • -unk, when building from a currently tagged commit/release

    It seems rather strange that the 'ideal' build, a new tagged release cross compiled in gitian, would result in a suffix of 'unknown' using BUILD_DESC_FROM_UNKNOWN.

    Perhaps BUILD_DESC_FROM_UNKNOWN would be better suited to builds where the source is unknown, with no suffix applied to tag matching release builds.

    Does that make sense?

    Details

    If you tag a for a release, then build it, the output of share/genbuild.sh will be something like:

    #define BUILD_DESC "v0.9.2.2"
    #define BUILD_DATE "2014-08-21 05:44:34 +0100"
    

    Then if you follow the logic in src/version.cpp you will find

    #ifndef BUILD_DESC
    #    ifdef BUILD_SUFFIX
    #        define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX)
    #    elif defined(GIT_COMMIT_ID)
    #        define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID)
    #    else
    #        define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD)
    #    endif
    #endif
    

    In english: If there's a tagged clean release, with no dirty suffix, and not a downloaded archive, then say it is from an unknown source.

  2. laanwj added the label Build system on Aug 21, 2014
  3. theuni commented at 3:46 PM on August 21, 2014: member

    Gitian builds are generated from the official (deterministic) source tarballs, which include the "git archive'd" version.cpp. Git replaces some place-holders with real info (deterministic, since it's based on a tag's hash). So real releases hit the GIT_COMMIT_ID path rather than the else path.

    For instance, from my current working tree: make dist untar that check bitcoin-* folder, src/version.cpp Mine looks like this:

    #define GIT_ARCHIVE 1
    #ifdef GIT_ARCHIVE
    #    define GIT_COMMIT_ID "36d51b8"
    #    define GIT_COMMIT_DATE "Thu, 21 Aug 2014 00:00:06 -0400"
    #endif
    
  4. MarkPfennig commented at 6:57 PM on August 21, 2014: none

    Very simple code that achieves the same thing, and handles four uses rather than three:

    #ifndef BUILD_DESC
    #    ifdef BUILD_SUFFIX // any commit
    #        define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX)
    #    elif defined(GIT_COMMIT_ID) // archive release
    #        define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID)
    #    else // tagged commit
    #        define BUILD_DESC BUILD_DESC_FROM_TAG(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD)
    #    endif
    #else // unknown source
    #  define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD)
    #endif
    
  5. theuni commented at 10:10 PM on August 21, 2014: member

    What problem are you trying to solve?

  6. laanwj closed this on Nov 11, 2015

  7. DrahtBot locked this on Sep 8, 2021
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-01 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me