webbuild: sync to current running version:

- refine socialbox refresh to avoid high browser cpu usage
- support for ruby specfile creation template and fixes for source creation from git
- make processes list a scroll-pane scrollbox
- other small webbuild fixes
This commit is contained in:
Silvan Calarco 2013-12-14 11:57:03 +01:00
parent ecc3ed74a2
commit f5d91a52fc
4 changed files with 128 additions and 59 deletions

View File

@ -1,4 +1,10 @@
var url = "/cgi-bin/webbuild"
var url = "/cgi-bin/webbuild.cgi"
/*function socialbox_refresh_times() {
socialbox_refresh_times(false);
}*/
var socialbox_fullrefresh_count = 0;
function socialbox_refresh_times() {
var times = document.getElementsByName("socialtime");
@ -12,6 +18,12 @@ function socialbox_refresh_times() {
var socialtime = times[i].attributes[1].value;
}
var timeago = utcnow - socialtime;
if ((times[i].innerHTML == "") ||
(timeago <= 120) || // update every 15 secs if < 2 min
(timeago <= 7200 && (socialbox_fullrefresh_count % 4 == 0)) || // update every minute if < 120 min
(timeago <= 86400 && (socialbox_fullrefresh_count % 120 == 0)) || // update every thirty minutes if < 1 day
(socialbox_fullrefresh_count >= 240)) // else update all every hour
{
var daysago = parseInt(timeago / 86400);
var hoursago = parseInt(timeago / 3600 % 24);
var minutesago = parseInt(timeago / 60 % 60);
@ -26,6 +38,8 @@ function socialbox_refresh_times() {
else times[i].innerHTML += secondsago + " seconds";
times[i].innerHTML += " ago) ";
}
}
if (socialbox_fullrefresh_count++ >= 240) socialbox_fullrefresh_count = 0;
}
var socialbox_interval = null;
@ -72,6 +86,7 @@ function ajax_getvalues_refresh(request,user,user_email,secret) {
}
if (xmldoc.getElementsByTagName("processes")[0] != undefined) {
document.getElementById("processes").innerHTML = xmldoc.getElementsByTagName("processes")[0].childNodes[0].nodeValue;
$(function() { $('.scroll-pane3').jScrollPane({scrollbarWidth:10}); });
}
$(function() { $('.scroll-pane').jScrollPane({scrollbarWidth:10}); });
// lastupdate = (+new Date());

View File

