webbuild: move show autodist logs section from right sidebar to central area below editor controls ..

- add environment information in some social_log messages
- improve automatic checks and output log in patches add function
This commit is contained in:
Silvan Calarco 2013-06-03 13:46:04 +02:00
parent 56923432c9
commit 07e9b8a75d
3 changed files with 88 additions and 28 deletions

View File

@ -226,6 +226,7 @@ function ajax_getvalues(request,confirm) {
<span id="processes"></span>
<div><span id="editor"></span></div>
<span id="editcontrols"></span>
<span id="showlogcontrols"></span>
<span id="output"></span>
</div>
<div style="position:relative;float:right;width:200px;padding:0;margin:1px;">

View File

@ -76,6 +76,7 @@ if [ "$USER" ]; then
echo -n "<repositories> </repositories>"
echo -n "<packages> </packages>"
echo -n "<editcontrols> </editcontrols>"
echo -n "<showlogcontrols> </showlogcontrols>"
echo -n "<editor> </editor>"
echo -n "<operationpanel> </operationpanel>"
echo -n "</webbuild>"
@ -97,6 +98,7 @@ elif [ "$REQUEST" != "refresh" ]; then
echo -n "<repositories> </repositories>"
echo -n "<packages> </packages>"
echo -n "<editcontrols> </editcontrols>"
echo -n "<showlogcontrols> </showlogcontrols>"
echo -n "<editor> </editor>"
echo -n "<operationpanel> </operationpanel>"
echo -n "</webbuild>"
@ -110,6 +112,7 @@ if [ "$USER_ENABLED" != "1" -a "$REQUEST" != "refresh" ]; then
echo -n "<repositories> </repositories>"
echo -n "<packages> </packages>"
echo -n "<editcontrols> </editcontrols>"
echo -n "<showlogcontrols> </showlogcontrols>"
echo -n "<editor> </editor>"
if [ "$USER" ]; then
if [ "$REQUEST" = "enablerequest" ]; then
@ -596,6 +599,7 @@ fi
if [ ! "$REPOSITORY" -a ! "$PACKAGE" -a ! "$REQUEST" = "repsearch" ]; then
echo -n "<editor> </editor>"
echo -n "<editcontrols> </editcontrols>"
echo -n "<showlogcontrols> </showlogcontrols>"
fi
# REPOSITORIES search
@ -863,7 +867,7 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "$AUTOSPEC_CMD -s \"$SPECCREATEURL\" $AUTOSPEC_CMDLINE --changelog \"package created by $USER using the webbuild interface\""
RET=$?
[ $RET -eq 0 ] && {
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STARGET=developers STEXT=\"is working on <b>$PACKAGE</b> new package\" STIME=`date +%s`"
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STARGET=developers STEXT=\"is working on <b>$PACKAGE</b> new package in <b>`print_environment_descr $ENVIRONMENT`</b> environment\" STIME=`date +%s`"
echo "<br><font color=gold>HINT: don't forget to add build requirements after successful build! Edit specfile and check <i>recreate SRPM</i> before sending the package.</font>"
}
else
@ -874,7 +878,7 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
"renamespec") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "mv $RENAMESPECFROM.spec $PACKAGE.spec && sed -i \"s|\(Name:[[:space:]]*\).*|\1$PACKAGE|\" $PACKAGE.spec"
RET=$?
[ $RET -eq 0 ] && {
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"renamed <b>$RENAMESPECFROM</b> to <b>$PACKAGE</b>\" STIME=`date +%s`"
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"renamed <b>$RENAMESPECFROM</b> to <b>$PACKAGE</b> in <b>`print_environment_descr $ENVIRONMENT`</b> environment\" STIME=`date +%s`"
echo "Specfile $RENAMESPECFROM successfully renamed to <b>$PACKAGE</b>."
}
;;
@ -924,6 +928,7 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
echo -n "]]></output>"
if [ "$REQUEST" = "exit" ]; then
echo -n "<editcontrols> </editcontrols>"
echo -n "<showlogcontrols> </showlogcontrols>"
echo -n "<operations> </operations>"
echo -n "<editor> </editor>"
echo -n "</webbuild>"
@ -932,6 +937,11 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
if [ $RET -eq 0 ]; then
REQUEST="edit"
print_editorcontrols
if [ "$PACKAGE" ]; then
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
print_showlogcontrols
fi
fi
else
REQUEST=
fi
@ -942,6 +952,7 @@ if [ "$MAINTAINERMODE" = "true" ]; then
if [ ! "$REQUEST" -o "$REQUEST" = "changerepository" -o \
"$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "reloadmaintainer" ]; then
echo -n "<editcontrols> </editcontrols>"
echo -n "<showlogcontrols> </showlogcontrols>"
echo -n "<operations> </operations>"
if [ "$REPOSITORY" ]; then
echo -n "<editor><![CDATA["
@ -1002,6 +1013,11 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmai
# echo -n "</div>"
# echo -n "]]></output>"
print_editorcontrols
if [ "$PACKAGE" ]; then
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
print_showlogcontrols
fi
fi
fi
REQUEST=
fi
@ -1229,22 +1245,22 @@ if [ "$MAINTAINERMODE" != "true" ]; then
fi
fi
if [ "$PACKAGE" ]; then
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
# autodist logs
echo -n "</div><hr><b>Last autodist logs:</b> "
echo -n "OK <input id=\"logstatusOK\" type=\"radio\" name=\"logstatus\" value=\"OK\"> "
echo -n "FAILED<input type=\"radio\" name=\"logstatus\" value=\"FAILED\" checked=\"checked\"><br>"
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 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);>"
fi
# if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
# # autodist logs
# echo -n "</div><hr><b>Last autodist logs:</b> "
# echo -n "OK <input id=\"logstatusOK\" type=\"radio\" name=\"logstatus\" value=\"OK\"> "
# echo -n "FAILED<input type=\"radio\" name=\"logstatus\" value=\"FAILED\" checked=\"checked\"><br>"
# 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 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);>"
# fi
echo -n "<hr><div style=\"background-color:#E0F2D0\"><b>RPM packaging commands:</b><br>"
# check for updates
echo -n "<input type=button value=\"check for updates\" onclick="
@ -1350,7 +1366,7 @@ if [ "$MAINTAINERMODE" != "true" ]; then
patchname=${f/*\/}
patchname=${patchname/.patch}
patchname=${patchname/$PACKAGE-}
echo -n "<option value=\"$f\">${SPECVAR_Patch_idx[$i-1]}: $patchname</option>"
echo -n "<option value=\"$f\">$patchname (${SPECVAR_Patch_idx[$i-1]})</option>"
done
echo -n "</select>"
# list build dir files
@ -1392,7 +1408,7 @@ if [ "$MAINTAINERMODE" != "true" ]; then
autospectemplatename=`basename $f`
echo -n "<option value=\"$autospectemplatename\">$autospectemplatename</option>"
done
echo -n "</select></div>"
echo -n "</select>"
# macros
echo -n "<select id=macrosfile onchange="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=showmacrosfile&"
@ -1422,7 +1438,8 @@ echo -n "</textarea>"
echo -n "]]></chatpanel>"
if [ "$REQUEST" != "" ]; then
echo -n "<output><![CDATA[<hr><b>Console output ($REQUEST"
echo -n "<output><![CDATA[<hr>"
echo -n "<b>Console output ($REQUEST"
[ "$PACKAGE" ] && echo -n " for $PACKAGE"
echo -n "):</b>"
echo -n "<div align=left class=output "
@ -1618,14 +1635,29 @@ case $REQUEST in
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "curl -sSkL '$ADDPATCHURL' -o ../SOURCES/$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch"
RET=$?
[ $RET -eq 0 ] && {
echo -n "Patch added with name <b>$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch</b>."
echo -n "<br><br><font color=gold>HINT: add the following lines in the appropriate sections:</font><br><br>"
echo -n "<font color=gold>1) in the header after Source[0-9]: and Patch[0-9]: lines:</font><br>"
NEWPATCHNUM=$((${SPECVAR_Patch_idx[${#SPECVAR_Patch_idx[@]}-1]}+1))
echo "<br>${SPECVAR_Version}: ${SPECVAR_Patch_idx[*]} : ${SPECVAR_Patch[*]}<br>"
echo -n "Patch added to sources with name '<b>$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch'</b>."
for l in 1 0 2 3; do
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && patch --dry-run -s -p1 < $SPECVAR_RPMSOURCESDIR/$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch >/dev/null"
RET=$?
[ $RET -eq 0 ] && break
done
if [ $RET -eq 0 ]; then
echo -n "<br><font color=green>Info: good, patch applies successfully with -p$l option!</font>"
echo -n "<br><br><font color=gold>HINT: add the following lines in the appropriate sections:</font><br>"
else
echo -n "<br><font color=red>Warning: patch does not apply with '-p0' to '-p3' options!</font>"
echo "<br><br><font color=gold>HINT: you might want to retry from a clean build dir after pressing the 'unpack' button or check if it applies after changing working subdirectory in build tree.</font>"
echo -n "<br><font color=gold>HINT: add anyway the following lines in the appropriate sections and press 'prepare' to see patch command output:</font><br>"
fi
echo -n "<br><font color=gold>1) in the header after Source[0-9]: and Patch[0-9]: lines:</font><br>"
if [ "${SPECVAR_Patch[*]}" ]; then
NEWPATCHNUM=$((${SPECVAR_Patch_idx[${#SPECVAR_Patch_idx[@]}-1]}+1))
else
NEWPATCHNUM=0
fi
echo -ne "<br><pre>Patch$NEWPATCHNUM: $PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch</pre>"
echo -n "<font color=gold>2) in %prep section after %setup:</font><br>"
echo -ne "<br><pre>%patch$NEWPATCHNUM -p1</pre>"
echo -ne "<br><pre>%patch$NEWPATCHNUM -p$l</pre>"
RET=-1
}
else
@ -1827,8 +1859,14 @@ if [ "$REQUEST" != "" ]; then
if [ $RET -le 0 -a "$SPECAVAILABLE" -a ! "$MAINTAINERMODE" ]; then
print_editorcontrols
fi
fi
if [ "$PACKAGE" ]; then
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
print_showlogcontrols
fi
fi
fi
if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "<packages> </packages>"

View File

@ -127,6 +127,27 @@ function showEnvironmentPanel() {
}
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>"
}
function print_editorcontrols() {
echo -n "<editcontrols><![CDATA["