From fd2b22474f59aa8dff800de5323309fd27ceb88c Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Thu, 11 Nov 2010 02:00:12 +0000 Subject: [PATCH] update for releases with git. --- kernel/main.c | 4 ++-- tools/release.sh | 34 +++++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/kernel/main.c b/kernel/main.c index 91a92566b..b630cbec8 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -347,8 +347,8 @@ PRIVATE void announce(void) { /* Display the MINIX startup banner. */ printf("\nMINIX %s.%s. " -#ifdef _SVN_REVISION - "(" _SVN_REVISION ")\n" +#ifdef _VCS_REVISION + "(" _VCS_REVISION ")\n" #endif "Copyright 2010, Vrije Universiteit, Amsterdam, The Netherlands\n", OS_RELEASE, OS_VERSION); diff --git a/tools/release.sh b/tools/release.sh index 6df4e30e2..844248420 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -177,6 +177,15 @@ PACKAGES=1 MINIMAL=0 MAKEMAP=0 +# Do we have git? +if git --version >/dev/null +then if [ -d ../.git ] + then REVTAG="`git describe --always`" + echo "git mode; building $REVTAG" + GITMODE=1 + fi +fi + FILENAMEOUT="" while getopts "s:pmMchu?r:f:" c @@ -273,6 +282,8 @@ cp -rp /usr/lib $RELEASEDIR/usr cp -rp /bin/sh /bin/echo $RELEASEDIR/bin cp -rp /usr/bin/make /usr/bin/install /usr/bin/yacc /usr/bin/lex /usr/bin/asmconv $RELEASEDIR/usr/bin +CONFIGHEADER=$RELEASEDIR/usr/src/include/minix/sys_config.h + if [ -d $PACKAGEDIR -a -f $PACKAGELIST -a $PACKAGES -ne 0 ] then index=pkg_summary @@ -327,7 +338,7 @@ fi chown -R root $RELEASEDIR/usr/lib chmod -R u+w $RELEASEDIR/usr/lib -if [ "$COPY" -ne 1 ] +if [ "$COPY" -ne 1 -a "$GITMODE" -ne 1 ] then echo " * Doing new svn export" TOOLSREPO="`svn info | grep '^URL: ' | awk '{ print $2 }'`" @@ -344,9 +355,9 @@ then echo " /* Added by release script */ -#ifndef _SVN_REVISION -#define _SVN_REVISION \"$REVTAG\" -#endif" >>$RELEASEDIR/usr/src/include/minix/sys_config.h +#ifndef _VCS_REVISION +#define _VCS_REVISION \"$REVTAG\" +#endif" >>$CONFIGHEADER # output image name if [ "$USB" -ne 0 ]; then @@ -355,13 +366,26 @@ else IMG=${IMG_BASE}_${REVTAG}.iso fi -else +elif [ "$COPY" -eq 1 ] +then ( cd .. && make depend && make clean ) srcdir=/usr/$SRC ( cd $srcdir && tar cf - . ) | ( cd $RELEASEDIR/usr && mkdir $SRC && cd $SRC && tar xf - ) REVTAG=copy REVISION=unknown IMG=${IMG_BASE}_copy.iso +elif [ "$GITMODE" -eq 1 ] +then + srcdir=$RELEASEDIR/usr/src + git clone file://.. $srcdir + ( cd $srcdir && git checkout $REVTAG && rm -r .git ) + echo " + +/* Added by release script */ +#ifndef _VCS_REVISION +#define _VCS_REVISION \"$REVTAG\" +#endif" >>$CONFIGHEADER + fi echo " * Fixups for owners and modes of dirs and files"