Add local autobuild interface autobuilds.html and other fixes

This commit is contained in:
Silvan Calarco 2014-05-24 16:05:40 +02:00
parent ea9bd6e623
commit 03d939419c
4 changed files with 84 additions and 32 deletions

View File

@ -96,6 +96,7 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
RELOADTIME=15000
break
fi
RNUM=0
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
@ -115,8 +116,8 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
AUTODISTLOGFILE="$AUTOPORTLOGDIR/${AUTOPORT_ARCH[$i]}/$r-current.log"
AUTODISTSTATEFILE="$AUTOPORTLOGDIR/autoport-$r-current"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
LOGFILE="$LOGDIR/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
LASTLOGFILE="$LOGDIR/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
LASTLOGFILE="/var/autodist/log/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
AUTODISTLOGFILE="$AUTOPORTLOGDIR/${AUTOPORT_ARCH[$i]}/$r-current.log"
AUTODISTSTATEFILE="$AUTOPORTLOGDIR/autoport-$r-current"
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
@ -126,7 +127,7 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
continue
fi
if [ "$SHOWLOG" ]; then
if [ "$HOST" = "$AS_HOST" -a "$NUM" = "$i" ]; then
if [ "$HOST" = "$AS_HOST" -a "$NUM" = "$RNUM" ]; then
echo -n "<p><h2>$SHOWLOG log in "
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
echo -n "update"
@ -156,11 +157,7 @@ _EOF
else
# Security check
[ "${SHOWLOG/\/\.}" != "${SHOWLOG}" ] && continue
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
BUILDLOGDIR="$LOGDIR"
elif [ "${AUTOPORT_NATIVE[$i]}" -o "${AUTOPORT_UPDATE[$i]}" ]; then
BUILDLOGDIR="/var/autodist/log/"
fi
BUILDLOGDIR="$LOGDIR"
if [ "${SHOWLOG/\/ok\/}" != "${SHOWLOG}" -o "${SHOWLOG/\failed\/}" != "${SHOWLOG}" ]; then
SHOWLOGPKG=${SHOWLOG/*\/}
[ "${SHOWLOGPKG}" ] || continue
@ -218,7 +215,7 @@ _EOF
<div class=downloadbox align=center>
<div align=left style="background-color: white; height: 250px; width: 850px; overflow: auto; font-size: 8pt; border:1px solid #2b6600; margin: 4px; padding:4; background-color: #e0f2d0;">
_EOF
echo "<pre>"
echo -n "<pre style='margin:1px'>"
unset BUILDNOWIDX BUILDLOG BUILDNOW BUILDNOWSTATUS SCHEDULED STARTTIME AUTODIST_PID ENDTIME
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
BUILDNOWIDX=0
@ -297,9 +294,9 @@ _EOF
else
WEBBUILD_APPEND="&LOGSTATUSOK=false"
fi
echo -n "<a target=_webbuild href=\"/distribution/webbuild.php?REQUEST=autobuildedit&ENVIRONMENT=$i&PACKAGE=$JOBNAME&LOGTYPE=$OPERATIONNAME${WEBBUILD_APPEND}\"><b>$JOBNAME</b></a>: "
echo -n "<a target=_webbuild href=\"$AUTOPORT_WEBBUILD_HOST?REQUEST=autobuildedit&ENVIRONMENT=$i&PACKAGE=$JOBNAME&LOGTYPE=$OPERATIONNAME${WEBBUILD_APPEND}\"><b>$JOBNAME</b></a>: "
else
echo -n "<a target=_webbuild href=\"/distribution/webbuild.php?ENVIRONMENT=$i&PACKAGE=$JOBNAME\"><b>$JOBNAME</b></a>: "
echo -n "<a target=_webbuild href=\"$AUTOPORT_WEBBUILD_HOST?ENVIRONMENT=$i&PACKAGE=$JOBNAME\"><b>$JOBNAME</b></a>: "
fi
fi
rowcnt=0
@ -331,7 +328,7 @@ _EOF
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=red>$OPERATIONNAME:$OPERATIONSTATUS</font></a>"
;;
esac
# [ "$SUBJOBNAME" != "$JOBNAME" ] && echo -en "(<a href=\"/distribution/webbuild.php?ENVIRONMENT=$i&PACKAGE=$SUBJOBNAME\" target=\"webbuild\">$SUBJOBNAME</a>)"
# [ "$SUBJOBNAME" != "$JOBNAME" ] && echo -en "(<a href=\"$AUTOPORT_WEBBUILD_HOST?ENVIRONMENT=$i&PACKAGE=$SUBJOBNAME\" target=\"webbuild\">$SUBJOBNAME</a>)"
echo -n " "
rowcnt=`expr $rowcnt + 1`
done
@ -352,6 +349,7 @@ _EOF
# echo
echo "</pre></div></div>"
fi
RNUM=`expr $RNUM + 1`
done
done
@ -367,7 +365,7 @@ if [ "$AS_HOST" = "0" -a ! "$SHOWLOG" ]; then
fi
fi
if [ "$AS_HOST" = "0" ]; then
echo "<br><p><i>Generated by autodist CGI interface. Last update: `date`</i>"
echo "<p><i>Generated by autodist CGI interface. Last update: `date`</i>"
if [ "$FORMAT" = "xml" ]; then
echo -n "]]></output>"
[ "$RELOADTIME" ] && echo -n "<reloadtime>$RELOADTIME</reloadtime>"

View File

@ -53,23 +53,6 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
echo "+ Autoport start at `date`" > $LOGFILE
echo "============================================" >> $LOGFILE
# if [ "${AUTOPORT_CHROOT[$i]}" ]; then
# a=${AUTOPORT_CHROOT[$i]}
# # sudo mount -o bind /proc /var/autoport/$a/proc
# [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a chroot environment"
# echo "= Updating packages in $a chroot environment..." >> $LOGFILE
# LANG=C /usr/sbin/chroot /var/autoport/$a smart update --quiet > /dev/null
# LANG=C /usr/sbin/chroot /var/autoport/$a smart upgrade -y >> $LOGFILE
# echo "= Working on $r($a) in chroot mode..." >> $LOGFILE
# [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in chroot mode" >> $LOGFILE
# # disable service restarts
# mv /var/autoport/$a/sbin/service /var/autoport/$a/sbin/service.autoport
# ln -s /bin/true /var/autoport/$a/sbin/service
# $CMD_PREFIX /usr/sbin/chroot /var/autoport/$a su -l ${AUTOPORT_CHROOT_USER[$i]} -c "autoport -b -r $r" >> $LOGFILE
# mv /var/autoport/$a/sbin/service.autoport /var/autoport/$a/sbin/service
# cat /var/autoport/$a/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
# fi
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
a=${AUTOPORT_ARCH[$i]}
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a native environment"
@ -78,7 +61,8 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
LANG=C smart upgrade -y >> $LOGFILE
echo "= Working on $r($a) in native mode" >> $LOGFILE
su -l ${AUTOPORT_CHROOT_USER[$i]} -c "$CMD_PREFIX autoport -b -r $r" >> $LOGFILE
cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
AUTODIST_HOME=`getent passwd autodist | cut -d: -f6`
cat $AUTODIST_HOME/.autoport/$a/$r-current.log >> $LOGFILE
fi
# if [ "${AUTOPORT_CROSS[$i]}" ]; then

View File

@ -2,9 +2,11 @@
# autoport global configuration
#
local_ftp=/var/ftp/pub/openmamba/
#AUTOBUILDS_STATUS_URL="http://www.openmamba.org/distribution/autobuilds.html"
#AUTOPORT_ENABLE=1
#AUTOPORT_CGI_HOST=(http://localhost/cgi-bin/autodist http://192.168.0.100/cgi-bin/autodist)
#AUTOPORT_CGI_HOST=(http://localhost/cgi-bin/autodist)
#AUTOPORT_WEBBUILD_HOST=http://localhost/webbuild.html
AUTOPORT_DEVEL_IMPORT_REPOSITORIES="devel-makedist devel devel-games devel-autodist devel-gnome \
devel-kde4 devel-xorg devel-kernel devel-misc devel-java devel-future devel-past devel-contrib devel-contrib-java"

View File

@ -0,0 +1,68 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<!-- styles needed by jScrollPane -->
<link type="text/css" href="/scripts/jquery.jscrollpane.css" rel="stylesheet" media="all" >
<!-- latest jQuery direct from google's CDN -->
<script type="text/javascript" src="/scripts/jquery.js"></script>
<!-- the mousewheel plugin - optional to provide mousewheel support -->
<script type="text/javascript" src="/scripts/jquery.mousewheel.js"></script>
<!-- the jScrollPane script -->
<script type="text/javascript" src="/scripts/jquery.jscrollpane.min.js"></script>
<link rel="stylesheet" type="text/css" href="/styles/webbuild.css">
<script type="text/javascript" src="/scripts/socialbox.js"></script>
<script type="text/javascript">
<!--
var lastupdate = 0;
var reloadtime = 0;
function ajax_getvalues() {
var url = window.location.protocol+"//"+window.location.hostname+"/cgi-bin/autodist?FORMAT=xml&"+window.location.href.replace(/.*\?/,"");
if (window.XMLHttpRequest)
xmlhttp = new XMLHttpRequest();
else if (window.ActiveXObject)
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
else
return;
document.getElementById("noajax_msg").innerHTML = "";
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState != 4)
return;
var xmldoc = xmlhttp.responseXML.documentElement;
document.getElementById("output").innerHTML = xmldoc.getElementsByTagName("output")[0].childNodes[0].nodeValue;
reloadtime = xmldoc.getElementsByTagName("reloadtime")[0].childNodes[0].nodeValue;
lastupdate = (+new Date());
setTimeout("ajax_getvalues()", reloadtime);
}
xmlhttp.open("GET", url, true);
xmlhttp.send(null);
}
//-->
</script>
</head><body>
<div id=container style="position:relative;width:894px;height:auto;top:0;left:0;margin-left:auto;margin-right:auto;">
<table width="100%"><tr><td>
<tr><td valign="middle">
<table align="center"><tr>
<td colspan=2><img src="/images/webbuild.png" alt="build automatici">
&nbsp;&nbsp;&nbsp;<b>- Autodist - Build automatici</b>
</td>
</tr></table>
</td></tr>
<tr><td>
<div id="noajax_msg"><p>Il supporto per AJAX non è abilitato nel tuo browser. L'aggiornamento live non sarà disponibile, premi Ricarica per aggiornare la pagina.</p></div>
<span id="output">Caricamento in corso, attendere...</span>
<script>
ajax_getvalues("");
$("#output").mousemove(function(event) {
lastupdatetime = (+new Date()) - lastupdate; // milliseconds since last update
// var msg = "called " + lastupdatetime + "ms ago";
if (lastupdatetime > reloadtime) { lastupdate = lastupdatetime; ajax_getvalues(); }
});
</script>
</td></tr>
</table>
</div>
</body></html>