1940 lines
101 KiB
Bash
Executable File
1940 lines
101 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# webbuild cgi script
|
|
# Copyright (c) 2012-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
#
|
|
. /etc/sysconfig/autoport
|
|
. /usr/share/autodist/webbuild-functions
|
|
. /usr/share/autodist/webbuild-functions-private
|
|
|
|
AUTOSPEC_CMD="autospec --colors web"
|
|
# register all GET and POST variables
|
|
cgi_getvars BOTH ALL
|
|
|
|
#[ "$PACKAGE" ] && PACKAGEENCODED=`cgi_encodevar "$PACKAGE"` || PACKAGEENCODED=
|
|
[ "$PACKAGE" ] && PACKAGEENCODED=`cgi_encodevar "$PACKAGE"` || PACKAGEENCODED=
|
|
|
|
#cgi_getvars POST
|
|
if [ "$REQUEST" != "refresh" ]; then
|
|
# echo "`date` - $QUERY_STRING_POST" >> $LOG
|
|
echo "`date` - USER=$USER&REQUEST=$REQUEST&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGE&MAINTAINERMODE=$MAINTAINERMODE" >> $LOG
|
|
fi
|
|
|
|
[ "$HOST" ] || HOST=0
|
|
[ "$AS_HOST" ] || AS_HOST=0
|
|
|
|
[ "$AS_HOST" -a "$HOST" != "0" ] && HOST_ADD="&HOST=$HOST"
|
|
|
|
if [ "$AS_HOST" = "0" ]; then
|
|
echo -e "Content-type: text/xml\nPragma: no-cache\n"
|
|
# echo -e "Content-Length: 10485\n"
|
|
echo -n "<webbuild>"
|
|
else
|
|
echo -e "Content-type: text/html; charset=UTF-8\n"
|
|
fi
|
|
|
|
# SECURITY
|
|
USER_ENABLED=
|
|
USER_ADMIN=
|
|
USER_CANMAINTAIN=
|
|
USER_CANSENDMESSAGES=
|
|
USER=${USER/.*\/}
|
|
if [ "$SECRET" -a "$USER" ]; then
|
|
if [ -r "$WEBBUILD_STATEDIR/users/$USER.conf" ]; then
|
|
. $WEBBUILD_STATEDIR/users/$USER.conf
|
|
fi
|
|
if [ "$USER_ENABLED" ]; then
|
|
USER_ENABLED=
|
|
if [ "$SECRET" = "$USER_SECRET" ]; then
|
|
USER_ENABLED=1
|
|
elif [ ! "$SECRET" ]; then
|
|
USER_ENABLED=
|
|
elif [ "$USER_SECRET" ]; then
|
|
echo -n "<environments> </environments>"
|
|
echo -n "<speccreate> </speccreate>"
|
|
echo -n "<specedit> </specedit>"
|
|
echo -n "<repositories> </repositories>"
|
|
echo -n "<packages> </packages>"
|
|
echo -n "<editcontrols> </editcontrols>"
|
|
echo -n "<editor> </editor>"
|
|
echo -n "<output>Unauthorized! If this happened after you changed your password in openmamba website please ask the maintainer to be re-enabled to use this service. Thank you."
|
|
echo -n "</output>"
|
|
echo -n "<operationpanel> </operationpanel>"
|
|
echo -n "</webbuild>"
|
|
exit
|
|
elif [ "$REQUEST" = "password" ]; then
|
|
/usr/libexec/webbuild-checkpassword "$PASSWORD" "$SECRET" 2>/dev/null
|
|
if [ $? -eq 0 ]; then
|
|
tmpfile=`mktemp --suffix=webbuildtmp`
|
|
cat $WEBBUILD_STATEDIR/users/$USER.conf > $tmpfile
|
|
echo "USER_SECRET='$SECRET'" >> $tmpfile
|
|
USER_ENABLED=1
|
|
$SUDO_WRAPPER 0 local "$USER" "" "mv $tmpfile $WEBBUILD_STATEDIR/users/$USER.conf"
|
|
else
|
|
USER_ENABLED=
|
|
fi
|
|
else
|
|
# no "$USER_SECRET" set; require password
|
|
echo -n "<output><![CDATA[Please enter your password: <input type=password id=password>"
|
|
echo -n " <input type=button value=\"Submit\" onClick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "REQUEST=password&PASSWORD=\"+encodeURIComponent(getElementById('password').value));>"
|
|
echo -n "]]></output>"
|
|
echo -n "<environments> </environments>"
|
|
echo -n "<speccreate> </speccreate>"
|
|
echo -n "<specedit> </specedit>"
|
|
echo -n "<repositories> </repositories>"
|
|
echo -n "<packages> </packages>"
|
|
echo -n "<editcontrols> </editcontrols>"
|
|
echo -n "<editor> </editor>"
|
|
echo -n "<operationpanel> </operationpanel>"
|
|
echo -n "</webbuild>"
|
|
exit
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if [ "$USER_ENABLED" != "1" ]; then
|
|
echo -n "<environments> </environments>"
|
|
echo -n "<speccreate> </speccreate>"
|
|
echo -n "<specedit> </specedit>"
|
|
echo -n "<repositories> </repositories>"
|
|
echo -n "<packages> </packages>"
|
|
echo -n "<editcontrols> </editcontrols>"
|
|
echo -n "<editor> </editor>"
|
|
if [ "$USER" -a "$SECRET" ]; then
|
|
if [ "$REQUEST" = "enablerequest" ]; then
|
|
echo "REQUEST_DATE=\"`date`\" REQUEST_USER=$USER REQUEST_USER_EMAIL=$USER_EMAIL REQUEST_TYPE=$REQUEST REQUEST_SECRET='$SECRET'" >> $WEBBUILD_STATEDIR/requests
|
|
echo -n "<output>Your request has been submitted. Please wait for approval and retry later.</output>"
|
|
elif [ "$REQUEST" = "password" ]; then
|
|
echo -n "<output>Invalid password. Please reload and retry or ask the maintainer in case of problems.</output>"
|
|
elif [ "`grep \" REQUEST_USER=$USER \" $WEBBUILD_STATEDIR/requests`" ]; then
|
|
echo -n "<output>Your request is pending for approval. Please try again later or ask the maintainer in case of problems.</output>"
|
|
else
|
|
echo -n "<output><![CDATA[Your account is not enabled to use this service!"
|
|
echo -n " <input type=button value=\"Send enable request\" onClick="
|
|
echo -n "ajax_getvalues(\"REQUEST=enablerequest\");>"
|
|
echo -n "]]></output>"
|
|
fi
|
|
# else
|
|
# echo -n "<output>Unauthorized!</output>"
|
|
fi
|
|
echo -n "<operationpanel> </operationpanel>"
|
|
# echo -n "</webbuild>"
|
|
# exit
|
|
fi
|
|
|
|
if [ -e $WEBBUILD_STATEDIR/webbuild.state ]; then
|
|
. $WEBBUILD_STATEDIR/users/webbuild.state
|
|
else
|
|
touch $WEBBUILD_STATEDIR/users/webbuild.state
|
|
fi
|
|
|
|
if [ "$USER_ADMIN" -a "$FAKEUSERSWITCH" != "" ]; then
|
|
if [ "$FAKEUSERSWITCH" = "_disabled_" ]; then
|
|
set_user_state_var STATE_FAKEUSER
|
|
FAKEUSER=
|
|
else
|
|
set_user_state_var STATE_FAKEUSER $FAKEUSERSWITCH
|
|
fi
|
|
fi
|
|
|
|
if [ "$USER" -a "$USER_ENABLED" ]; then
|
|
# set user state changes
|
|
if [ "$AUTODISTCURRENT" != "" ]; then
|
|
if [ "$AUTODISTCURRENT" = "true" ]; then
|
|
set_user_state_var STATE_AUTODISTCURRENT 1
|
|
else
|
|
set_user_state_var STATE_AUTODISTCURRENT 0
|
|
fi
|
|
fi
|
|
if [ "$ADVANCEDCONTROLSSWITCH" != "" ]; then
|
|
if [ "$ADVANCEDCONTROLSSWITCH" = "true" ]; then
|
|
set_user_state_var STATE_ADVANCEDCONTROLS 1
|
|
else
|
|
set_user_state_var STATE_ADVANCEDCONTROLS
|
|
fi
|
|
fi
|
|
if [ "$PRIVACYMODESWITCH" != "" ]; then
|
|
if [ "$PRIVACYMODESWITCH" = "true" ]; then
|
|
set_user_state_var STATE_PRIVACYMODE 1
|
|
else
|
|
set_user_state_var STATE_PRIVACYMODE
|
|
fi
|
|
fi
|
|
if [ "$JOBSSHOWALL" != "" ]; then
|
|
if [ "$JOBSSHOWALL" = "true" ]; then
|
|
set_user_state_var STATE_JOBSSHOWALL 1
|
|
else
|
|
set_user_state_var STATE_JOBSSHOWALL
|
|
fi
|
|
fi
|
|
|
|
# read user state file
|
|
[ -e $WEBBUILD_STATEDIR/users/$USER.state ] && . $WEBBUILD_STATEDIR/users/$USER.state
|
|
|
|
if [ "$USER_ADMIN" -a "$STATE_FAKEUSER" != "" ]; then
|
|
USER=$STATE_FAKEUSER
|
|
USER_ENABLED=
|
|
USER_ADMIN=
|
|
USER_CANMAINTAIN=
|
|
USER_CANINSTALL=
|
|
USER_ALLENVIRONMENTS=
|
|
USER_ALLREPOSITORIES=
|
|
[ -e $WEBBUILD_STATEDIR/users/$USER.conf ] && . $WEBBUILD_STATEDIR/users/$USER.conf
|
|
STATE_ADVANCEDCONTROLS=
|
|
[ -e $WEBBUILD_STATEDIR/users/$USER.state ] && . $WEBBUILD_STATEDIR/users/$USER.state
|
|
fi
|
|
else
|
|
USER=
|
|
fi
|
|
|
|
#
|
|
# Public requests
|
|
#
|
|
if [ "$REQUEST" = "refresh" -o ! "$USER" ]; then
|
|
[ -e "$WEBBUILD_STATEDIR/social_log" ] || exit
|
|
# social box
|
|
echo -n "<socialbox>"
|
|
count=0
|
|
if [ ! "$FROMID" -o "$FROMID" = "0" -o "$FROMID" = "NaN" ]; then
|
|
if [ "$USER" ]; then
|
|
line=`tac $WEBBUILD_STATEDIR/social_log | grep -v " SUSER=$USER " | head -n 25 | tail -n 1`
|
|
else
|
|
line=`tac $WEBBUILD_STATEDIR/social_log | grep -v " STARGET=developers " | head -n 25 | tail -n 1`
|
|
fi
|
|
eval $line
|
|
FROMID=$SID
|
|
fi
|
|
tail -n 100 $WEBBUILD_STATEDIR/social_log | while read line; do
|
|
STYPE=
|
|
SPRIVACY=
|
|
SUSER=
|
|
STARGET=
|
|
SID=
|
|
eval $line
|
|
[ "$SID" ] || continue
|
|
[ $SID -ge $FROMID ] || continue
|
|
[ "$STARGET" = "developers" -a ! "$USER" ] && continue
|
|
[ "$SUSER" = "$USER" -a "$STARGET" == "developers" ] && continue
|
|
if [ "$SPRIVACY" -a ! "$USER" ]; then
|
|
USER_GRAVATAR=
|
|
else
|
|
USER_GRAVATAR=`echo -n $SEMAIL | md5sum | sed "s| .*||"`
|
|
fi
|
|
echo -n "<add id=\"$SID\"><![CDATA[<div style=\"margin:0;padding:0;\"><div style=\"vertical-align:middle;position:relative;float:left;height:24px;width:24px;margin-right:2px;\">"
|
|
echo -n "<img src=\"http://www.gravatar.com/avatar/$USER_GRAVATAR?s=24&d=http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=24\" /></div>"
|
|
if [ "$SPRIVACY" -a ! "$USER" ]; then
|
|
SUSER="a developer"
|
|
elif [ "$USER" = "$SUSER" ]; then
|
|
SUSER="you"
|
|
fi
|
|
echo -n "<div style=\"position:relative;margin-left:24px;height:auto;padding:0;\"><b>$SUSER</b> $STEXT <i><span name=socialtime time=$STIME></span></i></div>"
|
|
echo -n "</div><div style=\"clear:both;\"><hr></div>]]></add>"
|
|
count=`expr $count + 1`
|
|
done
|
|
echo -n "</socialbox>"
|
|
fi
|
|
|
|
if [ "$USER_ENABLED" != "1" ]; then
|
|
echo -n "</webbuild>"
|
|
exit
|
|
fi
|
|
|
|
#
|
|
# Enabled users requests
|
|
#
|
|
|
|
# delete a note
|
|
if [ "$REQUEST" = "removenote" ]; then
|
|
if [ "$USER" = "$NOTEUSER" -o "$USER_ADMIN" ]; then
|
|
[ -e $WEBBUILD_STATEDIR/notes/$PACKAGE.notes ] || break
|
|
sed -i "/^$NOTEDATE $NOTEUSER /d" $WEBBUILD_STATEDIR/notes/$PACKAGE.notes
|
|
[ ! -s $WEBBUILD_STATEDIR/notes/$PACKAGE.notes ] && rm -f $WEBBUILD_STATEDIR/notes/$PACKAGE.notes
|
|
fi
|
|
echo -n "</webbuild>"
|
|
exit
|
|
fi
|
|
|
|
# enable user
|
|
if [ "$USER_ADMIN" -a "$REQUEST" = "enableuser" ]; then
|
|
if [ ! -e $WEBBUILD_STATEDIR/users/$REQUEST_USER.conf ]; then
|
|
if [ "$REQUEST_ACCEPT" = "true" ]; then
|
|
cat >> $WEBBUILD_STATEDIR/users/$REQUEST_USER.conf << _EOF
|
|
USER_ENABLED=1
|
|
USER_SECRET='$REQUEST_SECRET'
|
|
_EOF
|
|
else
|
|
cat >> $WEBBUILD_STATEDIR/users/$REQUEST_USER.conf << _EOF
|
|
USER_ENABLED=0
|
|
_EOF
|
|
fi
|
|
sed -i "/ REQUEST_USER=$REQUEST_USER /d" $WEBBUILD_STATEDIR/requests
|
|
fi
|
|
echo -n "</webbuild>"
|
|
exit
|
|
fi
|
|
|
|
# kill processes or clean log
|
|
if [ "$REQUEST" = "killtree" ]; then
|
|
killline=`grep "^$KILLPID " $WEBBUILD_STATEDIR/processes`
|
|
if [ "$killline" ]; then
|
|
if [ $KILLPID -ge 1 ]; then
|
|
[ -e /proc/$KILLPID ] && $SUDO_WRAPPER killtree $KILLPID "$USER"
|
|
set -- $killline
|
|
rm -f $5
|
|
sed -i "/^$KILLPID /d" $WEBBUILD_STATEDIR/processes
|
|
else
|
|
echo "<output>ERROR: Invalid PID</output>"
|
|
fi
|
|
fi
|
|
REQUEST=refresh
|
|
fi
|
|
|
|
# refresh processes list
|
|
if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
|
|
echo -n "<processes><![CDATA["
|
|
|
|
if [ "$USER_ADMIN" -a -s $WEBBUILD_STATEDIR/requests ]; then
|
|
echo -n "<div align=left class=processes><b>Pending admin requests:</b>"
|
|
while read line; do
|
|
eval $line
|
|
echo -n "<br><b>$REQUEST_USER</b>: "
|
|
case $REQUEST_TYPE in
|
|
"enablerequest") echo -n "enable request" ;;
|
|
*) echo -n "unknown request" ;;
|
|
esac
|
|
echo -n " <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 " <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`\");>"
|
|
done < $WEBBUILD_STATEDIR/requests
|
|
echo -n "</div>"
|
|
fi
|
|
|
|
numprocess=0
|
|
while read line; do
|
|
set -- $line
|
|
RETCODE=$6
|
|
# if [ -e /proc/$1 -o $5 -lt 256 ]; then
|
|
numprocess=`expr $numprocess + 1`
|
|
cmdline=`echo $line | sed "s|$1 $2 $3 $4 $5 $RETCODE ||"`
|
|
cmdline=`echo $cmdline | sed "s| --colors web||"`
|
|
PACKAGE_ENCODED=`cgi_encodevar $4`
|
|
[ $numprocess -eq 1 ] && {
|
|
echo -n "<div align=left class=processes>"
|
|
echo -n "<b>Webbuild jobs:</b> "
|
|
if [ "$STATE_JOBSSHOWALL" != "1" ]; then
|
|
echo "[ <a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=true\");>Show all</a> ]"
|
|
else
|
|
echo "[ <a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=false\");>Show mine only</a> ]"
|
|
fi
|
|
#echo -n "<i>(please click on [x] to clean your build logs when you are done)</i>"
|
|
echo -n "<br>"
|
|
}
|
|
[ "$STATE_JOBSSHOWALL" = "1" -o "$USER" = "$2" ] || continue
|
|
if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then
|
|
echo -n "<img style=\"margin-top:-1px;margin-right:2px;\" width=10 height=10 src=\"/images/inprogress.gif\" alt=\"running...\" title=\"running...\">"
|
|
else
|
|
if [ $RETCODE -eq 0 ]; then
|
|
# echo -n "<font color=green><b>OK</b></font>"
|
|
echo -n "<img style=\"margin-top:-1px;margin-right:2px;\" src=\"/images/ok.png\" width=10 height=10 alt=\"OK\" title=\"Job successfully completed\">"
|
|
else
|
|
# echo -n "<font color=red><b>ERROR ($RETCODE)</b></font>"
|
|
echo -n "<img style=\"margin-top:-1px;margin-right:2px;\" src=\"/images/fail.png\" width=10 height=10 alt=\"ERROR\" title=\"Job returned with error $RETCODE\">"
|
|
fi
|
|
fi
|
|
echo -n "<b>$2</b> on <i>`print_environment_descr $3`</i>: "
|
|
if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then
|
|
echo -n "\"<a href=# title=\"Click to see live output log\" onclick=ajax_getvalues(\"ENVIRONMENT=$3&PACKAGE=$PACKAGE_ENCODED&"
|
|
echo -n "REQUEST=showlog&LOGTYPE=processtail&PROCESSPID=$1&LOGFILE=$5\")>"
|
|
echo -n "<b><i>$cmdline</i></b></a>\" "
|
|
else
|
|
echo -n "\"<a href=# title=\"Click to see output log\" onClick=ajax_getvalues(\"ENVIRONMENT=$3&PACKAGE=$PACKAGE_ENCODED&"
|
|
echo -n "REQUEST=showlog&LOGTYPE=processoutput&LOGFILE=$5\")>"
|
|
echo -n "<b><i>$cmdline</i></b></a>\" "
|
|
if [ $RETCODE -eq 256 ]; then
|
|
$SUDO_WRAPPER finishprocess $1 "$USER" $5
|
|
RETCODE=$?
|
|
fi
|
|
fi
|
|
if [ "$2" = "$USER" -o "$USER_ADMIN" ]; then
|
|
if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then
|
|
echo -n " [<a href=# title=\"Click to kill this running job\" onclick=ajax_getvalues(\"ENVIRONMENT=$3&PACKAGE=$PACKAGE_ENCODED&"
|
|
echo -n "REQUEST=killtree&KILLPID=$1\")>"
|
|
echo -n "kill"
|
|
else
|
|
echo -n " [<a href=# title=\"Click to clean job output when you are done\" onclick=ajax_getvalues(\"ENVIRONMENT=$3&PACKAGE=$PACKAGE_ENCODED&"
|
|
echo -n "REQUEST=killtree&KILLPID=$1\")>"
|
|
echo -n "x"
|
|
fi
|
|
echo -n "</a>]"
|
|
fi
|
|
echo -n "<br>"
|
|
done < $WEBBUILD_STATEDIR/processes
|
|
[ $numprocess -gt 0 ] && echo -n "</div>"
|
|
echo -n "]]></processes></webbuild>"
|
|
exit
|
|
fi
|
|
|
|
# message send request (social_log)
|
|
if [ "$REQUEST" = "message" -a "$USER" -a "$USER_CANSENDMESSAGES" ]; then
|
|
# external (autodist) social messages
|
|
[ "$MESSAGETYPE" ] || MESSAGETYPE=broadcastmessage
|
|
social_log "SUSER=$USER STYPE=$MESSAGETYPE SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`"
|
|
echo "</webbuild>"
|
|
exit
|
|
fi
|
|
|
|
# repsearch request
|
|
if [ "$REQUEST" = "repsearch" ]; then
|
|
echo -n "<output><![CDATA["
|
|
echo -n "<hr><b>Repository search results for \"$REPSEARCHTEXT\":</b><div align=left class=output id=outputtop>"
|
|
echo -n "<pre><!-- SCROLL -->"
|
|
$SUDO_WRAPPER 0 local "$USER" "" "openmamba-repository search -i ${REPSEARCHTEXT/-/\-}" | \
|
|
parse_search_output ${AUTOPORT_ARCH[$ENVIRONMENT]}
|
|
# sed "s|\(.*(source).*\)|<font color=white><b>\1</b></font>|;
|
|
# s|\(.*(${AUTOPORT_ARCH[$ENVIRONMENT]}).*\)|<font color=lightgreen>\1</font>|"
|
|
echo -n "<!-- ENDSCROLL --></pre>"
|
|
echo "</div>]]></output></webbuild>"
|
|
exit
|
|
fi
|
|
|
|
# environment search request
|
|
if [ "$REQUEST" = "environmentsearch" ]; then
|
|
echo -n "<output><![CDATA["
|
|
echo -n "<hr><b>Environment search results for \"$ENVSEARCHTEXT\":</b><div align=left class=output id=outputtop>"
|
|
echo -n "<pre><!-- SCROLL -->"
|
|
echo -n "<font style=\"background-color:gray\">Installed packages providing '$ENVSEARCHTEXT':</font><br>"
|
|
WHAT_PROVIDES=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -q --what-provides \"$ENVSEARCHTEXT\"" | sort -u`
|
|
echo -n "$WHAT_PROVIDES<br>"
|
|
if [ "${WHAT_PROVIDES:0:10}" != "no package" ]; then
|
|
for f in $WHAT_PROVIDES; do
|
|
echo -n "<br><font style=\"background-color:gray\">$f installed package info:</font><br>"
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -qi $f"
|
|
if [ $? -eq 0 ]; then
|
|
echo -n "<br><font style=\"color:gold\">$f provides:</font><br>"
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -q $f --provides"
|
|
echo -n "<br><font style=\"color:gold\">$f requirements:</font><br>"
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -q $f --requires"
|
|
fi
|
|
done
|
|
fi
|
|
# sed "s|\(.*(source).*\)|<font color=white><b>\1</b></font>|;
|
|
# s|\(.*(${AUTOPORT_ARCH[$ENVIRONMENT]}).*\)|<font color=lightgreen>\1</font>|"
|
|
echo -n "<!-- ENDSCROLL --></pre>"
|
|
echo "</div>]]></output></webbuild>"
|
|
exit
|
|
fi
|
|
|
|
# set current user environment if not passed
|
|
if [ ! "$ENVIRONMENT" ]; then
|
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
|
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "$USER" ]; then
|
|
ENVIRONMENT=$i
|
|
break
|
|
fi
|
|
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "contrib" ]; then
|
|
ENVIRONMENT=$i
|
|
fi
|
|
done
|
|
[ "$ENVIRONMENT" ] || ENVIRONMENT=$DEFAULT_ENVIRONMENT
|
|
fi
|
|
|
|
if [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
|
|
WORKINGROOT="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/"
|
|
WORKINGHOME="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/usr/src/"
|
|
BUILDLOGDIR="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autodist/log/"
|
|
AUTOPORTLOGDIR="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autoport/${AUTOPORT_ARCH[$ENVIRONMENT]}/"
|
|
elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then
|
|
WORKINGROOT="/"
|
|
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} | cut -d: -f6`
|
|
BUILDLOGDIR="/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autodist/log/"
|
|
AUTOPORTLOGDIR="/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autoport/${AUTOPORT_ARCH[$ENVIRONMENT]}/"
|
|
else
|
|
WORKINGROOT="/"
|
|
WORKINGHOME="/var/autodist/"
|
|
BUILDLOGDIR="/var/autodist/log/"
|
|
AUTOPORTLOGDIR="/var/autodist/.autoport/${AUTOPORT_ARCH[$ENVIRONMENT]}/"
|
|
fi
|
|
|
|
# show log
|
|
if [ "$REQUEST" = "showlog" -o "$REQUEST" = "autobuildedit" ]; then
|
|
showlog
|
|
if [ "$REQUEST" = "autobuildedit" ]; then
|
|
REQUEST=edit
|
|
else
|
|
echo -n "</webbuild>"
|
|
exit
|
|
fi
|
|
fi
|
|
|
|
echo -n "<topcontrols><![CDATA["
|
|
# new session button
|
|
echo -n "<input type=button id=newsessionbutton value=\"New session\" onclick="
|
|
echo -n "window.open(document.URL);>"
|
|
# expert mode checkbox
|
|
[ "$STATE_ADVANCEDCONTROLS" ] && CHECKED="checked=checked" || CHECKED=
|
|
echo -n " <span style=\"white-space:nowrap\">Autodist:<input type=checkbox id=\"advancedcontrols\" "
|
|
echo -n "onclick=ajax_getvalues(\""
|
|
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
|
|
echo -n "ADVANCEDCONTROLSSWITCH=\"+getElementById('advancedcontrols').checked); $CHECKED>"
|
|
# privacy mode checkbox
|
|
[ "$STATE_PRIVACYMODE" ] && CHECKED="checked=checked" || CHECKED=
|
|
echo -n " <span style=\"white-space:nowrap\">Privacy:<input type=checkbox id=\"privacymode\" "
|
|
echo -n "onclick=ajax_getvalues(\""
|
|
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "PRIVACYMODESWITCH=\"+getElementById('privacymode').checked); $CHECKED>"
|
|
echo -n "</span>"
|
|
# maintainer mode checkbox
|
|
if [ "$USER_CANMAINTAIN" ]; then
|
|
[ "$MAINTAINERMODE" = "true" ] && CHECKED="checked"
|
|
echo -n "Maintainer:<input type=checkbox id=\"maintain\" $CHECKED onclick="
|
|
echo -n "ajax_getvalues(\"REPOSITORY=$REPOSITORY"
|
|
echo -n "&MAINTAINERMODE=\"+getElementById('maintain').checked+\""
|
|
echo -n "&PACKAGE=$PACKAGEENCODED&ENVIRONMENT=$ENVIRONMENT&REQUEST=switchmaintainermode\");>"
|
|
fi
|
|
# switch user select
|
|
if [ "$USER_ADMIN" -o "$STATE_FAKEUSER" ]; then
|
|
echo -n " | "
|
|
echo -n " Test user: <select id=adminuser "
|
|
echo -n "onchange=ajax_getvalues(\"REQUEST=adminuser&"
|
|
echo -n "FAKEUSERSWITCH=\"+this.value);>"
|
|
echo -n "<option value=\"_disabled_\">-- disabled --</option>"
|
|
for f in $WEBBUILD_STATEDIR/users/*.conf; do
|
|
adminuser=`basename ${f/.conf}`
|
|
[ "$STATE_FAKEUSER" = "$adminuser" ] && SELECTED="selected=\"selected\"" || SELECTED=
|
|
echo -n "<option value=\"$adminuser\" $SELECTED>$adminuser</option>"
|
|
done
|
|
echo -n "</select>"
|
|
fi
|
|
echo -n "]]></topcontrols>"
|
|
|
|
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$ENVIRONMENT]}" != "x86_64" ]; then
|
|
SUDO_WRAPPER="linux32 $SUDO_WRAPPER"
|
|
fi
|
|
|
|
echo -n "<environments><![CDATA["
|
|
# ENVIRONMENT select
|
|
echo -n "<br>Build environment:<select id=environment "
|
|
echo -n "onchange=ajax_getvalues(\"ENVIRONMENT=\"+this.value+\"&REQUEST=changeenvironment\");>"
|
|
echo "<option value=\"\">-- Select a build environment --</option>"
|
|
|
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
|
# [ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
|
SELECTED=
|
|
[ "$ENVIRONMENT" = "$i" ] && SELECTED="selected=\"selected\"" || SELECTED=
|
|
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "$USER" -o "${AUTOPORT_CHROOT_USER[$i]}" = "contrib" -o "$USER_ALLENVIRONMENTS" ]; then
|
|
echo -n "<option value=\"$i\" $SELECTED>"
|
|
print_environment_descr $i
|
|
echo -n "</option>"
|
|
fi
|
|
done
|
|
echo -n "</select>"
|
|
echo -n "]]></environments>"
|
|
|
|
if [ "$MAINTAINERMODE" = "true" ]; then
|
|
echo -n "<specedit> </specedit>"
|
|
elif [ ! "$REQUEST" -o "$REQUEST" = "changeenvironment" -o "$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "prepare" -o "$REQUEST" = "reloadspec" ]; then
|
|
# SPECFILES select
|
|
echo -n "<specedit><![CDATA["
|
|
echo -n " Edit:<select id=specfile "
|
|
echo -n "onchange=ajax_getvalues(\"REQUEST=edit&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
|
|
echo -n "PACKAGE=\"+encodeURIComponent(this.value)+\"&REQUEST=changespec\");>"
|
|
echo -n "<option value=\"\">-- Select a .spec file --</option>"
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls *.spec | sed \"s|.spec$||\" | sort -f" | while read f; do
|
|
specname=${f/.spec}
|
|
[ "$PACKAGE" = "$specname" ] && SELECTED="selected=\"selected\"" || SELECTED=
|
|
echo -n "<option value=\"$specname\" $SELECTED>${specname}</option>"
|
|
done
|
|
echo -n "</select>.spec]]></specedit>"
|
|
fi
|
|
|
|
[ "$PACKAGE" -a ! "$REQUEST" ] && REQUEST=edit
|
|
|
|
# clean output when changing environment
|
|
if [ ! "$REPOSITORY" -a ! "$PACKAGE" -a ! "$REQUEST" = "repsearch" ]; then
|
|
echo -n "<editor> </editor>"
|
|
echo -n "<editcontrols> </editcontrols>"
|
|
fi
|
|
|
|
# REPOSITORIES search
|
|
if [ ! "$REPSEARCHTEXT" ]; then
|
|
echo -n "<searchbox><![CDATA["
|
|
echo -n "<div class=searchbox>Search repositories:"
|
|
#<input type=button id=repsearchbutton value=\"Search repositories:\" onclick=ajax_getvalues(\""
|
|
# echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
# echo -n "REQUEST=repsearch&REPSEARCHTEXT=\"+encodeURIComponent(getElementById('repsearchtext').value));>"
|
|
if [ "$PACKAGE" ]; then
|
|
echo -n "<input type=text style=\"display:block;width:98%;align:center;padding:0;margin:0;\" id=repsearchtext value=\"${PACKAGE/*\/}-\" "
|
|
else
|
|
echo -n "<input type=text style=\"display:block;width:98%;align:center;padding:0;margin:0;\" id=repsearchtext value=\"Enter a package name to search...\" "
|
|
echo -n "onfocus=\"if (this.value==this.defaultValue) this.value=''\" "
|
|
fi
|
|
echo -n "onkeypress=if(checkEnter(event))ajax_getvalues(\""
|
|
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "REQUEST=repsearch&REPSEARCHTEXT=\"+encodeURIComponent(getElementById('repsearchtext').value));>"
|
|
echo -n "</div>]]></searchbox>"
|
|
fi
|
|
|
|
if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$MAINTAINERMODE" = "true" ]; then
|
|
# REPOSITORIES select
|
|
if [ "$MAINTAINERMODE" = "true" -o ! "$REPOSITORY" -o "$REQUEST" = "changeenvironment" ]; then
|
|
echo -n "<repositories><![CDATA[Repository:<select id=repository "
|
|
echo -n "onchange=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=\"+this.value+\""
|
|
if [ "$USER_CANMAINTAIN" ]; then
|
|
echo -n "&MAINTAINERMODE=\"+getElementById('maintain').checked+\""
|
|
fi
|
|
if [ ! "$MAINTAINERMODE" ]; then
|
|
echo -n "&PACKAGE=\"+encodeURIComponent(getSelectedValueById('specfile'))+\""
|
|
fi
|
|
echo -n "&REQUEST=changerepository\");>"
|
|
echo -n "<option value=\"\">-- Select a repository --</option>"
|
|
for f in `$SUDO_WRAPPER 0 local "$USER" "" "/usr/sbin/openmamba-repository list"`; do
|
|
repname=`basename $f`
|
|
[ "$repname" = "$REPOSITORY" ] && SELECTED="selected=selected" || SELECTED=
|
|
if [ "$MAINTAINERMODE" = "true" -a ! "$USER_ALLREPOSITORIES" ]; then
|
|
for u in $USER_CANMAINTAIN_REPOSITORIES devel-$USER; do
|
|
[ "$u" = "$repname" ] && echo -n "<option value=\"$repname\" $SELECTED>$repname</option>"
|
|
done
|
|
else
|
|
echo -n "<option value=\"$repname\" $SELECTED>$repname</option>"
|
|
fi
|
|
done
|
|
echo -n "</select>"
|
|
echo -n "]]></repositories>"
|
|
# echo -n "<editcontrols> </editcontrols>"
|
|
echo -n "<packages> </packages>"
|
|
echo -n "<operations> </operations>"
|
|
fi
|
|
else
|
|
echo -n "<repositories><![CDATA[Review failed <a href=\"$AUTOBUILDS_STATUS_URL\" target=\"autobuilds\""
|
|
echo -n " title=\"Open autobuilds status page in a new window\">autobuilds</a>:"
|
|
|
|
# autobuild edit previous
|
|
echo -n "<input type=button name=autobuildeditprev value=\" < \" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&"
|
|
echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById(\"autobuildedit\",-1).substring(0,getSelectedValueById(\"autobuildedit\",-1).indexOf(';')))+\"&"
|
|
echo -n "LOGTYPE=\"+getSelectedValueById(\"autobuildedit\",-1).substring(getSelectedValueById(\"autobuildedit\",-1).indexOf(';')+1)+\"&LOGSTATUSOK=&"
|
|
echo -n "REQUEST=autobuildedit\");>"
|
|
# autobuild edit select
|
|
echo -n "<select id=autobuildedit "
|
|
echo -n "onchange=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&"
|
|
echo -n "PACKAGE=\"+encodeURIComponent(this.value.substring(0,this.value.indexOf(';')))+\"&"
|
|
echo -n "LOGTYPE=\"+this.value.substring(this.value.indexOf(';')+1)+\"&LOGSTATUSOK=&"
|
|
echo -n "REQUEST=autobuildedit\");>"
|
|
echo -n "<option value=\"\">-- Select a failed build to review --</option>"
|
|
SELECTED=
|
|
[ "$STATE_AUTODISTCURRENT" = "1" ] && AUTOUPDATEFILE=$BUILDLOGDIR/autoupdate-current || AUTOUPDATEFILE=$BUILDLOGDIR/autoupdate-last
|
|
while read line; do
|
|
set -- $line
|
|
if [ "$3" = "failed" -a "$2" != "autoupdate" ]; then
|
|
if [ "$REQUEST" != "skip" ]; then
|
|
[ "$PACKAGE" = "$1" ] && SELECTED="selected=selected" || SELECTED=
|
|
else
|
|
[ "$SELECTED" ] && {
|
|
NEXTPACKAGE=$1
|
|
NEXTLOGTYPE=$2
|
|
}
|
|
fi
|
|
echo -n "<option value=\"$1;$2\" $SELECTED>$1 ($2 $3)</option>"
|
|
if [ "$PACKAGE" = "$1" -a "$REQUEST" = "skip" ]; then
|
|
SELECTED="selected=selected"
|
|
else
|
|
SELECTED=
|
|
fi
|
|
fi
|
|
done < $AUTOUPDATEFILE
|
|
echo -n "</select>"
|
|
# autobuild edit next
|
|
echo -n "<input type=button name=autobuildeditnext value=\" > \" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&"
|
|
echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById(\"autobuildedit\",1).substring(0,getSelectedValueById(\"autobuildedit\",1).indexOf(';')))+\"&"
|
|
echo -n "LOGTYPE=\"+getSelectedValueById(\"autobuildedit\",1).substring(getSelectedValueById(\"autobuildedit\",1).indexOf(';')+1)+\"&LOGSTATUSOK=&"
|
|
echo -n "REQUEST=autobuildedit\");>"
|
|
# autodist current checkbox (in progress)
|
|
[ "$STATE_AUTODISTCURRENT" = "1" ] && SELECTED="checked" || SELECTED=
|
|
echo -n "<label><input type=checkbox id=\"autodistcurrentcheckbox\" value=\"autodistcurrent\" $SELECTED onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&"
|
|
echo -n "AUTODISTCURRENT=\"+getElementById('autodistcurrentcheckbox').checked+\"&"
|
|
echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById(\"autobuildedit\").substring(0,getSelectedValueById(\"autobuildedit\").indexOf(';')))+\"&"
|
|
echo -n "LOGTYPE=\"+getSelectedValueById(\"autobuildedit\").substring(getSelectedValueById(\"autobuildedit\").indexOf(';'))+\"&REQUEST=autobuildedit\");>"
|
|
echo -n "in progress</label>"
|
|
echo -n " ]]></repositories>"
|
|
echo -n "<operations> </operations>"
|
|
echo -n "<speccreate> </speccreate>"
|
|
echo -n "<packages> </packages>"
|
|
if [ "$REQUEST" = "skip" ]; then
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool skip $AUTODISTJOB"
|
|
RET=$?
|
|
if [ $RET -eq 0 ]; then
|
|
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"added autodist job <b>$AUTODISTJOB</b> to skipped list\" STIME=`date +%s`"
|
|
fi
|
|
if [ "$NEXTPACKAGE" ]; then
|
|
PACKAGE=$NEXTPACKAGE
|
|
PACKAGEENCODED=`cgi_encodevar $PACKAGE`
|
|
LOGTYPE=$NEXTLOGTYPE
|
|
AUTODISTJOB=
|
|
showlog
|
|
REQUEST="edit"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
|
# PACKAGES (SRPM) select
|
|
if [ "$REQUEST" = "changerepository" -o "$REQUEST" = "switchmaintainermode" -a "$MAINTAINERMODE" != "true" ]; then
|
|
echo -n "<packages><![CDATA[ SRPMS:"
|
|
echo -n "<select id=package onchange="
|
|
echo -n "getElementById('preparebutton').disabled=0;getElementById('portbutton').disabled=0;>"
|
|
#(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
|
|
fi
|
|
while read f; do
|
|
[ -r $f ] || continue
|
|
pkgname=`basename $f`
|
|
pkgname=${pkgname/.src.rpm}
|
|
pkgrel=${pkgname/*-}
|
|
pkgname=${pkgname/-$pkgrel}
|
|
pkgver=${pkgname/*-}
|
|
pkgname=${pkgname/-$pkgver}
|
|
if [ "$PACKAGE" = "$pkgname" ]; then
|
|
SELECTED="selected=\"selected\""
|
|
SRPMBUTTONDISABLED=
|
|
else
|
|
SELECTED=
|
|
fi
|
|
echo -n "<option value=\"$pkgname\" $SELECTED>${pkgname} ${pkgver}-${pkgrel}</option>"
|
|
done < $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
|
|
echo -n "</select>"
|
|
echo -n "]]></packages>"
|
|
if [ "$MAINTAINERMODE" != "true" ]; then
|
|
echo -n "<operations><![CDATA["
|
|
echo -n "<input type=button name=prepare value=\"Unpack and edit\" id=preparebutton onclick="
|
|
echo -n "ajax_getvalues(\"REQUEST=prepare&REPOSITORY=\"+getSelectedValueById('repository')+\""
|
|
echo -n "&ENVIRONMENT=$ENVIRONMENT&"
|
|
if [ "$USER_CANMAINTAIN" ]; then
|
|
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
|
|
fi
|
|
echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById('package'))); $SRPMBUTTONDISABLED>"
|
|
if [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
|
|
echo -n "<input type=button name=port value=\"Port\" id=portbutton onclick="
|
|
echo -n "ajax_getvalues(\"REQUEST=autoport&REPOSITORY=\"+getSelectedValueById('repository')+\""
|
|
echo -n "&ENVIRONMENT=$ENVIRONMENT&"
|
|
if [ "$USER_CANMAINTAIN" ]; then
|
|
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
|
|
fi
|
|
echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById('specfile'))+\"&"
|
|
echo -n "AUTOPORTPACKAGE=\"+encodeURIComponent(getSelectedValueById('package'))); $SRPMBUTTONDISABLED>"
|
|
fi
|
|
echo -n "]]></operations>"
|
|
fi
|
|
fi
|
|
|
|
# SPECFILE creation
|
|
if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -a "$MAINTAINERMODE" != "true" ]; then
|
|
echo -n "<speccreate><![CDATA[<div style=\"white-space:nowrap;\">"
|
|
echo -n " Start from URL:<input onChange=\"suggestSpecName()\" type=text id=speccreateurl value=\"\" style=\"width:32%\">"
|
|
echo -n " name:<input type=text id=speccreatename disabled value=\"\" style=\"width:10%\">"
|
|
echo -n " type:<select id=speccreatetype disabled>"
|
|
for t in `ls /usr/share/autospec/templates`; do
|
|
[ "$t" = "library" ] && SELECTED="selected=selected" || SELECTED=
|
|
echo -n "<option id=speccreatetype value=\"$t\" $SELECTED>$t</option>"
|
|
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 "<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)+\"&"
|
|
echo -n "SPECCREATETYPE=\"+getElementById('speccreatetype').value+\"&"
|
|
echo -n "SPECCREATEVERSION=\"+getElementById('speccreateversion').value+\"&"
|
|
echo -n "SPECCREATEGITBRANCH=\"+getElementById('speccreategitbranch').value+\"&"
|
|
echo -n "SPECCREATEURL=\"+encodeURIComponent(getElementById('speccreateurl').value));>"
|
|
echo "</div>]]></speccreate>"
|
|
elif [ "$MAINTAINERMODE" = "true" ]; then
|
|
echo -n "<speccreate> </speccreate>"
|
|
fi
|
|
#else
|
|
# echo -n "<repositories> </repositories><packages> </packages><operations> </operations><speccreate> </speccreate> <operations></operations>"
|
|
fi
|
|
|
|
if [ "$REQUEST" = "changespec" ]; then
|
|
if [ "$PACKAGE" ]; then
|
|
REQUEST="edit";
|
|
fi
|
|
elif [ "$REQUEST" = "broadcastmessage" ]; then
|
|
BROADCASTMESSAGE=`echo $BROADCASTMESSAGE | sed "s|<|\<|g"`
|
|
social_log "SUSER=$USER STYPE=broadcastmessage SEMAIL=$USER_EMAIL STEXT=\"said:"<i>$BROADCASTMESSAGE</i>"\" STIME=`date +%s`"
|
|
REQUEST=
|
|
fi
|
|
|
|
if [ "$SPECTEXT" ]; then
|
|
# save specfile
|
|
tmpfile=`mktemp --suffix=.webbuildspectmp`
|
|
echo -n $SPECTEXT | perl -MURI::Escape -e 'print uri_unescape(<>)' > $tmpfile
|
|
chmod 644 $tmpfile
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" ${PACKAGE/*\/} "cat $tmpfile > ${PACKAGE/*\/}.spec" $tmpfile
|
|
RET=$?
|
|
[ $RET -eq 0 ] || {
|
|
echo -n "<output><![CDATA[<div class=output>ERROR: could not save file ${PACKAGE/*\/}.spec! Please report the problem, thanks.</div>]]></output></webbuild>"
|
|
exit 1
|
|
}
|
|
rm -f $tmpfile
|
|
fi
|
|
|
|
if [ "$REQUEST" = "edit" -o "$REQUEST" = "prepare" ]; then
|
|
if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
|
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STARGET=developers STEXT=\"is working on <b>$PACKAGE</b> in <b>`print_environment_descr $ENVIRONMENT`</b> environment\" STIME=`date +%s`"
|
|
fi
|
|
fi
|
|
|
|
# Here requests which update the specfile, so editor is refreshed after
|
|
if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccreate" -o \
|
|
"$REQUEST" = "rebuildspec" -o "$REQUEST" = "renamespec" -o "$REQUEST" = "deletespec" -o \
|
|
"$REQUEST" = "autodistprepare" -o "$REQUEST" = "autodistupdate" -o "$REQUEST" = "addpkgnote" ]; then
|
|
echo -n "<output><![CDATA[<hr><b>Console output:</b><div align=left class=output id=outputbottom>"
|
|
echo -n "<pre>"
|
|
RET=255
|
|
case $REQUEST in
|
|
"prepare") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a1 --server $REPOSITORY"; RET=$? ;;
|
|
"updatespec") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-update"
|
|
[ "$DEBUG" = "true" ] && RPMFORCEADD="$RPMFORCEADD --debug"
|
|
if [ "$UPDATESPECVERSION" -a "$REBUILDSPECCHANGELOG" ]; then
|
|
echo "ERROR: new version and changelog can't be specified together"
|
|
elif [ "$REBUILDSPECCHANGELOG" ]; then
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a4 $RPMFORCEADD --rebuild --changelog \"$REBUILDSPECCHANGELOG\""
|
|
elif [ "$UPDATESPECVERSION" ]; then
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a3,4 $RPMFORCEADD $UPDATESPECVERSION"
|
|
else
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a2:4 $RPMFORCEADD $UPDATESPECVERSION"
|
|
fi
|
|
RET=$?
|
|
;;
|
|
"speccreate") if [ "$SPECCREATEURL" -a "$PACKAGE" ]; then
|
|
AUTOSPEC_CMDLINE="-n $PACKAGE -o $PACKAGE.spec"
|
|
#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"
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "$AUTOSPEC_CMD -s \"$SPECCREATEURL\" $AUTOSPEC_CMDLINE --changelog \"package created by $USER using the webbuild interface\""
|
|
RET=$?
|
|
[ $RET -eq 0 ] && {
|
|
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STARGET=developers STEXT=\"is working on <b>$PACKAGE</b> new package\" STIME=`date +%s`"
|
|
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."
|
|
RET=1
|
|
fi
|
|
;;
|
|
"renamespec") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "mv $RENAMESPECFROM.spec $PACKAGE.spec && sed -i \"s|\(Name:[[:space:]]*\).*|\1$PACKAGE|\" $PACKAGE.spec"
|
|
RET=$?
|
|
[ $RET -eq 0 ] && {
|
|
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"renamed <b>$RENAMESPECFROM</b> to <b>$PACKAGE</b>\" STIME=`date +%s`"
|
|
echo "Specfile $RENAMESPECFROM successfully renamed to <b>$PACKAGE</b>."
|
|
}
|
|
;;
|
|
"deletespec") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rm -f $PACKAGE.spec"
|
|
RET=$?
|
|
[ $RET -eq 0 ] && REQUEST="exit"
|
|
;;
|
|
"autodistprepare") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
|
|
autodistjobs=
|
|
if [ "$AUTODISTPKGS" ]; then
|
|
for p in $AUTODISTPKGS; do
|
|
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
|
|
done
|
|
else
|
|
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"
|
|
RET=$?
|
|
;;
|
|
"autodistupdate") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
|
|
[ "$DEBUG" = "true" ] && AUTODISTADD="$AUTODISTADD --debug" || AUTODISTADD=
|
|
if [ "$AUTODISTUPDATECHANGELOG" ]; then
|
|
AUTODISTADD="$AUTODISTADD --rebuild -- --changelog \"${AUTODISTUPDATECHANGELOG}\""
|
|
fi
|
|
autodistjobs=
|
|
if [ "$AUTODISTPKGS" ]; then
|
|
for p in $AUTODISTPKGS; do
|
|
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
|
|
done
|
|
else
|
|
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"
|
|
RET=$?
|
|
;;
|
|
"addpkgnote") echo "`date +%s` $USER $ENVIRONMENT $PKGNOTE" >> $WEBBUILD_STATEDIR/notes/$PACKAGE.notes; RET=$? ;;
|
|
esac
|
|
echo -n "</pre>"
|
|
if [ $RET -eq 0 ]; then
|
|
echo "Result: <font color=green><b>OK</b></font>"
|
|
else
|
|
echo "Result: <font color=red><b>ERROR ($RET)</b></font>"
|
|
fi
|
|
echo -n "</div>"
|
|
echo -n "]]></output>"
|
|
if [ "$REQUEST" = "exit" ]; then
|
|
echo -n "<editcontrols> </editcontrols>"
|
|
echo -n "<operations> </operations>"
|
|
echo -n "<editor> </editor>"
|
|
echo -n "</webbuild>"
|
|
exit
|
|
fi
|
|
if [ $RET -eq 0 ]; then
|
|
REQUEST="edit"
|
|
print_editorcontrols
|
|
else
|
|
REQUEST=
|
|
fi
|
|
fi
|
|
|
|
# maintainer mode editor
|
|
if [ "$MAINTAINERMODE" = "true" ]; then
|
|
if [ ! "$REQUEST" -o "$REQUEST" = "changerepository" -o \
|
|
"$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "reloadmaintainer" ]; then
|
|
echo -n "<editcontrols> </editcontrols>"
|
|
echo -n "<operations> </operations>"
|
|
if [ "$REPOSITORY" ]; then
|
|
echo -n "<editor><![CDATA["
|
|
echo -n "<div class=maintainer>"
|
|
echo -n "<b>Recent packages in $REPOSITORY:</b><br>"
|
|
cat $local_ftp/distromatic/$REPOSITORY/_recent.inc | sed "s|a href=|a target=new href=|g"
|
|
echo -n "<br><b>Log:</b><br><pre>"
|
|
cat $local_ftp/$REPOSITORY/distromatic.log
|
|
echo -n "</pre></div>"
|
|
echo -n "<input type=button id=updatespecbutton value=\"refresh\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "MAINTAINERMODE=$MAINTAINERMODE&REQUEST=reloadmaintainer\");>"
|
|
echo -n "]]></editor>"
|
|
else
|
|
echo -n "<editor> </editor>"
|
|
fi
|
|
REQUEST=
|
|
fi
|
|
fi
|
|
|
|
if [ "$REQUEST" = "changerepository" -o "$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "changeenvironment" ]; then
|
|
REQUEST=
|
|
fi
|
|
|
|
if [ "$PACKAGE" ]; then
|
|
[ "$AUTODISTJOB" ] || AUTODISTJOB=${PACKAGE/\/*}
|
|
AUTODISTJOB="${AUTODISTJOB/-/_}"
|
|
PACKAGE=${PACKAGE/*\/}
|
|
eval `$SUDO_WRAPPER specinfo $ENVIRONMENT "$USER" $PACKAGE ""`
|
|
[ $? -eq 0 ] && SPECAVAILABLE=1
|
|
fi
|
|
|
|
# specfile editor
|
|
if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmaintainermode" -o \
|
|
"$REQUEST" = "renamespec" -o "$REQUEST" = "addpkgnote" -a "$MAINTAINERMODE" != "true" ]; then
|
|
if [ "$SPECAVAILABLE" ]; then
|
|
# editor textarea
|
|
echo -n "<editor><![CDATA["
|
|
if [ -s $WEBBUILD_STATEDIR/notes/$PACKAGE.notes ]; then
|
|
echo -n "<div align=left class=notes>"
|
|
echo -n "<b>Packaging notes for $PACKAGE:</b>"
|
|
while read ndate nuser nenv line; do
|
|
echo "<br><b>$nuser</b>: \"$line\""
|
|
if [ "$USER" = "$nuser" -o "$USER_ADMIN" ]; then
|
|
echo -n " [<a href=# title=\"Click to remove this note\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "REQUEST=removenote&NOTEDATE=$ndate&NOTEUSER=$nuser\")>"
|
|
echo -n "x</a>]"
|
|
fi
|
|
done < $WEBBUILD_STATEDIR/notes/$PACKAGE.notes
|
|
echo -n "</div>"
|
|
fi
|
|
echo -n "Current <b>$PACKAGE.spec</b> in build environment:<textarea id=spectext class=editor>"
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat $PACKAGE.spec"
|
|
echo -n "</textarea>]]></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>"
|
|
print_editorcontrols
|
|
fi
|
|
REQUEST=
|
|
fi
|
|
|
|
# operation panel
|
|
if [ "$MAINTAINERMODE" != "true" ]; then
|
|
echo -n "<operationpanel><![CDATA["
|
|
showEnvironmentPanel
|
|
echo -n "<hr>"
|
|
[ "$PACKAGE" ] && {
|
|
echo -n "Package: <b>$PACKAGE</b><br>Version: <b>"
|
|
[ "${SPECVAR_Epoch[0]}" ] && echo -n "${SPECVAR_Epoch[0]}:" || echo -n "0:"
|
|
echo -n "${SPECVAR_Version[0]}-${SPECVAR_Release[0]}</b><br>"
|
|
}
|
|
echo -n "Target arch:<select id=rpmbuildarch>"
|
|
for f in i586 arm x86_64 ppc; do
|
|
SELECTED=
|
|
if [ "$f" = "$RPMBUILDARCH" ]; then
|
|
SELECTED="selected=\"selected\"";
|
|
elif [ ! "$RPMBUILDARCH" -a "$f" = "${AUTOPORT_ARCH[$ENVIRONMENT]}" ]; then
|
|
SELECTED="selected=\"selected\"";
|
|
fi
|
|
echo -n "<option value=\"$f\" $SELECTED>$f</option>"
|
|
done
|
|
echo -n "</select>"
|
|
echo -n "<label style=\"background-color:red;padding:1px;\"><input type=checkbox id=\"rpmforce\" value=\"force\">force </label>"
|
|
echo -n "<label style=\"padding:1px;\"><input type=checkbox id=\"debug\" value=\"debug\">debug </label>"
|
|
# destination repository select
|
|
echo -n "<br>Send to:"
|
|
echo -n "<select id=sendrepository>"
|
|
if [ "$USER_ALLREPOSITORIES" ]; then
|
|
SEND_REPS=`$SUDO_WRAPPER 0 local "$USER" "" "/usr/sbin/openmamba-repository list"`
|
|
elif [ "$USER_CANMAINTAIN_REPOSITORIES" ]; then
|
|
SEND_REPS="$USER_CANMAINTAIN_REPOSITORIES";
|
|
for u in $USER_CANMAINTAIN_REPOSITORIES devel-$USER; do
|
|
[ "$u" = "$repname" ] && echo -n "<option value=\"$repname\" $SELECTED>$repname</option>"
|
|
done
|
|
else
|
|
SEND_REPS="devel-contrib"
|
|
fi
|
|
for f in $SEND_REPS; do
|
|
repname=`basename $f`
|
|
# if [ "$repname" = "devel-${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" -o \
|
|
# "$repname" = "${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}" -o \
|
|
# "$repname" = "devel-$USER" -o \
|
|
# "$USER_ALLREPOSITORIES" ]; then
|
|
SELECTED=
|
|
if [ "$SENDREPOSITORY" = "$repname" ]; then
|
|
SELECTED="selected=\"selected\"";
|
|
elif [ ! "$SENDREPOSITORY" -a "${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}" = "$repname" ]; then
|
|
SELECTED="selected=\"selected\"";
|
|
fi
|
|
echo -n "<option value=\"$repname\" $SELECTED>$repname</option>"
|
|
# fi
|
|
done
|
|
echo -n "</select><br>"
|
|
[ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$STATE_ADVANCEDCONTROLS" ] && echo -n "<hr><div style=\"background-color:#FFFFDE\"><b>Autodist batch builds:</b><br>"
|
|
if [ "$PACKAGE" ]; then
|
|
if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
|
echo -n "Patch for $PACKAGE:<br>"
|
|
# autodist show patch
|
|
echo -n "<input type=button value=\"show current\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "REQUEST=showpatch\");>"
|
|
# autodist remove patch
|
|
echo -n "<input type=button value=\"remove\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "REQUEST=removepatch\""
|
|
echo -n ",\"`cgi_encodevar "Remove current autodist patch for package <b>$PACKAGE</b>?"`\"); class=redbutton>"
|
|
# autodist auto patch
|
|
echo -n "<input type=button id=updatepatchbutton value=\"create/refresh\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
|
echo -n "REQUEST=autopatch\""
|
|
echo -n ",\"`cgi_encodevar "Create or refresh autodist patch for package <b>$PACKAGE</b>?"`\"); class=redboldbutton>"
|
|
## autodist update patch
|
|
#echo -n "<input type=button id=updatepatchbutton value=\"update\" onclick="
|
|
#echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
#echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
|
#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="
|
|
#echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
#echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
|
#echo -n "REQUEST=buildpatch\""
|
|
#echo -n ",\"`cgi_encodevar "Create an autodist <b>build</b> patch for package <b>$PACKAGE</b>?"`\"); class=redbutton>"
|
|
fi
|
|
fi
|
|
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
|
# autodist list-jobs
|
|
[ "$PACKAGE" -a "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ] && echo -n "<hr>"
|
|
echo -n "Job:<select id=autodistjobs onchange="
|
|
echo -n "ajax_getvalues(\""
|
|
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
|
|
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
|
|
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
|
|
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistjobchange\");>"
|
|
echo -n "<option value=\"\">-- select a job --</option>"
|
|
AUTODISTJOBSELECTED=
|
|
for f in `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist --list-jobs"`; do
|
|
SELECTED=
|
|
if [ "$AUTODISTJOB" -a "$AUTODISTJOB" = "$f" ]; then
|
|
SELECTED="selected=\"selected\""
|
|
AUTODISTJOBSELECTED=1
|
|
elif [ "$PACKAGE" = "$f" -a ! "$AUTODISTJOB" ]; then
|
|
# elif [ "$PACKAGE" = "$f" -a ! "$AUTODISTJOBSELECTED" -a "$REQUEST" != "autodistjobchange" ]; then
|
|
SELECTED="selected=\"selected\""
|
|
AUTODISTJOB=$f
|
|
AUTODISTJOBSELECTED=1
|
|
fi
|
|
JOBENCODED=`cgi_encodevar $f`
|
|
echo -n "<option value=\"$JOBENCODED\" $SELECTED>$f</option>"
|
|
done
|
|
if [ "$PACKAGE" -a ! "$AUTODISTJOBSELECTED" ]; then
|
|
SELECTED="selected=\"selected\""
|
|
AUTODISTJOB=$PACKAGE
|
|
echo -n "<option value=\"$PACKAGEENCODED\" $SELECTED>$PACKAGE (defaults)</option>"
|
|
fi
|
|
echo -n "</select>"
|
|
if [ "$AUTODISTJOB" ]; then
|
|
echo -n "<br>Job packages:"
|
|
echo -n "<label><input type=checkbox name=autodistpkgsselectallcheckbox value=\"\" onclick=checkAllBoxes('autodistpkgscheckbox',this.checked);>select/unselect all</label>"
|
|
echo -n "<div class=multiselect style=\"height:60px;\">"
|
|
for p in `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist --list-pkgs $AUTODISTJOB"`; do
|
|
if [ "$AUTODISTPKGS" ]; then
|
|
for i in $AUTODISTPKGS; do
|
|
[ "$i" = "$p" ] && { SELECTED=checked; break; } || SELECTED=
|
|
done
|
|
else
|
|
[ "$p" = "$PACKAGE" ] && SELECTED=checked || SELECTED=
|
|
fi
|
|
echo -n "<label><input type=checkbox name=autodistpkgscheckbox value=\"$p\" $SELECTED>${p}</label>"
|
|
done
|
|
echo -n "</div>"
|
|
# autodist prepare
|
|
echo -n "<input type=button value=\"prepare\" onclick="
|
|
echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
|
|
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
|
|
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
|
|
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
|
|
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
|
|
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistprepare\");>"
|
|
# autodist update
|
|
echo -n "<input type=button value=\"update\" onclick="
|
|
echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
|
|
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
|
|
echo -n "DEBUG=\"+getElementById('debug').checked+\"&"
|
|
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
|
|
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
|
|
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
|
|
echo -n "AUTODISTUPDATECHANGELOG=\"+encodeURIComponent(getElementById('autodistupdatechangelog').value)+\"&"
|
|
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistupdate\");>"
|
|
# autodist build
|
|
echo -n "<input type=button value=\"build\" onclick="
|
|
echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
|
|
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
|
|
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
|
|
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
|
|
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
|
|
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
|
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistbuild\"); class=boldbutton>"
|
|
# autodist install
|
|
[ ! "$USER_CANINSTALL" ] && DISABLED="disabled=disabled" || DISABLED=
|
|
echo -n "<input type=button value=\"install\" onclick="
|
|
echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
|
|
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
|
|
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
|
|
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
|
|
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
|
|
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistinstall\""
|
|
echo -n ",\"`cgi_encodevar "Install built packages for <b>"`\"+getSelectedValueById('autodistjobs')+\""
|
|
echo -n "`cgi_encodevar "</b> job in current environment?"`\""
|
|
echo -n "); class=redbutton $DISABLED>"
|
|
# autodist send
|
|
[ ! "$USER_ALLREPOSITORIES" ] && DISABLED="disabled=disabled" || DISABLED=
|
|
echo -n "<input type=button value=\"send\" onclick="
|
|
echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
|
|
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
|
|
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
|
|
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
|
|
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
|
|
echo -n "SENDREPOSITORY=\"+getSelectedValueById('sendrepository')+\"&"
|
|
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistsend\""
|
|
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>"
|
|
# autodist update changelog
|
|
echo -n "Rebuild changelog:"
|
|
echo -n "<input type=text id=autodistupdatechangelog style=\"width:95%\">"
|
|
# autodist schedule
|
|
echo -n "<br><input type=button value=\"schedule job\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
|
|
echo -n "REQUEST=schedule&SCHEDULEVERSION=\"+getElementById('scheduleversion').value"
|
|
echo -n ",\"`cgi_encodevar "Schedule <b>"`\"+getSelectedValueById('autodistjobs')+\"`cgi_encodevar "</b> autodist job for automatic update?"`\"); class=boldbutton>"
|
|
echo -n "(version:<input type=text id=scheduleversion value=\"\" size=\"6\">)"
|
|
# autodist show schedule
|
|
echo -n "<input type=button value=\"show schedule\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "REQUEST=showscheduled\");>"
|
|
# autodist unschedule
|
|
echo -n "<input type=button value=\"unschedule\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
|
|
echo -n "REQUEST=unschedule\"); class=redbutton>"
|
|
# autodist skip
|
|
echo -n "<input type=button value=\"skip\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
|
|
echo -n "REQUEST=skip\""
|
|
echo -n ",\"`cgi_encodevar "Skip <b>"`\"+getSelectedValueById('autodistjobs')+\"`cgi_encodevar "</b> from being checked for automatic updates for a period?"`\""
|
|
echo -n "); class=redbutton><br>"
|
|
else
|
|
echo -n "<br>"
|
|
fi
|
|
# automatic port
|
|
if [ ! "${AUTOPORT_DISABLE[$ENVIRONMENT]}" -a ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
|
echo -n "Automatic port:"
|
|
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 "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>"
|
|
echo -n "<input type=button id=autoportlog value=\"log\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autoportlog\");>"
|
|
fi
|
|
fi
|
|
if [ "$PACKAGE" ]; then
|
|
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
|
# autodist logs
|
|
echo -n "</div><hr><b>Last autodist logs:</b> "
|
|
echo -n "OK <input id=\"logstatusOK\" type=\"radio\" name=\"logstatus\" value=\"OK\"> "
|
|
echo -n "FAILED<input type=\"radio\" name=\"logstatus\" value=\"FAILED\" checked=\"checked\"><br>"
|
|
echo -n "<input type=button value=\"prepare\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "REQUEST=showlog&LOGTYPE=prepare&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
|
echo -n "<input type=button value=\"update\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "REQUEST=showlog&LOGTYPE=update&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
|
echo -n "<input type=button value=\"build\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "REQUEST=showlog&LOGTYPE=build&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
|
echo -n "<input type=button value=\"install\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "REQUEST=showlog&LOGTYPE=install&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
|
echo -n "<input type=button value=\"send\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "REQUEST=showlog&LOGTYPE=send&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
|
fi
|
|
echo -n "<hr><div style=\"background-color:#E0F2D0\"><b>RPM packaging commands:</b><br>"
|
|
# check for updates
|
|
echo -n "<input type=button value=\"check for updates\" onclick="
|
|
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 "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=rpmprepare&"
|
|
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue()));>"
|
|
# build
|
|
echo -n "<input type=button value=\"build\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=rpmbuild&"
|
|
echo -n "RPMBUILDARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
|
|
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&RPMFORCE=\"+getElementById('rpmforce').checked); class=boldbutton>"
|
|
# unpackaged files
|
|
echo -n "<input type=button value=\"unpackaged files\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autospeclistcheck&"
|
|
echo -n "RPMBUILDARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
|
|
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue()));>"
|
|
# build requirements
|
|
echo -n "<input type=button value=\"build requirements\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autospecbuildreq\");>"
|
|
## recreate SRPM
|
|
#echo -n "<input type=button value=\"recreate SRPM\" onclick="
|
|
#echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=srpmbuild&"
|
|
#echo -n "RPMFORCE=\"+getElementById('rpmforce').checked+\"&"
|
|
#echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&RPMFORCE=\"+getElementById('rpmforce').checked);>"
|
|
# rpm checks
|
|
echo -n "<input type=button id=rpmchecks value=\"checks\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=rpmchecks\");>"
|
|
echo -n "<input type=button id=rpmsimulateinstallbutton value=\"simulate install\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=rpmsimulateinstall\");>"
|
|
# rpm install
|
|
[ ! "$USER_CANINSTALL" ] && DISABLED="disabled=disabled"
|
|
echo -n "<input type=button id=rpminstallbutton value=\"install\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=rpminstall&"
|
|
echo -n "RPMFORCE=\"+getElementById('rpmforce').checked"
|
|
echo -n ",\"`cgi_encodevar "Install <b>$PACKAGE</b> in current environment?"`\""
|
|
echo -n "); class=redbutton $DISABLED>"
|
|
# rpm send
|
|
if [ "$SPECVAR_CHECK_NOAUTOBUILDREQ" ]; then
|
|
HREFADD="disabled=disabled title=\"WARNING: fix specfile build requirements before you can send the package\""
|
|
else
|
|
HREFADD=
|
|
fi
|
|
echo -n "<input type=button id=sendpackagebutton value=\"send\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=sendpackage&"
|
|
echo -n "SENDRECREATESRPM=\"+getElementById('sendrecreatesrpm').checked+\"&"
|
|
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
|
echo -n "SENDREPOSITORY=\"+getSelectedValueById('sendrepository')"
|
|
echo -n ",\"`cgi_encodevar "Send <b>$PACKAGE</b> built packages to <b>"`\"+getSelectedValueById('sendrepository')+"
|
|
echo -n "\"`cgi_encodevar "</b>?<br><br><font color=green>HINT: does summary look short and good?</font><br><b>${SPECVAR_Name[0]} - ${SPECVAR_Summary[0]}.</b>"`\""
|
|
echo -n "); class=redbutton $HREFADD>"
|
|
# recreate and send SRPM
|
|
if [ "$SPECVAR_CHECK_NOAUTOBUILDREQ" ]; then
|
|
HREFADD="disabled=disabled title=\"WARNING: fix specfile build requirements before you can send the package\""
|
|
else
|
|
HREFADD=
|
|
fi
|
|
echo -n "<input type=button id=sendsourcebutton value=\"send SRPM\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=sendsource&"
|
|
echo -n "RPMFORCE=\"+getElementById('rpmforce').checked+\"&"
|
|
echo -n "SENDRECREATESRPM=\"+getElementById('sendrecreatesrpm').checked+\"&"
|
|
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
|
echo -n "SENDREPOSITORY=\"+getSelectedValueById('sendrepository')"
|
|
echo -n ",\"`cgi_encodevar "Send <b>$PACKAGE</b> source package only to <b>"`\"+getSelectedValueById('sendrepository')+"
|
|
echo -n "\"`cgi_encodevar "</b>?<br><br>WARNING: use this to refresh the SRPM of a package which already exists with same release in repository"`\""
|
|
echo -n "); class=redbutton $HREFADD>"
|
|
# recreate SRPM before sending checkbox
|
|
echo -n "<label style=\"color:red;padding:0;\"><input type=checkbox id=\"sendrecreatesrpm\" value=\"force\">recreate SRPM</label>"
|
|
# add patches
|
|
echo -n "<hr><b>Add patches:</b>"
|
|
echo -n "<input type=button id=addpatchbutton value=\"submit\" onclick=ajax_getvalues(\""
|
|
echo -n "REQUEST=addpatch&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "ADDPATCHURL=\"+encodeURIComponent(getElementById('addpatchurl').value)+\"&"
|
|
echo -n "ADDPATCHNAME=\"+encodeURIComponent(getElementById('addpatchname').value));>"
|
|
echo -n " <a href=\"http://pastebin.com\" target=_new>pastebin</a><br>"
|
|
echo -n "URL:<input type=text id=addpatchurl value=\"\" style=\"size:100%\">"
|
|
echo -n "<br><div style=\"white-space:nowrap;font-size:9px;width:100%;overflow:hidden\"><span style=\"float:left;margin-top:6px;\">$PACKAGE-${SPECVAR_Version}-</span>"
|
|
echo -n "<span style=\"display:block;float:right;margin-top:6px;\">.patch</span>"
|
|
echo -n "<span style=\"display:block;overflow:hidden;padding-right:5px;\"><input type=text id=addpatchname value=\"\" style=\"width:100%\"></span></div>"
|
|
echo -n "</div><hr>"
|
|
# info from package sources
|
|
echo -n "<b>Info from package in the works:</b><br>"
|
|
# show sources
|
|
echo -n "<select id=sourcefile onchange="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=showsourcefile&"
|
|
echo -n "SOURCEFILE=\"+getSelectedValueById('sourcefile'));>"
|
|
echo -n "<br><option value=\"\">-- select a source to display --</option>"
|
|
for f in ${SPECVAR_Source[*]}; do
|
|
sourcename=${f/*\/}
|
|
echo -n "<option value=\"$f\">$sourcename</option>"
|
|
done
|
|
echo -n "</select>"
|
|
# show patches
|
|
echo -n "<select id=patchfile onchange="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=showpatchfile&"
|
|
echo -n "PATCHFILE=\"+getSelectedValueById('patchfile'));>"
|
|
echo -n "<option value=\"\">-- select a patch to display --</option>"
|
|
for f in ${SPECVAR_Patch[*]}; do
|
|
patchname=${f/*\/}
|
|
patchname=${patchname/.patch}
|
|
patchname=${patchname/$PACKAGE-}
|
|
echo -n "<option value=\"$f\">$patchname</option>"
|
|
done
|
|
echo -n "</select>"
|
|
# list build dir files
|
|
echo -n "<input type=button value=\"build dir files\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=builddirfiles\");>"
|
|
# show package licenses
|
|
echo -n "<input type=button value=\"license(s)\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=showlicenses\");>"
|
|
# show package build docs
|
|
echo -n "<input type=button value=\"build docs\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=showbuilddocs\");>"
|
|
# show package configure help
|
|
echo -n "<input type=button value=\"configure help\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=configurehelp\");>"
|
|
# show package configure log
|
|
echo -n "<input type=button value=\"configure log\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=configurelog\");>"
|
|
# buildroot files
|
|
echo -n "<input type=button value=\"installed files\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=buildrootfiles\");>"
|
|
# show package changelog
|
|
echo -n "<input type=button value=\"changelog(s)\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=showchangelogs\");>"
|
|
|
|
# generic info
|
|
echo -n "<hr><b>Generic info:</b><br>"
|
|
# allowed groups
|
|
echo -n "<input type=button value=\"allowed groups\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=allowedgroups\");>"
|
|
# approved licenses
|
|
echo -n "<input type=button value=\"approved licenses\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=approvedlicenses\");>"
|
|
# templates
|
|
echo -n "<select id=autospectemplate onchange="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=showautospectemplate&"
|
|
echo -n "AUTOSPECTEMPLATE=\"+getSelectedValueById('autospectemplate'));>"
|
|
echo -n "<option value=\"\">-- display a .spec template --</option>"
|
|
for f in $WORKINGROOT/usr/share/autospec/templates/*; do
|
|
autospectemplatename=`basename $f`
|
|
echo -n "<option value=\"$autospectemplatename\">$autospectemplatename</option>"
|
|
done
|
|
echo -n "</select></div>"
|
|
# macros
|
|
echo -n "<select id=macrosfile onchange="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=showmacrosfile&"
|
|
echo -n "MACROSFILE=\"+getSelectedValueById('macrosfile'));>"
|
|
echo -n "<option value=\"\">-- display a RPM macros file --</option>"
|
|
for f in $WORKINGROOT/etc/rpm/macros.*; do
|
|
macrosfilename=`basename $f`
|
|
macrosfile=`echo $macrosfilename | sed "s|macros\.||"`
|
|
echo -n "<option value=\"$macrosfile\">$macrosfile</option>"
|
|
done
|
|
echo -n "</select></div>"
|
|
fi
|
|
echo -n "]]></operationpanel>"
|
|
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 "onkeypress=if(checkEnter()){ajax_getvalues(\""
|
|
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
|
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
|
|
echo -n "REQUEST=broadcastmessage&BROADCASTMESSAGE=\"+encodeURIComponent(getElementById('broadcastmessage').value));"
|
|
echo -n "getElementById('broadcastmessage').value=\"\";}>"
|
|
echo -n "</textarea>"
|
|
#echo -n "<input type=button value=\"send\" onClick="
|
|
echo -n "]]></chatpanel>"
|
|
|
|
if [ "$REQUEST" != "" ]; then
|
|
echo -n "<output><![CDATA[<hr><b>Console output ($REQUEST"
|
|
[ "$PACKAGE" ] && echo -n " for $PACKAGE"
|
|
echo -n "):</b>"
|
|
echo -n "<div align=left class=output "
|
|
if [ "$REQUEST" = "rpmbuild" -o "$REQUEST" = "autoportnp" -o "$REQUEST" = "rpmprepare" \
|
|
-o "$REQUEST" = "sendpackage" -o "$REQUEST" = "sendsource" -o "$REQUEST" = "autospeclistcheck" \
|
|
-o "$REQUEST" = "autodistbuild" -o "$REQUEST" = "autodistinstall" -o "$REQUEST" = "autodistsend" ]; then
|
|
echo -n "id=outputbottom>"
|
|
else
|
|
echo -n "id=outputtop>"
|
|
fi
|
|
if [ "$REQUEST" != "showchangelogs" -a "$REQUEST" != "showbuilddocs" -a "$REQUEST" != "showlicenses" ]; then
|
|
echo -n "<pre><!-- SCROLL -->"
|
|
fi
|
|
RET=255
|
|
fi
|
|
|
|
case $REQUEST in
|
|
"savespec") echo "File <b>$PACKAGE.spec</b> saved."
|
|
RET=-1
|
|
;;
|
|
"smartupgrade") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "export LANG=C;sudo smart update && sudo smart upgrade"
|
|
RET=$?
|
|
;;
|
|
"runldconfig") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "/sbin/ldconfig"
|
|
RET=$?
|
|
;;
|
|
"showpatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE"; RET=$? ;;
|
|
"removepatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE remove"
|
|
RET=$?
|
|
if [ $RET -eq 0 ]; then
|
|
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"removed the autodist patch for <b>$PACKAGE</b>\" STIME=`date +%s`"
|
|
fi ;;
|
|
"autopatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE auto"
|
|
RET=$?
|
|
if [ $RET -eq 0 ]; then
|
|
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist patch for <b>$PACKAGE</b>\" STIME=`date +%s`"
|
|
fi ;;
|
|
"updatepatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE update"
|
|
RET=$?
|
|
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`"
|
|
fi ;;
|
|
"buildpatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE build"
|
|
RET=$?
|
|
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`"
|
|
fi ;;
|
|
"showscheduled") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule"; RET=$? ;;
|
|
"schedule") if [ "$SCHEDULEVERSION" ]; then
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule $AUTODISTJOB#$SCHEDULEVERSION"
|
|
RET=$?
|
|
if [ $RET -eq 0 ]; then
|
|
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job <b>$AUTODISTJOB</b> for update to version $SCHEDULEVERSION\" STIME=`date +%s`"
|
|
fi
|
|
else
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule $AUTODISTJOB"
|
|
RET=$?
|
|
if [ $RET -eq 0 ]; then
|
|
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job <b>$AUTODISTJOB</b> for automatic update\" STIME=`date +%s`"
|
|
fi
|
|
fi
|
|
;;
|
|
"unschedule") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool unschedule $AUTODISTJOB"
|
|
RET=$?
|
|
if [ $RET -eq 0 ]; then
|
|
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"unscheduled autodist job <b>$AUTODISTJOB</b>\" STIME=`date +%s`"
|
|
fi ;;
|
|
"autodistbuild") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
|
|
autodistjobs=
|
|
if [ "$AUTODISTPKGS" ]; then
|
|
for p in $AUTODISTPKGS; do
|
|
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
|
|
done
|
|
else
|
|
autodistjobs="$AUTODISTJOB"
|
|
fi
|
|
$SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -b $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $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."
|
|
}
|
|
#[ $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=
|
|
autodistjobs=
|
|
if [ "$AUTODISTPKGS" ]; then
|
|
for p in $AUTODISTPKGS; do
|
|
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
|
|
done
|
|
else
|
|
autodistjobs="$AUTODISTJOB"
|
|
fi
|
|
$SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -i $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH $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."
|
|
}
|
|
;;
|
|
"autodistsend") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
|
|
autodistjobs=
|
|
if [ "$AUTODISTPKGS" ]; then
|
|
for p in $AUTODISTPKGS; do
|
|
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
|
|
done
|
|
else
|
|
autodistjobs="$AUTODISTJOB"
|
|
fi
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -s $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --server $SENDREPOSITORY --arch $AUTODISTARCH $AUTODISTADD"
|
|
RET=$?
|
|
[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$AUTODISTPKGS</b> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
|
|
;;
|
|
"autoport") if [ "$AUTOPORTPACKAGE" ]; then
|
|
$SUDO_WRAPPER background $ENVIRONMENT "$USER" $AUTOPORTPACKAGE "autoport $AUTOPORTPACKAGE -r $REPOSITORY" &>/dev/null
|
|
RET=$?
|
|
[ $REQ -eq 0 ] && {
|
|
RET=-1
|
|
echo "Autoport started. You may see the output in the <b>Webbuild jobs</b> box above."
|
|
}
|
|
else
|
|
echo "ERROR: no port package specified!"
|
|
RET=1
|
|
fi
|
|
;;
|
|
"autospecupdatescheck") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a2"; RET=$? ;;
|
|
"rpmprepare") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec --nodeps"; RET=$? ;;
|
|
"rpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-build"
|
|
[ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
|
|
RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
|
|
$SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a5,6 $RPMFORCEADD $RPMARCHADD" &>/dev/null
|
|
# && echo \"Webbuild HINT: now you may want to click on 'build requirements', add build requirements in .spec file and then 'recreate SRPMS'\""
|
|
[ $? -ne 0 ] && RET=$? || {
|
|
RET=-1
|
|
echo -n "Build started. You may see the output in the <b>Webbuild jobs</b> box above."
|
|
echo -n "<br><br><font color=gold>HINT: when build is done add or update build requirements to specfile and recreate SRPM.</font>"
|
|
}
|
|
;;
|
|
"srpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--nodeps"
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs --define=\"_sourcedir $SPECVAR_WORKINGHOME/RPM/SOURCES\" $RPMFORCEADD $PACKAGE.spec"
|
|
RET=$? ;;
|
|
"autospeclistcheck")
|
|
[ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
|
|
RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a5 --list-check --force $RPMARCHADD"
|
|
RET=$? ;;
|
|
"autospecbuildreq") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a6"
|
|
RET=$? ;;
|
|
"rpmchecks") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a8"; RET=$? ;;
|
|
"rpmsimulateinstall") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a7"; RET=$? ;;
|
|
"rpminstall") if [ "$USER_CANINSTALL" ]; then
|
|
[ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-install"
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a11 $RPMFORCEADD"; RET=$?
|
|
else
|
|
echo "Install function disabled."
|
|
RET=1
|
|
fi ;;
|
|
"sendpackage") if [ "$SENDREPOSITORY" ]; then
|
|
if [ "$SENDRECREATESRPM" ]; 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
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY"
|
|
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`"
|
|
fi
|
|
else
|
|
echo "ERROR: send repository is not defined."
|
|
RET=255
|
|
fi
|
|
;;
|
|
"sendsource") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--nodeps"
|
|
if [ "$SENDREPOSITORY" ]; then
|
|
if [ "$SENDRECREATESRPM" ]; 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
|
|
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent edited <b>$PACKAGE</b> source to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
|
|
fi
|
|
else
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm"
|
|
RET=$?
|
|
if [ $RET -eq 0 ]; then
|
|
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$PACKAGE</b> source to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
|
|
fi
|
|
fi
|
|
else
|
|
echo "ERROR: send repository is not defined."
|
|
RET=255
|
|
fi
|
|
;;
|
|
"addpatch") if [ "$ADDPATCHURL" -a "$ADDPATCHNAME" ]; then
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "curl -sSkL '$ADDPATCHURL' -o ../SOURCES/$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch"
|
|
RET=$?
|
|
[ $RET -eq 0 ] && {
|
|
echo -n "Patch added with name <b>$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch</b>."
|
|
echo -n "<br><br><font color=gold>HINT: add the following lines to the .spec file in the appropriate sections (fix indexes if needed):</font><br>"
|
|
NEWPATCHNUM=`expr ${#SPECVAR_Patch[*]} + 1`
|
|
echo -ne "<br><pre>Patch$NEWPATCHNUM: $PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch\n\n%patch$NEWPATCHNUM -p1</pre>"
|
|
RET=-1
|
|
}
|
|
else
|
|
echo "Patch URL or destination name not provided."
|
|
RET=1
|
|
fi ;;
|
|
"repositoryimport")
|
|
[ "$PACKAGES" ] || {
|
|
echo "ERROR: no packages(s) selected."
|
|
RET=1
|
|
break
|
|
}
|
|
for p in $PACKAGES; do
|
|
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
|
|
[ "$REPOSITORYFORCE" = "true" ] && FORCEADD="-f"
|
|
$SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository import $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD $FORCEADD -y"
|
|
RET=$?
|
|
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`"
|
|
fi
|
|
[ $RET -eq 0 ] || break
|
|
done
|
|
;;
|
|
"repositoryrelease")
|
|
[ "$PACKAGES" ] || {
|
|
echo "ERROR: no package(s) selected."
|
|
RET=1
|
|
break
|
|
}
|
|
for p in $PACKAGES; do
|
|
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
|
|
[ "$REPOSITORYFORCE" = "true" ] && SIMULATEADD="$SIMULATEADD -f"
|
|
$SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository release $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
|
|
RET=$?
|
|
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`"
|
|
fi
|
|
[ $RET -eq 0 ] || break
|
|
done
|
|
;;
|
|
"repositorydiff")
|
|
[ "$PACKAGES" ] || {
|
|
echo "ERROR: no package(s) selected."
|
|
RET=1
|
|
break
|
|
}
|
|
for p in $PACKAGES; do
|
|
$SUDO_WRAPPER 0 local "$USER" "" "openmamba-repository diff $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO"
|
|
RET=$?
|
|
[ $RET -eq 0 ] || break
|
|
done
|
|
;;
|
|
"repositoryarchive")
|
|
[ "$PACKAGES" ] || {
|
|
echo "ERROR: no package(s) selected."
|
|
RET=1
|
|
break
|
|
}
|
|
for p in $PACKAGES; do
|
|
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
|
|
$SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "openmamba-repository archive $SENDREPOSITORY $p -y"
|
|
RET=$?
|
|
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`"
|
|
fi
|
|
[ $RET -eq 0 ] || break
|
|
done
|
|
;;
|
|
"repositorymassrebuild")
|
|
if [ ! "$PACKAGES" ]; then
|
|
echo "ERROR: no package(s) selected."
|
|
RET=1
|
|
elif [ ! "$MASSREBUILDCHANGELOG" ]; then
|
|
echo "ERROR: changelog was not specified."
|
|
RET=1
|
|
else
|
|
$SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autoport -r $SENDREPOSITORY -d $REPOSITORYIMPORTTO $PACKAGES -u \"$MASSREBUILDCHANGELOG\"" &>/dev/null
|
|
[ $? -ne 0 ] && RET=$? || {
|
|
RET=-1
|
|
echo -n "Mass rebuild started. You may see the output in the <b>Webbuild jobs</b> box above."
|
|
}
|
|
# if [ $RET -eq 0 ]; then
|
|
# social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"mass rebuilt <b>$PACKAGES</b> from <b>$SENDREPOSITORY</b> and sent them to <b>$REPOSITORYIMPORTTO</b>\" STIME=`date +%s`"
|
|
# fi
|
|
fi
|
|
;;
|
|
"repositorysync")
|
|
if [ "$REPOSITORY" ]; then
|
|
$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
|
|
[ $? -ne 0 ] && RET=$? || {
|
|
RET=-1
|
|
echo -n "Autoport started. You may see the output in the <b>Webbuild jobs</b> box above."
|
|
}
|
|
;;
|
|
"autoportlog") cat "$AUTOPORTLOGDIR/current.log"; RET=$? ;;
|
|
"allowedgroups") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "$AUTOSPEC_CMD --eval rpm_allowed_groups"
|
|
RET=$?
|
|
[ $RET -eq 0 ] && RET=-1
|
|
;;
|
|
"approvedlicenses") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "$AUTOSPEC_CMD --eval rpm_approved_licenses | grep -v \"^#\"" | \
|
|
while read line; do
|
|
echo $line
|
|
done
|
|
RET=-1
|
|
;;
|
|
"builddirfiles") if [ ! "$SPECVAR_BUILDDIR" ]; then
|
|
echo "ERROR: BUILDDIR is undefined"
|
|
RET=1
|
|
else
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR && find $SPECVAR_BUILDDIR"
|
|
RET=$?
|
|
[ $RET -eq 0 ] && RET=-1
|
|
fi
|
|
;;
|
|
"buildrootfiles") if [ ! "$SPECVAR_BUILDROOT" ]; then
|
|
echo "ERROR: BUILDROOT is undefined"
|
|
RET=1
|
|
else
|
|
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDROOT/$SPECVAR_BUILDROOT && find"
|
|
RET=$?
|
|
fi
|
|
;;
|
|
"showchangelogs"|"showbuilddocs"|"showlicenses")
|
|
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"
|
|
elif [ "$REQUEST" = "showbuilddocs" ]; then
|
|
PATTERN="-iname readme\* -or -iname install\* -or -iname todo\* -or -iname pkgbuild\* -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|<|\<|g;s|[[:cntrl:]]\[[0-9;]*m||g\"" | parse_generic_output
|
|
RET=$?
|
|
[ $RET -eq 0 ] && RET=-1
|
|
echo -n "</pre>"
|
|
done
|
|
;;
|
|
"configurehelp") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && ./configure --help || ./waf configure --help"
|
|
RET=$?
|
|
[ $RET -eq 0 ] && RET=-1 ;;
|
|
"configurelog") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && cat config.log"
|
|
RET=$?
|
|
[ $RET -eq 0 ] && RET=-1 ;;
|
|
"showautospectemplate") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat /usr/share/autospec/templates/$AUTOSPECTEMPLATE"
|
|
RET=$?
|
|
[ $RET -eq 0 ] && RET=-1 ;;
|
|
"showmacrosfile") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat /etc/rpm/macros.$MACROSFILE"
|
|
RET=$?
|
|
[ $RET -eq 0 ] && RET=-1 ;;
|
|
"showpatchfile") OUTPATCHFILE=${PATCHFILE/*\/}
|
|
case ${OUTPATCHFILE/*.} in
|
|
gz|gzip) $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "gunzip -c $SPECVAR_RPMSOURCESDIR/$OUTPATCHFILE" | parse_patch_output ;;
|
|
bz2) $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "bzcat $SPECVAR_RPMSOURCESDIR/$OUTPATCHFILE" | parse_patch_output ;;
|
|
*) $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat $SPECVAR_RPMSOURCESDIR/$OUTPATCHFILE" | parse_patch_output ;;
|
|
esac
|
|
RET=$?
|
|
[ $RET -eq 0 ] && RET=-1
|
|
;;
|
|
"showsourcefile") OUTSOURCEFILE=${SOURCEFILE/*\/}
|
|
case ${OUTSOURCEFILE} in
|
|
*.tar.*) $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "tar tvf $SPECVAR_RPMSOURCESDIR/$OUTSOURCEFILE" ;;
|
|
*.gz|*.gzip) $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "gunzip -c $SPECVAR_RPMSOURCESDIR/$OUTSOURCEFILE" ;;
|
|
*.bz2) $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "bzcat $SPECVAR_RPMSOURCESDIR/$OUTSOURCEFILE" ;;
|
|
*) $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat $SPECVAR_RPMSOURCESDIR/$OUTSOURCEFILE" | parse_patch_output ;;
|
|
esac
|
|
RET=$?
|
|
[ $RET -eq 0 ] && RET=-1
|
|
;;
|
|
*) RET=0 ;;
|
|
esac
|
|
|
|
if [ "$REQUEST" != "" ]; then
|
|
if [ "$REQUEST" != "showchangelogs" -a "$REQUEST" != "showbuilddocs" -a "$REQUEST" != "showlicenses" ]; then
|
|
echo -n "<!-- ENDSCROLL --></pre>"
|
|
fi
|
|
if [ $RET -eq 0 ]; then
|
|
echo "Result: <font color=green><b>OK</b></font>"
|
|
elif [ $RET -gt 0 ]; then
|
|
echo "Result: <font color=red><b>ERROR ($RET)</b></font>"
|
|
fi
|
|
echo -n "</div>"
|
|
echo -n "]]></output>"
|
|
# editor controls
|
|
if [ $RET -le 0 -a "$SPECAVAILABLE" -a ! "$MAINTAINERMODE" ]; then
|
|
print_editorcontrols
|
|
fi
|
|
fi
|
|
|
|
|
|
if [ "$MAINTAINERMODE" = "true" ]; then
|
|
echo -n "<packages> </packages>"
|
|
echo -n "<operationpanel><![CDATA["
|
|
showEnvironmentPanel
|
|
echo -n "<hr>"
|
|
if [ "$REPOSITORY" ]; then
|
|
echo -n "<b>Repository maintenance:</b><br>"
|
|
# echo -n "<select multiple size=8 id=package onchange="
|
|
# echo -n "i=getElementById('repository').selectedIndex;ajax_getvalues(\"REQUEST=edit&"
|
|
# echo -n "ENVIRONMENT=$ENVIRONMENT&MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
|
|
# echo -n "PACKAGE=\"+encodeURIComponent(this.value)+\"&"
|
|
# echo -n "REPOSITORY=\"+getElementById('repository').options[i].text);>"
|
|
# echo "<option value=\"\">-- Select a SRPM package --</option>"
|
|
echo -n "<label><input type=checkbox name=pkgsselectallcheckbox value=\"\" onclick=checkAllBoxes('packagescheckbox',this.checked);>select/unselect all</label>"
|
|
echo -n "<div class=multiselect>"
|
|
ls $local_ftp/$REPOSITORY/SRPMS.base/*.src.rpm | sort -f | while read f; do
|
|
[ -r $f ] || continue
|
|
pkgname=`basename $f`
|
|
pkgname=${pkgname/.src.rpm}
|
|
pkgrel=${pkgname/*-}
|
|
pkgname=${pkgname/-$pkgrel}
|
|
pkgver=${pkgname/*-}
|
|
pkgname=${pkgname/-$pkgver}
|
|
if [ "$PACKAGE" = "$pkgname" ]; then
|
|
SELECTED="selected=\"selected\"";
|
|
# REQUEST="changesrpm"
|
|
else
|
|
SELECTED=
|
|
fi
|
|
echo -n "<label><input type=checkbox name=packagescheckbox value=\"$pkgname\" $SELECTED>${pkgname} ${pkgver}-${pkgrel}</label>"
|
|
done
|
|
echo -n "</div>"
|
|
echo -n "Origin: <b>$REPOSITORY</b>"
|
|
# repository sync
|
|
echo -n " <input type=button value=\"sync\" onclick="
|
|
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>"
|
|
echo -n "<br>Destination: "
|
|
echo -n "<select id=repositoryimportto>"
|
|
if [ "${REPOSITORY:0:10}" = "milestone2" ]; then
|
|
IMPORT_REPOSITORIES=$AUTOPORT_MILESTONE2_IMPORT_REPOSITORIES
|
|
else
|
|
IMPORT_REPOSITORIES="$AUTOPORT_DEVEL_IMPORT_REPOSITORIES devel-$USER"
|
|
fi
|
|
for f in $IMPORT_REPOSITORIES; do
|
|
if [ ! "$USER_ALLREPOSITORIES" ]; then
|
|
for u in $USER_CANMAINTAIN_REPOSITORIES devel-$USER; do
|
|
[ "$u" = "$f" ] && echo -n "<option value=\"$f\">$f</option>"
|
|
# -a "$f" != "$REPOSITORY"
|
|
done
|
|
else
|
|
#[ "$f" != "$REPOSITORY" ] &&
|
|
echo -n "<option value=\"$f\">$f</option>"
|
|
fi
|
|
done
|
|
echo -n "</select><br>"
|
|
# repository compare
|
|
echo -n "<input type=button value=\"compare\" onclick="
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
|
|
echo -n "PACKAGES=\"+encodeURIComponent(getCheckedValuesByName('packagescheckbox'))+\"&"
|
|
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
|
|
echo -n "REPOSITORYIMPORTTO=\"+getSelectedValueById('repositoryimportto')+\"&"
|
|
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
|
|
echo -n "REPOSITORYFORCE=\"+getElementById('repositoryforce').checked+\"&"
|
|
echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositorydiff\");>"
|
|
# repository import
|
|
echo -n "<input type=button value=\"import\" onclick="
|
|
echo -n "p=getCheckedValuesByName('packagescheckbox');"
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
|
|
echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
|
|
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
|
|
echo -n "REPOSITORYIMPORTTO=\"+getSelectedValueById('repositoryimportto')+\"&"
|
|
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
|
|
echo -n "REPOSITORYFORCE=\"+getElementById('repositoryforce').checked+\"&"
|
|
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
|
|
echo -n "<input type=button value=\"release\" onclick="
|
|
echo -n "p=getCheckedValuesByName('packagescheckbox');"
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
|
|
echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
|
|
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
|
|
echo -n "REPOSITORYIMPORTTO=\"+getSelectedValueById('repositoryimportto')+\"&"
|
|
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
|
|
echo -n "REPOSITORYFORCE=\"+getElementById('repositoryforce').checked+\"&"
|
|
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
|
|
echo -n "<input type=button value=\"archive\" onclick="
|
|
echo -n "p=getCheckedValuesByName('packagescheckbox');"
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
|
|
echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
|
|
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
|
|
echo -n "SENDREPOSITORY=$REPOSITORY&"
|
|
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
|
|
echo -n "REPOSITORYFORCE=\"+getElementById('repositoryforce').checked+\"&"
|
|
echo -n "REQUEST=repositoryarchive\""
|
|
echo -n ",\"`cgi_encodevar "Archive <b>"`\"+p+\"`cgi_encodevar "</b> in <b>$REPOSITORY</b>?"`\""
|
|
echo -n "); class=redbutton>"
|
|
# mass rebuild
|
|
echo -n "<input type=button value=\"mass rebuild\" onclick="
|
|
echo -n "p=getCheckedValuesByName('packagescheckbox');"
|
|
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
|
|
echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
|
|
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
|
|
echo -n "REPOSITORYIMPORTTO=\"+getSelectedValueById('repositoryimportto')+\"&"
|
|
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
|
|
echo -n "REPOSITORYFORCE=\"+getElementById('repositoryforce').checked+\"&"
|
|
echo -n "MASSREBUILDCHANGELOG=\"+encodeURIComponent(getElementById('massrebuildchangelog').value)+\"&"
|
|
echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositorymassrebuild\""
|
|
echo -n ",\"`cgi_encodevar "Rebuild <b>"`\"+p+\"`cgi_encodevar "</b> from <b>$REPOSITORY</b> and send to <b>"`\"+getSelectedValueById('repositoryimportto')+"
|
|
echo -n "\"`cgi_encodevar "</b>?"`\""
|
|
echo -n "); class=redbutton>"
|
|
echo -n " Changelog:"
|
|
echo -n "<input type=text id=massrebuildchangelog style=\"width:100%\">"
|
|
# force checkbox
|
|
echo -n "<label><input type=checkbox id=\"repositoryforce\" value=\"force\">force</label>"
|
|
# simulate checkbox
|
|
echo -n "<label><input type=checkbox id=\"repositorysimulate\" value=\"simulate\">simulate</label>"
|
|
fi
|
|
echo -n "]]></operationpanel>"
|
|
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 "
|
|
[ "${SPECVAR_Epoch[0]}" ] && echo -n "${SPECVAR_Epoch[0]}:"
|
|
echo -n "$SPECVAR_Version-$SPECVAR_Release " || echo -n "no package "
|
|
echo -n "("
|
|
print_environment_descr $ENVIRONMENT
|
|
echo -n ")"
|
|
}
|
|
fi
|
|
|
|
echo -n " :: openmamba webbuild</title>"
|
|
echo "</webbuild>"
|