Skip to contentSkip to conversation

mmc-utils: Change version string to git hash

PATCH In review Christian Loehle 2 participants 2 messages Apr 12, 2023 – Apr 17, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc-utils: Change version string to git hash

Since mmc-utils versioning has always been 0.1 and changes are not made frequently and formal releases do not happen, packaged versions are just pulled from git anyway, using the git hash for version is probably the best idea for now.

---
 Makefile | 3 ++-
 mmc.c    | 6 ++----
 2 files changed, 4 insertions(+), 5 deletions(-)
Makefile +2 -1
index aa27ff2..d8d59a4 100644
@@ -1,6 +1,7 @@
 CC ?= gcc
+GIT_VERSION := "$(shell git describe --abbrev=6 --always --tags)"
 AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2
-CFLAGS ?= -g -O2
+CFLAGS ?= -g -O2 -DVERSION=\"$(GIT_VERSION)\"
 objects = \
 	mmc.o \
 	mmc_cmds.o \
mmc.c +2 -4
index b9aa478..795b4e3 100644
@@ -26,8 +26,6 @@
 
 #include "mmc_cmds.h"
 
-#define MMC_VERSION	"0.1"
-
 #define BASIC_HELP 0
 #define ADVANCED_HELP 1
 
@@ -319,7 +317,7 @@ static void help(char *np)
 
 	printf("\n\t%s help|--help|-h\n\t\tShow the help.\n",np);
 	printf("\n\t%s <cmd> --help\n\t\tShow detailed help for a command or subset of commands.\n",np);
-	printf("\n%s\n", MMC_VERSION);
+	printf("\n%s\n", VERSION);
 }
 
 static int split_command(char *cmd, char ***commands)
@@ -500,7 +498,7 @@ static int parse_args(int argc, char **argv,
 	}
 
 	if(helprequested){
-		printf("\n%s\n", MMC_VERSION);
+		printf("\n%s\n", VERSION);
 		return 0;
 	}
 
Signature · 6 lines
2.37.3


Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
#1 lore raw
Quoted 7 lines · Christian Loehle

Since mmc-utils versioning has always been 0.1 and changes are not made frequently and formal releases do not happen, packaged versions are just pulled from git anyway, using the git hash for version is probably the best idea for now.

Seems reasonable to me, applied, thanks!

Kind regards
Uffe

Quoted 57 lines
---
 Makefile | 3 ++-
 mmc.c    | 6 ++----
 2 files changed, 4 insertions(+), 5 deletions(-)
Makefile +2 -1
index aa27ff2..d8d59a4 100644
@@ -1,6 +1,7 @@
 CC ?= gcc
+GIT_VERSION := "$(shell git describe --abbrev=6 --always --tags)"
 AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2
-CFLAGS ?= -g -O2
+CFLAGS ?= -g -O2 -DVERSION=\"$(GIT_VERSION)\"
 objects = \
        mmc.o \
        mmc_cmds.o \
mmc.c +2 -5
index b9aa478..795b4e3 100644
@@ -26,8 +26,6 @@
 
 #include "mmc_cmds.h"
 
-#define MMC_VERSION    "0.1"
-
 #define BASIC_HELP 0
 #define ADVANCED_HELP 1
 
@@ -319,7 +317,7 @@ static void help(char *np)
 
        printf("\n\t%s help|--help|-h\n\t\tShow the help.\n",np);
        printf("\n\t%s <cmd> --help\n\t\tShow detailed help for a command or subset of commands.\n",np);
-       printf("\n%s\n", MMC_VERSION);
+       printf("\n%s\n", VERSION);
 }
 
 static int split_command(char *cmd, char ***commands)
@@ -500,7 +498,7 @@ static int parse_args(int argc, char **argv,
        }
 
        if(helprequested){
-               printf("\n%s\n", MMC_VERSION);
+               printf("\n%s\n", VERSION);
                return 0;
        }
 
--

2.37.3

Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782