[SERVER-21317] Better fallback for builds with no version.json and no git repo Created: 05/Nov/15  Updated: 18/Apr/18  Resolved: 31/Mar/17

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 3.2.20, 3.4.15, 3.5.6

Type: Improvement Priority: Minor - P4
Reporter: Ramon Fernandez Marina Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 1
Labels: bkp
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Duplicate
is duplicated by SERVER-25144 Failure to compile mongod server and ... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v3.4, v3.2
Sprint: Platforms 2017-04-17
Participants:

 Description   

In SConstruct:479 we try to extract version information using "git describe" when version.json is not present in the repo (which is the new default, see SERVER-21224).

Since there may be users building without a git repo it would be nice to add another fallback, such as environment variable or some other mechanism.

Workarounds include:

  • adding a fake version.json file before compiling that looks as follows:

    {
        "version": "0.0.1-fake-"
    }

  • Setting MONGO_VERSION in ~/.scons/site_scons/mongo_custom_variables.py:

    MONGO_VERSION="0.0.1-fake-"
    



 Comments   
Comment by Githook User [ 18/Apr/18 ]

Author:

{'email': 'acm@mongodb.com', 'name': 'Andrew Morrow', 'username': 'acmorrow'}

Message: SERVER-21317 Enforce MONGO_VERSION is set properly

(cherry picked from commit 19b7e7213746e50323abe8ec97bb33023965aab7)
Branch: v3.2
https://github.com/mongodb/mongo/commit/ed1813b8f82684ff53abc92326f1cf6ac6709e8d

Comment by Githook User [ 18/Apr/18 ]

Author:

{'email': 'acm@mongodb.com', 'name': 'Andrew Morrow', 'username': 'acmorrow'}

Message: SERVER-21317 Enforce MONGO_VERSION is set properly

(cherry picked from commit 19b7e7213746e50323abe8ec97bb33023965aab7)
Branch: v3.4
https://github.com/mongodb/mongo/commit/656969f94fd597e4f78f3824dd643ff6b5028286

Comment by yuandeqiao [X] [ 18/May/17 ]

thanks sir, I'll try it later.......

Comment by Andrew Morrow (Inactive) [ 17/May/17 ]

yuan.Mr - I think you have placed the version.json file in the wrong directory. It doesn't go in etc, just at the top level of the source tree. Note that on the branch you are using, 3.0, there is no enforcement of the format of the values. On the master branch, there is, as of commit https://github.com/mongodb/mongo/commit/19b7e7213746e50323abe8ec97bb33023965aab7.

Comment by yuandeqiao [X] [ 17/May/17 ]

hello,i adding a fake mongo-3.0.11/etc/version.json file before compiling that looks as follows:
"version": "0.0.1-fake-"
,but that error result:

Checking for C library pcap... no
Checking for C library wpcap... no
Checking for C library tcmalloc... no
IndexError: list index out of range:
File "/root/mongo-3.0.11/SConstruct", line 2576:
env.SConscript('src/SConscript', variant_dir='$BUILD_DIR', duplicate=False)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 541:
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 250:
exec file in call_stack[-1].globals
File "/root/mongo-3.0.11/src/SConscript", line 14:
] + module_sconscripts
File "/usr/lib/scons/SCons/Script/SConscript.py", line 541:
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 250:
exec file in call_stack[-1].globals
File "/root/mongo-3.0.11/src/mongo/SConscript", line 57:
'util/mongoutils/SConscript'])
File "/usr/lib/scons/SCons/Script/SConscript.py", line 541:
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 250:
exec file in call_stack[-1].globals
File "/root/mongo-3.0.11/src/mongo/installer/msi/SConscript", line 90:
major_version = "%s.%s" % (mv[0], mv[1])

can you tell me why? thank !

Comment by Githook User [ 31/Mar/17 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-21317 Enforce MONGO_VERSION is set properly
Branch: master
https://github.com/mongodb/mongo/commit/19b7e7213746e50323abe8ec97bb33023965aab7

Comment by Jonathan Reams [ 19/Nov/15 ]

Because there are workarounds, I'm bumping this into 3.3 desired.

Generated at Thu Feb 08 03:56:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.