summaryrefslogtreecommitdiff
blob: 770078b16e986e010d0bb24233796aab133f3757 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
# kernel-check -- Kernel security information
# Copyright 2009-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

TEXT=".*$@.*"
GITPATH="./"

KNOWNCOMMITS=""
LASTFIXEDBRANCH=""
WHITEBOARD=""

GOOD=$'\e[32;01m'
BAD=$'\e[31;01m'
BRACKET=$'\e[34;01m'
NORMAL=$'\e[0m'

GITPATH="--git-dir=$GITPATH.git --work-tree=$GITPATH"
BRANCHES="`git $GITPATH branch -a | grep linux` origin/master"
for B in $BRANCHES ; do
    COMMITS="`git $GITPATH rev-list --pretty=oneline "$B" |
             grep "$TEXT" | cut -d " " -f 1`"
    for C in $COMMITS ; do
        if [ "${KNOWNCOMMITS/$C/}" == "$KNOWNCOMMITS" ] ; then
            TAG="`git $GITPATH describe --contains --all "$C"`"
            DESC="`git $GITPATH --no-pager log -1 --pretty=short "$C"`"
            DESC="`echo "$DESC" | tr -s "\n" `"
            DESC="${TAG/tags\//\n${GOOD}label${NORMAL}  }\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"