summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Tropf <asym@gentoo.org>2009-12-19 12:53:55 +0100
committerBjoern Tropf <asym@gentoo.org>2009-12-19 12:53:55 +0100
commit26edc0e62dfadfb032306458300fb5437aca42e7 (patch)
tree88b55a2bbefc82faf5ec45d9458349c47072734f /bin/fcommit
parentFix invalid CVSS data (diff)
downloadkernel-check-26edc0e62dfadfb032306458300fb5437aca42e7.tar.gz
kernel-check-26edc0e62dfadfb032306458300fb5437aca42e7.tar.bz2
kernel-check-26edc0e62dfadfb032306458300fb5437aca42e7.zip
Rename findcommit.sh to fcommit
Fix some bugs
Diffstat (limited to 'bin/fcommit')
-rwxr-xr-xbin/fcommit64
1 files changed, 64 insertions, 0 deletions
diff --git a/bin/fcommit b/bin/fcommit
new file mode 100755
index 0000000..68835a9
--- /dev/null
+++ b/bin/fcommit
@@ -0,0 +1,64 @@
+#!/bin/sh
+# kernel-check -- Gentoo Kernel Security
+# Copyright 2009-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+TEXT=".*$@.*"
+KNOWNCOMMITS=""
+LASTFIXEDBRANCH=""
+WHITEBOARD=""
+
+GOOD=$'\e[32;01m'
+BAD=$'\e[31;01m'
+BRACKET=$'\e[34;01m'
+NORMAL=$'\e[0m'
+
+BRANCHES="`git branch -a | grep linux` origin/master"
+for B in $BRANCHES ; do
+ COMMITS="`git rev-list --pretty=oneline "$B" |
+ grep "$TEXT" | cut -d " " -f 1`"
+ for C in $COMMITS ; do
+ if [ "${KNOWNCOMMITS/$C/}" == "$KNOWNCOMMITS" ] ; then
+ TAG="`git describe --contains --all "$C"`"
+ LABEL="${TAG/remotes\/origin\/linux-/v}"
+ LABEL="${LABEL/tags\//}"
+
+ DESC="`git --no-pager log -1 --pretty=short "$C"`"
+ DESC="`echo "$DESC" | tr -s "\n" `"
+ DESC="${GOOD}label${NORMAL} ${LABEL}\n${DESC}"
+
+ DESC="${DESC/commit/${GOOD}commit${NORMAL}}"
+ DESC="${DESC/Author:/${GOOD}author${NORMAL}}"
+ DESC="${DESC/ /${GOOD}title${NORMAL} ${BRACKET}}${NORMAL}\n"
+ echo -e "$DESC"
+
+ VERSION="${TAG/tags\/v/}"
+ VERSION="${VERSION/~*/}"
+ VERSION="${VERSION/^*/}"
+
+ if [ "$B" != "origin/master" ] ; then
+ THISBRANCH="${B/remotes\/origin\/linux-/}"
+ THISBRANCH="${THISBRANCH/.y/}"
+ REVISION="${THISBRANCH/*./}"
+ MAJORMINOR="${THISBRANCH/.${REVISION}/}"
+ let REVISION=REVISION+1
+ NEXTBRANCH="${MAJORMINOR}.${REVISION}"
+ fi
+ if [ -z "$LASTFIXEDBRANCH" ] ; then
+ WHITEBOARD="$WHITEBOARD [linux <${VERSION}]"
+ else
+ if [ "${LASTFIXEDBRANCH}" == "${VERSION/-rc*/}" ] ; then
+ WHITEBOARD="${WHITEBOARD} ${BAD}[linux >= \
+ ${LASTFIXEDBRANCH} <${VERSION}]${NORMAL}"
+ else
+ WHITEBOARD="${WHITEBOARD} [linux >= \
+ ${LASTFIXEDBRANCH} <${VERSION}]"
+ fi
+ fi
+ LASTFIXEDBRANCH=$NEXTBRANCH
+ KNOWNCOMMITS="$KNOWNCOMMITS $C"
+ fi
+ done
+done
+echo -e "${GOOD}Whiteboard${NORMAL}\n${WHITEBOARD:1}\n"
+