169 lines
7.8 KiB
Plaintext
169 lines
7.8 KiB
Plaintext
|
function showlog() {
|
||
|
local LOGDIR LOGFILES LOGFILE1 LOGFILE2 LOGFILE3 LOGFILE4
|
||
|
|
||
|
if [ "$LOGTYPE" = "processoutput" -o "$LOGTYPE" = "processtail" ]; then
|
||
|
LOGFILES=$LOGFILE
|
||
|
LOGOUTPUTID=outputbottom
|
||
|
else
|
||
|
LOGOUTPUTID=outputbottom
|
||
|
case $LOGTYPE in
|
||
|
autoupdate) LOGFILE=update; ;;
|
||
|
buildinstall|rebuild) LOGFILE=build ;;
|
||
|
*) LOGFILE=$LOGTYPE ;;
|
||
|
esac
|
||
|
if [ "$LOGSTATUSOK" = "true" ]; then
|
||
|
LOGFILE=$LOGFILE/ok
|
||
|
LOGSTATUSAPPEND=" ok"
|
||
|
else
|
||
|
LOGFILE=$LOGFILE/failed
|
||
|
LOGSTATUSAPPEND=" failed"
|
||
|
fi
|
||
|
LOGFILE1=$LOGFILE/${PACKAGE/\//_}.${AUTOPORT_ARCH[$ENVIRONMENT]}
|
||
|
LOGFILE2=$LOGFILE/${PACKAGE/\//_}__*.${AUTOPORT_ARCH[$ENVIRONMENT]}
|
||
|
LOGFILE3=$LOGFILE/*_${PACKAGE/\//_}__*.${AUTOPORT_ARCH[$ENVIRONMENT]}
|
||
|
LOGFILE4=$LOGFILE/*_${PACKAGE/\//_}.${AUTOPORT_ARCH[$ENVIRONMENT]}
|
||
|
|
||
|
if [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
|
||
|
LOGDIR="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autodist/log/"
|
||
|
elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then
|
||
|
LOGDIR="/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autodist/log/"
|
||
|
else
|
||
|
LOGDIR="/var/autodist/log/"
|
||
|
fi
|
||
|
LOGFILES="$LOGDIR/$LOGFILE1 $LOGDIR/$LOGFILE2 $LOGDIR/$LOGFILE3 $LOGDIR/$LOGFILE4"
|
||
|
|
||
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||
|
[ "$i" = "$ENVIRONMENT" ] && continue
|
||
|
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
||
|
LOGDIR="/var/autodist/log"
|
||
|
LOGFILES="$LOGFILES $LOGDIR/$LOGFILE1 $LOGDIR/$LOGFILE2 $LOGDIR/$LOGFILE3 $LOGDIR/$LOGFILE4"
|
||
|
fi
|
||
|
done
|
||
|
fi
|
||
|
echo -n "<output><![CDATA[<hr><b>Console output for $PACKAGE ($LOGTYPE$LOGSTATUSAPPEND):</b>"
|
||
|
echo "<div align=left class=output id=$LOGOUTPUTID>"
|
||
|
for f in $LOGFILES; do
|
||
|
if [ -r $f ]; then
|
||
|
LOGFILESIZE=`stat -c %s $f`
|
||
|
LOGDATE=`stat -c %y $f`
|
||
|
else
|
||
|
LOGFILESIZE=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "stat -c %s $f"`
|
||
|
LOGDATE=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "stat -c %y $f"`
|
||
|
[ $? -eq 0 ] || continue
|
||
|
fi
|
||
|
echo -n "<b>`basename $f` ($LOGDATE; $LOGFILESIZE):</b>"
|
||
|
echo -n "<pre>"
|
||
|
if [ "$LOGTYPE" = "processtail" ]; then
|
||
|
echo -n "<!-- SCROLL -->"
|
||
|
tail -n +0 -f $f --pid $PROCESSPID | sed "s|<|\<|g"
|
||
|
echo -n "<!-- ENDSCROLL -->"
|
||
|
else
|
||
|
if [ $LOGFILESIZE -lt 131072 ]; then
|
||
|
if [ -r $f ]; then
|
||
|
cat $f | parse_build_output $PACKAGE
|
||
|
else
|
||
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "cat $f" | parse_build_output $PACKAGE
|
||
|
fi
|
||
|
else
|
||
|
if [ -r $f ]; then
|
||
|
head -c 65535 $f | parse_build_output $PACKAGE
|
||
|
echo "<br><font style=\"background-color:yellow;color:black\"><------ CUT (long file) -------></font>"
|
||
|
tail -c 65535 $f | parse_build_output $PACKAGE
|
||
|
else
|
||
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "head -c 65535 $f" | parse_build_output $PACKAGE
|
||
|
echo "<br><font style=\"background-color:yellow;color:black\"><------ CUT (long file) -------></font>"
|
||
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "tail -c 65535 $f" | parse_build_output $PACKAGE
|
||
|
fi
|
||
|
fi
|
||
|
fi
|
||
|
echo -n "</pre>"
|
||
|
done
|
||
|
echo -n "</div>]]></output>"
|
||
|
}
|
||
|
|
||
|
function showEnvironmentPanel() {
|
||
|
|
||
|
echo -n "Environment: <b>"
|
||
|
if [ "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" ]; then
|
||
|
echo -n "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} - "
|
||
|
else
|
||
|
echo -n "autodist - "
|
||
|
fi
|
||
|
if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
||
|
echo -n "update"
|
||
|
elif [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
|
||
|
echo -n "chroot"
|
||
|
elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then
|
||
|
echo -n "native"
|
||
|
elif [ "${AUTOPORT_CROSS[$ENVIRONMENT]}" ]; then
|
||
|
echo -n "cross"
|
||
|
else
|
||
|
echo -n "unknown type"
|
||
|
fi
|
||
|
echo -n " (${AUTOPORT_ARCH[$ENVIRONMENT]})</b>"
|
||
|
|
||
|
#echo "<br>Base repository: <b>${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}</b>"
|
||
|
|
||
|
# smart upgrade
|
||
|
echo -n "<input type=button id=smartupgrade value=\"system upgrade\" onclick="
|
||
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||
|
echo -n "REQUEST=smartupgrade\""
|
||
|
echo -n ",\"`cgi_encodevar "Upgrade current environment to latest updates now?"`\"); class=redbutton>"
|
||
|
|
||
|
## run ldconfig
|
||
|
#echo -n "<input type=button id=runldconfig value=\"run ldconfig\" onclick="
|
||
|
#echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||
|
#echo -n "REQUEST=runldconfig\");>"
|
||
|
|
||
|
# environment search
|
||
|
echo -n "<br>Installed:<input type=text size=23 style=\"align:center;padding:0;margin:2px;\" id=environmentsearch value=\"Search package or provide...\" "
|
||
|
echo -n "onfocus=\"if (this.value==this.defaultValue) this.value=''\" "
|
||
|
echo -n "onkeypress=if(checkEnter(event))ajax_getvalues(\""
|
||
|
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||
|
echo -n "REQUEST=environmentsearch&ENVSEARCHTEXT=\"+encodeURIComponent(getElementById('environmentsearch').value));>"
|
||
|
|
||
|
}
|
||
|
|
||
|
function print_editorcontrols() {
|
||
|
|
||
|
echo -n "<editcontrols><![CDATA["
|
||
|
# specfile save
|
||
|
echo -n "<input type=button id=savebutton value=\"save\" onclick="
|
||
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||
|
echo -n "REQUEST=savespec&SPECTEXT=\"+encodeURIComponent(editor.getValue()));"
|
||
|
echo -n "this.disabled=true; disabled=disabled class=redbutton>"
|
||
|
# specfile reload
|
||
|
echo -n "<input type=button id=updatespecbutton value=\"reload\" onclick="
|
||
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||
|
echo -n "REQUEST=reloadspec\""
|
||
|
echo -n ",\"`cgi_encodevar "Reload <b>$PACKAGE.spec</b>?<br><br>Warning: current unsaved .spec file changes will be lost."`\");>"
|
||
|
# specfile rename
|
||
|
echo -n "<input type=button id=updatespecbutton value=\"rename to:\" onclick="
|
||
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&RENAMESPECFROM=$PACKAGE&"
|
||
|
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
||
|
echo -n "REQUEST=renamespec&PACKAGE=\"+encodeURIComponent(getElementById('specnewname').value));>"
|
||
|
echo -n "<input type=text id=specnewname value=\"\" size=\"10\">.spec"
|
||
|
# specfile delete
|
||
|
echo -n "<input type=button id=updatespecbutton value=\"delete\" onclick="
|
||
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||
|
echo -n "REQUEST=deletespec\",\"`cgi_encodevar "Really delete <b>$PACKAGE.spec</b>?"`\")>"
|
||
|
# add a note
|
||
|
echo -n "<input type=button id=addpkgnote value=\"add a note:\" onclick="
|
||
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||
|
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
||
|
echo -n "REQUEST=addpkgnote&PKGNOTE=\"+encodeURIComponent(getElementById('pkgnote').value));>"
|
||
|
echo -n "<input type=text id=pkgnote value=\"\" size=\"55\">"
|
||
|
# specfile update
|
||
|
echo -n "<br><input type=button id=updatespecbutton value=\"update\" onclick="
|
||
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||
|
echo -n "REQUEST=updatespec&UPDATESPECVERSION=\"+getElementById('updatespecversion').value+\"&"
|
||
|
echo -n "RPMFORCE=\"+getElementById('rpmforce').checked+\"&"
|
||
|
echo -n "REBUILDSPECCHANGELOG=\"+encodeURIComponent(getElementById('rebuildspecchangelog').value)+\"&"
|
||
|
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue()));>"
|
||
|
echo -n " (specify new version:<input type=text id=updatespecversion value=\"\" size=\"12\">"
|
||
|
echo -n " or new release changelog:<input type=text id=rebuildspecchangelog value=\"$REBUILDSPECCHANGELOG\" size=\"45\">)"
|
||
|
# close tag
|
||
|
echo -n "]]></editcontrols>"
|
||
|
|
||
|
}
|