#!/bin/bash
for i in src/*/debian/RFS; do
echo "$(git log -1 --pretty="format:%ct" "$i")" "$i"
done | sort | while read t i; do
pkg=$(basename "$(dirname "$(dirname "$i")")")
upstream_pkg=$(grep Upstream-Name src/$pkg/debian/copyright|awk '{print $2}')
if test -z $upstream_pkg; then
echo "Could not find upstream package name. is src/$pkg/debian/copyright correct?"
exit 2
fi
if test -n "$(git --no-pager branch --remotes -l origin/pending-"$pkg")"; then
# If a pending branch exists, skip it
continue
fi
AUTHOR=$(cat $(dirname "$i")/changelog|grep " -- "|head -1|sed -e "s| -- \(.*\) <.*$|\1|g")
if test $pkg == $upstream_pkg; then
echo -e "$(date -d@"$t") \e[32m$pkg - $AUTHOR\e[0m"
else
echo -e "$(date -d@"$t") \e[32m$pkg (upstream name: $upstream_pkg) - $AUTHOR\e[0m"
fi
if ! head -1 $(dirname "$i")/changelog |grep -q UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; then
echo -e "\e[31mRFS but the first line of the changelog doesn't contain UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO\e[0m"
fi
if grep -q FIXME $(dirname "$i")/copyright; then
echo -e "\e[31mRFS but still contains FIXME in debian/copyright\e[0m"
fi
if test `grep urgency $(dirname "$i")/changelog|wc -l` -eq 1; then
# If there is only one item in the changelog, mark the package as NEW
echo -e "\e[31mNEW package\e[0m"
else
# It isn't NEW but I want to know if this is a new upstream release or not
LAST_TWO=$(dpkg-parsechangelog -c 2 -l $(dirname "$i")/changelog|grep urgency)
LAST_FULL=$(echo "$LAST_TWO"|head -1|cut -d\( -f2|cut -d\) -f1)
SECOND_FULL=$(echo "$LAST_TWO"|tail -1|cut -d\( -f2|cut -d\) -f1)
LAST=$(echo $LAST_FULL|cut -d- -f1)
SECOND=$(echo $SECOND_FULL|cut -d- -f1)
if test $LAST == $SECOND; then
echo -e "\e[36mSame release ($SECOND_FULL => $LAST_FULL) \e[0m"
else
echo -e "\e[33mNew upstream release ($SECOND_FULL => $LAST_FULL) \e[0m"
fi
fi
# trim the content
content=$(xargs '-d\n' echo -n < "$i")
if test -n "$content"; then
echo " $content"
fi
done