2013-05-22 12:09:19 +02:00
|
|
|
repository_list() {
|
|
|
|
if [ "$WEBBUILD_REPOSITORIES" ]; then
|
|
|
|
echo "${WEBBUILD_REPOSITORIES[*]}"
|
|
|
|
else
|
|
|
|
$SUDO_WRAPPER 0 local "$USER" "" "/usr/sbin/openmamba-repository list"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-11-19 23:52:30 +01:00
|
|
|
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]}
|
|
|
|
|
2012-12-01 23:36:43 +01:00
|
|
|
LOGDIR=`environment_logdir $ENVIRONMENT`
|
2012-11-19 23:52:30 +01:00
|
|
|
LOGFILES="$LOGDIR/$LOGFILE1 $LOGDIR/$LOGFILE2 $LOGDIR/$LOGFILE3 $LOGDIR/$LOGFILE4"
|
2013-05-23 15:44:13 +02:00
|
|
|
# sort by most recent and take first
|
|
|
|
LOGFILES=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls -t $LOGFILES 2>/dev/null | head -1"`
|
2012-11-19 23:52:30 +01:00
|
|
|
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
|
2013-01-19 16:24:26 +01:00
|
|
|
if [ $LOGFILESIZE -lt 524288 ]; then
|
2012-11-19 23:52:30 +01:00
|
|
|
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
|
2013-01-19 16:24:26 +01:00
|
|
|
head -c 262144 $f | parse_build_output $PACKAGE
|
2012-11-19 23:52:30 +01:00
|
|
|
echo "<br><font style=\"background-color:yellow;color:black\"><------ CUT (long file) -------></font>"
|
2013-01-19 16:24:26 +01:00
|
|
|
tail -c 262144 $f | parse_build_output $PACKAGE
|
2012-11-19 23:52:30 +01:00
|
|
|
else
|
2013-01-19 16:24:26 +01:00
|
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "head -c 262144 $f" | parse_build_output $PACKAGE
|
2012-11-19 23:52:30 +01:00
|
|
|
echo "<br><font style=\"background-color:yellow;color:black\"><------ CUT (long file) -------></font>"
|
2013-01-19 16:24:26 +01:00
|
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "tail -c 262144 $f" | parse_build_output $PACKAGE
|
2012-11-19 23:52:30 +01:00
|
|
|
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>"
|
|
|
|
|
2013-01-19 16:24:26 +01:00
|
|
|
# toolchain
|
|
|
|
echo -n "<br>"
|
|
|
|
local toolchain_output=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "LANGUAGE=C gcc --version | head -n1; LANGUAGE=C ld -v"`
|
|
|
|
local gcc_ver=`echo $toolchain_output | sed "s|.*(GCC) \([0-9.]*\) .*|\1|"`
|
|
|
|
local binutils_ver=`echo $toolchain_output | sed "s|.*GNU \(.*\) (GNU Binutils.*)\(.*\)|\1 \2|"`
|
|
|
|
echo "Toolchain: gcc $gcc_ver, $binutils_ver"
|
|
|
|
|
2013-06-05 18:31:55 +02:00
|
|
|
# system upgrade
|
2013-01-19 16:24:26 +01:00
|
|
|
echo -n "<br><input type=button id=smartupgrade value=\"system upgrade\" onclick="
|
2012-11-19 23:52:30 +01:00
|
|
|
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\");>"
|
|
|
|
|
2013-06-05 18:31:55 +02:00
|
|
|
# rpm manager
|
|
|
|
echo -n "<input type=button id=rpmmanager value=\"RPM manager\" onclick="
|
|
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
|
|
echo -n "REQUEST=rpmmanager\");>"
|
|
|
|
|
2012-11-19 23:52:30 +01:00
|
|
|
# environment search
|
2013-05-04 15:46:24 +02:00
|
|
|
echo -n "<br><div style=\"white-space:nowrap;width:100%;\">Provides:<input type=text style=\"width:75%;align:center;padding:0;margin:2px;\" id=environmentsearch value=\"Search package or provide...\" "
|
2012-11-19 23:52:30 +01:00
|
|
|
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&"
|
2013-05-04 15:46:24 +02:00
|
|
|
echo -n "REQUEST=environmentsearch&ENVSEARCHTEXT=\"+encodeURIComponent(getElementById('environmentsearch').value));></div>"
|
2012-11-19 23:52:30 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-06-03 13:46:04 +02:00
|
|
|
function print_showlogcontrols() {
|
|
|
|
echo -n "<showlogcontrols><![CDATA["
|
|
|
|
# autodist logs
|
|
|
|
echo -n "<hr><b>Show last autodist logs:</b> "
|
|
|
|
echo -n "<input type=button value=\"prepare\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
|
|
|
echo -n "REQUEST=showlog&LOGTYPE=prepare&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
|
|
|
echo -n "<input type=button value=\"update\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
|
|
|
echo -n "REQUEST=showlog&LOGTYPE=update&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
|
|
|
echo -n "<input type=button class=boldbutton value=\"build\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
|
|
|
echo -n "REQUEST=showlog&LOGTYPE=build&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
|
|
|
echo -n "<input type=button value=\"install\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
|
|
|
echo -n "REQUEST=showlog&LOGTYPE=install&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
|
|
|
echo -n "<input type=button value=\"send\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
|
|
|
echo -n "REQUEST=showlog&LOGTYPE=send&LOGSTATUSOK=\"+document.all.logstatusOK.checked);> with status: "
|
|
|
|
echo -n "OK <input id=\"logstatusOK\" type=\"radio\" name=\"logstatus\" value=\"OK\"> "
|
|
|
|
echo -n "FAILED <input type=\"radio\" name=\"logstatus\" value=\"FAILED\" checked=\"checked\">"
|
|
|
|
# close tag
|
|
|
|
echo -n "]]></showlogcontrols>"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-11-19 23:52:30 +01:00
|
|
|
function print_editorcontrols() {
|
|
|
|
|
|
|
|
echo -n "<editcontrols><![CDATA["
|
|
|
|
# specfile save
|
2013-05-04 15:46:24 +02:00
|
|
|
echo -n "<div style=\"width:100%;overflow:hidden;\"><span style=\"float:left\">"
|
2012-11-19 23:52:30 +01:00
|
|
|
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."`\");>"
|
2013-05-04 15:46:24 +02:00
|
|
|
# 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>?"`\")>"
|
2012-11-19 23:52:30 +01:00
|
|
|
# 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));>"
|
2013-05-04 15:46:24 +02:00
|
|
|
echo -n "<input type=text id=specnewname value=\"\" size=12>.spec"
|
2012-11-19 23:52:30 +01:00
|
|
|
# add a note
|
2013-05-04 15:46:24 +02:00
|
|
|
echo -n "<label>"
|
2012-11-19 23:52:30 +01:00
|
|
|
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())+\"&"
|
2013-05-04 15:46:24 +02:00
|
|
|
echo -n "REQUEST=addpkgnote&PKGNOTE=\"+encodeURIComponent(getElementById('pkgnote').value));></label></span>"
|
|
|
|
echo -n "<span style=\"display:block;overflow:hidden;padding-right:5px;\">"
|
|
|
|
echo -n "<input type=text id=pkgnote value=\"\" style=\"width:100%\">"
|
|
|
|
echo -n "</span></div>"
|
2012-11-19 23:52:30 +01:00
|
|
|
# specfile update
|
2013-05-04 15:46:24 +02:00
|
|
|
echo -n "<div style=\"width:100%;overflow:hidden;\"><span style=\"float:left\">"
|
|
|
|
echo -n "<input type=button id=updatespecbutton value=\"update\" onclick="
|
2012-11-19 23:52:30 +01:00
|
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
|
|
echo -n "REQUEST=updatespec&UPDATESPECVERSION=\"+getElementById('updatespecversion').value+\"&"
|
|
|
|
echo -n "RPMFORCE=\"+getElementById('rpmforce').checked+\"&"
|
2013-01-19 16:24:26 +01:00
|
|
|
echo -n "DEBUG=\"+getElementById('debug').checked+\"&"
|
2012-11-19 23:52:30 +01:00
|
|
|
echo -n "REBUILDSPECCHANGELOG=\"+encodeURIComponent(getElementById('rebuildspecchangelog').value)+\"&"
|
|
|
|
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue()));>"
|
2013-05-04 15:46:24 +02:00
|
|
|
echo -n " (automatic or specify new version:<input type=text id=updatespecversion value=\"\" size=\"10\">"
|
|
|
|
echo -n " or new release changelog:"
|
|
|
|
echo -n "</span><span style=\"display:block;float:right\">)</span>"
|
|
|
|
echo -n "<span style=\"display:block;overflow:hidden;padding-right:5px;\">"
|
|
|
|
echo -n "<input type=text id=rebuildspecchangelog value=\"$REBUILDSPECCHANGELOG\" style=\"width:100%\">"
|
|
|
|
echo -n "</span></div>"
|
2012-11-19 23:52:30 +01:00
|
|
|
# close tag
|
|
|
|
echo -n "]]></editcontrols>"
|
|
|
|
|
|
|
|
}
|