Skip to content

Commit

Permalink
fix #72: Include Git commit hash in version
Browse files Browse the repository at this point in the history
  • Loading branch information
ballle98 committed Jun 11, 2024
1 parent 31d83dc commit 5c7822c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ else
endif
endif

GIT_HASH = $(shell git rev-parse --short HEAD)
$(info GIT_HASH: $(GIT_HASH) )

# Main source files
SRCS = aqualinkd.c utils.c config.c aq_serial.c aq_panel.c aq_programmer.c \
Expand Down Expand Up @@ -131,9 +133,9 @@ endif


# Put all flags together.
CFLAGS = $(GCCFLAGS) $(AQ_FLAGS) $(MGFLAGS)
DFLAGS = $(DGCCFLAGS) $(AQ_FLAGS) $(MGFLAGS)
DBG_CFLAGS = $(DBGFLAGS) $(AQ_FLAGS) $(MGFLAGS)
CFLAGS = $(GCCFLAGS) $(AQ_FLAGS) $(MGFLAGS) -DGIT_HASH="\"$(GIT_HASH)\""
DFLAGS = $(DGCCFLAGS) $(AQ_FLAGS) $(MGFLAGS) -DGIT_HASH="\"$(GIT_HASH)\""
DBG_CFLAGS = $(DBGFLAGS) $(AQ_FLAGS) $(MGFLAGS) -DGIT_HASH="\"$(GIT_HASH)\""

# Other sources.
DBG_SRC = $(SRCS) debug_timer.c
Expand Down
4 changes: 2 additions & 2 deletions aqualinkd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ void action_delayed_request()

void printHelp()
{
printf("%s %s\n",AQUALINKD_NAME,AQUALINKD_VERSION);
printf("%s %s (rev %s)\n", AQUALINKD_NAME, AQUALINKD_VERSION, GIT_HASH);
printf("\t-h (this message)\n");
printf("\t-d (do not deamonize)\n");
printf("\t-c <file> (Configuration file)\n");
Expand Down Expand Up @@ -1249,7 +1249,7 @@ int startup(char *self, char *cfgFile)
setLoggingPrms(_aqconfig_.log_level, _aqconfig_.deamonize, _aqconfig_.log_file, NULL);
#endif

LOG(AQUA_LOG,LOG_NOTICE, "%s v%s\n", AQUALINKD_NAME, AQUALINKD_VERSION);
LOG(AQUA_LOG,LOG_NOTICE, "%s v%s (rev %s)\n", AQUALINKD_NAME, AQUALINKD_VERSION, GIT_HASH);
/*
LOG(AQUA_LOG,LOG_NOTICE, "Panel set to %s%s-%d %s%s %s\n",
isRS_PANEL?"RS":"",
Expand Down
2 changes: 1 addition & 1 deletion json_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ int build_aqualink_status_JSON(struct aqualinkdata *aqdata, char* buffer, int si
length += sprintf(buffer+length, ",\"panel_type\":\"%s\"",getPanelString());
//length += sprintf(buffer+length, ",\"message\":\"%s\"",aqdata->message );
length += sprintf(buffer+length, ",\"version\":\"%s\"",aqdata->version );//8157 REV MMM",
length += sprintf(buffer+length, ",\"aqualinkd_version\":\"%s\"", AQUALINKD_VERSION ); //1.0b,
length += sprintf(buffer+length, ",\"aqualinkd_version\":\"%s (rev %s)\"", AQUALINKD_VERSION, GIT_HASH); //1.0b,
length += sprintf(buffer+length, ",\"date\":\"%s\"",aqdata->date );//"09/01/16 THU",
length += sprintf(buffer+length, ",\"time\":\"%s\"",aqdata->time );//"1:16 PM",
//length += sprintf(buffer+length, ",\"air_temp\":\"%d\"",aqdata->air_temp );//"96",
Expand Down

0 comments on commit 5c7822c

Please sign in to comment.