#!/bin/bash

COMPAT=$HOME/compat/.git
COMPAT_DRIVERS=$HOME/devel/compat-drivers/.git

export GIT_DIR=${COMPAT_DRIVERS}

OLD_VER=6
let VER="7"
RC="-rc1"
LOG="ChangeLog-$(git describe| sed -e 's|compat-drivers-||')"

echo > $LOG

echo -e "===============================================" >> $LOG
echo -e "ChangeLog for compat-drivers for linux-3.${VER}${RC}" >> $LOG
echo -e "===============================================" >> $LOG

echo -e "
This is the ChangeLog for the Linux kernel project compat-drivers.
It provides a backport of a few Linux kernel subsystems down to
older kernels:

  * 802.11
  * Bluetooth
  * Ethernet
  * DRM

For more details refer to the home pages:

https://backports.wiki.kernel.org

The compat-drivers project consists of code from three projects:

  * The Linux kernel: linux-stable.git
  * Compat-wirelesS: compat-drivers.git
  * Compat: compat.git

The compat-drivers stable releases incorporates code from from
each of these git trees for the respective upstream Linux kernel
stable release. A branch called linux-3.x.y exists for each
stable release. Below we provide the ChangeLog of changes from
the previous branched release to the new branched release.

Release: linux-3.${VER}

" >> $LOG

export GIT_DIR=${COMPAT}
echo -e "Updates from the compat.git project:" >> $LOG
echo -e "====================================\n" >> $LOG

echo -e "git shortlog linux-3.${OLD_VER}.y..linux-3.${VER}.y\n" >> $LOG
git shortlog origin/linux-3.${OLD_VER}.y..HEAD >> $LOG

export GIT_DIR=${COMPAT_DRIVERS}
echo -e "Updates from the compat-drivers.git project:" >> $LOG
echo -e "=============================================\n" >> $LOG
echo -e "git shortlog linux-3.${OLD_VER}.y..linux-3.${VER}.y\n" >> $LOG
git shortlog origin/linux-3.${OLD_VER}.y..HEAD >> $LOG

echo -e "Updates from the Linux kernel:" >> $LOG
echo -e "=============================================\n" >> $LOG

echo -e "We only include very specific changes for the supported" >> $LOG
echo -e "subsystems:\n" >> $LOG
echo -e "  * 802.11" >> $LOG
echo -e "  * Bluetooth" >> $LOG
echo -e "  * Ethernet" >> $LOG
echo -e "  * DRM " >> $LOG

echo -e "
Generated by using: 

git log v3.${OLD_VER}${RC}..HEAD \ 
        net/wireless/ \ 
        net/mac80211/ \ 
        net/rfkill/ \ 
        drivers/net/wireless/ \ 
        net/bluetooth/ \ 
        drivers/bluetooth/ \ 
        drivers/gpu/drm/ \
        drivers/net/ethernet/atheros/atl1c/ \ 
        drivers/net/ethernet/atheros/atl1e/ \ 
        drivers/net/ethernet/atheros/atlx/ \ 
        include/uapi/linux/nl80211.h \ 
        include/linux/rfkill.h \ 
        include/uapi/rfkill.h \ 
        include/uapi/drm \ 
        include/net/cfg80211.h \ 
        include/net/regulatory.h \ 
        include/net/cfg80211.h >> $LOG 

git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
" >> $LOG

export GIT_DIR=${PWD}/.git/
git log v3.${OLD_VER}..HEAD \
        net/wireless/ \
        net/mac80211/ \
        net/rfkill/ \
        drivers/net/wireless/ \
        net/bluetooth/ \
        drivers/bluetooth/ \
        drivers/gpu/drm/ \
        drivers/net/ethernet/atheros/atl1c/ \
        drivers/net/ethernet/atheros/atl1e/ \
        drivers/net/ethernet/atheros/atlx/ \
        include/uapi/linux/nl80211.h \
        include/linux/rfkill.h \
        include/uapi/linux/rfkill.h \
        include/uapi/drm \
        include/net/cfg80211.h \
        include/net/regulatory.h \
        include/net/cfg80211.h >> $LOG

