webbuild: improvement in RPM manager and lots of other changes and fixes

This commit is contained in:
Silvan Calarco 2013-07-11 11:03:09 +02:00
parent ee91237d64
commit cbe63c0c85
5 changed files with 253 additions and 75 deletions

View File

@ -90,6 +90,11 @@ function suggestSpecName(url) {
if (document.getElementById("speccreatetype").options[j].value == "python")
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")
document.getElementById("speccreatetype").options[j].selected=true;
};
} else {
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
if (document.getElementById("speccreatetype").options[j].value == "library")
@ -112,6 +117,26 @@ function replaceHTML(el, html) {
return newEl;
};
function getDownload(request) {
var url = "/cgi-bin/webbuild.cgi"
if (request != "")
request=request+"&USER="+user+"&USER_EMAIL="+user_email+"&SECRET="+encodeURIComponent(secret);
else
request="USER="+user+"&USER_EMAIL="+user_email+"&SECRET="+encodeURIComponent(secret);
url = url + "?" + request;
// var hiddenIFrameID = 'hiddenDownloader', iframe = document.getElementById(hiddenIFrameID);
// if (iframe == null) {
iframe = document.createElement('iframe');
// iframe.id = hiddenIFrameID;
iframe.style.display = 'none';
// }
iframe.src = url;
document.body.appendChild(iframe);
}
// ajaxFileUpload
jQuery.extend({

View File

@ -22,8 +22,10 @@ fi
# read configuration after cgi_getvars to prevent variables overriding
. /etc/sysconfig/autoport
echo -e "Content-type: text/xml\nPragma: no-cache\n"
echo -n "<webbuild>"
if [ "$REQUEST" != "rpmmanagerdownload" ]; then
echo -e "Content-type: text/xml\nPragma: no-cache\n"
echo -n "<webbuild>"
fi
# SECURITY
USER_ENABLED=
@ -40,6 +42,10 @@ if [ "$USER" ]; then
. $WEBBUILD_STATEDIR/users/$USER.conf
fi
if [ "$USER_ENABLED" ]; then
if [ "$USER_EMAIL" ]; then
grep "USER_EMAIL=" $WEBBUILD_STATEDIR/users/$USER.conf >/dev/null ||
echo "USER_EMAIL=$USER_EMAIL" >> $WEBBUILD_STATEDIR/users/$USER.conf
fi
USER_ENABLED=
if [ "$SECRET" = "$USER_SECRET" ]; then
[ "$REMOTE_ADDR" = "127.0.0.1" -o "$USER_SECRET" ] && USER_ENABLED=1 || USER_ENABLED=
@ -225,7 +231,7 @@ if [ "$REQUEST" = "refresh" -o ! "$USER" ]; then
STARGET=
SID=
eval $line
[ "$SID" -a "$FROMID" ] || continue
[ "$SID" ] || continue
[ $SID -ge $FROMID ] || continue
[ "$STARGET" = "developers" -a ! "$USER" ] && continue
[ "$SUSER" = "$USER" -a "$STARGET" == "developers" ] && continue
@ -277,6 +283,21 @@ _EOF
. $WEBBUILD_STATEDIR/cache/config-dynamic
fi
if [ "$REQUEST" = "rpmmanagerdownload" ]; then
resolve_rpmmanagerdir "$RPMMANAGERDIR" "${AUTOPORT_ARCH[$ENVIRONMENT]}" "$REPOSITORY"
for f in $RPMMANAGERPACKAGES; do
installpackages="$installpackages $rpmmanagerdir/$f"
done
if [ "$rpmmanagermode" = "environment" ]; then
download_file $ENVIRONMENT "$installpackages"
else
download_file "" "$installpackages"
fi
RET=$?
exit
fi
# delete a note
if [ "$REQUEST" = "removenote" ]; then
if [ "$USER" = "$NOTEUSER" -o "$USER_ADMIN" ]; then
@ -295,10 +316,12 @@ if [ "$USER_ADMIN" -a "$REQUEST" = "enableuser" ]; then
cat >> $WEBBUILD_STATEDIR/users/$REQUEST_USER.conf << _EOF
USER_ENABLED=1
USER_SECRET='$REQUEST_SECRET'
USER_EMAIL='$REQUEST_USER_EMAIL'
_EOF
else
cat >> $WEBBUILD_STATEDIR/users/$REQUEST_USER.conf << _EOF
USER_ENABLED=0
USER_EMAIL='$REQUEST_USER_EMAIL'
_EOF
fi
fi
@ -343,10 +366,10 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
esac
echo -n "&nbsp;<input type=button id=enableuser value=\"Accept\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=enableuser&REQUEST_ACCEPT=true&REQUEST_USER=$REQUEST_USER&REQUEST_SECRET=`cgi_encodevar $REQUEST_SECRET`\");>"
echo -n "REQUEST=enableuser&REQUEST_ACCEPT=true&REQUEST_USER=$REQUEST_USER&REQUEST_USER_EMAIL=$REQUEST_USER_EMAIL&REQUEST_SECRET=`cgi_encodevar $REQUEST_SECRET`\");>"
echo -n "&nbsp;<input type=button id=enableuser value=\"Deny\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=enableuser&REQUEST_ACCEPT=&REQUEST_USER=$REQUEST_USER&REQUEST_SECRET=`cgi_encodevar $REQUEST_SECRET`\");>"
echo -n "REQUEST=enableuser&REQUEST_ACCEPT=&REQUEST_USER=$REQUEST_USER&REQUEST_USER_EMAIL=$REQUEST_USER_EMAIL&REQUEST_SECRET=`cgi_encodevar $REQUEST_SECRET`\");>"
done < $WEBBUILD_STATEDIR/requests
echo -n "</div>"
fi
@ -466,20 +489,68 @@ if [ "$REQUEST" = "environmentsearch" ]; then
exit
fi
# install rpms window
# rpm manager
if [ "$REQUEST" = "rpmmanager" ]; then
environment_descr=`print_environment_descr $i`
echo -n "<window><![CDATA["
echo -n "<div class=windowcontainer><div class=windowopaquebackground></div>"
echo -n "<div class=windowbox><div style=\"overflow:auto;width:600px;height:400px\">"
echo -n "<div class=windowbox><div style=\"overflow:auto;width:600px;height:420px\">"
echo -n "RPM manager for <b>$environment_descr</b> environment<br>"
echo -n "<div style=\"text-align:left\"><label><input type=checkbox name=pkgsselectallcheckbox value=\"\" onclick=checkAllBoxes('rpmmanagercheckbox',this.checked);>select/unselect all</label></div>"
# select rpm manager resource directory to display
echo "<select id=rpmmanagerdir "
echo -n "onchange=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=rpmmanager&RPMMANAGERDIR=\"+this.value);>"
[ "$RPMMANAGERDIR" = "RPMS" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"RPMS\" $SELECTED>Local *.${AUTOPORT_ARCH[$ENVIRONMENT]}.rpm</option>"
[ "$RPMMANAGERDIR" = "RPMSNOARCH" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"RPMSNOARCH\" $SELECTED>Local *.noarch.rpm</option>"
[ "$RPMMANAGERDIR" = "SRPMS" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"SRPMS\" $SELECTED>Local *.src.rpm</option>"
if [ -e $local_ftp/$REPOSITORY ]; then
[ "$RPMMANAGERDIR" = "REP_RPMS" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"REP_RPMS\" $SELECTED>$REPOSITORY *.${AUTOPORT_ARCH[$ENVIRONMENT]}.rpm</option>"
[ "$RPMMANAGERDIR" = "REP_RPMSNOARCH" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"REP_RPMSNOARCH\" $SELECTED>$REPOSITORY *.noarch.rpm</option>"
[ "$RPMMANAGERDIR" = "REP_SRPMS" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"REP_SRPMS\" $SELECTED>$REPOSITORY *.src.rpm</option>"
fi
echo -n "</select>"
# multiselect
echo -n "<div style=\"text-align:left\"><label><input type=checkbox name=pkgsselectallcheckbox value=\"\" onclick=checkAllBoxes('rpmmanagercheckbox',this.checked);>select/unselect all</label>"
echo -n "</div>"
echo -n "<div class=multiselect style=\"height:350px;text-align:left;\">"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls -t ../RPMS/${AUTOPORT_ARCH[$ENVIRONMENT]}/*.${AUTOPORT_ARCH[$ENVIRONMENT]}.rpm ../RPMS/noarch/*.noarch.rpm 2>/dev/null" | \
while read f; do
resolve_rpmmanagerdir "$RPMMANAGERDIR" "${AUTOPORT_ARCH[$ENVIRONMENT]}" "$REPOSITORY"
rpmmanagerfiles=$rpmmanagerdir/$rpmmanagermask
if [ "${rpmmanagermode}" = "environment" ]; then
# local files in environment
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls -t $rpmmanagerfiles 2>/dev/null" | \
while read f; do
pkgname=`basename $f`
echo -n "<label><input type=checkbox name=rpmmanagercheckbox value=\"$pkgname\">${pkgname}</label>"
done
echo -n "<label>"
echo -n "<input type=checkbox name=rpmmanagercheckbox value=\"$pkgname\">${pkgname} "
echo -n "<a title=\"Click to download file\" href=\"#\" "
echo -n "onclick=getDownload(\"ENVIRONMENT=$ENVIRONMENT&REQUEST=rpmmanagerdownload&RPMMANAGERDIR=$RPMMANAGERDIR&"
echo -n "&REPOSITORY=$REPOSITORY&RPMMANAGERPACKAGES=\"+encodeURIComponent('$pkgname'));>"
echo -n "<img src=/images/download.png width=16 height=16></img></a>"
echo -n "</label>"
done
else
# files in real local repositories
ls -t $rpmmanagerfiles 2>/dev/null | \
while read f; do
pkgname=`basename $f`
echo -n "<label>"
echo -n "<input type=checkbox name=rpmmanagercheckbox value=\"$pkgname\">${pkgname} "
echo -n "<a title=\"Click to download file\" href=\"#\" "
echo -n "onclick=getDownload(\"ENVIRONMENT=$ENVIRONMENT&REQUEST=rpmmanagerdownload&RPMMANAGERDIR=$RPMMANAGERDIR&"
echo -n "&REPOSITORY=$REPOSITORY&RPMMANAGERPACKAGES=\"+encodeURIComponent('$pkgname'));>"
echo -n "<img src=/images/download.png width=16 height=16></img></a>"
echo -n "</label>"
done
fi
echo -n "</div>"
echo -n "</div>"
@ -491,6 +562,7 @@ if [ "$REQUEST" = "rpmmanager" ]; then
echo -n "p=getCheckedValuesByName('rpmmanagercheckbox');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "RPMMANAGERFORCE=\"+getElementById('rpmmanagerforce').checked+\"&"
echo -n "REQUEST=rpmmanagerinstall\""
echo -n ",\"`cgi_encodevar "Install <b>"`\"+p+"
@ -505,9 +577,10 @@ if [ "$REQUEST" = "rpmmanager" ]; then
echo -n "REQUEST=rpmmanagerupgrade\""
echo -n ",\"`cgi_encodevar "Upgrade <b>"`\"+p+"
echo -n "\"`cgi_encodevar "</b> in <b>$environment_descr</b> environment?"`\""
echo -n ");>"
echo -n ");>&nbsp;&nbsp;"
fi
# rpm manager close link
echo -n "<br><a href=# onclick=clearid(\"window\")>CLOSE</a></div></div>"
echo "]]></window></webbuild>"
exit
@ -719,7 +792,7 @@ else
[ "$STATE_AUTODISTCURRENT" = "1" ] && AUTOUPDATEFILE=$BUILDLOGDIR/autoupdate-current || AUTOUPDATEFILE=$BUILDLOGDIR/autoupdate-last
while read line; do
set -- $line
if [ "$3" != "ok" ]; then
if [ "$3" != "ok" -a "$3" != "skipped" ]; then
if [ "$REQUEST" != "skip" ]; then
[ "$PACKAGE" = "$1" ] && SELECTED="selected=selected" || SELECTED=
else
@ -787,17 +860,22 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
#(getElementById('package').selectedIndex);>"
echo "<option value=\"\">-- Select a SRPM package --</option>"
SRPMBUTTONDISABLED="disabled=disabled"
if [ $local_ftp/$REPOSITORY/SRPMS.base -nt $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY ]; then
ls $local_ftp/$REPOSITORY/SRPMS.base/*.src.rpm | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
if [ -e $local_ftp/$REPOSITORY ]; then
if [ $local_ftp/$REPOSITORY/SRPMS.base -nt $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY ]; then
ls $local_ftp/$REPOSITORY/SRPMS.base/*.src.rpm | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
fi
else
curl $REPS_BASE_URL/$REPOSITORY/SRPMS.base/ | grep .src.rpm | \
sed "s|.*\.src\.rpm\">\(.*\)</a>.*|\1|" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
fi
while read f; do
[ -r $f ] || continue
# [ -r $f ] || continue
pkgname=`basename $f`
pkgname=${pkgname/.src.rpm}
pkgname=${pkgname%.src.rpm}
pkgrel=${pkgname/*-}
pkgname=${pkgname/-$pkgrel}
pkgname=${pkgname%-$pkgrel}
pkgver=${pkgname/*-}
pkgname=${pkgname/-$pkgver}
pkgname=${pkgname%-$pkgver}
if [ "$PACKAGE" = "$pkgname" ]; then
SELECTED="selected=\"selected\""
SRPMBUTTONDISABLED=
@ -843,7 +921,7 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
done
echo -n "</select>"
echo -n " version:<input type=text disabled id=speccreateversion value=\"\" style=\"width:5%\">"
echo -n " branch:<input type=text disabled id=speccreategitbranch value=\"\" style=\"width:5%\">"
echo -n " branch/tag:<input type=text disabled id=speccreategitbranch value=\"\" style=\"width:5%\">"
echo -n "<input type=button disabled id=speccreatebutton value=\"Create .spec\" onclick=ajax_getvalues(\""
echo -n "REQUEST=speccreate&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
echo -n "PACKAGE=\"+encodeURIComponent(getElementById('speccreatename').value)+\"&"
@ -916,12 +994,18 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
#DECODEDURL=`cgi_decodevar $SPECCREATEURL`
[ "$SPECCREATETYPE" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -t $SPECCREATETYPE"
[ "$SPECCREATEVERSION" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -v $SPECCREATEVERSION"
[ "$SPECCREATEGITBRANCH" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -v --git-branch $SPECCREATEGITBRANCH"
[ "$SPECCREATEGITBRANCH" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE --git-branch $SPECCREATEGITBRANCH"
$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 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>"
# prepare
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec --nodeps"
RET=$?
if [ $RET -eq 0 ]; then
REQUEST_NEXT="showbuilddocs"
fi
#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
echo "ERROR: both source archive URL and name are needed."
@ -949,7 +1033,7 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
autodistjobs="$AUTODISTJOB"
fi
[ "$REPOSITORY" ] && REPOSITORYADD="--repository $REPOSITORY" || REPOSITORYADD="--repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -p $autodistjobs $REPOSITORYADD --arch $AUTODISTARCH $AUTODISTADD"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -p $autodistjobs $REPOSITORYADD --arch $AUTODISTARCH --user $USER $AUTODISTADD"
RET=$?
;;
"autodistupdate") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
@ -966,7 +1050,7 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
autodistjobs="$AUTODISTJOB"
fi
[ "$REPOSITORY" ] && REPOSITORYADD="--repository $REPOSITORY" || REPOSITORYADD="--repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -u $autodistjobs $REPOSITORYADD --arch $AUTODISTARCH $AUTODISTADD"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -u $autodistjobs $REPOSITORYADD --arch $AUTODISTARCH --user $USER $AUTODISTADD"
RET=$?
;;
"addpkgnote") echo "`date +%s` $USER $ENVIRONMENT $PKGNOTE" >> $WEBBUILD_STATEDIR/notes/$PACKAGE.notes; RET=$? ;;
@ -1072,7 +1156,7 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmai
fi
fi
fi
REQUEST=
REQUEST=$REQUEST_NEXT
fi
# operation panel
@ -1289,7 +1373,8 @@ if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "<input type=button id=autoportnp value=\"port\" onclick="
echo -n "p=getSelectedValueById('sendrepository');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
echo -n "PORTREPOSITORY=\"+p+\"&"
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "SENDREPOSITORY=\"+p+\"&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "PACKAGE=$PACKAGEENCODED&REQUEST=autoportnp\""
echo -n ",\"`cgi_encodevar "Port <b>$PACKAGE</b> package in <b>"`\"+p+\"`cgi_encodevar "</b> with current specfile changes?"`\"); class=redbutton>"
@ -1304,7 +1389,7 @@ if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autospecupdatescheck&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue()));>"
# unpack
echo -n "<input type=button value=\"unpack\" onclick="
echo -n "<input type=button value=\"prepare\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=rpmprepare&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue()));>"
# build
@ -1412,7 +1497,7 @@ if [ "$MAINTAINERMODE" != "true" ]; then
patchname=${f/*\/}
patchname=${patchname/.patch}
patchname=${patchname/$PACKAGE-}
echo -n "<option value=\"$f\">$patchname (${SPECVAR_Patch_idx[$i-1]})</option>"
echo -n "<option value=\"$f\">$patchname (#${SPECVAR_Patch_idx[$i-1]})</option>"
done
echo -n "</select>"
# list build dir files
@ -1473,7 +1558,7 @@ fi
echo -n "<chatpanel><![CDATA["
# broadcast message
echo -n "<hr><b>Write a message to all developers:</b><br>"
echo -n "<textarea id=broadcastmessage style=\"width:98%;font-size:8pt;resize:none;\" rows=2 "
echo -n "<textarea id=broadcastmessage style=\"width:98%;font-size:8pt;resize:none;\" rows=4 "
echo -n "onkeypress=if(checkEnter()){ajax_getvalues(\""
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
@ -1562,7 +1647,7 @@ case $REQUEST in
else
autodistjobs="$AUTODISTJOB"
fi
$SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -b $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD" &>/dev/null
$SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -b $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH --user $USER $AUTODISTADD" &>/dev/null
[ $? -ne 0 ] && RET=$? || {
RET=-1
echo "Autodist build start. You may see the output in the <b>Webbuild jobs</b> box above."
@ -1578,7 +1663,7 @@ case $REQUEST in
else
autodistjobs="$AUTODISTJOB"
fi
$SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -i $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD" &>/dev/null
$SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -i $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH --user $USER $AUTODISTADD" &>/dev/null
[ $? -ne 0 ] && RET=$? || {
RET=-1
echo "Autodist install start. You may see the output in the <b>Webbuild jobs</b> box above."
@ -1593,9 +1678,9 @@ case $REQUEST in
else
autodistjobs="$AUTODISTJOB"
fi
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -s $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --server $SENDREPOSITORY --arch $AUTODISTARCH $AUTODISTADD"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -s $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --server $SENDREPOSITORY --arch $AUTODISTARCH --user $USER $AUTODISTADD"
RET=$?
[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$AUTODISTPKGS</b> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
[ $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" &>/dev/null
@ -1642,7 +1727,7 @@ case $REQUEST in
RET=1
fi ;;
"sendpackage") if [ "$SENDREPOSITORY" ]; then
if [ "$SENDRECREATESRPM" ]; then
if [ "$SENDRECREATESRPM" = "true" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs --define=\"_sourcedir $SPECVAR_WORKINGHOME/RPM/SOURCES\" $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY"
RET=$?
else
@ -1650,7 +1735,7 @@ case $REQUEST in
RET=$?
fi
if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$PACKAGE</b> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$PACKAGE $SPECVAR_Version-$SPECVAR_Release</b> from <i>`print_environment_descr $ENVIRONMENT`</i> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
fi
else
echo "ERROR: send repository is not defined."
@ -1659,7 +1744,7 @@ case $REQUEST in
;;
"sendsource") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--nodeps"
if [ "$SENDREPOSITORY" ]; then
if [ "$SENDRECREATESRPM" ]; then
if [ "$SENDRECREATESRPM" = "true" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs --define=\"_sourcedir $SPECVAR_WORKINGHOME/RPM/SOURCES\" $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm"
RET=$?
if [ $RET -eq 0 ]; then
@ -1822,14 +1907,17 @@ case $REQUEST in
;;
"repositorysync")
if [ "$REPOSITORY" ]; then
$SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/20-openmamba-apt $REPOSITORY"
$SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/10-openmamba-sync-back $REPOSITORY"
LOCALRET=$?
[ $LOCALRET -eq 0 ] && $SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/20-openmamba-apt $REPOSITORY"
LOCALRET=$?
[ $LOCALRET -eq 0 ] && $SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/40-openmamba-rsync $REPOSITORY"
LOCALRET=$?
[ $LOCALRET -ne 0 ] && RET=$LOCALRET || RET=-1
fi
;;
"autoportnp") $SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "autoport -np $PACKAGE -r $PORTREPOSITORY" &>/dev/null
"autoportnp") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="-f" || AUTODISTADD=
$SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "autoport -np $PACKAGE -r $SENDREPOSITORY $AUTODISTADD" &>/dev/null
[ $? -ne 0 ] && RET=$? || {
RET=-1
echo -n "Autoport started. You may see the output in the <b>Webbuild jobs</b> box above."
@ -1867,24 +1955,12 @@ case $REQUEST in
if [ "$REQUEST" = "showchangelogs" ]; then
PATTERN="-iname changelog -or -iname news -and -type f"
elif [ "$REQUEST" = "showlicenses" ]; then
PATTERN="-iname license\* -or -iname copying\* -or -iname authors\* -and -type f"
PATTERN="-iname license\* -or -iname copying\* -or -iname authors\* -or -iname credits\* -and -type f"
elif [ "$REQUEST" = "showbuilddocs" ]; then
PATTERN="-iname readme\* -or -iname install\* -or -iname todo\* -or -iname pkgbuild\* -and -type f"
PATTERN="-iname readme\* -or -iname install\* -or -iname todo\* -or -iname pkgbuild\* -or -iname \*.desktop -and -type f"
fi
files=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && find . $PATTERN -maxdepth 2"`
cnt=0
for f in $files; do
echo -n "<a href=#logfile-$f>$f</a><br>"
done
echo -n "<br>"
for f in $files; do
echo -n "<a name=logfile-$f><p style=\"background-color:gray\"><b>File $f:</b></a><pre>"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE \
"cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && head -c 10240 $f | sed \"s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g\"" | parse_generic_output
RET=$?
[ $RET -eq 0 ] && RET=-1
echo -n "</pre>"
done
show_docs `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && find . $PATTERN -maxdepth 2"`
RET=-1
;;
"configurehelp") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && ./configure --help || ./waf configure --help"
RET=$?
@ -1920,23 +1996,25 @@ case $REQUEST in
"rpmmanagerinstall"|"rpmmanagerupgrade") if [ "$USER_CANINSTALL" ]; then
[ "$RPMMANAGERFORCE" = "true" ] && rpmforceadd="--force"
echo -n "<script>clearid(\"window\")</script>"
resolve_rpmmanagerdir "$RPMMANAGERDIR" "${AUTOPORT_ARCH[$ENVIRONMENT]}" "$REPOSITORY"
for f in $RPMMANAGERPACKAGES; do
if [ "$f/.${AUTOPORT_ARCH[$ENVIRONMENT]}." != "$f" ]; then
installpackages="$installpackages ../RPMS/${AUTOPORT_ARCH[$ENVIRONMENT]}/$f"
elif [ "$f/.noarch." != "$f" ]; then
installpackages="$installpackages ../RPMS/noarch/$f"
else
echo "<font color=red>ERROR: invalid package $f;aborting.</font>"
break
fi
installpackages="$installpackages $rpmmanagerdir/$f"
done
if [ "$installpackages" ]; then
if [ "$REQUEST" = "rpmmanagerinstall" ]; then
echo "Installing packages: $RPMMANAGERPACKAGES<br>"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -i $installpackages $rpmforceadd"
else
if [ "$rpmmanagermode" = "environment" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -i $installpackages $rpmforceadd"
else
sudo rpm -i $installpackages $rpmforceadd
fi
elif [ "$REQUEST" = "rpmmanagerupgrade" ]; then
echo "Upgrading packages: $RPMMANAGERPACKAGES<br>"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -U $installpackages $rpmforceadd"
if [ "$rpmmanagermode" = "environment" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -U $installpackages $rpmforceadd"
else
sudo rpm -U $installpackages $rpmforceadd
fi
fi
RET=$?
else

View File

@ -216,20 +216,21 @@ function parse_patch_output() {
IFS=''
echo -n "<font color=gray>"
while read line; do
[ "${line:0:3}" = "+++" ] && echo -n "</font>"
echo "$line" | sed "s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g;
sed "s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g;
s|^\(+++.*\)|<font color=white style=\"background-color:gray\"><b>\1</b></font>|;
s|^\(---.*\)|<font color=white style=\"background-color:gray\"><b>\1</b></font>|;
s|^\(-.*\)|<font color=red>\1</font>|;
s|^\(+.*\)|<font color=lightgreen>\1</font>|;
s|^ |\&nbsp;|;"
s|^ |\&nbsp;|;" |
while read line; do
[ "${line:0:3}" = "+++" ] && echo -n "</font>"
echo "$line"
done
IFS=$SAVE_IFS
}
function parse_build_output() {
sed "s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g;
sed "s|\(.\{10000\}\).*|\1 [CUT - LONG LINE]|;s|\\\|\\\\\\\|g;s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g;
s|&lt;font|<font|g;
s|&lt;/font|</font|g;
s|^\([\+#] .*\)|<font style=\"color:cyan\">\1</font>|;
@ -242,7 +243,7 @@ function parse_build_output() {
}
function parse_generic_output() {
sed "s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g;
sed "s|\(.\{10000\}\).*|\1 [CUT - LONG LINE]|;s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g;
s|&lt;font|<font|g;
s|&lt;/font|</font|g;
s|^\([\+#] .*\)|<font style=\"color:cyan\">\1</font>|;

View File

@ -34,7 +34,8 @@ function showlog() {
LOGDIR=`environment_logdir $ENVIRONMENT`
LOGFILES="$LOGDIR/$LOGFILE1 $LOGDIR/$LOGFILE2 $LOGDIR/$LOGFILE3 $LOGDIR/$LOGFILE4"
# sort by most recent and take first
LOGFILES=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls -t $LOGFILES 2>/dev/null | head -1"`
LOGFILES=`ls -t $LOGFILES 2>/dev/null | head -1`
# LOGFILES=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls -t $LOGFILES 2>/dev/null | head -1"`
fi
echo -n "<output><![CDATA[<hr><b>Console output for $PACKAGE ($LOGTYPE$LOGSTATUSAPPEND):</b>"
echo "<div align=left class=output id=$LOGOUTPUTID>"
@ -205,3 +206,68 @@ function print_editorcontrols() {
echo -n "]]></editcontrols>"
}
function show_docs() {
local f RET
for f in $@; do
echo -n "<a href=#logfile-$f>$f</a><br>"
done
echo -n "<br>"
for f in $@; do
echo -n "<a name=logfile-$f><p style=\"background-color:gray\"><b>File $f:</b></a><pre>"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE \
"cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && head -c 10240 $f | sed \"s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g\"" | parse_generic_output
RET=$?
echo -n "</pre>"
done
return $RET
}
function download_file() {
local RET
local download_environment=$1
local download_files=$2
local f
for f in $download_files; do
echo $f >> /tmp/down
echo -e "Content-Type: application/octet-stream"
echo -e "Content-Disposition: attachment; filename=\"${f/*\/}\"\n"
if [ "$download_environment" ]; then
$SUDO_WRAPPER binary $download_environment "$USER" "" "cat $f 2>/dev/null"
else
cat $f 2>/dev/null
fi
done
RET=$?
return $RET
}
function resolve_rpmmanagerdir() {
local RPMMANAGERDIR=$1
local RPMMANAGERARCH=$2
local REPOSITORY=$3
case $RPMMANAGERDIR in
REP_SRPMS) rpmmanagerdir=$local_ftp/$REPOSITORY/SRPMS.base
rpmmanagermask="*.src.rpm"
rpmmanagermode=repository ;;
REP_RPMS) rpmmanagerdir=$local_ftp/$REPOSITORY/RPMS.$RPMMANAGERARCH
rpmmanagermask="*.$RPMMANAGERARCH.rpm"
rpmmanagermode=repository ;;
REP_RPMSNOARCH) rpmmanagerdir=$local_ftp/$REPOSITORY/RPMS.$RPMMANAGERARCH
rpmmanagermask="*.noarch.rpm"
rpmmanagermode=repository ;;
SRPMS) rpmmanagerdir=../SRPMS
rpmmanagermask="*.src.rpm"
rpmmanagermode=environment ;;
RPMSNOARCH) rpmmanagerdir=../RPMS/noarch
rpmmanagermask="*.noarch.rpm"
rpmmanagermode=environment ;;
*) rpmmanagerdir=../RPMS/$RPMMANAGERARCH
rpmmanagermask="*.$RPMMANAGERARCH.rpm"
rpmmanagermode=environment ;;
esac
}

View File

@ -141,11 +141,19 @@ else
rettmpfile=`$SUCMDPREFIX "mktemp --suffix=.webbuildret"`
if [ "$WORKINGHOME" ]; then
[ "$DEBUG" ] && echo "=> . /etc/profile;cd $WORKINGHOME/RPM/SPECS;$SUCMDPREFIX \"$COMMAND\""
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \$? > $rettmpfile" 2>&1 | tr -d '\f' | tee $cmdtmpfile
if [ "$MODE" = "binary" ]; then
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \$? > $rettmpfile" 2>&1
else
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \$? > $rettmpfile" 2>&1 | tr -d '\f' | tee $cmdtmpfile
fi
# sed "s|<|\&lt;|g" |
else
[ "$DEBUG" ] && echo "=> $SUCMDPREFIX \"$COMMAND\""
$SUCMDPREFIX "$COMMAND;echo \$? > $rettmpfile" 2>&1 | tr -d '\f' | tee $cmdtmpfile
if [ "$MODE" = "binary" ]; then
$SUCMDPREFIX "$COMMAND;echo \$? > $rettmpfile" 2>&1
else
$SUCMDPREFIX "$COMMAND;echo \$? > $rettmpfile" 2>&1 | tr -d '\f' | tee $cmdtmpfile
fi
# sed "s|<|\&lt;|g" |
fi
RET=`cat $ENVPREFIX/$rettmpfile`