-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve #770, add baseline and buildnumber to version.h #771
Resolve #770, add baseline and buildnumber to version.h #771
Conversation
f8c0fea
to
c44e4af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the plan was to update the BUILD number via script? Should I write a script to do this?
Yep, that's the plan. I wanted to do a quick hand implementation for now since I really don't want to increase the Revision number for merging the current IC. Let's hold off on the script for a little bit and explore what already exists "out there" |
The issue is that if we are are intending to use v6.5.0a tag as our build epoch, then we are not at build "1" anymore. We are at build 311 (that is, the current output of Do you have anything in mind for what already exists? This seems like a pretty simple script and a fairly unique/project-specific objective so I don't know of anything existing to do this specific task. What I was thinking is to use cmake in its "script mode" (-E switch) which is basically what we do for the compile-time info but can just as easily be run from command line or on-demand. |
I don't have anything in mind so far but we should do our due diligence before making our own. For the epoch, I think we should use the new 6.7 tag so you're totally right that it's not "1"; that's an easy change :) @skliper, which tag do you prefer? |
Normally I would agree, but this seems so simple I'm not seeing the benefit of trying to adapt someone else's solution - it will probably take more time in the end than writing a simple script that we can own. But the other thing to consider is that it may impact which file this goes in. For instance right now its in a "version.h" file but perhaps we really need to have a separate "build" header file that contains nothing other than these defines. Whatever script is doing the update to this value may also impact the name and format of this file too. I do think we need at least a notional plan for updating this value before we change header files. Because it is probably easier to implement if the tool (whatever it is) can update/regenerate the entire file, not just a single line or two within a file that also has other hand-maintained data. |
I don't have a preference as long as when combined with the code name it's unique (which it is if we follow our plan, so that doesn't help narrow it down at all). As long as we just pick one and don't change it then the logic never has to change (as long as the tag exists and we stick with git). Forced to choose I'd just pick the first release in each repo. |
I was thinking we would reset the build number to zero whenever a new tag was out but maybe using the first release is a good idea since we would never have any aliasing. Then the codename is strictly a "branding" and compatibility tag while the build number keeps increasing to infinity. |
I could be convinced either way (commit count for each cycle by referencing the last release or rc tag, or a fixed reference with increasing count), but a fixed tag means less changes to the script (although trivial) and doesn't depend on a fresh tag like the one I recently messed up in cFS. |
I keep going back and forth on this, I think that it makes sense to think of the Build Name (and therefore the last released tag) as the epoch. |
I could also be convinced either way - to reset numbers to 1 with every release or to keep a constant epoch. I don't see major problems/advantages to one or the other. BUT - with regards to naming - should we call this a "baseline" number rather than a "build" number? That is, I think a "build" implies production of binary files, and this is only source code. For each baseline there are currently at least 4 binary builds that are produced from it with different configs. |
And not to muddy the water even further, but we could also just do a ISO date code (YYYYMMDD) using the date of final merge to main/master. This is super-simple and VC system agnostic - but the downside is we couldn't produce more than one baseline a day. If you publish a baseline and find a bug post-publication, you must either wait until the next day to baseline a patch, or use some type of suffix. |
Good point about the perils of using "buildname". I liked Jake's original nomenclature of "codename" though baseline is growing on me. |
I interpret "Codename" is the name i.e. Aquila or Bootes ... that indicates the family or group that this belongs to. So we have both, a code name and a number, but I'm just questioning whether it should be called a "build" number (because we are referring to source, not binaries). |
I think we can keep build number since we do actually try to ensure everything builds before adding it to the main branch. In theory there is an associated build (created by CI) for that source. Looking more into nomenclature, I think it makes more sense to have
|
0d98431
to
31a1a5c
Compare
3144ae4
to
cf9fa02
Compare
Note that the What exactly is the Either way I don't recommend setting a macro to Finally, if this really is necessary, we should confine it to the minimum scope. I'd hate to see |
79b8e47
to
5f7f8c8
Compare
e40a786
to
1a4ab35
Compare
Elaborating a bit on what I brought up in CCB - One thing I think we really need to consider - The reason that the "GLOBAL_PSP_CONFIGDATA" exists deals with where version information actually resides inside the library files. When setting a "Version number" as a Most importantly - If one were to re-link with an updated PSP but not re-compile CFE, then you'd still be reporting the version of PSP that CFE was originally compiled against, not necessarily the one you are running with. That is why the PSP uses this |
Although the current build script statically links the two and dependency rules stipulate that CFE is be recompiled whenever PSP headers change, that doesn't have to be the case. We could also keep these (CFE, PSP, OSAL) as separate shared libs which has some advantages. You really want the version info to be stored within the binary file (either .a or .so) that it is associated with, not compiled into a different file. |
I like this idea. Honestly I think it would be better if the version report was gathered through a function instead of a macro. Something like GetOSALVersion() which then returns the string. Digging a bit deeper it looks like osapi-version.h is included into cfe by way of osapi.h For PSP, cfe_psp.h (which I think should be renamed since naively I think that |
Right - in fact I would go so far as to say that getting the value via preprocessor macro is actually wrong and broken - I would avoid it! It is, by definition, evaluated when the unit is compiled - but its the wrong unit - not the unit to which the version is associated. Getting the version number via global variable (e.g. GLOBAL_PSP_CONFIGDATA) or a runtime API (possibly better) doesn't have this problem. The objective is that the PSP binary (libpsp.a/so) should hold the PSP version number, the CFE binary (libcfe-core.a/so) should hold the CFE version number, and so forth. If using preprocessor macros, the libcfe-core binary actually ends up holding all this data, which is the wrong place to keep it, and can be really confusing and cause incorrect version to be reported in some cases. |
The more I learn about how the code works the more I realize that our pretty and clean layer diagram is more of an aspiration than reality :P |
This is actually one reason for the separate "target_config.c" file in cfe/cmake/target/src. It is the thing which is compiled to form the CFE executable, and contains references to GLOBAL_PSP_CONFIGDATA, GLOBAL_CFE_CONFIGDATA, etc causing all those units to be pulled in when linked as static libs. This is why I recommend reading this variable to get the PSP version info, rather than using macros to get the data. |
True - the key to the "layer diagram" is to stick to APIs (functions) and types to define the interface. Preprocessor macros make things get fuzzy - macros are evaluated separately/independently for every source unit that uses it. So it becomes a "clone" than one data value that is referenced in all places. This distinction makes a big difference when trying to have a stable ABI (something I've long said that CFE doesn't do a good job of, currently -- too many dependencies on compile-time macros that define ABI elements). Not meaning to digress - the main point being - get the version at runtime either through an API or the global config struct - don't rely on preprocessor macros. |
33e39a3
to
1a8973b
Compare
Update Version Numbers description to remove statement on Revision number increases with development build Add description for build name and build number. Add buildnumber macro Add CFE_VERSION Add CFE_VERSION_STRING macro Use CFE_VERSION to event messages for different services Check for OSAL_VERSION and CFE_PSP_VERSION macros and populate them with version numbers if they don't exist. Add CFS_VERSIONS macro Use new version string in event messages Use new macros in evs and tbl startup events
1a8973b
to
4838a61
Compare
Update Version Numbers description to remove statement on Revision number increases with development build Add description for build name and build number. Add buildnumber macro Add CFE_VERSION Add CFE_VERSION_STRING macro Use CFE_VERSION to event messages for different services Check for OSAL_VERSION and CFE_PSP_VERSION macros and populate them with version numbers if they don't exist. Add CFS_VERSIONS macro Use new version string in event messages Use new macros in evs and tbl startup events
Update Version Numbers description to remove statement on Revision number increases with development build Add description for build name and build number. Add buildnumber macro Add CFE_VERSION Add CFE_VERSION_STRING macro Use CFE_VERSION to event messages for different services Check for OSAL_VERSION and CFE_PSP_VERSION macros and populate them with version numbers if they don't exist. Add CFS_VERSIONS macro Use new version string in event messages Use new macros in evs and tbl startup events
Describe the contribution
Resolve #770
Testing performed
Steps taken to test the contribution:
Built on top of current integration candidate
Built with other integration candidates as well as with nasa/osal#532 and nasa/PSP#178
Expected behavior changes
New macros defined. Startup reporting now looks like
System(s) tested on
Docker Ubuntu-based gcc image on OSX
Additional context
Also Tested with nasa/osal#532 and nasa/PSP#178
Third party code
None
Contributor Info - All information REQUIRED for consideration of pull request
Gerardo E. Cruz-Ortiz, NASA-GSFC