From 42834bd8d06ca68938c652c2f32250589ac350e9 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Tue, 9 Nov 2010 19:40:23 +0100 Subject: Further updates to the buildinfo - Reorganised the layout a bit - Added a path to the local git repository - Added '(origin)' identificator to the remote git repo string - Do the 'git status' call from the root of the source tree Signed-off-by: David Sommerseth --- eurephiadm/commands/buildinfo.c | 23 ++++++++++++++--------- eurephiadm/mk_buildinfo.sh | 10 ++++++++-- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/eurephiadm/commands/buildinfo.c b/eurephiadm/commands/buildinfo.c index aa518a4..ba30606 100644 --- a/eurephiadm/commands/buildinfo.c +++ b/eurephiadm/commands/buildinfo.c @@ -73,17 +73,22 @@ void help_BuildInfo() */ int cmd_BuildInfo(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int argc, char **argv) { - printf("** eurephia build information:\n" - " Version: " EUREPHIAVERSION "\n" - " Source base: " BUILDSOURCE "\n" - " Build date: " BUILDDATE "\n" - " Build host: " BUILDHOST "\n" - " System info: " BUILDSYSTEM "\n"); + printf("**\n** eurephia build information\n**\n\n" + " * Genric information *\n" + " Version: " EUREPHIAVERSION "\n" + " Source base: " BUILDSOURCE "\n" + " Build date: " BUILDDATE "\n" + " Build host: " BUILDHOST "\n" + " System info: " BUILDSYSTEM "\n"); #ifdef BUILDBRANCH - printf(" git branch: " BUILDBRANCH "\n" - " git commit: " BUILDGITREV "\n"); + printf("\n * git information *\n"); + printf(" repo dir: " GITDIR "\n" + " branch: " BUILDBRANCH "\n" + " HEAD ref: " BUILDGITREV "\n"); + printf(" tree state: %s\n", + (GITSTATE == 0 ? "Clean" : "Modified")); if( GITSTATE != 0 ) { - printf(" Uncommitted changes to the git tree:\n" + printf("\n Uncommitted changes to the git tree:\n" MODIFIEDFILES); } #endif diff --git a/eurephiadm/mk_buildinfo.sh b/eurephiadm/mk_buildinfo.sh index 64d9d86..4f6a520 100755 --- a/eurephiadm/mk_buildinfo.sh +++ b/eurephiadm/mk_buildinfo.sh @@ -26,14 +26,19 @@ buildsystem="`uname -a`" buildhost="`hostname`" # Check if we're in a git tree -git rev-parse --git-dir 2> /dev/null 1> /dev/null +gitdir="`git rev-parse --git-dir 2> /dev/null`" if [[ $? = 0 ]]; then # If we have a .git directory, presume the source is from a git tree branch=`git symbolic-ref HEAD` gitrev=`git rev-list ${branch} -1` - buildsource="`git remote -v | awk '/^origin/{print $2; exit 0}'`" + buildsource="`git remote -v | awk '/^origin/{print $2; exit 0}'` (origin)" + + curdir=`pwd` + srcroot="`dirname $gitdir`" + cd $srcroot modfiles="`git status -s | awk '/^[ADM\?]/{ printf " %s\\\n", $0 }'`" [[ -z ${modfiles} ]] && state=0 || state=1 + cd $curdir else # Otherwise, it's from a source tarball buildsource="tar.bz2" @@ -50,6 +55,7 @@ EOF if [[ -n "${gitrev}" ]]; then cat <> buildinfo.h +#define GITDIR "${gitdir}" #define BUILDBRANCH "${branch}" #define BUILDGITREV "${gitrev}" #define GITSTATE "${state}" -- cgit