webbuild: sync with current alpha development with lots of changes and improvements

This commit is contained in:
Silvan Calarco 2012-09-21 12:57:19 +02:00
parent 4021d4f7a1
commit 0601482f54
3 changed files with 559 additions and 271 deletions

View File

@ -66,7 +66,7 @@ if [ "$SECRET" -a "$USER" ]; then
cat $WEBBUILD_STATEDIR/users/$USER.conf > $tmpfile cat $WEBBUILD_STATEDIR/users/$USER.conf > $tmpfile
echo "USER_SECRET='$SECRET'" >> $tmpfile echo "USER_SECRET='$SECRET'" >> $tmpfile
USER_ENABLED=1 USER_ENABLED=1
$SUDO_WRAPPER local "" "mv $tmpfile $WEBBUILD_STATEDIR/users/$USER.conf" $SUDO_WRAPPER 0 local "" "mv $tmpfile $WEBBUILD_STATEDIR/users/$USER.conf"
else else
USER_ENABLED= USER_ENABLED=
fi fi
@ -189,8 +189,8 @@ if [ "$REQUEST" = "refresh" -o ! "$USER" ]; then
else else
USER_GRAVATAR=`echo -n $SEMAIL | md5sum | sed "s| .*||"` USER_GRAVATAR=`echo -n $SEMAIL | md5sum | sed "s| .*||"`
fi fi
echo -n "<div id=\"sociallog-$SID\" style=\"height:auto;\"><div style=\"position:relative;float:left;height:26px;width:24px;\">" echo -n "<div id=\"sociallog-$SID\" style=\"height:auto;\"><div style=\"vertical-align:middle;position:relative;float:left;height:24px;width:24px;\">"
echo -n "<img src=\"http://www.gravatar.com/avatar/$USER_GRAVATAR?s=22&d='http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=22'\" /></div>" echo -n "<img src=\"http://www.gravatar.com/avatar/$USER_GRAVATAR?s=24&d='http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=22'\" /></div>"
DATENOW=`date +%s` DATENOW=`date +%s`
DAYSAGO=`expr \( $DATENOW - $STIME \) / 86400` DAYSAGO=`expr \( $DATENOW - $STIME \) / 86400`
HOURAGO=`expr \( $DATENOW - $STIME \) / 3600 % 24` HOURAGO=`expr \( $DATENOW - $STIME \) / 3600 % 24`
@ -233,26 +233,71 @@ fi
# Enabled users requests # Enabled users requests
# #
if [ "$REQUEST" = "killtree" ]; then
killline=`grep "^$KILLPID " $WEBBUILD_STATEDIR/processes`
if [ "$killline" ]; then
if [ $KILLPID -ge 1 ]; then
$SUDO_WRAPPER killtree $KILLPID
# if [ $? -eq 0 ]; then
set -- $killline
rm -f $4
sed -i "/^$KILLPID /d" $WEBBUILD_STATEDIR/processes
# else
# echo "<output>ERROR: killtree returned $?</output>"
# fi
else
echo "<output>ERROR: Invalid PID</output>"
fi
fi
echo -n "</webbuild>"
exit
fi
if [ "$REQUEST" = "refresh" ]; then if [ "$REQUEST" = "refresh" ]; then
echo -n "<processes><![CDATA[" echo -n "<processes><![CDATA["
numprocess=0 numprocess=0
while read line; do while read line; do
set -- $line set -- $line
if [ -e /proc/$1 ]; then RETCODE=$5
# if [ -e /proc/$1 -o $5 -lt 256 ]; then
numprocess=`expr $numprocess + 1` numprocess=`expr $numprocess + 1`
cmdline=`echo $line | sed "s|$1 $2 $3 $4 ||"` cmdline=`echo $line | sed "s|$1 $2 $3 $4 $RETCODE ||"`
[ $numprocess -eq 1 ] && { [ $numprocess -eq 1 ] && {
echo -n "<div align=left class=processes>" echo -n "<div align=left class=processes>"
echo -n "<b>Webbuild running jobs:</b><br>" echo -n "<b>Webbuild jobs:</b><br>"
} }
echo -n "<b>$2</b> <i>\"$cmdline\"</i> " echo -n "<b>$2</b> "
echo -n " [ <a onClick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&" if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then
echo -n "\"<a onClick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=showlog&LOGTYPE=processtail&PROCESSPID=$1&LOGFILE=$4\")>"
echo -n "<i>$cmdline</i></a>\" "
echo -n "<i>(running...)</i>"
else
echo -n "\"<a onClick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=showlog&LOGTYPE=processoutput&LOGFILE=$4\")>" echo -n "REQUEST=showlog&LOGTYPE=processoutput&LOGFILE=$4\")>"
echo -n "show</a> ]" echo -n "<i>$cmdline</i></a>\" "
echo -n "<br>" if [ $RETCODE -eq 256 ]; then
$SUDO_WRAPPER finishprocess $1 $4
RETCODE=$?
fi fi
if [ $RETCODE -eq 0 ]; then
echo -n "<font color=green><b>OK</b></font>"
else
echo -n "<font color=red><b>ERROR ($RETCODE)</b></font>"
fi
fi
echo -n " [<a onClick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=killtree&KILLPID=$1\")>"
if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then
echo -n "kill"
else
echo -n "x"
fi
echo -n "</a>]"
echo -n "<br>"
# fi
done < $WEBBUILD_STATEDIR/processes done < $WEBBUILD_STATEDIR/processes
[ $numprocesses -gt 0 ] && echo -n "</div>" [ $numprocess -gt 0 ] && echo -n "</div>"
echo -n "]]></processes></webbuild>" echo -n "]]></processes></webbuild>"
exit exit
fi fi
@ -260,7 +305,8 @@ fi
# message send request (social_log) # message send request (social_log)
if [ "$REQUEST" = "message" -a "$USER" -a "$USER_CANSENDMESSAGES" ]; then if [ "$REQUEST" = "message" -a "$USER" -a "$USER_CANSENDMESSAGES" ]; then
# external (autodist) social messages # external (autodist) social messages
social_log "SUSER=$USER STYPE=broadcastmessage SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`" [ "$MESSAGETYPE" ] || MESSAGETYPE=broadcastmessage
social_log "SUSER=$USER STYPE=$MESSAGETYPE SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`"
echo "</webbuild>" echo "</webbuild>"
exit exit
fi fi
@ -270,7 +316,7 @@ if [ "$REQUEST" = "repsearch" ]; then
echo -n "<output><![CDATA[" echo -n "<output><![CDATA["
echo -n "<div align=left class=output id=outputtop>" echo -n "<div align=left class=output id=outputtop>"
echo -n "<pre><!-- SCROLL -->" echo -n "<pre><!-- SCROLL -->"
$SUDO_WRAPPER local "" "openmamba-repository search -i $REPSEARCHTEXT" $SUDO_WRAPPER 0 local "" "openmamba-repository search -i $REPSEARCHTEXT"
echo -n "<!-- ENDSCROLL --></pre>" echo -n "<!-- ENDSCROLL --></pre>"
echo "</div>]]></output></webbuild>" echo "</div>]]></output></webbuild>"
exit exit
@ -393,7 +439,7 @@ fi
# show log # show log
if [ "$REQUEST" = "showlog" ]; then if [ "$REQUEST" = "showlog" ]; then
echo -n "<output><![CDATA[" echo -n "<output><![CDATA["
if [ "$LOGTYPE" = "processoutput" ]; then if [ "$LOGTYPE" = "processoutput" -o "$LOGTYPE" = "processtail" ]; then
LOGFILES=$LOGFILE LOGFILES=$LOGFILE
else else
LOGFILE=$LOGTYPE LOGFILE=$LOGTYPE
@ -412,7 +458,13 @@ if [ "$REQUEST" = "showlog" ]; then
for f in $LOGFILES; do for f in $LOGFILES; do
[ -r $f ] || continue [ -r $f ] || continue
echo -n "<b>`basename $f` (`stat -c %y $f`)</b><pre>" echo -n "<b>`basename $f` (`stat -c %y $f`)</b><pre>"
if [ "$LOGTYPE" = "processtail" ]; then
echo -n "<!-- SCROLL -->"
tail -n +0 -f $f --pid $PROCESSPID | sed "s|<|\&lt;|g"
echo -n "<!-- ENDSCROLL -->"
else
cat $f | sed "s|<|\&lt;|g" cat $f | sed "s|<|\&lt;|g"
fi
echo -n "</pre>" echo -n "</pre>"
done done
echo -n "</div>]]></output>" echo -n "</div>]]></output>"
@ -429,8 +481,8 @@ if [ "$ENVIRONMENT" -a "$MAINTAINERMODE" != "true" ]; then
echo -n "onchange=javascript:ajax_getvalues(\"REQUEST=edit&ENVIRONMENT=$ENVIRONMENT&" echo -n "onchange=javascript:ajax_getvalues(\"REQUEST=edit&ENVIRONMENT=$ENVIRONMENT&"
echo -n "PACKAGE=\"+encodeURIComponent(this.value)+\"&REQUEST=changespec\");>" echo -n "PACKAGE=\"+encodeURIComponent(this.value)+\"&REQUEST=changespec\");>"
echo -n "<option value=\"\">-- Select a .spec file --</option>" echo -n "<option value=\"\">-- Select a .spec file --</option>"
for f in `$SUDO_WRAPPER $ENVIRONMENT "" "ls *.spec"`; do for f in `$SUDO_WRAPPER 0 $ENVIRONMENT "" "ls *.spec"`; do
specname=${f/.*} specname=${f/.spec}
[ "$PACKAGE" = "$specname" ] && SELECTED="selected=\"selected\"" || SELECTED= [ "$PACKAGE" = "$specname" ] && SELECTED="selected=\"selected\"" || SELECTED=
echo -n "<option value=\"$specname\" $SELECTED>${specname}.spec</option>" echo -n "<option value=\"$specname\" $SELECTED>${specname}.spec</option>"
done done
@ -443,7 +495,7 @@ fi
if [ ! "$REPOSITORY" -a ! "$PACKAGE" -a ! "$REQUEST" = "repsearch" ]; then if [ ! "$REPOSITORY" -a ! "$PACKAGE" -a ! "$REQUEST" = "repsearch" ]; then
echo -n "<editor> </editor>" echo -n "<editor> </editor>"
# echo -n "<editor><![CDATA[<textarea id=spectext class=editor disabled=true></textarea>]]></editor>" # echo -n "<editor><![CDATA[<textarea id=spectext class=editor disabled=true></textarea>]]></editor>"
echo -n "<output><![CDATA[<div align=left class=output id=outputbottom>]]></output>" # echo -n "<output><![CDATA[<div align=left class=output id=outputbottom>]]></output>"
fi fi
# REPOSITORIES search # REPOSITORIES search
@ -473,7 +525,7 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
fi fi
echo -n "&REQUEST=changerepository\");>" echo -n "&REQUEST=changerepository\");>"
echo -n "<option value=\"\">-- Select a repository --</option>" echo -n "<option value=\"\">-- Select a repository --</option>"
for f in `$SUDO_WRAPPER local "" "/usr/sbin/openmamba-repository list"`; do for f in `$SUDO_WRAPPER 0 local "" "/usr/sbin/openmamba-repository list"`; do
repname=`basename $f` repname=`basename $f`
[ "$repname" = "$REPOSITORY" ] && SELECTED="selected=selected" || SELECTED= [ "$repname" = "$REPOSITORY" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"$repname\" $SELECTED>$repname</option>" echo -n "<option value=\"$repname\" $SELECTED>$repname</option>"
@ -488,9 +540,10 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
if [ "$REQUEST" = "changerepository" -o "$REQUEST" = "switchmaintainermode" -a "$MAINTAINERMODE" != "true" ]; then if [ "$REQUEST" = "changerepository" -o "$REQUEST" = "switchmaintainermode" -a "$MAINTAINERMODE" != "true" ]; then
echo -n "<packages><![CDATA[ SRPMS:" echo -n "<packages><![CDATA[ SRPMS:"
echo -n "<select id=package onchange=javascript:" echo -n "<select id=package onchange=javascript:"
echo -n "getElementById('preparebutton').disabled=0;>" echo -n "getElementById('preparebutton').disabled=0;getElementById('portbutton').disabled=0;>"
#(getElementById('package').selectedIndex);>" #(getElementById('package').selectedIndex);>"
echo "<option value=\"\">-- Select a SRPM package --</option>" echo "<option value=\"\">-- Select a SRPM package --</option>"
SRPMBUTTONDISABLED="disabled=disabled"
for f in $local_ftp/$REPOSITORY/SRPMS.base/*.src.rpm; do for f in $local_ftp/$REPOSITORY/SRPMS.base/*.src.rpm; do
[ -r $f ] || continue [ -r $f ] || continue
pkgname=`basename $f` pkgname=`basename $f`
@ -501,7 +554,7 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
pkgname=${pkgname/-$pkgver} pkgname=${pkgname/-$pkgver}
if [ "$PACKAGE" = "$pkgname" ]; then if [ "$PACKAGE" = "$pkgname" ]; then
SELECTED="selected=\"selected\""; SELECTED="selected=\"selected\"";
# REQUEST="changesrpm" SRPMBUTTONDISABLED=
else else
SELECTED= SELECTED=
fi fi
@ -511,11 +564,16 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
echo -n "]]></packages>" echo -n "]]></packages>"
if [ "$MAINTAINERMODE" != "true" ]; then if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "<operations><![CDATA[" echo -n "<operations><![CDATA["
echo -n "<input type=button name=prepare value=\"Unpack and edit\" id=preparebutton " echo -n "<input type=button name=prepare value=\"Unpack and edit\" id=preparebutton onclick=javascript:"
echo -n "onclick=javascript:i=getElementById('repository').selectedIndex;j=getElementById('package').selectedIndex;" echo -n "ajax_getvalues(\"REQUEST=prepare&REPOSITORY=\"+getSelectedValueById('repository')+\""
echo -n "ajax_getvalues(\"REQUEST=prepare&REPOSITORY=\"+getElementById('repository').options[i].value+\""
echo -n "&ENVIRONMENT=$ENVIRONMENT&MAINTAINERMODE=\"+getElementById('maintain').checked+\"&" echo -n "&ENVIRONMENT=$ENVIRONMENT&MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
echo -n "PACKAGE=\"+encodeURIComponent(getElementById('package').options[j].value)); disabled=disabled>" echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById('package'))); $SRPMBUTTONDISABLED>"
if [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
echo -n "<input type=button name=port value=\"Port\" id=portbutton onclick=javascript:"
echo -n "ajax_getvalues(\"REQUEST=autoport&REPOSITORY=\"+getSelectedValueById('repository')+\""
echo -n "&ENVIRONMENT=$ENVIRONMENT&MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById('package'))); $SRPMBUTTONDISABLED>"
fi
echo -n "]]></operations>" echo -n "]]></operations>"
# REQUEST=changesrpm # REQUEST=changesrpm
fi fi
@ -542,9 +600,10 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
elif [ "$MAINTAINERMODE" = "true" ]; then elif [ "$MAINTAINERMODE" = "true" ]; then
echo -n "<speccreate> </speccreate>" echo -n "<speccreate> </speccreate>"
fi fi
else #else
echo -n "<repositories> </repositories><packages> </packages><operations> </operations><speccreate> </speccreate> <operations></operations>" # echo -n "<repositories> </repositories><packages> </packages><operations> </operations><speccreate> </speccreate> <operations></operations>"
fi fi
if [ "$REQUEST" = "changespec" ]; then if [ "$REQUEST" = "changespec" ]; then
if [ "$PACKAGE" ]; then if [ "$PACKAGE" ]; then
REQUEST="edit"; REQUEST="edit";
@ -555,18 +614,18 @@ elif [ "$REQUEST" = "broadcastmessage" ]; then
REQUEST= REQUEST=
fi fi
if [ "$MAINTAINERMODE" != "true" -a ! "$PACKAGE" ]; then #if [ "$MAINTAINERMODE" != "true" -a ! "$PACKAGE" ]; then
echo "<editor> </editor>" # echo "<editor> </editor>"
echo "<editcontrols> </editcontrols>" # echo "<editcontrols> </editcontrols>"
echo "<operationpanel> </operationpanel>" # echo "<operationpanel> </operationpanel>"
fi #fi
if [ "$SPECTEXT" ]; then if [ "$SPECTEXT" ]; then
# save specfile # save specfile
tmpfile=`mktemp` tmpfile=`mktemp`
echo -n $SPECTEXT | perl -MURI::Escape -e 'print uri_unescape(<>)' > $tmpfile echo -n $SPECTEXT | perl -MURI::Escape -e 'print uri_unescape(<>)' > $tmpfile
chmod 644 $tmpfile chmod 644 $tmpfile
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "cat $tmpfile > $PACKAGE.spec" $tmpfile $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cat $tmpfile > $PACKAGE.spec" $tmpfile
rm -f $tmpfile rm -f $tmpfile
fi fi
@ -576,39 +635,44 @@ fi
# Here requests which update the specfile, so editor is refreshed after # Here requests which update the specfile, so editor is refreshed after
if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccreate" -o \ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccreate" -o \
"$REQUEST" = "rebuildspec" -o "$REQUEST" = "renamespec" ]; then "$REQUEST" = "rebuildspec" -o "$REQUEST" = "renamespec" -o "$REQUEST" = "deletespec" ]; then
echo -n "<output><![CDATA[<div align=left class=output id=outputbottom>" echo -n "<output><![CDATA[<div align=left class=output id=outputbottom>"
echo -n "<pre>" echo -n "<pre>"
RET=255 RET=255
case $REQUEST in case $REQUEST in
"prepare") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a1 --server $REPOSITORY"; RET=$? ;; "prepare") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a1 --server $REPOSITORY"; RET=$? ;;
"updatespec") if [ "$UPDATESSPECVERSION" -a "$REBUILDSPECCHANGELOG" ]; then "updatespec") if [ "$UPDATESSPECVERSION" -a "$REBUILDSPECCHANGELOG" ]; then
echo "ERROR: new version and changelog can't be specified together" echo "ERROR: new version and changelog can't be specified together"
elif [ "$REBUILDSPECCHANGELOG" ]; then elif [ "$REBUILDSPECCHANGELOG" ]; then
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a4 --rebuild --changelog \"$REBUILDSPECCHANGELOG\"" $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a4 --rebuild --changelog \"$REBUILDSPECCHANGELOG\""
elif [ "$UPDATESSPECVERSION" ]; then elif [ "$UPDATESSPECVERSION" ]; then
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a3,4 $UPDATESPECVERSION" $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a3,4 $UPDATESPECVERSION"
else else
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a2:4 $UPDATESPECVERSION" $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a2:4 $UPDATESPECVERSION"
fi fi
RET=$? ;; RET=$?
[ ;;
"speccreate") if [ "$SPECCREATEURL" -a "$PACKAGE" ]; then "speccreate") if [ "$SPECCREATEURL" -a "$PACKAGE" ]; then
AUTOSPEC_CMDLINE="-n $PACKAGE -o $PACKAGE.spec" AUTOSPEC_CMDLINE="-n $PACKAGE -o $PACKAGE.spec"
#DECODEDURL=`cgi_decodevar $SPECCREATEURL` #DECODEDURL=`cgi_decodevar $SPECCREATEURL`
[ "$SPECCREATETYPE" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -t $SPECCREATETYPE" [ "$SPECCREATETYPE" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -t $SPECCREATETYPE"
[ "$SPECCREATEVERSION" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -v $SPECCREATEVERSION" [ "$SPECCREATEVERSION" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE -v $SPECCREATEVERSION"
$SUDO_WRAPPER $ENVIRONMENT "" "autospec -s \"$SPECCREATEURL\" $AUTOSPEC_CMDLINE" $SUDO_WRAPPER 0 $ENVIRONMENT "" "autospec -s \"$SPECCREATEURL\" $AUTOSPEC_CMDLINE"
RET=$? RET=$?
[ $REQ -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"is working on <b>$PACKAGE</b> new package\" STIME=`date +%s`" [ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"is working on <b>$PACKAGE</b> new package\" STIME=`date +%s`"
# --changelog \"package created by $USER from autodist webbuild interface\"" # --changelog \"package created by $USER from autodist webbuild interface\""
else else
echo "ERROR: both source archive URL and name are needed." echo "ERROR: both source archive URL and name are needed."
RET=1 RET=1
fi fi
;; ;;
"renamespec") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "mv $RENAMESPECFROM.spec $PACKAGE.spec && sed -i \"s|\(Name:[[:space:]]*\).*|\1$PACKAGE|\" $PACKAGE.spec" "renamespec") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "mv $RENAMESPECFROM.spec $PACKAGE.spec && sed -i \"s|\(Name:[[:space:]]*\).*|\1$PACKAGE|\" $PACKAGE.spec"
RET=$? RET=$?
[ $REQ -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"renamed <b>$RENAMESPECFROM</b> to <b>$PACKAGE</b>\" STIME=`date +%s`" [ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"renamed <b>$RENAMESPECFROM</b> to <b>$PACKAGE</b>\" STIME=`date +%s`"
;;
"deletespec") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "rm -f $PACKAGE.spec"
RET=$?
[ $RET -eq 0 ] && REQUEST="exit"
;; ;;
esac esac
echo -n "</pre>" echo -n "</pre>"
@ -619,14 +683,23 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
fi fi
echo -n "</div>" echo -n "</div>"
echo -n "]]></output>" echo -n "]]></output>"
REQUEST="edit" if [ "$REQUEST" = "exit" ]; then
echo -n "<editcontrols> </editcontrols>"
echo -n "<operations> </operations>"
echo -n "<editor> </editor>"
echo -n "</webbuild>"
exit
fi
[ $RET -eq 0 ] && REQUEST="edit" || REQUEST=
fi fi
if [ "$MAINTAINERMODE" = "true" -a "$REPOSITORY" != "" ]; then # maintainer mode editor
if [ "$MAINTAINERMODE" = "true" ]; then
if [ ! "$REQUEST" -o "$REQUEST" = "changerepository" -o \ if [ ! "$REQUEST" -o "$REQUEST" = "changerepository" -o \
"$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "reloadmaintainer" ]; then "$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "reloadmaintainer" ]; then
echo -n "<editcontrols> </editcontrols>" echo -n "<editcontrols> </editcontrols>"
echo -n "<operations> </operations>" echo -n "<operations> </operations>"
if [ "$REPOSITORY" ]; then
echo -n "<editor><![CDATA[" echo -n "<editor><![CDATA["
echo -n "<div class=maintainer>" echo -n "<div class=maintainer>"
echo -n "<b>Recent packages in $REPOSITORY:</b><br>" echo -n "<b>Recent packages in $REPOSITORY:</b><br>"
@ -638,16 +711,21 @@ if [ "$MAINTAINERMODE" = "true" -a "$REPOSITORY" != "" ]; then
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "MAINTAINERMODE=$MAINTAINERMODE&REQUEST=reloadmaintainer\");>" echo -n "MAINTAINERMODE=$MAINTAINERMODE&REQUEST=reloadmaintainer\");>"
echo -n "]]></editor>" echo -n "]]></editor>"
else
echo -n "<editor> </editor>"
fi
fi fi
fi fi
# specfile editor
if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmaintainermode" -a "$MAINTAINERMODE" != "true" ]; then if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmaintainermode" -a "$MAINTAINERMODE" != "true" ]; then
if [ "$PACKAGE" ]; then if [ "$PACKAGE" ]; then
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "ls $PACKAGE.spec" $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "ls $PACKAGE.spec"
[ $? -eq 0 ] && SPECAVAILABLE=1 [ $? -eq 0 ] && SPECAVAILABLE=1
fi fi
if [ "$SPECAVAILABLE" ]; then if [ "$SPECAVAILABLE" ]; then
echo -n "<editcontrols><![CDATA[" echo -n "<editcontrols><![CDATA["
# specfile update
echo -n "<br><input type=button id=updatespecbutton value=\"update\" onclick=javascript:" echo -n "<br><input type=button id=updatespecbutton value=\"update\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=updatespec&UPDATESPECVERSION=\"+getElementById('updatespecversion').value+\"&" echo -n "REQUEST=updatespec&UPDATESPECVERSION=\"+getElementById('updatespecversion').value+\"&"
@ -656,25 +734,45 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmai
echo -n " (specify new version:<input type=text id=updatespecversion value=\"\" size=\"12\">" echo -n " (specify new version:<input type=text id=updatespecversion value=\"\" size=\"12\">"
echo -n " or changelog for a new release:<input type=text id=rebuildspecchangelog value=\"$REBUILDSPECCHANGELOG\" size=\"40\">)" echo -n " or changelog for a new release:<input type=text id=rebuildspecchangelog value=\"$REBUILDSPECCHANGELOG\" size=\"40\">)"
echo -n "]]></editcontrols>" echo -n "]]></editcontrols>"
# editor textarea
echo -n "<editor><![CDATA[Current <b>$PACKAGE.spec</b> in build environment:<textarea id=spectext " echo -n "<editor><![CDATA[Current <b>$PACKAGE.spec</b> in build environment:<textarea id=spectext "
echo -n "onkeyup=\"getElementById('savebutton').disabled=false;getElementById('savebutton').class='redbutton';\" class=editor>" echo -n "onkeyup=\"getElementById('savebutton').disabled=false;getElementById('savebutton').class='redbutton';\" class=editor>"
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "cat $PACKAGE.spec" $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cat $PACKAGE.spec"
echo -n "</textarea>" echo -n "</textarea>"
# specfile save
echo -n "<input type=button id=savebutton value=\"save\" onclick=javascript:" echo -n "<input type=button id=savebutton value=\"save\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=savespec&SPECTEXT=\"+encodeURIComponent(editor.getValue()));" echo -n "REQUEST=savespec&SPECTEXT=\"+encodeURIComponent(editor.getValue()));"
echo -n "this.disabled=true; disabled=disabled class=redbutton>" echo -n "this.disabled=true; disabled=disabled class=redbutton>"
# specfile reload
echo -n "<input type=button id=updatespecbutton value=\"reload\" onclick=javascript:" echo -n "<input type=button id=updatespecbutton value=\"reload\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=reloadspec\");>" echo -n "REQUEST=reloadspec\");>"
# specfile rename
echo -n "<input type=button id=updatespecbutton value=\"rename to:\" onclick=javascript:" echo -n "<input type=button id=updatespecbutton value=\"rename to:\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&RENAMESPECFROM=$PACKAGE&" 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 "REQUEST=renamespec&PACKAGE=\"+encodeURIComponent(getElementById('specnewname').value));>"
echo -n "<input type=text id=specnewname value=\"\" size=\"10\">.spec" echo -n "<input type=text id=specnewname value=\"\" size=\"10\">.spec"
# specfile delete
echo -n "<input type=button id=updatespecbutton value=\"delete\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=deletespec\",\"`cgi_encodevar "Really delete <b>$PACKAGE.spec</b>?"`\")>"
echo -n "]]></editor>" echo -n "]]></editor>"
# else
# echo "<output><![CDATA[<div align=left class=output id=outputtop>"
# echo "No pre-existing .spec file $PACKAGE.spec in current working environment. Choose package from a repository and press 'Unpack and edit' to edit."
# echo -n "</div>"
# echo -n "]]></output>"
fi
REQUEST=
fi
# operation panel
if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "<operationpanel><![CDATA[" echo -n "<operationpanel><![CDATA["
echo -n "Package: <b>$PACKAGE</b>" [ "$PACKAGE" ] && echo -n "Package: <b>$PACKAGE</b><br>"
echo -n "<br>Target arch:<select id=rpmbuildarch>" echo -n "Target arch:<select id=rpmbuildarch>"
for f in i586 arm x86_64 ppc; do for f in i586 arm x86_64 ppc; do
SELECTED= SELECTED=
if [ ! "$RPMBUILDARCH" -a "$f" = "${AUTOPORT_ARCH[$ENVIRONMENT]}" ]; then if [ ! "$RPMBUILDARCH" -a "$f" = "${AUTOPORT_ARCH[$ENVIRONMENT]}" ]; then
@ -687,7 +785,7 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmai
# destination repository select # destination repository select
echo -n "<br>Send to:" echo -n "<br>Send to:"
echo -n "<select id=sendrepository>" echo -n "<select id=sendrepository>"
for f in `$SUDO_WRAPPER local "" "/usr/sbin/openmamba-repository list"`; do for f in `$SUDO_WRAPPER 0 local "" "/usr/sbin/openmamba-repository list"`; do
repname=`basename $f` repname=`basename $f`
if [ "$repname" = "devel-${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" -o \ if [ "$repname" = "devel-${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" -o \
"$repname" = "${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}" -o \ "$repname" = "${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}" -o \
@ -703,25 +801,37 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmai
fi fi
done done
echo -n "</select><br>" echo -n "</select><br>"
[ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$STATE_ADVANCEDCONTROLS" ] && echo -n "<hr><b>Autodist automatic builds:</b><br>" [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$STATE_ADVANCEDCONTROLS" ] && echo -n "<hr><b>Autodist batch builds:</b><br>"
if [ "$PACKAGE" ]; then
if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
# autodist show patch
echo -n "Patch:<input type=button value=\"show\" onclick=javascript:" echo -n "Patch:<input type=button value=\"show\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=showpatch\");>" echo -n "REQUEST=showpatch\");>"
# autodist remove patch
echo -n "<input type=button value=\"remove\" onclick=javascript:" echo -n "<input type=button value=\"remove\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=removepatch\"); class=redbutton>" echo -n "REQUEST=removepatch\""
echo -n ",\"`cgi_encodevar "Remove current autodist patch for package <b>$PACKAGE</b>?"`\"); class=redbutton>"
# autodist update patch
echo -n "<input type=button id=updatepatchbutton value=\"update\" onclick=javascript:" echo -n "<input type=button id=updatepatchbutton value=\"update\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&" echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "REQUEST=updatepatch\"); class=redbutton>" echo -n "REQUEST=updatepatch\""
echo -n ",\"`cgi_encodevar "Create an autodist <b>update</b> patch for package <b>$PACKAGE</b>?"`\"); class=redbutton>"
# autodist build patch
echo -n "<input type=button id=buildpatchbutton value=\"build\" onclick=javascript:" echo -n "<input type=button id=buildpatchbutton value=\"build\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&" echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "REQUEST=buildpatch\"); class=redbutton>" echo -n "REQUEST=buildpatch\""
# autodist schedule echo -n ",\"`cgi_encodevar "Create an autodist <b>build</b> patch for package <b>$PACKAGE</b>?"`\"); class=redbutton>"
# autodist show schedule
echo -n "<br>Schedule:<input type=button value=\"show\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&" echo -n "<br>Schedule:<input type=button value=\"show\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=showscheduled\");>" echo -n "REQUEST=showscheduled\");>"
# autodist schedule
echo -n "<input type=button value=\"schedule\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=schedule\""
echo -n ",\"`cgi_encodevar "Schedule <b>$PACKAGE</b> autodist job for automatic update?"`\"); class=redbutton>"
# autodist unschedule # autodist unschedule
echo -n "<input type=button value=\"unschedule\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&" echo -n "<input type=button value=\"unschedule\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=unschedule\"); class=redbutton>" echo -n "REQUEST=unschedule\"); class=redbutton>"
@ -729,57 +839,99 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmai
echo -n "<input type=button value=\"skip\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&" echo -n "<input type=button value=\"skip\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=skip\"); class=redbutton><br>" echo -n "REQUEST=skip\"); class=redbutton><br>"
fi fi
fi
if [ "$STATE_ADVANCEDCONTROLS" ]; then if [ "$STATE_ADVANCEDCONTROLS" ]; then
# autodist list-jobs # autodist list-jobs
echo -n "Job:<select id=autodistjobs>" echo -n "Job:<select id=autodistjobs onchange="
echo -n "<option value=\"$PACKAGEENCODED\">$PACKAGE</option>" echo -n "ajax_getvalues(\""
for f in `$SUDO_WRAPPER $ENVIRONMENT "" "autodist --list-jobs"`; do echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
[ "$AUTODISTJOB" = "$f" ] && SELECTED="selected=\"selected\"" || SELECTED= echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistjobchange\");>"
echo -n "<option value=\"\">-- select a job --</option>"
for f in `$SUDO_WRAPPER 0 $ENVIRONMENT "" "autodist --list-jobs"`; do
SELECTED=
if [ "$AUTODISTJOB" ]; then
[ "$AUTODISTJOB" = "$f" ] && SELECTED="selected=\"selected\""
elif [ "$PACKAGE" = "$f" ]; then
SELECTED="selected=\"selected\""
AUTODISTJOB=$f
fi
JOBENCODED=`cgi_encodevar $f` JOBENCODED=`cgi_encodevar $f`
echo -n "<option value=\"$JOBENCODED\" $SELECTED>$f</option>" echo -n "<option value=\"$JOBENCODED\" $SELECTED>$f</option>"
done done
if [ "$PACKAGE" ]; then
[ "$AUTODISTJOB" ] && SELECTED= || {
SELECTED="selected=\"selected\""
AUTODISTJOB=$PACKAGE
}
echo -n "<option value=\"$PACKAGEENCODED\" $SELECTED>$PACKAGE (generic)</option>"
fi
echo -n "</select>" echo -n "</select>"
if [ "$AUTODISTJOB" ]; then
echo -n "<br>Job packages:<div class=multiselect style=\"height:60px;\">"
for p in `$SUDO_WRAPPER 0 $ENVIRONMENT "" "autodist --list-pkgs $AUTODISTJOB"`; do
if [ "$AUTODISTPKGS" ]; then
for i in $AUTODISTPKGS; do
[ "$i" = "$p" ] && { SELECTED=checked; break; } || SELECTED=
done
else
[ "$p" = "$AUTODISTJOB" ] && SELECTED=checked || SELECTED=
fi
echo -n "<label><input type=checkbox name=autodistpkgscheckbox value=\"$p\" $SELECTED>${p}</label>"
done
echo -n "</div>"
# autodist prepare # autodist prepare
echo -n "<br><input type=button value=\"prepare\" onclick=javascript:" echo -n "<input type=button value=\"prepare\" onclick="
echo -n "ajax_getvalues(\"" echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&" echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&" echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&" echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistprepare\");>" echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistprepare\");>"
# autodist update # autodist update
echo -n "<input type=button value=\"update\" onclick=javascript:" echo -n "<input type=button value=\"update\" onclick="
echo -n "ajax_getvalues(\"" echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&" echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&" echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&" echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistupdate\");>" echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistupdate\");>"
# autodist build # autodist build
echo -n "<input type=button value=\"build\" onclick=javascript:" echo -n "<input type=button value=\"build\" onclick="
echo -n "ajax_getvalues(\"" echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&" echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&" echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&" echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&" echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistbuild\"); class=boldbutton>" echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistbuild\"); class=boldbutton>"
# autodist install # autodist install
[ ! "$USER_CANINSTALL" ] && DISABLED="disabled=disabled" || DISABLED= [ ! "$USER_CANINSTALL" ] && DISABLED="disabled=disabled" || DISABLED=
echo -n "<input type=button value=\"install\" onclick=javascript:" echo -n "<input type=button value=\"install\" onclick="
echo -n "ajax_getvalues(\"" echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&" echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&" echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&" echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistinstall\"); class=redbutton $DISABLED>" echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistinstall\"); class=redbutton $DISABLED>"
# autodist send # autodist send
[ ! "$USER_ALLREPOSITORIES" ] && DISABLED="disabled=disabled" || DISABLED= [ ! "$USER_ALLREPOSITORIES" ] && DISABLED="disabled=disabled" || DISABLED=
echo -n "<input type=button value=\"send\" onclick=javascript:" echo -n "<input type=button value=\"send\" onclick="
echo -n "ajax_getvalues(\"" echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&" echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&" echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&" echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
echo -n "SENDREPOSITORY=\"+getSelectedValueById('sendrepository')+\"&" echo -n "SENDREPOSITORY=\"+getSelectedValueById('sendrepository')+\"&"
echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistsend\"); class=redbutton $DISABLED>" echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistsend\""
# autodist force checkbox echo -n ",\"`cgi_encodevar "Send selected packages for <b>"`\"+getSelectedValueById('autodistjobs')+\"`cgi_encodevar "</b> job to <b>"`\"+"
echo -n "getSelectedValueById('sendrepository')+\"`cgi_encodevar "</b>?"`\"); class=redbutton $DISABLED>"
else
echo -n "<br>"
fi fi
fi
if [ "$PACKAGE" ]; then
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
# autodist logs # autodist logs
echo -n "<hr><b>Last autodist logs:</b> " echo -n "<hr><b>Last autodist logs:</b> "
@ -836,17 +988,24 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmai
[ ! "$USER_CANINSTALL" ] && DISABLED="disabled=disabled" [ ! "$USER_CANINSTALL" ] && DISABLED="disabled=disabled"
echo -n "<input type=button id=rpminstallbutton value=\"install\" onclick=javascript:" echo -n "<input type=button id=rpminstallbutton value=\"install\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=rpminstall&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=rpminstall&"
echo -n "RPMFORCE=\"+getElementById('rpmforce').checked); class=redbutton $DISABLED>" echo -n "RPMFORCE=\"+getElementById('rpmforce').checked"
# send echo -n ",\"`cgi_encodevar "Install <b>$PACKAGE</b> in current environment?"`\""
echo -n "); class=redbutton $DISABLED>"
# rpm send
echo -n "<input type=button id=sendpackagebutton value=\"send\" onclick=javascript:" echo -n "<input type=button id=sendpackagebutton value=\"send\" onclick=javascript:"
echo -n "i=getElementById('sendrepository').selectedIndex;"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=sendpackage&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=sendpackage&"
echo -n "SENDREPOSITORY=\"+getElementById('sendrepository').options[i].value); class=redbutton>" echo -n "SENDREPOSITORY=\"+getSelectedValueById('sendrepository')"
echo -n ",\"`cgi_encodevar "Send <b>$PACKAGE</b> built packages to <b>"`\"+getSelectedValueById('sendrepository')+"
echo -n "\"`cgi_encodevar "</b>?"`\""
echo -n "); class=redbutton>"
# recreate and send SRPM # recreate and send SRPM
echo -n "<input type=button id=sendsourcebutton value=\"recreate and send SRPM\" onclick=javascript:" echo -n "<input type=button id=sendsourcebutton value=\"recreate and send SRPM\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=sendsource&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=sendsource&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&" echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "SENDREPOSITORY=\"+getSelectedValueById('sendrepository')); class=redbutton>" echo -n "SENDREPOSITORY=\"+getSelectedValueById('sendrepository')"
echo -n ",\"`cgi_encodevar "Rebuild <b>$PACKAGE</b> source package only and send to <b>"`\"+getSelectedValueById('sendrepository')+"
echo -n "\"`cgi_encodevar "</b>?"`\""
echo -n "); class=redbutton>"
# add patches # add patches
echo -n "<hr><b>Add patches:</b>" echo -n "<hr><b>Add patches:</b>"
echo -n "<input type=button id=addpatchbutton value=\"submit\" onclick=javascript:ajax_getvalues(\"" echo -n "<input type=button id=addpatchbutton value=\"submit\" onclick=javascript:ajax_getvalues(\""
@ -855,17 +1014,6 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmai
echo -n "ADDPATCHNAME=\"+encodeURIComponent(getElementById('addpatchname').value));><br>" echo -n "ADDPATCHNAME=\"+encodeURIComponent(getElementById('addpatchname').value));><br>"
echo -n "URL:<input type=text id=addpatchurl value=\"\" size=\"28\">" echo -n "URL:<input type=text id=addpatchurl value=\"\" size=\"28\">"
echo -n "As: $PACKAGE-<input type=text id=addpatchname value=\"\" size=\"13\">.patch" echo -n "As: $PACKAGE-<input type=text id=addpatchname value=\"\" size=\"13\">.patch"
# fi
# if [ "$USER_CANMAINTAIN" -a "$PACKAGE" ]; then
# echo -n "<input type=button value=\"archive\" onclick=javascript:"
# echo -n "i=getElementById('sendrepository').selectedIndex;"
# echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
# echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
# echo -n "SENDREPOSITORY=\"+getElementById('sendrepository').options[i].value+\"&"
# echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
# echo -n "REQUEST=repositoryarchive\"); class=redbutton>"
# echo -n "<label><input type=checkbox id=\"repositorysimulate\" value=\"simulate\">simulate</label>"
# fi
if [ ! "${AUTOPORT_DISABLE[$ENVIRONMENT]}" -a ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then if [ ! "${AUTOPORT_DISABLE[$ENVIRONMENT]}" -a ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
echo -n "<hr>Automatic port:<br>" echo -n "<hr>Automatic port:<br>"
echo -n "<input type=button id=autoportnp value=\"port\" onclick=javascript:" echo -n "<input type=button id=autoportnp value=\"port\" onclick=javascript:"
@ -900,6 +1048,11 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmai
echo -n "<option value=\"$macrosfile\">$macrosfile</option>" echo -n "<option value=\"$macrosfile\">$macrosfile</option>"
done done
echo -n "</select></div>" echo -n "</select></div>"
fi
echo -n "]]></operationpanel>"
fi
echo -n "<chatpanel><![CDATA["
# broadcast message # broadcast message
echo -n "<hr><b>Broadcast message:</b><br>" echo -n "<hr><b>Broadcast message:</b><br>"
echo -n "<input type=text id=broadcastmessage size=\"25\">" echo -n "<input type=text id=broadcastmessage size=\"25\">"
@ -907,14 +1060,8 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmai
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=broadcastmessage&BROADCASTMESSAGE=\"+encodeURIComponent(getElementById('broadcastmessage').value));" echo -n "REQUEST=broadcastmessage&BROADCASTMESSAGE=\"+encodeURIComponent(getElementById('broadcastmessage').value));"
echo -n "getElementById('broadcastmessage').value=\"\";>" echo -n "getElementById('broadcastmessage').value=\"\";>"
echo -n "]]></operationpanel>" echo -n "]]></chatpanel>"
else
echo "<output><![CDATA[<div align=left class=output id=outputtop>"
echo "No pre-existing .spec file $PACKAGE.spec in current working environment. Choose package from a repository and press 'Unpack and edit' to edit."
echo -n "</div>"
echo -n "]]></output>"
fi
else
if [ "$REQUEST" != "" ]; then if [ "$REQUEST" != "" ]; then
echo -n "<output><![CDATA[" echo -n "<output><![CDATA["
echo -n "<div align=left class=output " echo -n "<div align=left class=output "
@ -931,101 +1078,151 @@ else
fi fi
RET=255 RET=255
fi fi
case $REQUEST in case $REQUEST in
"showpatch") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE"; RET=$? ;; "showpatch") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE"; RET=$? ;;
"removepatch") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE remove" "removepatch") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE remove"
RET=$? RET=$?
if [ $RET -eq 0 ]; then if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"removed the autodist patch for <b>$PACKAGE</b>\" STIME=`date +%s`" social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"removed the autodist patch for <b>$PACKAGE</b>\" STIME=`date +%s`"
fi ;; fi ;;
"updatepatch") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE update" "updatepatch") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE update"
RET=$? RET=$?
if [ $RET -eq 0 ]; then if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist <b>update</b> patch for <b>$PACKAGE</b>\" STIME=`date +%s`" social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist <b>update</b> patch for <b>$PACKAGE</b>\" STIME=`date +%s`"
fi ;; fi ;;
"buildpatch") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE build" "buildpatch") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE build"
RET=$? RET=$?
if [ $RET -eq 0 ]; then if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist <b>build</b> patch for <b>$PACKAGE</b>\" STIME=`date +%s`" social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist <b>build</b> patch for <b>$PACKAGE</b>\" STIME=`date +%s`"
fi ;; fi ;;
"showscheduled") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool schedule"; RET=$? ;; "showscheduled") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool schedule"; RET=$? ;;
"unschedule") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool unschedule $PACKAGE" "schedule") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool schedule $PACKAGE"
RET=$?
if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job <b>$PACKAGE</b>\" STIME=`date +%s`"
fi ;;
"unschedule") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool unschedule $PACKAGE"
RET=$? RET=$?
if [ $RET -eq 0 ]; then if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"unscheduled autodist job <b>$PACKAGE</b>\" STIME=`date +%s`" social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"unscheduled autodist job <b>$PACKAGE</b>\" STIME=`date +%s`"
fi ;; fi ;;
"skip") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool skip $PACKAGE" "skip") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autodist-tool skip $PACKAGE"
RET=$? RET=$?
if [ $RET -eq 0 ]; then if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"added autodist job <b>$PACKAGE</b> to skipped list\" STIME=`date +%s`" social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"added autodist job <b>$PACKAGE</b> to skipped list\" STIME=`date +%s`"
fi ;; fi ;;
"autodistprepare") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD= "autodistprepare") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist -v -p $AUTODISTJOB --arch $AUTODISTARCH $AUTODISTADD" autodistjobs=
if [ "$AUTODISTPKGS" ]; then
for p in $AUTODISTPKGS; do
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
done
else
autodistjobs="$AUTODISTJOB"
fi
$SUDO_WRAPPER 0 $ENVIRONMENT "" "autodist -v -p $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
RET=$? ;; RET=$? ;;
"autodistupdate") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD= "autodistupdate") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist -v -u $AUTODISTJOB --arch $AUTODISTARCH $AUTODISTADD" autodistjobs=
if [ "$AUTODISTPKGS" ]; then
for p in $AUTODISTPKGS; do
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
done
else
autodistjobs="$AUTODISTJOB"
fi
$SUDO_WRAPPER 0 $ENVIRONMENT "" "autodist -v -u $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
RET=$? ;; RET=$? ;;
"autodistbuild") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD= "autodistbuild") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist -v -b $AUTODISTJOB --arch $AUTODISTARCH $AUTODISTADD" autodistjobs=
if [ "$AUTODISTPKGS" ]; then
for p in $AUTODISTPKGS; do
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
done
else
autodistjobs="$AUTODISTJOB"
fi
$SUDO_WRAPPER background $ENVIRONMENT "" "autodist -v -b $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
RET=$? RET=$?
[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"successfully built <b>$PACKAGE</b>\" STIME=`date +%s`" #[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"successfully built <b>$PACKAGE</b>\" STIME=`date +%s`"
;; ;;
"autodistinstall") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD= "autodistinstall") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist -v -i $AUTODISTJOB --arch $AUTODISTARCH $AUTODISTADD" autodistjobs=
if [ "$AUTODISTPKGS" ]; then
for p in $AUTODISTPKGS; do
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
done
else
autodistjobs="$AUTODISTJOB"
fi
$SUDO_WRAPPER 0 $ENVIRONMENT "" "autodist -v -i $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $AUTODISTADD"
RET=$? ;; RET=$? ;;
"autodistsend") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD= "autodistsend") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist -v -s $AUTODISTJOB --server $SENDREPOSITORY --arch $AUTODISTARCH $AUTODISTADD" autodistjobs=
if [ "$AUTODISTPKGS" ]; then
for p in $AUTODISTPKGS; do
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
done
else
autodistjobs="$AUTODISTJOB"
fi
$SUDO_WRAPPER 0 $ENVIRONMENT "" "autodist -v -s $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --server $SENDREPOSITORY --arch $AUTODISTARCH $AUTODISTADD"
RET=$? RET=$?
[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$PACKAGE</b> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`" [ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$PACKAGE</b> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
;; ;;
"buildrootfiles") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "cd @RPMBUILDROOT@ && find @BUILDROOT@"; RET=$? ;; "autoport") $SUDO_WRAPPER background $ENVIRONMENT $PACKAGE "autoport $PACKAGE -r $REPOSITORY -v"
"autospecupdatescheck") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a2"; RET=$? ;; RET=$?
"rpmprepare") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "rpmbuild -bp $PACKAGE.spec"; RET=$? ;; ;;
"buildrootfiles") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cd @RPMBUILDROOT@ && find @BUILDROOT@"; RET=$? ;;
"autospecupdatescheck") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a2"; RET=$? ;;
"rpmprepare") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "rpmbuild -bp $PACKAGE.spec"; RET=$? ;;
"rpmbuild") echo "`date` - RPMBUILD=$PACKAGE USER=$USER ENVIRONMENT=$ENVIRONMENT" >> $WEBBUILD_STATEDIR/buildingnow_log "rpmbuild") echo "`date` - RPMBUILD=$PACKAGE USER=$USER ENVIRONMENT=$ENVIRONMENT" >> $WEBBUILD_STATEDIR/buildingnow_log
[ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-build" [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-build"
[ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \ [ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\"" RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a5 $RPMFORCEADD $RPMARCHADD" $SUDO_WRAPPER background $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a5,6 $RPMFORCEADD $RPMARCHADD"
# && echo \"Webbuild HINT: now you may want to click on 'build requirements', add build requirements in .spec file and then 'recreate SRPMS'\""
RET=$? RET=$?
if [ $RET -eq 0 ]; then # if [ $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"successfully built <b>$PACKAGE</b>\" STIME=`date +%s`" # social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"successfully built <b>$PACKAGE</b>\" STIME=`date +%s`"
fi # fi
sed -i "|RPMBUILD=$PACKAGE USER=$USER ENVIRONMENT=$ENVIRONMENT|d" $WEBBUILD_STATEDIR/buildingnow_log sed -i "|RPMBUILD=$PACKAGE USER=$USER ENVIRONMENT=$ENVIRONMENT|d" $WEBBUILD_STATEDIR/buildingnow_log
;; ;;
"srpmbuild") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "rpmbuild -bs $PACKAGE.spec" "srpmbuild") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "rpmbuild -bs $PACKAGE.spec"
RET=$? ;; RET=$? ;;
"autospeclistcheck") "autospeclistcheck")
[ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \ [ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\"" RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a5 --list-check $RPMARCHADD" $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a5 --list-check $RPMARCHADD"
RET=$? ;; RET=$? ;;
"autospecbuildreq") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a6" "autospecbuildreq") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a6"
RET=$? ;; RET=$? ;;
"rpmchecks") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a8"; RET=$? ;; "rpmchecks") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a8"; RET=$? ;;
"rpmsimulateinstall") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a7"; RET=$? ;; "rpmsimulateinstall") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a7"; RET=$? ;;
"rpminstall") if [ "$USER_CANINSTALL" ]; then "rpminstall") if [ "$USER_CANINSTALL" ]; then
[ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-install" [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-install"
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a11 $RPMFORCEADD"; RET=$? $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a11 $RPMFORCEADD"; RET=$?
else else
echo "Install function disabled." echo "Install function disabled."
RET=1 RET=1
fi ;; fi ;;
"addpatch") if [ "$ADDPATCHURL" -a "$ADDPATCHNAME" ]; then "addpatch") if [ "$ADDPATCHURL" -a "$ADDPATCHNAME" ]; then
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "curl -s \"$ADDPATCHURL\" -o ../SOURCES/$PACKAGE-$ADDPATCHNAME.patch" $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "curl -s -k \"$ADDPATCHURL\" -o ../SOURCES/$PACKAGE-$ADDPATCHNAME.patch"
RET=$? RET=$?
[ $RET -eq 0 ] && echo "Patch added with name $PACKAGE-$ADDPATCHNAME.patch" [ $RET -eq 0 ] && echo "Patch added with name $PACKAGE-$ADDPATCHNAME.patch"
else else
echo "Patch URL or destination name not provided." echo "Patch URL or destination name not provided."
RET=1 RET=1
fi ;; fi ;;
"sendpackage") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a10 --server $SENDREPOSITORY" "sendpackage") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a10 --server $SENDREPOSITORY"
RET=$? RET=$?
if [ $RET -eq 0 ]; then 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</b> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
fi ;; fi ;;
"sendsource") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force --nodeps" "sendsource") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force --nodeps"
if [ "$SENDREPOSITORY" ]; then if [ "$SENDREPOSITORY" ]; then
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "rpmbuild -bs $PACKAGE.spec $RPMFORCEADD && autospec -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm" $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "rpmbuild -bs $PACKAGE.spec $RPMFORCEADD && autospec -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm"
RET=$? RET=$?
else else
echo "ERROR: send repository is not defined." echo "ERROR: send repository is not defined."
@ -1034,7 +1231,7 @@ else
"repositoryimport") "repositoryimport")
for p in $PACKAGES; do for p in $PACKAGES; do
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD= [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
$SUDO_WRAPPER local "$PACKAGE" "openmamba-repository import $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y" $SUDO_WRAPPER 0 local "$PACKAGE" "openmamba-repository import $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
RET=$? RET=$?
if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"imported <b>$p</b> from <b>$SENDREPOSITORY</b> to <b>$REPOSITORYIMPORTTO</b>\" STIME=`date +%s`" social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"imported <b>$p</b> from <b>$SENDREPOSITORY</b> to <b>$REPOSITORYIMPORTTO</b>\" STIME=`date +%s`"
@ -1045,7 +1242,7 @@ else
"repositoryrelease") "repositoryrelease")
for p in $PACKAGES; do for p in $PACKAGES; do
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD= [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
$SUDO_WRAPPER local "$PACKAGE" "openmamba-repository release $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y" $SUDO_WRAPPER 0 local "$PACKAGE" "openmamba-repository release $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
RET=$? RET=$?
if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"released <b>$p</b> from <b>$SENDREPOSITORY</b> to <b>$REPOSITORYIMPORTTO</b>\" STIME=`date +%s`" social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"released <b>$p</b> from <b>$SENDREPOSITORY</b> to <b>$REPOSITORYIMPORTTO</b>\" STIME=`date +%s`"
@ -1055,7 +1252,7 @@ else
;; ;;
"repositorydiff") "repositorydiff")
for p in $PACKAGES; do for p in $PACKAGES; do
$SUDO_WRAPPER local "" "openmamba-repository diff $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO" $SUDO_WRAPPER 0 local "" "openmamba-repository diff $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO"
RET=$? RET=$?
[ $RET -eq 0 ] || break [ $RET -eq 0 ] || break
done done
@ -1063,7 +1260,7 @@ else
"repositoryarchive") "repositoryarchive")
for p in $PACKAGES; do for p in $PACKAGES; do
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD= [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
$SUDO_WRAPPER local "$PACKAGE" "openmamba-repository archive $SENDREPOSITORY $p -y" $SUDO_WRAPPER 0 local "$PACKAGE" "openmamba-repository archive $SENDREPOSITORY $p -y"
RET=$? RET=$?
if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"archived <b>$p</b> from <b>$SENDREPOSITORY</b>\" STIME=`date +%s`" social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"archived <b>$p</b> from <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
@ -1071,16 +1268,25 @@ else
[ $RET -eq 0 ] || break [ $RET -eq 0 ] || break
done done
;; ;;
"autoportnp") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autoport -np $PACKAGE"; RET=$? ;; "repositorysync")
if [ "$REPOSITORY" ]; then
$SUDO_WRAPPER background local "" "/etc/cron.hourly/20-openmamba-apt $REPOSITORY"
RET=$?
[ $RET -eq 0 ] && $SUDO_WRAPPER background local "" "/etc/cron.hourly/40-openmamba-rsync $REPOSITORY"
RET=$?
[ $RET -eq 0 ] || break
fi
;;
"autoportnp") $SUDO_WRAPPER keeplog $ENVIRONMENT $PACKAGE "autoport -np $PACKAGE"; RET=$? ;;
"autoportlog") cat "$AUTOPORTLOGDIR/current.log"; RET=$? ;; "autoportlog") cat "$AUTOPORTLOGDIR/current.log"; RET=$? ;;
"allowedgroups") $SUDO_WRAPPER $ENVIRONMENT "" "autospec --eval rpm_allowed_groups"; RET=$? ;; "allowedgroups") $SUDO_WRAPPER 0 $ENVIRONMENT "" "autospec --eval rpm_allowed_groups"; RET=$? ;;
"approvedlicenses") $SUDO_WRAPPER $ENVIRONMENT "" "autospec --eval rpm_approved_licenses | grep -v \"^#\"" | \ "approvedlicenses") $SUDO_WRAPPER 0 $ENVIRONMENT "" "autospec --eval rpm_approved_licenses | grep -v \"^#\"" | \
while read line; do while read line; do
echo $line echo $line
done done
RET=0 RET=0
;; ;;
"builddirfiles") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@ && find @BUILDDIR@"; RET=$? ;; "builddirfiles") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@ && find @BUILDDIR@"; RET=$? ;;
"showchangelogs"|"showbuilddocs"|"showlicenses") "showchangelogs"|"showbuilddocs"|"showlicenses")
if [ "$REQUEST" = "showchangelogs" ]; then if [ "$REQUEST" = "showchangelogs" ]; then
PATTERN="-iname changelog -or -iname news -and -type f" PATTERN="-iname changelog -or -iname news -and -type f"
@ -1089,7 +1295,7 @@ else
elif [ "$REQUEST" = "showbuilddocs" ]; then 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\* -and -type f"
fi fi
files=`$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && find . $PATTERN -maxdepth 2"` files=`$SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && find . $PATTERN -maxdepth 2"`
cnt=0 cnt=0
for f in $files; do for f in $files; do
echo -n "<a href=#logfile-$f>$f</a><br>" echo -n "<a href=#logfile-$f>$f</a><br>"
@ -1097,15 +1303,16 @@ else
echo -n "<br>" echo -n "<br>"
for f in $files; do for f in $files; do
echo -n "<a name=logfile-$f><p><b>File $f:</b></a><pre>" echo -n "<a name=logfile-$f><p><b>File $f:</b></a><pre>"
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && cat $f" $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && cat $f"
RET=$? RET=$?
echo -n "</pre>" echo -n "</pre>"
done done
;; ;;
"configurehelp") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && ./configure --help"; RET=$? ;; "configurehelp") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cd @RPMBUILDDIR@/@BUILDDIR@ && ./configure --help"; RET=$? ;;
"showmacrosfile") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "cat /etc/rpm/macros.$MACROSFILE"; RET=$? ;; "showmacrosfile") $SUDO_WRAPPER 0 $ENVIRONMENT $PACKAGE "cat /etc/rpm/macros.$MACROSFILE"; RET=$? ;;
*) RET=0 ;; *) RET=0 ;;
esac esac
if [ "$REQUEST" != "" ]; then if [ "$REQUEST" != "" ]; then
if [ "$REQUEST" != "showchangelogs" -a "$REQUEST" != "showbuilddocs" -a "$REQUEST" != "showlicenses" ]; then if [ "$REQUEST" != "showchangelogs" -a "$REQUEST" != "showbuilddocs" -a "$REQUEST" != "showlicenses" ]; then
echo -n "<!-- ENDSCROLL --></pre>" echo -n "<!-- ENDSCROLL --></pre>"
@ -1118,8 +1325,6 @@ else
echo -n "</div>" echo -n "</div>"
echo -n "]]></output>" echo -n "]]></output>"
fi fi
fi
if [ "$MAINTAINERMODE" = "true" ]; then if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "<packages> </packages>" echo -n "<packages> </packages>"
@ -1172,29 +1377,48 @@ if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositorydiff\");>" echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositorydiff\");>"
# repository import # repository import
echo -n "<input type=button value=\"import\" onclick=javascript:" echo -n "<input type=button value=\"import\" onclick=javascript:"
echo -n "p=getCheckedValuesByName('packagescheckbox');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
echo -n "PACKAGES=\"+encodeURIComponent(getCheckedValuesByName('packagescheckbox'))+\"&" echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&" echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
echo -n "REPOSITORYIMPORTTO=\"+getSelectedValueById('repositoryimportto')+\"&" echo -n "REPOSITORYIMPORTTO=\"+getSelectedValueById('repositoryimportto')+\"&"
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&" echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositoryimport\"); class=redbutton>" echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositoryimport\""
echo -n ",\"`cgi_encodevar "Import <b>"`\"+p+\"`cgi_encodevar "</b> from $REPOSITORY to <b>"`\"+getSelectedValueById('repositoryimportto')+"
echo -n "\"`cgi_encodevar "</b>?"`\""
echo -n "); class=redbutton>"
# repository release # repository release
echo -n "<input type=button value=\"release\" onclick=javascript:" echo -n "<input type=button value=\"release\" onclick=javascript:"
echo -n "p=getCheckedValuesByName('packagescheckbox');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
echo -n "PACKAGES=\"+encodeURIComponent(getCheckedValuesByName('packagescheckbox'))+\"&" echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&" echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
echo -n "REPOSITORYIMPORTTO=\"+getSelectedValueById('repositoryimportto')+\"&" echo -n "REPOSITORYIMPORTTO=\"+getSelectedValueById('repositoryimportto')+\"&"
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&" echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositoryrelease\"); class=redbutton>" echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositoryrelease\""
echo -n ",\"`cgi_encodevar "Release <b>"`\"+p+\"`cgi_encodevar "</b> in $REPOSITORY to <b>"`\"+getSelectedValueById('repositoryimportto')+"
echo -n "\"`cgi_encodevar "</b>?"`\""
echo -n "); class=redbutton>"
# repository archive # repository archive
echo -n "<input type=button value=\"archive\" onclick=javascript:" echo -n "<input type=button value=\"archive\" onclick=javascript:"
echo -n "p=getCheckedValuesByName('packagescheckbox');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
echo -n "PACKAGES=\"+encodeURIComponent(getCheckedValuesByName('packagescheckbox'))+\"&" echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&" echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
echo -n "SENDREPOSITORY=$REPOSITORY&" echo -n "SENDREPOSITORY=$REPOSITORY&"
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&" echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
echo -n "REQUEST=repositoryarchive\"); class=redbutton>" echo -n "REQUEST=repositoryarchive\""
echo -n ",\"`cgi_encodevar "Archive <b>"`\"+p+\"`cgi_encodevar "</b> in <b>$REPOSITORY</b>?"`\""
echo -n "); class=redbutton>"
echo -n "<label><input type=checkbox id=\"repositorysimulate\" value=\"simulate\">simulate</label>" echo -n "<label><input type=checkbox id=\"repositorysimulate\" value=\"simulate\">simulate</label>"
# repository sync
echo -n " <input type=button value=\"sync\" onclick=javascript:"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
echo -n "PACKAGES=\"+encodeURIComponent(getCheckedValuesByName('packagescheckbox'))+\"&"
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
echo -n "REQUEST=repositorysync\""
echo -n ",\"`cgi_encodevar "Make <b>$REPOSITORY</b> updates immediately available from public server?"`\""
echo -n "); class=redbutton>"
fi fi
echo -n "]]></operationpanel>" echo -n "]]></operationpanel>"
fi fi
@ -1213,4 +1437,31 @@ fi
# echo -n "]]></output>" # echo -n "]]></output>"
#fi #fi
echo -n "<title>"
if [ "$MAINTAINERMODE" = "true" ]; then
[ "$REPOSITORY" ] && echo -n "$REPOSITORY " || echo -n "no repository "
echo -n "(Maintainer mode)"
else
[ "$PACKAGE" ] && echo -n "$PACKAGE " || echo -n "no package "
echo -n "("
if [ "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" ]; then
echo -n "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} "
else
echo -n "autodist "
fi
if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
echo -n "autoupdate"
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 " for ${AUTOPORT_ARCH[$ENVIRONMENT]})"
fi
echo -n " :: openmamba webbuild</title>"
echo "</webbuild>" echo "</webbuild>"

View File

@ -20,7 +20,7 @@ function set_user_state_var() {
[ "$1" ] || return [ "$1" ] || return
[ -e $WEBBILD_STATEDIR/users/$stateuser.state ] || touch $WEBBUILD_STATEDIR/users/$stateuser.state [ -e $WEBBUILD_STATEDIR/users/$stateuser.state ] || touch $WEBBUILD_STATEDIR/users/$stateuser.state
sed -i "/^$statevar=/d" $WEBBUILD_STATEDIR/users/$stateuser.state sed -i "/^$statevar=/d" $WEBBUILD_STATEDIR/users/$stateuser.state
[ "$statevalue" ] && echo "$statevar=$statevalue" >> $WEBBUILD_STATEDIR/users/$stateuser.state [ "$statevalue" ] && echo "$statevar=$statevalue" >> $WEBBUILD_STATEDIR/users/$stateuser.state
} }
@ -28,7 +28,7 @@ function set_user_state_var() {
function social_log() { function social_log() {
local line=$1 local line=$1
[ "$1" ] || return [ "$line" ] || return
if [ ! "$STATE_FAKEUSER" ]; then if [ ! "$STATE_FAKEUSER" ]; then
STATE_SOCIALLOG_ID=0 STATE_SOCIALLOG_ID=0
@ -52,7 +52,7 @@ function cgi_encodevar() {
esac esac
encoded+="${o}" encoded+="${o}"
done done
echo "${encoded}" # You can either set a return variable (FASTER) echo -n "${encoded}" # You can either set a return variable (FASTER)
# REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p # REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
} }

View File

@ -2,18 +2,35 @@
. /usr/share/autodist/webbuild-functions . /usr/share/autodist/webbuild-functions
. /etc/sysconfig/autoport . /etc/sysconfig/autoport
ENVIRONMENT=$1 MODE=$1
PACKAGE=$2 ENVIRONMENT=$2
COMMAND=$3 PACKAGE=$3
TMPFILE=$4 COMMAND=$4
TMPFILE=$5
if [ "$ENVIRONMENT" = "local" ]; then if [ "$MODE" = "killtree" ]; then
KILLPID=$2
[ $KILLPID -gt 1 ] && kill_tree $KILLPID
exit $?
elif [ "$MODE" = "finishprocess" ]; then
PROCESSPID=$2
PROCESSLOG=$3
RETCODE=`tail -n1 $PROCESSLOG | grep "^# WEBBUILD_EXITCODE=" | sed "s|^# WEBBUILD_EXITCODE=||"`
[ "$RETCODE" ] || RETCODE=257
sed -i "s|\(^$PROCESSPID [^[:space:]]* [^[:space:]]* [^[:space:]]* \)[^[:space:]]*|\1$RETCODE|" $WEBBUILD_STATEDIR/processes
exit $RETCODE
elif [ "$ENVIRONMENT" = "local" ]; then
# echo "Command: $COMMAND" # echo "Command: $COMMAND"
$COMMAND 2>&1 | sed "s|<|\&lt;|g" $COMMAND 2>&1 | sed "s|<|\&lt;|g"
exit 0 exit 0
fi fi
if [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then if [ "$ENVIRONMENT" = "local" ]; then
ENVPREFIX=
ENVUSER=root
WORKINGHOME=
SUCMDPREFIX=
elif [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
ENVPREFIX="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}" ENVPREFIX="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}"
ENVUSER=${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} ENVUSER=${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}
WORKINGHOME="/usr/src/" WORKINGHOME="/usr/src/"
@ -36,6 +53,7 @@ else
RPMBUILDROOT="/var/tmp/autodist" RPMBUILDROOT="/var/tmp/autodist"
[ "$TMPFILE" ] && chown autodist $TMPFILE [ "$TMPFILE" ] && chown autodist $TMPFILE
fi fi
if [ "$WORKINGHOME" ]; then
eval `$SUCMDPREFIX "autospec --eval=tmppath_dir|grep -v '^#'"` eval `$SUCMDPREFIX "autospec --eval=tmppath_dir|grep -v '^#'"`
RPMBUILDROOT=$tmppath_dir RPMBUILDROOT=$tmppath_dir
SPECFILE=${ENVPREFIX}${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec SPECFILE=${ENVPREFIX}${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec
@ -52,6 +70,7 @@ if [ -r "$SPECFILE" ]; then
# SPECSETUP=`grep %setup ${_tmpfile} | sed "s|.*-n ||"` # SPECSETUP=`grep %setup ${_tmpfile} | sed "s|.*-n ||"`
[ "$BUILDDIR" ] || BUILDDIR=$PACKAGE-$SPECVERSION [ "$BUILDDIR" ] || BUILDDIR=$PACKAGE-$SPECVERSION
fi fi
fi
RPMBUILDDIR=${WORKINGHOME}/RPM/BUILD RPMBUILDDIR=${WORKINGHOME}/RPM/BUILD
COMMAND=`echo $COMMAND | sed "s|@BUILDDIR@|$BUILDDIR|g"` COMMAND=`echo $COMMAND | sed "s|@BUILDDIR@|$BUILDDIR|g"`
COMMAND=`echo $COMMAND | sed "s|@BUILDROOT@|$BUILDROOT|g"` COMMAND=`echo $COMMAND | sed "s|@BUILDROOT@|$BUILDROOT|g"`
@ -62,19 +81,37 @@ cmdtmpfile=`mktemp`
chgrp nobody $cmdtmpfile chgrp nobody $cmdtmpfile
chmod 640 $cmdtmpfile chmod 640 $cmdtmpfile
if [ "$MODE" = "background" ]; then
if [ "$WORKINGHOME" ]; then
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \"# WEBBUILD_EXITCODE=\$?\"" 2>&1 | sed "s|<|\&lt;|g" | tr -d '\f' > $cmdtmpfile &
else
$SUCMDPREFIX "$COMMAND;echo \"# WEBBUILD_EXITCODE=\$?\"" 2>&1 | sed "s|<|\&lt;|g" | tr -d '\f' > $cmdtmpfile &
fi
echo "$! $ENVUSER $ENVIRONMENT $cmdtmpfile 256 $COMMAND" >> $WEBBUILD_STATEDIR/processes
echo "Started background command: $COMMAND"
RET=0
else
echo "$$ $ENVUSER $ENVIRONMENT $cmdtmpfile 256 $COMMAND" >> $WEBBUILD_STATEDIR/processes
rettmpfile=`$SUCMDPREFIX mktemp` rettmpfile=`$SUCMDPREFIX mktemp`
if [ "$WORKINGHOME" ]; then
echo "$$ $ENVUSER $ENVIRONMENT $cmdtmpfile $COMMAND" >> $WEBBUILD_STATEDIR/processes
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \$? > $rettmpfile" 2>&1 | sed "s|<|\&lt;|g" | tr -d '\f' | tee $cmdtmpfile $SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \$? > $rettmpfile" 2>&1 | sed "s|<|\&lt;|g" | tr -d '\f' | tee $cmdtmpfile
RET=`cat $rettmpfile` else
$SUCMDPREFIX "$COMMAND;echo \$? > $rettmpfile" 2>&1 | sed "s|<|\&lt;|g" | tr -d '\f' | tee $cmdtmpfile
fi
RET=`cat $ENVPREFIX/$rettmpfile`
[ "$RET" ] || RET=255
$SUCMDPREFIX "rm -f $rettmpfile" $SUCMDPREFIX "rm -f $rettmpfile"
#echo "Command: $SUCMDPREFIX \"cd $WORKINGHOME/RPM/SPECS;$COMMAND\";RET=$RET" >&2
sed -i "/^$$ $ENVUSER/d" $WEBBUILD_STATEDIR/processes sed -i "/^$$ $ENVUSER/d" $WEBBUILD_STATEDIR/processes
if [ "$MODE" != "keeplog" ]; then
rm -f $cmdtmpfile rm -f $cmdtmpfile
else
echo "$$ $ENVUSER $ENVIRONMENT $cmdtmpfile $RET $COMMAND" >> $WEBBUILD_STATEDIR/processes
fi
fi
if [ "$ENVIRONMENT" != "local" ]; then
if [ "$TMPFILE" -a "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then if [ "$TMPFILE" -a "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
rm -f /var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/$TMPFILE rm -f /var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/$TMPFILE
fi fi
fi
exit $RET exit $RET