diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2010-11-09 19:25:53 +0100 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2010-11-09 19:25:53 +0100 |
commit | f4bb2414d788bec6cdeba75d28b31120636cd37a (patch) | |
tree | d47b6f799e53d051cd3f57eebcbdd2cb7bc9a44a /eurephiadm | |
parent | b895db8cef71822a98ce60886113a9ba34e51fa8 (diff) | |
download | eurephia-f4bb2414d788bec6cdeba75d28b31120636cd37a.tar.gz eurephia-f4bb2414d788bec6cdeba75d28b31120636cd37a.tar.xz eurephia-f4bb2414d788bec6cdeba75d28b31120636cd37a.zip |
Improved buildinfo, adding some kind of git tree state information
This patch adds a list over uncommitted files.
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'eurephiadm')
-rw-r--r-- | eurephiadm/commands/buildinfo.c | 7 | ||||
-rwxr-xr-x | eurephiadm/mk_buildinfo.sh | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/eurephiadm/commands/buildinfo.c b/eurephiadm/commands/buildinfo.c index 57ca9b6..aa518a4 100644 --- a/eurephiadm/commands/buildinfo.c +++ b/eurephiadm/commands/buildinfo.c @@ -81,7 +81,12 @@ int cmd_BuildInfo(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, " System info: " BUILDSYSTEM "\n"); #ifdef BUILDBRANCH printf(" git branch: " BUILDBRANCH "\n" - " git commit: " BUILDGITREV "\n\n"); + " git commit: " BUILDGITREV "\n"); + if( GITSTATE != 0 ) { + printf(" Uncommitted changes to the git tree:\n" + MODIFIEDFILES); + } #endif + printf("\n"); return 0; } diff --git a/eurephiadm/mk_buildinfo.sh b/eurephiadm/mk_buildinfo.sh index 2f45bbe..64d9d86 100755 --- a/eurephiadm/mk_buildinfo.sh +++ b/eurephiadm/mk_buildinfo.sh @@ -24,11 +24,16 @@ builddate="`date -u`" buildsystem="`uname -a`" buildhost="`hostname`" -if [[ -d ../.git ]]; then + +# Check if we're in a git tree +git rev-parse --git-dir 2> /dev/null 1> /dev/null +if [[ $? = 0 ]]; then # If we have a .git directory, presume the source is from a git tree - branch=`awk '{print $2}' ../.git/HEAD` + branch=`git symbolic-ref HEAD` gitrev=`git rev-list ${branch} -1` buildsource="`git remote -v | awk '/^origin/{print $2; exit 0}'`" + modfiles="`git status -s | awk '/^[ADM\?]/{ printf " %s\\\n", $0 }'`" + [[ -z ${modfiles} ]] && state=0 || state=1 else # Otherwise, it's from a source tarball buildsource="tar.bz2" @@ -47,5 +52,7 @@ if [[ -n "${gitrev}" ]]; then cat <<EOF >> buildinfo.h #define BUILDBRANCH "${branch}" #define BUILDGITREV "${gitrev}" +#define GITSTATE "${state}" +#define MODIFIEDFILES "${modfiles}" EOF fi |