#!/bin/bash
# Copyright 2015 Holger Levsen
# released under the GPLv=2
DEBUG=false
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
# common code defining db access
. /srv/jenkins/bin/reproducible_common.sh
SUITE="sid" # for links in page
ARCH="amd64" # same
VIEW=repo_stats
PAGE=index_${VIEW}.html
TMPFILE=$(mktemp)
echo "$(date) - starting to write $PAGE page."
write_page_header $VIEW "Overview about the reproducible builds apt repository (and comparison to Debian suites)"
write_page "These source packages are different from sid in our apt repository on alioth. They are available for testing using these sources.lists entries:
"
write_page "deb http://reproducible.alioth.debian.org/debian/ ./"
write_page "deb-src http://reproducible.alioth.debian.org/debian/ ./"
write_page "
"
write_page "source package | old versions in our repo (needed for reproducing old builds) | version in our repo | version in 'testing' | version in 'sid' | version in 'experimental' |
"
curl http://reproducible.alioth.debian.org/debian/Sources > $TMPFILE
SOURCES=$(grep-dctrl -n -s Package -r -FPackage . $TMPFILE | sort -u)
for PKG in $SOURCES ; do
echo "Processing $PKG..."
if [ "${PKG:0:3}" = "lib" ] ; then
PREFIX=${PKG:0:4}
else
PREFIX=${PKG:0:1}
fi
VERSIONS=$(grep-dctrl -n -s version -S $PKG $TMPFILE|sort -u)
CRUFT=""
WARN=false
BET=""
#
# gather versions of a package
#
for VERSION in ${VERSIONS} ; do
if [ "$BET" = "" ] ; then
BET=${VERSION}
continue
elif dpkg --compare-versions "$BET" lt "${VERSION}" ; then
BET=${VERSION}
fi
done
SID=$(rmadison -s sid $PKG | cut -d "|" -f2|xargs echo)
for VERSION in ${VERSIONS} ; do
if [ "${VERSION}" != "$BET" ] ; then
WARN=true
CRUFT="$CRUFT ${VERSION}"
fi
done
TESTING=$(rmadison -s testing $PKG | cut -d "|" -f2|xargs echo)
EXPERIMENTAL=$(rmadison -s experimental $PKG | cut -d "|" -f2|xargs echo)
#
# format output
#
CSID=""
for i in $SID ; do
if dpkg --compare-versions "$i" gt "$BET" ; then
CSID="$CSID$i
"
if [ ! -z "$BET" ] ; then
CRUFT="$BET $CRUFT"
BET=""
fi
else
CSID="$CSID$i
"
fi
done
SID=$CSID
if [ ! -z "$TESTING" ] ; then
CTEST=""
for i in $TESTING ; do
if dpkg --compare-versions "$i" gt "$BET" ; then
CTEST="$CTEST$i
"
else
CTEST="$CTEST$i
"
fi
done
TESTING=$CTEST
fi
if [ ! -z "$EXPERIMENTAL" ] ; then
CEXP=""
for i in $EXPERIMENTAL ; do
if dpkg --compare-versions "$i" gt "$BET" ; then
CEXP="$CEXP$i
"
else
CEXP="$CEXP$i
"
fi
done
EXPERIMENTAL=$CEXP
fi
if [ ! -z "$BET" ] ; then
BET="$BET"
else
BET=" "
fi
if [ ! -z "$CRUFT" ] ; then
CRUFT="$(echo $CRUFT|sed 's# #
#g')"
fi
#
# write output
#
write_page "$PKG | "
write_page "$CRUFT | "
write_page "$BET | "
write_page "$TESTING | "
write_page "$SID | "
write_page "$EXPERIMENTAL | "
write_page "
"
done
write_page "
"
rm $TMPFILE
write_page_footer
publish_page