webbuild-cgi: add remote fetch for maintainer recent packages and distromatic log plus add caching support

This commit is contained in:
Silvan Calarco 2014-09-28 12:34:41 +02:00
parent 60f8e3cff0
commit 4d8a804eee

View File

@ -889,12 +889,12 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
#(getElementById('package').selectedIndex);>"
echo "<option value=\"\">-- Select a SRPM package --</option>"
SRPMBUTTONDISABLED="disabled=disabled"
if [ -e $local_ftp/$REPOSITORY ]; then
if [ "$local_ftp" -a -e $local_ftp/$REPOSITORY ]; then
if [ $local_ftp/$REPOSITORY/SRPMS.base -nt $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY ]; then
ls --color=none $local_ftp/$REPOSITORY/SRPMS.base/ | grep ".src.rpm$" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
fi
else
curl $REPS_BASE_URL/$REPOSITORY/SRPMS.base/ | grep .src.rpm | \
curl -s $REPS_BASE_URL/$REPOSITORY/SRPMS.base/ | grep .src.rpm | \
sed "s|.*\.src\.rpm\">\(.*\)</a>.*|\1|" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
fi
while read f; do
@ -1140,9 +1140,18 @@ if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "<editor><![CDATA["
echo -n "<div class=maintainer>"
echo -n "<b>Recent packages in $REPOSITORY:</b><br>"
cat $local_ftp/distromatic/$REPOSITORY/_recent.inc | sed "s|a href=|a target=new href=|g"
if [ "$local_ftp" -a -e $local_ftp/distromatic/$REPOSITORY ]; then
if [ $local_ftp/distromatic/$REPOSITORY/_recent.inc -nt $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY ]; then
cat $local_ftp/distromatic/$REPOSITORY/_recent.inc > $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY
cat $local_ftp/$REPOSITORY/distromatic.log > $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
fi
else
curl -s $REPS_BASE_URL/distromatic/$REPOSITORY/_recent.inc > $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY
curl -s $REPS_BASE_URL/$REPOSITORY/distromatic.log > $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
fi
cat $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY | sed "s|a href=|a target=new href=|g"
echo -n "<br><b>Log:</b><br><pre>"
cat $local_ftp/$REPOSITORY/distromatic.log
cat $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
echo -n "</pre></div>"
echo -n "<input type=button id=updatespecbutton value=\"refresh\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
@ -2133,8 +2142,13 @@ if [ "$MAINTAINERMODE" = "true" ]; then
# echo "<option value=\"\">-- Select a SRPM package --</option>"
echo -n "<label><input type=checkbox name=pkgsselectallcheckbox value=\"\" onclick=checkAllBoxes('packagescheckbox',this.checked);>select/unselect all</label>"
echo -n "<div class=multiselect>"
if [ $local_ftp/$REPOSITORY/SRPMS.base -nt $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY ]; then
ls --color=none $local_ftp/$REPOSITORY/SRPMS.base/ | grep ".src.rpm$" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
if [ "$local_ftp" -a -e $local_ftp/$REPOSITORY ]; then
if [ $local_ftp/$REPOSITORY/SRPMS.base -nt $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY ]; then
ls --color=none $local_ftp/$REPOSITORY/SRPMS.base/ | grep ".src.rpm$" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
fi
else
curl -s $REPS_BASE_URL/$REPOSITORY/SRPMS.base/ | grep .src.rpm | \
sed "s|.*\.src\.rpm\">\(.*\)</a>.*|\1|" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
fi
while read f; do
pkgname=${f/.src.rpm}