@ -31,16 +31,24 @@ function checkEnter(event) {
return false;
}
function checkMinLength(st,len) {
if (st.length >= len) return true;
return false;
return false;
}
function suggestSpecName(url) {
var version="";
var url=document.getElementById("speccreateurl").value;
if (url.indexOf('&') > 0) url=url.substring(0,url.indexOf('&')+1);
if (url.indexOf('?') > 0) url=url.substring(0,url.indexOf('?'));
var specname=url.substring(url.lastIndexOf('/')+1);
var extension;
while (i=specname.lastIndexOf('.')) {
e=specname.substring(i);
if (e != ".tar" && e != ".gz" && e != ".zip" && e != ".bz2" &&
e != ".xz" && e != ".tgz" && e != ".zip" && e != ".src" &&
e != ".orig") break;
e != ".orig" && e != ".gem" ) break;
extension=specname.substring(i+1);
specname=specname.substring(0,i);
}
i=specname.lastIndexOf('_');
@ -59,16 +67,24 @@ function suggestSpecName(url) {
document.getElementById("speccreateurl").value=url;
if (url.search("cpan.org") >= 0) {
specname="perl-"+specname;
} else if (url.search("haskell.org") >= 0) {
specname="ghc-"+specname;
} else if (extension == "gem") {
specname="ruby-"+specname;
} else {
specname=specname.toLowerCase();
}
if (url.search("git://") >= 0) {
if ((url.search("git://") >= 0) || (url.indexOf(".git", url.length - 4) != -1)) {
document.getElementById("speccreategitbranch").disabled=false;
} else {
document.getElementById("speccreategitbranch").disabled=true;
document.getElementById("speccreateversion").value=version;
}
if (url.indexOf(".git", url.length - 4) != -1) {
document.getElementById("speccreategitbranch").value="master";
specname=specname.substring(0,specname.lastIndexOf('.git'));
}
document.getElementById("speccreatename").value=specname;
document.getElementById("speccreateversion").value=version;
if (url) {
document.getElementById("speccreatename").disabled=false;
document.getElementById("speccreateversion").disabled=false;
@ -80,7 +96,12 @@ function suggestSpecName(url) {
document.getElementById("speccreatetype").disabled=true;
document.getElementById("speccreatebutton").disabled=true;
}
if (specname.search("perl-") >= 0) {
if (extension == "gem") {
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
if (document.getElementById("speccreatetype").options[j].value == "ruby")
document.getElementById("speccreatetype").options[j].selected=true;
};
} else if (specname.search("perl-") >= 0) {
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
if (document.getElementById("speccreatetype").options[j].value == "perl")
document.getElementById("speccreatetype").options[j].selected=true;
@ -90,6 +111,11 @@ function suggestSpecName(url) {
if (document.getElementById("speccreatetype").options[j].value == "python")
document.getElementById("speccreatetype").options[j].selected=true;
};
} else if (specname.substring(0,4) == "ghc-") {
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
if (document.getElementById("speccreatetype").options[j].value == "ghc")
document.getElementById("speccreatetype").options[j].selected=true;
};
} else if (url.search("kde.org") >= 0) {
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
if (document.getElementById("speccreatetype").options[j].value == "kde4")

View File

@ -178,14 +178,6 @@ input[type="checkbox"] {
border:1px solid #2b6600;
}
.scroll-pane {
background-color: #e0f2d0;
height:130px;
width:200px;
overflow:auto;
float:right;
}
.searchbox {
position:relative;
display:block;
@ -228,14 +220,23 @@ input[type="checkbox"] {
background-color:white;
}
.processes {
width:680px;
font-size:7pt;
.socialbox {
float:right;
font-size:8pt;
padding:0px;
height:130px;
line-height: 100%;
border:1px solid #2b6600;
}
.processes {
float:left;
font-size:7pt;
padding:0px;
height:130px;
line-height: 130%;
margin-bottom: 2px;
border:1px solid #2b6600;
padding:2px;
margin:0;
margin-bottom:2px;
background-color:#E0F2D0;
}
.notes {
@ -311,17 +312,12 @@ input[type="checkbox"] {
background: #2b6600;
}
.scroll-pane-h {
height:272px;
width:400px;
overflow:auto;
white-space:nowrap;
}
.scroll-pane-v {
height:272px;
width:400px;
.scroll-pane {
background-color: #e0f2d0;
height:130px;
width:200px;
overflow:auto;
float:right;
}
.scroll-pane1 {
@ -336,3 +332,25 @@ input[type="checkbox"] {
width:390px;
overflow:auto;
}
.scroll-pane3 {
background-color: #e0f2d0;
height:130px;
width:685px;
overflow:auto;
float:right;
}
.scroll-pane3-h {
height:272px;
width:400px;
overflow:auto;
white-space:nowrap;
}
.scroll-pane3-v {
height:272px;
width:400px;
overflow:auto;
}

View File

@ -375,6 +375,7 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
fi
numprocess=0
tac $WEBBUILD_STATEDIR/processes | \
while read line; do
set -- $line
RETCODE=$6
@ -384,7 +385,7 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
cmdline=`echo $cmdline | sed "s| --colors web||"`
PACKAGE_ENCODED=`cgi_encodevar $4`
[ $numprocess -eq 1 ] && {
echo -n "<div align=left class=processes>"
# echo -n "<div align=left class=processes>"
echo -n "<b>Webbuild jobs:</b> "
if [ "$STATE_JOBSSHOWALL" != "1" ]; then
echo "[ <a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=true\");>Show all</a> ]"
@ -414,7 +415,7 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
else
echo -n "\"<a href=# title=\"Click to see output log\" onClick=ajax_getvalues(\"ENVIRONMENT=$3&PACKAGE=$PACKAGE_ENCODED&"
echo -n "REQUEST=showlog&LOGTYPE=processoutput&LOGFILE=$5\")>"
echo -n "<b><i>$cmdline</i></b></a>\" "
echo -n "<b><i>$cmdline</i></b>\"</a> (`date -r $5 +\"%F %T\"`)"
if [ $RETCODE -eq 256 ]; then
$SUDO_WRAPPER finishprocess $1 "$USER" $5
RETCODE=$?
@ -433,8 +434,8 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
echo -n "</a>]"
fi
echo -n "<br>"
done < $WEBBUILD_STATEDIR/processes
[ $numprocess -gt 0 ] && echo -n "</div>"
done
# [ $numprocess -gt 0 ] && echo -n "</div>"
echo -n "]]></processes></webbuild>"
exit
fi
@ -901,10 +902,13 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
fi
echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById('package'))); $SRPMBUTTONDISABLED>"
if [ "${AUTOPORT_PORT[$ENVIRONMENT]}" ]; then
if [ "${AUTOPORT_PORT_REPOSITORY[$ENVIRONMENT]}" ]; then
echo -n "<input type=button name=port value=\"Port\" id=portbutton onclick="
echo -n "ajax_getvalues(\"REQUEST=autoport&REPOSITORY=\"+getSelectedValueById('repository')+\""
echo -n "&ENVIRONMENT=$ENVIRONMENT&"
if [ "${AUTOPORT_PORT_REPOSITORY[$ENVIRONMENT]}" != "#SELF" ]; then
echo -n "AUTOPORTRELEASEREPOSITORY=${AUTOPORT_PORT_REPOSITORY[$ENVIRONMENT]}&"
fi
if [ "$USER_CANMAINTAIN" ]; then
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
fi
@ -1015,7 +1019,7 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
[ "$SPECCREATEGITBRANCH" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE --git-branch $SPECCREATEGITBRANCH"
[ "$USER_FULLNAME" -a "$USER_EMAIL" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE --packager-fullname=\"$USER_FULLNAME\" --packager-email=\"$USER_EMAIL\""
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "$AUTOSPEC_CMD -s \"$SPECCREATEURL\" $AUTOSPEC_CMDLINE \
--changelog \"package created by $USER using the webbuild interface\""
--changelog \"package created 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 in <b>`print_environment_descr $ENVIRONMENT`</b> environment\" STIME=`date +%s`"
@ -1206,17 +1210,19 @@ if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "<br>Send to:"
echo -n "<select id=sendrepository>"
if [ "$USER_ALLREPOSITORIES" ]; then
SEND_REPS=`repository_list`
SEND_REPS="`repository_list`"
elif [ "$USER_CANMAINTAIN_REPOSITORIES" ]; then
SEND_REPS="$USER_CANMAINTAIN_REPOSITORIES";
for u in $USER_CANMAINTAIN_REPOSITORIES devel-$USER; do
[ "$u" = "$repname" ] && echo -n "<option value=\"$repname\" $SELECTED>$repname</option>"
done
SEND_REPS="$USER_CANMAINTAIN_REPOSITORIES"
else
SEND_REPS="devel-contrib"
fi
for f in $SEND_REPS; do
repname=`basename $f`
for u in $SEND_REPS devel-$USER; do
[ "$u" = "$repname" ] && echo -n "<option value=\"$repname\" $SELECTED>$repname</option>"
done
for repname in $SEND_REPS; do
# repname=`basename $f`
# skip different milestone repositories
[ "${AUTOPORT_IMPORT_REPOSITORIES[$ENVIRONMENT]/$repname}" = "${AUTOPORT_IMPORT_REPOSITORIES[$ENVIRONMENT]}" ] && continue
# if [ "$repname" = "devel-${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" -o \
# "$repname" = "${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}" -o \
# "$repname" = "devel-$USER" -o \
@ -1703,7 +1709,10 @@ case $REQUEST in
[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$AUTODISTPKGS $SPECVAR_Version-$SPECVAR_Release</b> from <i>`print_environment_descr $ENVIRONMENT`</i> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
;;
"autoport") if [ "$AUTOPORTPACKAGE" ]; then
$SUDO_WRAPPER background $ENVIRONMENT "$USER" $AUTOPORTPACKAGE "autoport $AUTOPORTPACKAGE -r $REPOSITORY --user $USER" &>/dev/null
if [ "$AUTOPORTRELEASEREPOSITORY" ]; then
AUTOPORT_APPEND="-d $AUTOPORTRELEASEREPOSITORY"
fi
$SUDO_WRAPPER background $ENVIRONMENT "$USER" $AUTOPORTPACKAGE "autoport $AUTOPORTPACKAGE -r $REPOSITORY $AUTOPORT_APPEND --user $USER" &>/dev/null
RET=$?
[ $RET -eq 0 ] && {
RET=-1
@ -2119,9 +2128,10 @@ if [ "$MAINTAINERMODE" = "true" ]; then
if [ "${REPOSITORY:0:10}" = "milestone2" ]; then
IMPORT_REPOSITORIES=$AUTOPORT_MILESTONE2_IMPORT_REPOSITORIES
else
IMPORT_REPOSITORIES="$AUTOPORT_DEVEL_IMPORT_REPOSITORIES devel-$USER"
IMPORT_REPOSITORIES="$AUTOPORT_DEVEL_IMPORT_REPOSITORIES devel-$USER $AUTOPORT_DEVEL_RELEASE_REPOSITORIES"
fi
for f in $IMPORT_REPOSITORIES; do
[ "$f" = "$REPOSITORY" ] && continue
if [ ! "$USER_ALLREPOSITORIES" ]; then
for u in $USER_CANMAINTAIN_REPOSITORIES devel-$USER; do
[ "$u" = "$f" ] && echo -n "<option value=\"$f\">$f</option>"