include git commit description in fedex_plus version output

This commit is contained in:
Mark Pictor 2011-09-18 16:49:31 -04:00
parent 219957d2bb
commit 6851b271e5
4 changed files with 33 additions and 17 deletions

View file

@ -200,7 +200,19 @@ CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE)
CHECK_TYPE_SIZE("ssize_t" SSIZE_T) CHECK_TYPE_SIZE("ssize_t" SSIZE_T)
#set GIT_COMMIT_ID to the output of `git describe`
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags RESULT_VARIABLE res_var OUTPUT_VARIABLE GIT_COM_ID )
if( NOT ${res_var} EQUAL 0 )
set( GIT_COMMIT_ID "unknown (git failed!)")
message( WARNING "Git failed (not a repo?). Build will not contain git revision info." )
endif()
string( REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COM_ID} )
else()
set( GIT_COMMIT_ID "unknown (git not found!)")
message( WARNING "Git not found. Build will not contain git revision info." )
endif()
# Now that all the tests are done, configure the scl_cf.h file: # Now that all the tests are done, configure the scl_cf.h file:
configure_file(${SCL_BINARY_DIR}/include/scl_cf.h.in ${SCL_BINARY_DIR}/include/scl_cf.h) configure_file(${SCL_BINARY_DIR}/include/scl_cf.h.in ${SCL_BINARY_DIR}/include/scl_cf.h)

View file

@ -8,3 +8,6 @@
#cmakedefine HAVE_MEMCPY 1 #cmakedefine HAVE_MEMCPY 1
#cmakedefine HAVE_MEMMOVE 1 #cmakedefine HAVE_MEMMOVE 1
#cmakedefine HAVE_SSIZE_T 1 #cmakedefine HAVE_SSIZE_T 1
//cmake updates this at build time
#define SCL_COMMIT_ID "@GIT_COMMIT_ID@"

View file

@ -71,10 +71,7 @@
* *
*/ */
char * FEDEXversion( void ) { #include "scl_cf.h"
return( "V2.11.4-beta CADDETC preval June 8, 1995" );
}
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
@ -91,11 +88,17 @@ extern int yydbg_verbose;
extern int skip_exp_pause; extern int skip_exp_pause;
char EXPRESSgetopt_options[256] = "Bbd:e:i:w:p:u:l:nrvz"; char EXPRESSgetopt_options[256] = "Bbd:e:i:w:p:u:l:nrvz";
int no_need_to_work = 0; /* TRUE if we can exit gracefully without doing any work */
static void void print_fedex_version( void ) {
usage() { printf( "%s\nSCL version id (from git): %s\nhttp://github.com/mpictor/StepClassLibrary\n", EXPRESSprogram_name, SCL_COMMIT_ID );
no_need_to_work = 1;
}
static void usage() {
fprintf( stderr, "usage: %s [-v] [-d # | -d 9 [-l nnn | -u nnn]] [-n] [-p <object_type>] {-w|-i <warning>} express_file\n", EXPRESSprogram_name ); fprintf( stderr, "usage: %s [-v] [-d # | -d 9 [-l nnn | -u nnn]] [-n] [-p <object_type>] {-w|-i <warning>} express_file\n", EXPRESSprogram_name );
fprintf( stderr, "where\t-v produces a version description\n" ); fprintf( stderr, "where\t-v produces the following version description:\n" );
print_fedex_version();
fprintf( stderr, "\t-d turns on debugging (\"-d 0\" describes this further\n" ); fprintf( stderr, "\t-d turns on debugging (\"-d 0\" describes this further\n" );
fprintf( stderr, "\t-p turns on printing when processing certain objects (see below)\n" ); fprintf( stderr, "\t-p turns on printing when processing certain objects (see below)\n" );
fprintf( stderr, "\t-n do not pause for internal errors (useful with delta script)\n" ); fprintf( stderr, "\t-n do not pause for internal errors (useful with delta script)\n" );
@ -124,8 +127,6 @@ int main( int argc, char ** argv ) {
char * cp; char * cp;
int no_warnings = 1; int no_warnings = 1;
int resolve = 1; int resolve = 1;
int no_need_to_work = 0;/* TRUE if we can exit gracefully without */
/* doing any work */
bool buffer_messages = false; bool buffer_messages = false;
char * filename = 0; char * filename = 0;
@ -231,8 +232,7 @@ int main( int argc, char ** argv ) {
} }
break; break;
case 'v': case 'v':
printf( "%s %s\n%s\n", EXPRESSprogram_name, FEDEXversion(), EXPRESSversion() ); print_fedex_version();
no_need_to_work = 1;
break; break;
case 'z': /* to allow user to attach debugger and continue */ case 'z': /* to allow user to attach debugger and continue */
printf( "pid = %d\n", getpid() ); printf( "pid = %d\n", getpid() );

View file

@ -77,14 +77,15 @@
#include "../express/express.h" #include "../express/express.h"
#include "../express/resolve.h" #include "../express/resolve.h"
static void extern void print_fedex_version( void );
fedex_plus_usage() {
static void fedex_plus_usage() {
fprintf( stderr, "usage: %s [-s|-S] [-a|-A] [-c|-C] [-L] [-v] [-d # | -d 9 -l nnn -u nnn] [-n] [-p <object_type>] {-w|-i <warning>} express_file\n", EXPRESSprogram_name ); fprintf( stderr, "usage: %s [-s|-S] [-a|-A] [-c|-C] [-L] [-v] [-d # | -d 9 -l nnn -u nnn] [-n] [-p <object_type>] {-w|-i <warning>} express_file\n", EXPRESSprogram_name );
fprintf( stderr, "where\t-s or -S uses only single inheritance in the generated C++ classes\n" ); fprintf( stderr, "where\t-s or -S uses only single inheritance in the generated C++ classes\n" );
fprintf( stderr, "\t-a or -A generates the early bound access functions for entity classes the old way (without an underscore)\n" ); fprintf( stderr, "\t-a or -A generates the early bound access functions for entity classes the old way (without an underscore)\n" );
fprintf( stderr, "\t-c or -C generates C++ classes for use with CORBA (Orbix)\n" ); fprintf( stderr, "\t-c or -C generates C++ classes for use with CORBA (Orbix)\n" );
fprintf( stderr, "\t-L prints logging code in the generated C++ classes\n" ); fprintf( stderr, "\t-L prints logging code in the generated C++ classes\n" );
fprintf( stderr, "\t-v produces a version description\n" ); fprintf( stderr, "\t-v produces the version description below\n" );
fprintf( stderr, "\t-d turns on debugging (\"-d 0\" describes this further\n" ); fprintf( stderr, "\t-d turns on debugging (\"-d 0\" describes this further\n" );
fprintf( stderr, "\t-p turns on printing when processing certain objects (see below)\n" ); fprintf( stderr, "\t-p turns on printing when processing certain objects (see below)\n" );
fprintf( stderr, "\t-n do not pause for internal errors (useful with delta script)\n" ); fprintf( stderr, "\t-n do not pause for internal errors (useful with delta script)\n" );
@ -104,6 +105,7 @@ fedex_plus_usage() {
fprintf( stderr, " s schema or file\n" ); fprintf( stderr, " s schema or file\n" );
fprintf( stderr, " # pass #\n" ); fprintf( stderr, " # pass #\n" );
fprintf( stderr, " E everything (all of the above)\n" ); fprintf( stderr, " E everything (all of the above)\n" );
print_fedex_version();
exit( 2 ); exit( 2 );
} }
@ -121,8 +123,7 @@ int success( Express model ) {
/* This function is called from main() which is part of the NIST Express /* This function is called from main() which is part of the NIST Express
Toolkit. It assigns 2 pointers to functions which are called in main() */ Toolkit. It assigns 2 pointers to functions which are called in main() */
void void EXPRESSinit_init() {
EXPRESSinit_init() {
EXPRESSbackend = print_file; EXPRESSbackend = print_file;
EXPRESSsucceed = success; EXPRESSsucceed = success;
EXPRESSgetopt = Handle_FedPlus_Args; EXPRESSgetopt = Handle_FedPlus_Args;