2012-09-02 13:18:52 +02:00
#!/bin/bash
#
# webbuild cgi script
2014-05-22 18:20:42 +02:00
# Copyright (c) 2012-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
2012-09-02 13:18:52 +02:00
#
2012-09-10 17:48:21 +02:00
. /usr/share/autodist/webbuild-functions
2012-11-19 23:52:30 +01:00
. /usr/share/autodist/webbuild-functions-private
2012-09-02 13:18:52 +02:00
2012-11-19 23:52:30 +01:00
AUTOSPEC_CMD="autospec --colors web"
2012-09-02 13:18:52 +02:00
# register all GET and POST variables
cgi_getvars BOTH ALL
2012-09-04 13:05:57 +02:00
#[ "$PACKAGE" ] && PACKAGEENCODED=`cgi_encodevar "$PACKAGE"` || PACKAGEENCODED=
[ "$PACKAGE" ] && PACKAGEENCODED=`cgi_encodevar "$PACKAGE"` || PACKAGEENCODED=
2012-09-02 13:18:52 +02:00
#cgi_getvars POST
2014-05-23 21:17:27 +02:00
if [ "${REQUEST:0:7}" != "refresh" ]; then
2012-09-02 13:18:52 +02:00
echo "`date` - USER=$USER&REQUEST=$REQUEST&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGE&MAINTAINERMODE=$MAINTAINERMODE" >> $LOG
fi
2013-05-23 13:02:22 +02:00
# read configuration after cgi_getvars to prevent variables overriding
. /etc/sysconfig/autoport
2013-07-11 11:03:09 +02:00
if [ "$REQUEST" != "rpmmanagerdownload" ]; then
echo -e "Content-type: text/xml\nPragma: no-cache\n"
echo -n "<webbuild>"
fi
2012-09-02 13:18:52 +02:00
# SECURITY
USER_ENABLED=
2012-09-06 18:55:33 +02:00
USER_ADMIN=
2012-09-10 17:48:21 +02:00
USER_CANMAINTAIN=
USER_CANSENDMESSAGES=
2012-09-02 13:18:52 +02:00
USER=${USER/.*\/}
2013-05-23 13:02:22 +02:00
2013-05-21 16:12:02 +02:00
if [ "$REMOTE_ADDR" = "127.0.0.1" -a "$USER" = "" ]; then
USER=admin
fi
2013-05-20 18:55:13 +02:00
if [ "$USER" ]; then
2012-09-10 17:48:21 +02:00
if [ -r "$WEBBUILD_STATEDIR/users/$USER.conf" ]; then
. $WEBBUILD_STATEDIR/users/$USER.conf
2012-09-02 13:18:52 +02:00
fi
if [ "$USER_ENABLED" ]; then
2013-07-11 11:03:09 +02:00
if [ "$USER_EMAIL" ]; then
grep "USER_EMAIL=" $WEBBUILD_STATEDIR/users/$USER.conf >/dev/null ||
echo "USER_EMAIL=$USER_EMAIL" >> $WEBBUILD_STATEDIR/users/$USER.conf
fi
2012-09-02 13:18:52 +02:00
USER_ENABLED=
if [ "$SECRET" = "$USER_SECRET" ]; then
2013-05-21 16:12:02 +02:00
[ "$REMOTE_ADDR" = "127.0.0.1" -o "$USER_SECRET" ] && USER_ENABLED=1 || USER_ENABLED=
2012-09-02 13:18:52 +02:00
elif [ "$REQUEST" = "password" ]; then
2013-05-21 01:18:05 +02:00
if [ "$USER_SECRET" ]; then
/usr/libexec/webbuild-checkpassword "$PASSWORD" "$USER_SECRET" 2>/dev/null
else
/usr/libexec/webbuild-checkpassword "$PASSWORD" "$SECRET" 2>/dev/null
fi
2012-09-02 13:18:52 +02:00
if [ $? -eq 0 ]; then
2013-05-21 01:18:05 +02:00
if [ ! "$USER_SECRET" ]; then
tmpfile=`mktemp --suffix=webbuildtmp`
cat $WEBBUILD_STATEDIR/users/$USER.conf > $tmpfile
echo "USER_SECRET='$SECRET'" >> $tmpfile
$SUDO_WRAPPER 0 local "$USER" "" "mv $tmpfile $WEBBUILD_STATEDIR/users/$USER.conf"
fi
2012-09-02 13:18:52 +02:00
USER_ENABLED=1
else
USER_ENABLED=
fi
2014-05-23 21:17:27 +02:00
elif [ "${REQUEST:0:7}" != "refresh" ]; then
2012-09-02 13:18:52 +02:00
# no "$USER_SECRET" set; require password
2013-05-21 16:12:02 +02:00
echo -n "<output><![CDATA[Please enter your password: <input type=password id=password "
echo -n "onkeypress=if(checkEnter(event))"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=password&PASSWORD=\"+encodeURIComponent(getElementById('password').value));>"
2012-10-18 00:49:13 +02:00
echo -n " <input type=button value=\"Submit\" onClick="
2012-09-04 13:05:57 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
2012-09-02 13:18:52 +02:00
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>"
2013-06-03 13:46:04 +02:00
echo -n "<showlogcontrols> </showlogcontrols>"
2012-09-02 13:18:52 +02:00
echo -n "<editor> </editor>"
echo -n "<operationpanel> </operationpanel>"
echo -n "</webbuild>"
exit
fi
fi
2014-05-23 21:17:27 +02:00
elif [ "${REQUEST:0:7}" != "refresh" ]; then
2013-05-21 16:12:02 +02:00
echo -n "<output><![CDATA[Please enter your username: <input type=text id=username "
echo -n "onkeypress=if(checkEnter(event)){"
echo -n "user=encodeURIComponent(getElementById('username').value);"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED\");};>"
2013-05-21 01:18:05 +02:00
echo -n " <input type=button value=\"Submit\" onClick="
echo -n "user=encodeURIComponent(getElementById('username').value);"
2013-05-21 11:57:52 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED\");>"
2013-05-21 01:18:05 +02:00
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>"
2013-06-03 13:46:04 +02:00
echo -n "<showlogcontrols> </showlogcontrols>"
2013-05-21 01:18:05 +02:00
echo -n "<editor> </editor>"
echo -n "<operationpanel> </operationpanel>"
echo -n "</webbuild>"
exit
2012-09-02 13:18:52 +02:00
fi
2013-05-21 01:18:05 +02:00
2014-05-23 21:17:27 +02:00
if [ "$USER_ENABLED" != "1" -a "${REQUEST:0:7}" != "refresh" ]; then
2012-09-02 13:18:52 +02:00
echo -n "<environments> </environments>"
echo -n "<speccreate> </speccreate>"
echo -n "<specedit> </specedit>"
echo -n "<repositories> </repositories>"
echo -n "<packages> </packages>"
echo -n "<editcontrols> </editcontrols>"
2013-06-03 13:46:04 +02:00
echo -n "<showlogcontrols> </showlogcontrols>"
2012-09-02 13:18:52 +02:00
echo -n "<editor> </editor>"
2013-05-21 11:57:52 +02:00
if [ "$USER" ]; then
2012-09-02 13:18:52 +02:00
if [ "$REQUEST" = "enablerequest" ]; then
2012-11-19 23:52:30 +01:00
echo "REQUEST_DATE=\"`date`\" REQUEST_USER=$USER REQUEST_USER_EMAIL=$USER_EMAIL REQUEST_TYPE=$REQUEST REQUEST_SECRET='$SECRET'" >> $WEBBUILD_STATEDIR/requests
2012-09-02 13:18:52 +02:00
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>"
2012-11-19 23:52:30 +01:00
elif [ "`grep \" REQUEST_USER=$USER \" $WEBBUILD_STATEDIR/requests`" ]; then
2012-09-02 13:18:52 +02:00
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!"
2012-11-19 23:52:30 +01:00
echo -n " <input type=button value=\"Send enable request\" onClick="
2012-09-02 13:18:52 +02:00
echo -n "ajax_getvalues(\"REQUEST=enablerequest\");>"
echo -n "]]></output>"
fi
2012-09-06 18:55:33 +02:00
# else
# echo -n "<output>Unauthorized!</output>"
2012-09-02 13:18:52 +02:00
fi
echo -n "<operationpanel> </operationpanel>"
2013-05-21 11:57:52 +02:00
echo -n "</webbuild>"
exit
2012-09-02 13:18:52 +02:00
fi
2012-09-10 17:48:21 +02:00
if [ -e $WEBBUILD_STATEDIR/webbuild.state ]; then
. $WEBBUILD_STATEDIR/users/webbuild.state
2012-09-06 18:55:33 +02:00
else
2012-09-10 17:48:21 +02:00
touch $WEBBUILD_STATEDIR/users/webbuild.state
2012-09-02 13:18:52 +02:00
fi
2012-09-06 18:55:33 +02:00
if [ "$USER_ADMIN" -a "$FAKEUSERSWITCH" != "" ]; then
if [ "$FAKEUSERSWITCH" = "_disabled_" ]; then
set_user_state_var STATE_FAKEUSER
FAKEUSER=
2012-09-02 13:18:52 +02:00
else
2012-09-06 18:55:33 +02:00
set_user_state_var STATE_FAKEUSER $FAKEUSERSWITCH
fi
fi
if [ "$USER" -a "$USER_ENABLED" ]; then
# set user state changes
2013-01-19 16:24:26 +01:00
if [ "$AUTODISTCURRENT" != "" ]; then
if [ "$AUTODISTCURRENT" = "true" ]; then
set_user_state_var STATE_AUTODISTCURRENT 1
else
set_user_state_var STATE_AUTODISTCURRENT 0
fi
fi
2012-09-06 18:55:33 +02:00
if [ "$ADVANCEDCONTROLSSWITCH" != "" ]; then
if [ "$ADVANCEDCONTROLSSWITCH" = "true" ]; then
set_user_state_var STATE_ADVANCEDCONTROLS 1
else
set_user_state_var STATE_ADVANCEDCONTROLS
2012-09-02 13:18:52 +02:00
fi
fi
2012-09-06 18:55:33 +02:00
if [ "$PRIVACYMODESWITCH" != "" ]; then
if [ "$PRIVACYMODESWITCH" = "true" ]; then
set_user_state_var STATE_PRIVACYMODE 1
else
set_user_state_var STATE_PRIVACYMODE
2012-09-02 13:18:52 +02:00
fi
2012-09-06 18:55:33 +02:00
fi
2012-11-19 23:52:30 +01:00
if [ "$JOBSSHOWALL" != "" ]; then
if [ "$JOBSSHOWALL" = "true" ]; then
set_user_state_var STATE_JOBSSHOWALL 1
else
set_user_state_var STATE_JOBSSHOWALL
fi
fi
2012-09-06 18:55:33 +02:00
# read user state file
2012-09-10 17:48:21 +02:00
[ -e $WEBBUILD_STATEDIR/users/$USER.state ] && . $WEBBUILD_STATEDIR/users/$USER.state
2012-09-06 18:55:33 +02:00
if [ "$USER_ADMIN" -a "$STATE_FAKEUSER" != "" ]; then
USER=$STATE_FAKEUSER
USER_ENABLED=
USER_ADMIN=
2012-09-10 17:48:21 +02:00
USER_CANMAINTAIN=
2012-09-06 18:55:33 +02:00
USER_CANINSTALL=
2014-04-25 12:10:30 +02:00
USER_ENVIRONMENTS=
2012-09-06 18:55:33 +02:00
USER_ALLENVIRONMENTS=
USER_ALLREPOSITORIES=
2012-09-10 17:48:21 +02:00
[ -e $WEBBUILD_STATEDIR/users/$USER.conf ] && . $WEBBUILD_STATEDIR/users/$USER.conf
2012-09-06 18:55:33 +02:00
STATE_ADVANCEDCONTROLS=
2012-09-10 17:48:21 +02:00
[ -e $WEBBUILD_STATEDIR/users/$USER.state ] && . $WEBBUILD_STATEDIR/users/$USER.state
2012-09-06 18:55:33 +02:00
fi
2012-10-18 00:49:13 +02:00
else
USER=
2012-09-06 18:55:33 +02:00
fi
2012-09-10 17:48:21 +02:00
#
# Public requests
#
2014-05-23 21:17:27 +02:00
if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
2014-05-27 01:40:53 +02:00
if [ "$WEBBUILD_URL" -a "${WEBBUILD_URL/\/localhost\//}" = "$WEBBUILD_URL" ]; then
2014-05-23 21:17:27 +02:00
curl -s "$WEBBUILD_URL?REQUEST=refreshsocial&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&FROMID=$FROMID"
else
[ -e "$WEBBUILD_STATEDIR/social_log" ] || exit
# social box
echo -n "<socialbox>"
count=0
SID=0
if [ ! "$FROMID" -o "$FROMID" = "0" -o "$FROMID" = "NaN" ]; then
if [ "$USER" ]; then
line=`tail -n 500 $WEBBUILD_STATEDIR/social_log | grep -v " SUSER=$USER " 2>/dev/null | tail -n 25 | head -n 1`
else
line=`tail -n 500 $WEBBUILD_STATEDIR/social_log | grep -v " STARGET=developers " 2>/dev/null | tail -n 25 | head -n 1`
fi
eval $line
FROMID=$SID
2012-10-18 00:49:13 +02:00
fi
2014-05-23 21:17:27 +02:00
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=$(($count + 1))
done
echo -n "</socialbox>"
2012-10-18 00:49:13 +02:00
fi
2012-09-10 17:48:21 +02:00
fi
2012-09-06 18:55:33 +02:00
2012-09-10 17:48:21 +02:00
if [ "$USER_ENABLED" != "1" ]; then
echo -n "</webbuild>"
exit
2012-09-06 18:55:33 +02:00
fi
2012-09-10 17:48:21 +02:00
#
# Enabled users requests
#
2013-05-23 13:02:22 +02:00
rm -f $WEBBUILD_STATEDIR/cache/config-dynamic
if [ "${#AUTOPORT_ARCH[*]}" = "0" ]; then
LOCAL_PACKAGER_USERS=`getent group packager | cut -d: -f4 | tr , ' '`
LOCAL_ARCH=`uname -m`
case $LOCAL_ARCH in
i386|i486|i686|athlon) LOCAL_ARCH="i586" ;;
esac
i=0
for u in $LOCAL_PACKAGER_USERS; do
cat >> $WEBBUILD_STATEDIR/cache/config-dynamic << _EOF
AUTOPORT_DISABLE[$i]=1
AUTOPORT_CHROOT_USER[$i]=$u
AUTOPORT_NATIVE[$i]=1
AUTOPORT_ARCH[$i]="$LOCAL_ARCH"
_EOF
i=$((i + 1))
done
. $WEBBUILD_STATEDIR/cache/config-dynamic
fi
2013-07-11 11:03:09 +02:00
if [ "$REQUEST" = "rpmmanagerdownload" ]; then
resolve_rpmmanagerdir "$RPMMANAGERDIR" "${AUTOPORT_ARCH[$ENVIRONMENT]}" "$REPOSITORY"
for f in $RPMMANAGERPACKAGES; do
installpackages="$installpackages $rpmmanagerdir/$f"
done
if [ "$rpmmanagermode" = "environment" ]; then
download_file $ENVIRONMENT "$installpackages"
else
download_file "" "$installpackages"
fi
RET=$?
exit
fi
2012-11-19 23:52:30 +01:00
# 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'
2013-07-11 11:03:09 +02:00
USER_EMAIL='$REQUEST_USER_EMAIL'
2012-11-19 23:52:30 +01:00
_EOF
else
cat >> $WEBBUILD_STATEDIR/users/$REQUEST_USER.conf << _EOF
USER_ENABLED=0
2013-07-11 11:03:09 +02:00
USER_EMAIL='$REQUEST_USER_EMAIL'
2012-11-19 23:52:30 +01:00
_EOF
fi
fi
2013-05-21 12:05:33 +02:00
sed -i "/ REQUEST_USER=$REQUEST_USER /d" $WEBBUILD_STATEDIR/requests
2012-11-19 23:52:30 +01:00
echo -n "</webbuild>"
exit
fi
2013-05-21 01:18:05 +02:00
# send data for cookie
if [ "$REQUEST" = "password" ]; then
echo -n "<cookie-user>$USER</cookie-user><cookie-secret>$USER_SECRET</cookie-secret>"
fi
2012-10-18 00:49:13 +02:00
# kill processes or clean log
2012-09-21 12:57:19 +02:00
if [ "$REQUEST" = "killtree" ]; then
killline=`grep "^$KILLPID " $WEBBUILD_STATEDIR/processes`
if [ "$killline" ]; then
if [ $KILLPID -ge 1 ]; then
2014-02-01 14:56:17 +01:00
if [ -e /proc/$KILLPID ]; then
$SUDO_WRAPPER killtree $KILLPID "$USER"
else
set -- $killline
rm -f $5
sed -i "/^$KILLPID /d" $WEBBUILD_STATEDIR/processes
fi
2012-09-21 12:57:19 +02:00
else
echo "<output>ERROR: Invalid PID</output>"
fi
fi
2012-10-18 00:49:13 +02:00
REQUEST=refresh
2012-09-21 12:57:19 +02:00
fi
2012-10-18 00:49:13 +02:00
# refresh processes list
2012-11-19 23:52:30 +01:00
if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
2012-09-10 17:48:21 +02:00
echo -n "<processes><![CDATA["
2012-11-19 23:52:30 +01:00
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&"
2013-07-11 11:03:09 +02:00
echo -n "REQUEST=enableuser&REQUEST_ACCEPT=true&REQUEST_USER=$REQUEST_USER&REQUEST_USER_EMAIL=$REQUEST_USER_EMAIL&REQUEST_SECRET=`cgi_encodevar $REQUEST_SECRET`\");>"
2012-11-19 23:52:30 +01:00
echo -n " <input type=button id=enableuser value=\"Deny\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
2013-07-11 11:03:09 +02:00
echo -n "REQUEST=enableuser&REQUEST_ACCEPT=&REQUEST_USER=$REQUEST_USER&REQUEST_USER_EMAIL=$REQUEST_USER_EMAIL&REQUEST_SECRET=`cgi_encodevar $REQUEST_SECRET`\");>"
2012-11-19 23:52:30 +01:00
done < $WEBBUILD_STATEDIR/requests
echo -n "</div>"
fi
2012-09-10 17:48:21 +02:00
numprocess=0
2013-12-14 11:57:03 +01:00
tac $WEBBUILD_STATEDIR/processes | \
2012-09-10 17:48:21 +02:00
while read line; do
set -- $line
2012-10-18 00:49:13 +02:00
RETCODE=$6
2014-02-01 14:56:17 +01:00
PROCESSLOG=$5
2012-09-21 12:57:19 +02:00
# if [ -e /proc/$1 -o $5 -lt 256 ]; then
2013-06-01 00:30:05 +02:00
numprocess=$(($numprocess + 1))
2014-04-25 12:10:30 +02:00
cmdline=`echo "$line" | sed "s|$1 $2 $3 $4 $5 $RETCODE ||"`
cmdline=`echo "$cmdline" | sed "s| --colors web||"`
2012-11-19 23:52:30 +01:00
PACKAGE_ENCODED=`cgi_encodevar $4`
[ $numprocess -eq 1 ] && {
2013-12-14 11:57:03 +01:00
# echo -n "<div align=left class=processes>"
2012-11-19 23:52:30 +01:00
echo -n "<b>Webbuild jobs:</b> "
if [ "$STATE_JOBSSHOWALL" != "1" ]; then
echo "[ <a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=true\");>Show all</a> ]"
2012-09-21 12:57:19 +02:00
else
2012-11-19 23:52:30 +01:00
echo "[ <a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=false\");>Show mine only</a> ]"
2012-09-21 12:57:19 +02:00
fi
2013-11-09 14:31:17 +01:00
echo -n "<i>(please click on [x] to clean your jobs when they are done)</i>"
2012-09-10 17:48:21 +02:00
echo -n "<br>"
2012-11-19 23:52:30 +01:00
}
[ "$STATE_JOBSSHOWALL" = "1" -o "$USER" = "$2" ] || continue
2012-12-01 23:36:43 +01:00
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...\">"
2014-02-01 14:56:17 +01:00
elif [ ! -e $PROCESSLOG ]; then
2014-04-25 12:10:30 +02:00
sed -i "\,$1 $USER.* $PROCESSLOG ,d" $WEBBUILD_STATEDIR/processes
2014-02-01 14:56:17 +01:00
continue
2012-12-01 23:36:43 +01:00
else
2014-02-01 14:56:17 +01:00
if [ $RETCODE -eq 256 ]; then
$SUDO_WRAPPER finishprocess $1 "$USER" $5
RETCODE=$?
fi
2012-12-01 23:36:43 +01:00
if [ $RETCODE -eq 0 ]; then
2013-06-04 02:46:14 +02:00
# echo -n "<font color=lightgreen><b>OK</b></font>"
2012-12-01 23:36:43 +01:00
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
2012-11-19 23:52:30 +01:00
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\")>"
2014-04-25 12:10:30 +02:00
echo -n "<b><i>$cmdline</i></b>\"</a> (`date -r $5 +'%F %T'`)"
2012-11-19 23:52:30 +01:00
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>"
2013-12-14 11:57:03 +01:00
done
2014-04-25 12:10:30 +02:00
2013-12-14 11:57:03 +01:00
# [ $numprocess -gt 0 ] && echo -n "</div>"
2012-09-10 17:48:21 +02:00
echo -n "]]></processes></webbuild>"
exit
2012-09-06 18:55:33 +02:00
fi
2012-09-10 17:48:21 +02:00
# message send request (social_log)
if [ "$REQUEST" = "message" -a "$USER" -a "$USER_CANSENDMESSAGES" ]; then
# external (autodist) social messages
2012-09-21 12:57:19 +02:00
[ "$MESSAGETYPE" ] || MESSAGETYPE=broadcastmessage
social_log "SUSER=$USER STYPE=$MESSAGETYPE SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`"
2012-09-10 17:48:21 +02:00
echo "</webbuild>"
exit
2012-09-06 18:55:33 +02:00
fi
2012-09-10 17:48:21 +02:00
# repsearch request
if [ "$REQUEST" = "repsearch" ]; then
echo -n "<output><![CDATA["
2013-11-09 14:31:17 +01:00
echo -n "<hr><b>Search results for \"$REPSEARCHTEXT\":</b><div align=left class=output id=outputtop style=\"font-family:serif;color:black;background-color:#E0F2D0;\">"
# echo -n "<pre><!-- SCROLL -->"
2014-11-16 16:08:06 +01:00
REPSEARCHTEXT_FMT=`echo "${REPSEARCHTEXT}" | sed "s|[[:space:]]|+|g"`
curl -s "${WEBBUILD_DISTROQUERY_URL}?query=${REPSEARCHTEXT_FMT}&search_milestone2=true&search_devel=true\
2014-10-05 19:26:55 +02:00
&search_i586=true&search_x86_64=true&search_arm=true&search_sources=true&query_compact=true&replyplain=true" | \
sed "s| \(href=.\)/| \1${SITE_BASE_URL}/|g"
2014-05-23 21:17:27 +02:00
# $SUDO_WRAPPER 0 local "$USER" "" "autodist-repository search -i ${REPSEARCHTEXT/-/\-}" | \
2013-11-09 14:31:17 +01:00
# parse_search_output ${AUTOPORT_ARCH[$ENVIRONMENT]}
2012-11-19 23:52:30 +01:00
# sed "s|\(.*(source).*\)|<font color=white><b>\1</b></font>|;
# s|\(.*(${AUTOPORT_ARCH[$ENVIRONMENT]}).*\)|<font color=lightgreen>\1</font>|"
2013-11-09 14:31:17 +01:00
# echo -n "<!-- ENDSCROLL --></pre>"
echo "</div>"
echo "]]></output></webbuild>"
2012-11-19 23:52:30 +01:00
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>"
2014-07-08 18:55:58 +02:00
WHAT_PROVIDES=`$SUDO_WRAPPER binary $ENVIRONMENT "$USER" "" "rpm -q --what-provides \"$ENVSEARCHTEXT\"" | sort -u`
2012-11-19 23:52:30 +01:00
echo -n "$WHAT_PROVIDES<br>"
if [ "${WHAT_PROVIDES:0:10}" != "no package" ]; then
for f in $WHAT_PROVIDES; do
2013-01-19 16:24:26 +01:00
echo -n "<br><font style=\"background-color:gray\">$f installed package info:</font><br>"
2012-11-19 23:52:30 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -qi $f"
if [ $? -eq 0 ]; then
2013-01-19 16:24:26 +01:00
echo -n "<br><font style=\"color:gold\">$f provides:</font><br>"
2012-11-19 23:52:30 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -q $f --provides"
2013-01-19 16:24:26 +01:00
echo -n "<br><font style=\"color:gold\">$f requirements:</font><br>"
2012-11-19 23:52:30 +01:00
$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>|"
2012-09-10 17:48:21 +02:00
echo -n "<!-- ENDSCROLL --></pre>"
echo "</div>]]></output></webbuild>"
exit
fi
2013-07-11 11:03:09 +02:00
# rpm manager
2013-06-05 18:31:55 +02:00
if [ "$REQUEST" = "rpmmanager" ]; then
2013-11-09 14:31:17 +01:00
environment_descr=`print_environment_descr $ENVIRONMENT`
2013-06-05 18:31:55 +02:00
echo -n "<window><![CDATA["
echo -n "<div class=windowcontainer><div class=windowopaquebackground></div>"
2013-11-09 14:31:17 +01:00
echo -n "<div class=windowbox style=\"top:-50px;\"><div style=\"overflow:auto;width:600px;height:420px\">"
2013-06-05 18:31:55 +02:00
echo -n "RPM manager for <b>$environment_descr</b> environment<br>"
2013-07-11 11:03:09 +02:00
# select rpm manager resource directory to display
echo "<select id=rpmmanagerdir "
echo -n "onchange=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=rpmmanager&RPMMANAGERDIR=\"+this.value);>"
[ "$RPMMANAGERDIR" = "RPMS" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"RPMS\" $SELECTED>Local *.${AUTOPORT_ARCH[$ENVIRONMENT]}.rpm</option>"
[ "$RPMMANAGERDIR" = "RPMSNOARCH" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"RPMSNOARCH\" $SELECTED>Local *.noarch.rpm</option>"
[ "$RPMMANAGERDIR" = "SRPMS" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"SRPMS\" $SELECTED>Local *.src.rpm</option>"
if [ -e $local_ftp/$REPOSITORY ]; then
[ "$RPMMANAGERDIR" = "REP_RPMS" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"REP_RPMS\" $SELECTED>$REPOSITORY *.${AUTOPORT_ARCH[$ENVIRONMENT]}.rpm</option>"
[ "$RPMMANAGERDIR" = "REP_RPMSNOARCH" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"REP_RPMSNOARCH\" $SELECTED>$REPOSITORY *.noarch.rpm</option>"
[ "$RPMMANAGERDIR" = "REP_SRPMS" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"REP_SRPMS\" $SELECTED>$REPOSITORY *.src.rpm</option>"
fi
echo -n "</select>"
# multiselect
echo -n "<div style=\"text-align:left\"><label><input type=checkbox name=pkgsselectallcheckbox value=\"\" onclick=checkAllBoxes('rpmmanagercheckbox',this.checked);>select/unselect all</label>"
echo -n "</div>"
2013-06-05 18:31:55 +02:00
echo -n "<div class=multiselect style=\"height:350px;text-align:left;\">"
2013-07-11 11:03:09 +02:00
resolve_rpmmanagerdir "$RPMMANAGERDIR" "${AUTOPORT_ARCH[$ENVIRONMENT]}" "$REPOSITORY"
rpmmanagerfiles=$rpmmanagerdir/$rpmmanagermask
if [ "${rpmmanagermode}" = "environment" ]; then
# local files in environment
2014-07-08 18:55:58 +02:00
$SUDO_WRAPPER binary $ENVIRONMENT "$USER" "" "ls -t $rpmmanagerfiles 2>/dev/null" | \
2013-07-11 11:03:09 +02:00
while read f; do
2013-06-05 18:31:55 +02:00
pkgname=`basename $f`
2013-07-11 11:03:09 +02:00
echo -n "<label>"
echo -n "<input type=checkbox name=rpmmanagercheckbox value=\"$pkgname\">${pkgname} "
echo -n "<a title=\"Click to download file\" href=\"#\" "
echo -n "onclick=getDownload(\"ENVIRONMENT=$ENVIRONMENT&REQUEST=rpmmanagerdownload&RPMMANAGERDIR=$RPMMANAGERDIR&"
2013-11-09 14:31:17 +01:00
echo -n "&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&RPMMANAGERPACKAGES=\"+encodeURIComponent('$pkgname'));>"
2013-07-11 11:03:09 +02:00
echo -n "<img src=/images/download.png width=16 height=16></img></a>"
echo -n "</label>"
done
else
# files in real local repositories
ls -t $rpmmanagerfiles 2>/dev/null | \
while read f; do
pkgname=`basename $f`
echo -n "<label>"
echo -n "<input type=checkbox name=rpmmanagercheckbox value=\"$pkgname\">${pkgname} "
echo -n "<a title=\"Click to download file\" href=\"#\" "
echo -n "onclick=getDownload(\"ENVIRONMENT=$ENVIRONMENT&REQUEST=rpmmanagerdownload&RPMMANAGERDIR=$RPMMANAGERDIR&"
2013-11-09 14:31:17 +01:00
echo -n "&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&RPMMANAGERPACKAGES=\"+encodeURIComponent('$pkgname'));>"
2013-07-11 11:03:09 +02:00
echo -n "<img src=/images/download.png width=16 height=16></img></a>"
echo -n "</label>"
done
fi
2013-06-05 18:31:55 +02:00
echo -n "</div>"
echo -n "</div>"
if [ "$USER_CANINSTALL" ]; then
# force rpm install/upgrade operation
echo -n "<label style=\"background-color:red;padding:1px;\"><input type=checkbox id=\"rpmmanagerforce\" value=\"force\">force </label> "
# rpm manager install packages
echo -n "<input type=button value=\"install\" onclick="
echo -n "p=getCheckedValuesByName('rpmmanagercheckbox');"
2013-11-09 14:31:17 +01:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
2013-06-05 18:31:55 +02:00
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
2013-07-11 11:03:09 +02:00
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
2013-06-05 18:31:55 +02:00
echo -n "RPMMANAGERFORCE=\"+getElementById('rpmmanagerforce').checked+\"&"
echo -n "REQUEST=rpmmanagerinstall\""
echo -n ",\"`cgi_encodevar "Install <b>"`\"+p+"
echo -n "\"`cgi_encodevar "</b> in <b>$environment_descr</b> environment?"`\""
echo -n ");> "
# rpm manager upgrade packages
echo -n "<input type=button value=\"upgrade\" onclick="
echo -n "p=getCheckedValuesByName('rpmmanagercheckbox');"
2013-11-09 14:31:17 +01:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
2013-06-05 18:31:55 +02:00
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "RPMMANAGERFORCE=\"+getElementById('rpmmanagerforce').checked+\"&"
echo -n "REQUEST=rpmmanagerupgrade\""
echo -n ",\"`cgi_encodevar "Upgrade <b>"`\"+p+"
echo -n "\"`cgi_encodevar "</b> in <b>$environment_descr</b> environment?"`\""
2013-07-11 11:03:09 +02:00
echo -n ");> "
2013-06-05 18:31:55 +02:00
fi
2013-07-11 11:03:09 +02:00
# rpm manager close link
2013-06-05 18:31:55 +02:00
echo -n "<br><a href=# onclick=clearid(\"window\")>CLOSE</a></div></div>"
echo "]]></window></webbuild>"
exit
fi
2012-10-18 00:49:13 +02:00
# set current user environment if not passed
if [ ! "$ENVIRONMENT" ]; then
2012-09-06 18:55:33 +02:00
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue
2012-10-18 00:49:13 +02:00
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "$USER" ]; then
ENVIRONMENT=$i
break
2012-09-06 18:55:33 +02:00
fi
2012-10-18 00:49:13 +02:00
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "contrib" ]; then
ENVIRONMENT=$i
2012-09-06 18:55:33 +02:00
fi
done
2012-10-18 00:49:13 +02:00
[ "$ENVIRONMENT" ] || ENVIRONMENT=$DEFAULT_ENVIRONMENT
2012-09-02 13:18:52 +02:00
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`
2013-05-23 13:02:22 +02:00
[ -e "$WORKINGHOME/RPM" ] || WORKINGHOME="/usr/src/"
2012-09-02 13:18:52 +02:00
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
2012-09-10 17:48:21 +02:00
# show log
2012-10-18 00:49:13 +02:00
if [ "$REQUEST" = "showlog" -o "$REQUEST" = "autobuildedit" ]; then
2012-11-19 23:52:30 +01:00
showlog
2012-10-18 00:49:13 +02:00
if [ "$REQUEST" = "autobuildedit" ]; then
REQUEST=edit
else
echo -n "</webbuild>"
exit
fi
2012-09-10 17:48:21 +02:00
fi
2012-10-18 00:49:13 +02:00
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=
2013-01-19 16:24:26 +01:00
echo -n " <span style=\"white-space:nowrap\">Autodist:<input type=checkbox id=\"advancedcontrols\" "
2012-10-18 00:49:13 +02:00
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=
2013-01-19 16:24:26 +01:00
echo -n " <span style=\"white-space:nowrap\">Privacy:<input type=checkbox id=\"privacymode\" "
2012-10-18 00:49:13 +02:00
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>"
2012-09-02 13:18:52 +02:00
2012-10-18 00:49:13 +02:00
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$ENVIRONMENT]}" != "x86_64" ]; then
SUDO_WRAPPER="linux32 $SUDO_WRAPPER"
fi
2012-11-19 23:52:30 +01:00
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=
2014-04-25 12:10:30 +02:00
if [ "$USER_ENVIRONMENTS" ]; then
for u in $USER_ENVIRONMENTS; do
if [ "$i" = "$u" ]; then
echo -n "<option value=\"$i\" $SELECTED>"
print_environment_descr $i
echo -n "</option>"
break
fi
done
elif [ "${AUTOPORT_CHROOT_USER[$i]}" = "$USER" -o "${AUTOPORT_CHROOT_USER[$i]}" = "contrib" -o "$USER_ALLENVIRONMENTS" ]; then
2012-11-19 23:52:30 +01:00
echo -n "<option value=\"$i\" $SELECTED>"
print_environment_descr $i
echo -n "</option>"
fi
done
echo -n "</select>"
echo -n "]]></environments>"
2012-10-18 00:49:13 +02:00
if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "<specedit> </specedit>"
2013-11-09 14:31:17 +01:00
elif [ ! "$REQUEST" -o "$REQUEST" = "changeenvironment" -o "$REQUEST" = "switchmaintainermode" \
-o "$REQUEST" = "prepare" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "edit" ]; then
2012-10-18 00:49:13 +02:00
# SPECFILES select
2012-09-02 13:18:52 +02:00
echo -n "<specedit><![CDATA["
echo -n " Edit:<select id=specfile "
2012-12-01 23:36:43 +01:00
echo -n "onchange=ajax_getvalues(\"REQUEST=edit&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
2012-09-04 13:05:57 +02:00
echo -n "PACKAGE=\"+encodeURIComponent(this.value)+\"&REQUEST=changespec\");>"
2012-09-02 13:18:52 +02:00
echo -n "<option value=\"\">-- Select a .spec file --</option>"
2014-07-08 18:55:58 +02:00
$SUDO_WRAPPER binary $ENVIRONMENT "$USER" "" "ls *.spec 2>/dev/null| sed \"s|.spec$||\" | sort -f" | while read f; do
2012-09-21 12:57:19 +02:00
specname=${f/.spec}
2012-09-02 13:18:52 +02:00
[ "$PACKAGE" = "$specname" ] && SELECTED="selected=\"selected\"" || SELECTED=
2013-05-19 16:54:31 +02:00
echo -n "<option value=\"$specname\" $SELECTED>${specname}</option>"
2012-09-02 13:18:52 +02:00
done
2013-05-19 16:54:31 +02:00
echo -n "</select>.spec]]></specedit>"
2012-09-02 13:18:52 +02:00
fi
2012-10-18 00:49:13 +02:00
[ "$PACKAGE" -a ! "$REQUEST" ] && REQUEST=edit
2012-09-02 13:18:52 +02:00
# clean output when changing environment
if [ ! "$REPOSITORY" -a ! "$PACKAGE" -a ! "$REQUEST" = "repsearch" ]; then
echo -n "<editor> </editor>"
2012-11-19 23:52:30 +01:00
echo -n "<editcontrols> </editcontrols>"
2013-06-03 13:46:04 +02:00
echo -n "<showlogcontrols> </showlogcontrols>"
2012-09-02 13:18:52 +02:00
fi
# REPOSITORIES search
if [ ! "$REPSEARCHTEXT" ]; then
echo -n "<searchbox><![CDATA["
2012-11-19 23:52:30 +01:00
echo -n "<div class=searchbox>Search repositories:"
2013-11-09 14:31:17 +01:00
2012-11-19 23:52:30 +01:00
#<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));>"
2013-11-09 14:31:17 +01:00
2012-09-02 13:18:52 +02:00
if [ "$PACKAGE" ]; then
2013-11-09 14:31:17 +01:00
echo -n "<input type=text style=\"display:block;width:98%;align:center;padding:0;margin:0;\" id=repsearchtext value=\"${PACKAGE/*\/}\" "
2012-09-02 13:18:52 +02:00
else
2012-11-19 23:52:30 +01:00
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=''\" "
2012-09-02 13:18:52 +02:00
fi
2012-11-19 23:52:30 +01:00
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));>"
2012-09-02 13:18:52 +02:00
echo -n "</div>]]></searchbox>"
fi
2012-10-18 00:49:13 +02:00
if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$MAINTAINERMODE" = "true" ]; then
2012-09-06 18:55:33 +02:00
# REPOSITORIES select
2012-09-10 17:48:21 +02:00
if [ "$MAINTAINERMODE" = "true" -o ! "$REPOSITORY" -o "$REQUEST" = "changeenvironment" ]; then
2012-09-06 18:55:33 +02:00
echo -n "<repositories><![CDATA[Repository:<select id=repository "
2012-10-18 00:49:13 +02:00
echo -n "onchange=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=\"+this.value+\""
2012-09-10 17:48:21 +02:00
if [ "$USER_CANMAINTAIN" ]; then
2012-09-06 18:55:33 +02:00
echo -n "&MAINTAINERMODE=\"+getElementById('maintain').checked+\""
2012-09-02 13:18:52 +02:00
fi
2012-09-10 17:48:21 +02:00
if [ ! "$MAINTAINERMODE" ]; then
echo -n "&PACKAGE=\"+encodeURIComponent(getSelectedValueById('specfile'))+\""
fi
echo -n "&REQUEST=changerepository\");>"
2012-09-06 18:55:33 +02:00
echo -n "<option value=\"\">-- Select a repository --</option>"
2013-05-22 12:09:19 +02:00
for f in `repository_list`; do
2012-09-06 18:55:33 +02:00
repname=`basename $f`
2012-09-10 17:48:21 +02:00
[ "$repname" = "$REPOSITORY" ] && SELECTED="selected=selected" || SELECTED=
2012-10-18 00:49:13 +02:00
if [ "$MAINTAINERMODE" = "true" -a ! "$USER_ALLREPOSITORIES" ]; then
2014-04-25 12:10:30 +02:00
for u in $USER_CANMAINTAIN_REPOSITORIES; do
2012-10-18 00:49:13 +02:00
[ "$u" = "$repname" ] && echo -n "<option value=\"$repname\" $SELECTED>$repname</option>"
done
else
echo -n "<option value=\"$repname\" $SELECTED>$repname</option>"
fi
2012-09-06 18:55:33 +02:00
done
echo -n "</select>"
echo -n "]]></repositories>"
2012-11-19 23:52:30 +01:00
# echo -n "<editcontrols> </editcontrols>"
2012-09-06 18:55:33 +02:00
echo -n "<packages> </packages>"
echo -n "<operations> </operations>"
fi
2012-10-18 00:49:13 +02:00
else
2013-04-22 12:33:50 +02:00
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>:"
2012-11-19 23:52:30 +01:00
# autobuild edit previous
echo -n "<input type=button name=autobuildeditprev value=\" < \" onclick="
2012-10-18 00:49:13 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&"
echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById(\"autobuildedit\",-1).substring(0,getSelectedValueById(\"autobuildedit\",-1).indexOf(';')))+\"&"
2013-01-19 16:24:26 +01:00
echo -n "LOGTYPE=\"+getSelectedValueById(\"autobuildedit\",-1).substring(getSelectedValueById(\"autobuildedit\",-1).indexOf(';')+1)+\"&LOGSTATUSOK=&"
echo -n "REQUEST=autobuildedit\");>"
2012-11-19 23:52:30 +01:00
# autobuild edit select
2012-10-18 00:49:13 +02:00
echo -n "<select id=autobuildedit "
echo -n "onchange=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&"
echo -n "PACKAGE=\"+encodeURIComponent(this.value.substring(0,this.value.indexOf(';')))+\"&"
2013-01-19 16:24:26 +01:00
echo -n "LOGTYPE=\"+this.value.substring(this.value.indexOf(';')+1)+\"&LOGSTATUSOK=&"
echo -n "REQUEST=autobuildedit\");>"
2012-10-18 00:49:13 +02:00
echo -n "<option value=\"\">-- Select a failed build to review --</option>"
2012-11-19 23:52:30 +01:00
SELECTED=
2013-01-19 16:24:26 +01:00
[ "$STATE_AUTODISTCURRENT" = "1" ] && AUTOUPDATEFILE=$BUILDLOGDIR/autoupdate-current || AUTOUPDATEFILE=$BUILDLOGDIR/autoupdate-last
2012-10-18 00:49:13 +02:00
while read line; do
set -- $line
2013-07-11 11:03:09 +02:00
if [ "$3" != "ok" -a "$3" != "skipped" ]; then
2012-10-18 00:49:13 +02:00
if [ "$REQUEST" != "skip" ]; then
[ "$PACKAGE" = "$1" ] && SELECTED="selected=selected" || SELECTED=
else
2012-11-19 23:52:30 +01:00
[ "$SELECTED" ] && {
NEXTPACKAGE=$1
NEXTLOGTYPE=$2
}
2012-10-18 00:49:13 +02:00
fi
2013-06-05 14:03:56 +02:00
# skip 'higher version' (2), 'cant' find update' (3)
# 'no updates available' (4) autospec return codes
if [ "$2-$3" != "update-2" -a "$2-$3" != "autoupdate-2" -a \
"$2-$3" != "update-3" -a "$2-$3" != "autoupdate-3" -a \
"$2-$3" != "update-4" -a "$2-$3" != "autoupdate-4" ]; then
echo -n "<option value=\"$1;$2\" $SELECTED>$1 ($2)</option>"
fi
2012-10-18 00:49:13 +02:00
if [ "$PACKAGE" = "$1" -a "$REQUEST" = "skip" ]; then
SELECTED="selected=selected"
else
SELECTED=
fi
fi
2012-11-19 23:52:30 +01:00
done < $AUTOUPDATEFILE
echo -n "</select>"
# autobuild edit next
2012-10-18 00:49:13 +02:00
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(';')))+\"&"
2013-01-19 16:24:26 +01:00
echo -n "LOGTYPE=\"+getSelectedValueById(\"autobuildedit\",1).substring(getSelectedValueById(\"autobuildedit\",1).indexOf(';')+1)+\"&LOGSTATUSOK=&"
echo -n "REQUEST=autobuildedit\");>"
2012-11-19 23:52:30 +01:00
# autodist current checkbox (in progress)
2013-01-19 16:24:26 +01:00
[ "$STATE_AUTODISTCURRENT" = "1" ] && SELECTED="checked" || SELECTED=
2012-11-19 23:52:30 +01:00
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>"
2012-10-18 00:49:13 +02:00
echo -n " ]]></repositories>"
echo -n "<operations> </operations>"
echo -n "<speccreate> </speccreate>"
echo -n "<packages> </packages>"
2012-11-19 23:52:30 +01:00
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
2012-10-18 00:49:13 +02:00
fi
2012-09-02 13:18:52 +02:00
2012-10-18 00:49:13 +02:00
if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
2012-09-06 18:55:33 +02:00
# PACKAGES (SRPM) select
2012-09-10 17:48:21 +02:00
if [ "$REQUEST" = "changerepository" -o "$REQUEST" = "switchmaintainermode" -a "$MAINTAINERMODE" != "true" ]; then
2012-09-06 18:55:33 +02:00
echo -n "<packages><![CDATA[ SRPMS:"
2012-10-18 00:49:13 +02:00
echo -n "<select id=package onchange="
2012-09-21 12:57:19 +02:00
echo -n "getElementById('preparebutton').disabled=0;getElementById('portbutton').disabled=0;>"
2012-09-10 17:48:21 +02:00
#(getElementById('package').selectedIndex);>"
2012-09-06 18:55:33 +02:00
echo "<option value=\"\">-- Select a SRPM package --</option>"
2012-09-21 12:57:19 +02:00
SRPMBUTTONDISABLED="disabled=disabled"
2014-09-28 12:34:41 +02:00
if [ "$local_ftp" -a -e $local_ftp/$REPOSITORY ]; then
2013-07-11 11:03:09 +02:00
if [ $local_ftp/$REPOSITORY/SRPMS.base -nt $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY ]; then
2014-06-07 19:20:56 +02:00
ls --color=none $local_ftp/$REPOSITORY/SRPMS.base/ | grep ".src.rpm$" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
2013-07-11 11:03:09 +02:00
fi
else
2014-09-28 12:34:41 +02:00
curl -s $REPS_BASE_URL/$REPOSITORY/SRPMS.base/ | grep .src.rpm | \
2013-07-11 11:03:09 +02:00
sed "s|.*\.src\.rpm\">\(.*\)</a>.*|\1|" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
2013-05-19 16:54:31 +02:00
fi
2012-11-19 23:52:30 +01:00
while read f; do
2014-05-22 18:20:42 +02:00
pkgname=${f%.src.rpm}
2012-09-06 18:55:33 +02:00
pkgrel=${pkgname/*-}
2013-07-11 11:03:09 +02:00
pkgname=${pkgname%-$pkgrel}
2012-09-06 18:55:33 +02:00
pkgver=${pkgname/*-}
2013-07-11 11:03:09 +02:00
pkgname=${pkgname%-$pkgver}
2012-09-06 18:55:33 +02:00
if [ "$PACKAGE" = "$pkgname" ]; then
2012-11-19 23:52:30 +01:00
SELECTED="selected=\"selected\""
2012-09-21 12:57:19 +02:00
SRPMBUTTONDISABLED=
2012-09-06 18:55:33 +02:00
else
SELECTED=
fi
echo -n "<option value=\"$pkgname\" $SELECTED>${pkgname} ${pkgver}-${pkgrel}</option>"
2012-11-19 23:52:30 +01:00
done < $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
2012-09-06 18:55:33 +02:00
echo -n "</select>"
echo -n "]]></packages>"
2012-09-02 13:18:52 +02:00
if [ "$MAINTAINERMODE" != "true" ]; then
2012-09-10 17:48:21 +02:00
echo -n "<operations><![CDATA["
2012-10-18 00:49:13 +02:00
echo -n "<input type=button name=prepare value=\"Unpack and edit\" id=preparebutton onclick="
2012-09-21 12:57:19 +02:00
echo -n "ajax_getvalues(\"REQUEST=prepare&REPOSITORY=\"+getSelectedValueById('repository')+\""
2013-01-19 16:24:26 +01:00
echo -n "&ENVIRONMENT=$ENVIRONMENT&"
if [ "$USER_CANMAINTAIN" ]; then
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
fi
2012-09-21 12:57:19 +02:00
echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById('package'))); $SRPMBUTTONDISABLED>"
2013-12-14 11:57:03 +01:00
if [ "${AUTOPORT_PORT_REPOSITORY[$ENVIRONMENT]}" ]; then
2012-10-18 00:49:13 +02:00
echo -n "<input type=button name=port value=\"Port\" id=portbutton onclick="
2012-09-21 12:57:19 +02:00
echo -n "ajax_getvalues(\"REQUEST=autoport&REPOSITORY=\"+getSelectedValueById('repository')+\""
2013-01-19 16:24:26 +01:00
echo -n "&ENVIRONMENT=$ENVIRONMENT&"
2013-12-14 11:57:03 +01:00
if [ "${AUTOPORT_PORT_REPOSITORY[$ENVIRONMENT]}" != "#SELF" ]; then
echo -n "AUTOPORTRELEASEREPOSITORY=${AUTOPORT_PORT_REPOSITORY[$ENVIRONMENT]}&"
fi
2013-01-19 16:24:26 +01:00
if [ "$USER_CANMAINTAIN" ]; then
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
fi
2012-12-01 23:36:43 +01:00
echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById('specfile'))+\"&"
echo -n "AUTOPORTPACKAGE=\"+encodeURIComponent(getSelectedValueById('package'))); $SRPMBUTTONDISABLED>"
2012-09-21 12:57:19 +02:00
fi
2012-09-10 17:48:21 +02:00
echo -n "]]></operations>"
2012-09-02 13:18:52 +02:00
fi
2012-09-06 18:55:33 +02:00
fi
# SPECFILE creation
if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -a "$MAINTAINERMODE" != "true" ]; then
2013-05-04 15:44:57 +02:00
echo -n "<speccreate><![CDATA[<div style=\"white-space:nowrap;\">"
2013-05-19 16:54:31 +02:00
echo -n " Start from URL:<input onChange=\"suggestSpecName()\" type=text id=speccreateurl value=\"\" style=\"width:32%\">"
2013-05-20 18:27:13 +02:00
echo -n " name:<input type=text id=speccreatename disabled value=\"\" style=\"width:10%\">"
echo -n " type:<select id=speccreatetype disabled>"
2013-04-22 12:33:50 +02:00
for t in `ls /usr/share/autospec/templates`; do
[ "$t" = "library" ] && SELECTED="selected=selected" || SELECTED=
2013-05-19 16:54:31 +02:00
echo -n "<option id=speccreatetype value=\"$t\" $SELECTED>$t</option>"
2012-09-06 18:55:33 +02:00
done
echo -n "</select>"
2013-05-20 18:27:13 +02:00
echo -n " version:<input type=text disabled id=speccreateversion value=\"\" style=\"width:5%\">"
2013-07-11 11:03:09 +02:00
echo -n " branch/tag:<input type=text disabled id=speccreategitbranch value=\"\" style=\"width:5%\">"
2013-05-19 16:54:31 +02:00
echo -n "<input type=button disabled id=speccreatebutton value=\"Create .spec\" onclick=ajax_getvalues(\""
2012-09-06 18:55:33 +02:00
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+\"&"
2013-04-22 12:33:50 +02:00
echo -n "SPECCREATEGITBRANCH=\"+getElementById('speccreategitbranch').value+\"&"
2012-09-06 18:55:33 +02:00
echo -n "SPECCREATEURL=\"+encodeURIComponent(getElementById('speccreateurl').value));>"
2013-05-04 15:44:57 +02:00
echo "</div>]]></speccreate>"
2012-09-06 18:55:33 +02:00
elif [ "$MAINTAINERMODE" = "true" ]; then
echo -n "<speccreate> </speccreate>"
2012-09-02 13:18:52 +02:00
fi
2012-09-21 12:57:19 +02:00
#else
# echo -n "<repositories> </repositories><packages> </packages><operations> </operations><speccreate> </speccreate> <operations></operations>"
2012-09-06 18:55:33 +02:00
fi
2012-09-21 12:57:19 +02:00
2012-09-06 18:55:33 +02:00
if [ "$REQUEST" = "changespec" ]; then
2012-09-02 13:18:52 +02:00
if [ "$PACKAGE" ]; then
REQUEST="edit";
fi
elif [ "$REQUEST" = "broadcastmessage" ]; then
BROADCASTMESSAGE=`echo $BROADCASTMESSAGE | sed "s|<|\<|g"`
2012-09-06 18:55:33 +02:00
social_log "SUSER=$USER STYPE=broadcastmessage SEMAIL=$USER_EMAIL STEXT=\"said:"<i>$BROADCASTMESSAGE</i>"\" STIME=`date +%s`"
2012-09-02 13:18:52 +02:00
REQUEST=
fi
if [ "$SPECTEXT" ]; then
# save specfile
2012-11-19 23:52:30 +01:00
tmpfile=`mktemp --suffix=.webbuildspectmp`
2012-09-02 13:18:52 +02:00
echo -n $SPECTEXT | perl -MURI::Escape -e 'print uri_unescape(<>)' > $tmpfile
chmod 644 $tmpfile
2013-11-09 14:31:17 +01:00
if [ "REQUEST" = "renamespec" -a "$RENAMESPECFROM" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" ${PACKAGE/*\/} "cat $tmpfile > ${RENAMESPECFROM/*\/}.spec" $tmpfile
else
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" ${PACKAGE/*\/} "cat $tmpfile > ${PACKAGE/*\/}.spec" $tmpfile
fi
2012-11-19 23:52:30 +01:00
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
}
2012-09-02 13:18:52 +02:00
rm -f $tmpfile
fi
2012-09-10 17:48:21 +02:00
if [ "$REQUEST" = "edit" -o "$REQUEST" = "prepare" ]; then
2012-11-19 23:52:30 +01:00
if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
2013-01-19 16:24:26 +01:00
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`"
2012-11-19 23:52:30 +01:00
fi
2012-09-10 17:48:21 +02:00
fi
2012-09-02 13:18:52 +02:00
# Here requests which update the specfile, so editor is refreshed after
if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccreate" -o \
2012-10-18 00:49:13 +02:00
"$REQUEST" = "rebuildspec" -o "$REQUEST" = "renamespec" -o "$REQUEST" = "deletespec" -o \
2012-11-19 23:52:30 +01:00
"$REQUEST" = "autodistprepare" -o "$REQUEST" = "autodistupdate" -o "$REQUEST" = "addpkgnote" ]; then
2014-10-31 22:27:05 +01:00
if [ "$REQUEST" = "speccreate" ]; then
OUTPUTMODE="outputtop"
else
OUTPUTMODE="outputbottom"
fi
echo -n "<output><![CDATA[<hr><b>Console output:</b><div align=left class=output id=$OUTPUTMODE>"
2012-09-02 13:18:52 +02:00
echo -n "<pre>"
RET=255
case $REQUEST in
2012-11-19 23:52:30 +01:00
"prepare") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a1 --server $REPOSITORY"; RET=$? ;;
"updatespec") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-update"
2013-01-19 16:24:26 +01:00
[ "$DEBUG" = "true" ] && RPMFORCEADD="$RPMFORCEADD --debug"
2013-11-09 14:31:17 +01:00
[ "$USER_FULLNAME" -a "$USER_EMAIL" ] && RPMUSERADD="--packager-fullname=\"$USER_FULLNAME\" --packager-email=\"$USER_EMAIL\""
2012-11-19 23:52:30 +01:00
if [ "$UPDATESPECVERSION" -a "$REBUILDSPECCHANGELOG" ]; then
2012-09-02 13:18:52 +02:00
echo "ERROR: new version and changelog can't be specified together"
elif [ "$REBUILDSPECCHANGELOG" ]; then
2013-11-09 14:31:17 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a4 $RPMFORCEADD --rebuild \
--changelog \"$REBUILDSPECCHANGELOG\" $RPMUSERADD"
2012-11-19 23:52:30 +01:00
elif [ "$UPDATESPECVERSION" ]; then
2013-11-09 14:31:17 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a3,4 $RPMFORCEADD $UPDATESPECVERSION \
$RPMUSERADD"
2012-09-02 13:18:52 +02:00
else
2013-11-09 14:31:17 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a2:4 $RPMFORCEADD $UPDATESPECVERSION \
$RPMUSERADD"
2012-09-02 13:18:52 +02:00
fi
2012-09-21 12:57:19 +02:00
RET=$?
2012-10-18 00:49:13 +02:00
;;
2012-09-02 13:18:52 +02:00
"speccreate") if [ "$SPECCREATEURL" -a "$PACKAGE" ]; then
2014-11-13 14:30:28 +01:00
FOUND_EXISTING=`curl -s "${WEBBUILD_DISTROQUERY_URL}?package=$PACKAGE&search_milestone2=true&search_devel=true&search_sources=true&query_compact=true&replyplain=true" | \
2014-10-31 22:27:05 +01:00
sed "s|.*\([0-9][0-9]*\) result.*|\1|"`
2014-11-13 14:30:28 +01:00
if [ "$FOUND_EXISTING" != "0" -a "$FOUND_EXISTING" != "" ]; then
2014-10-31 22:27:05 +01:00
echo -n "<div align=left class=output id=outputtop style=\"font-family:serif;color:black;background-color:#E0F2D0;\">"
echo "<b><font color=red>ERROR: package already exists, please update from appropriate version:</font><b>"
echo -n "<hr><b>Search results for \"$PACKAGE\":</b>"
2014-11-13 14:30:28 +01:00
curl -s "${WEBBUILD_DISTROQUERY_URL}?package=$PACKAGE&search_milestone2=true&search_devel=true&search_sources=true&query_compact=true&replyplain=true" | \
2014-10-31 22:27:05 +01:00
sed "s| \(href=.\)/| \1${SITE_BASE_URL}/|g"
echo -n "</div>"
RET=1
continue
else
if [ "${SPECCREATEURL/\/}" = "$SPECCREATEURL" ]; then
# local source in /SOURCES
SPECCREATEURL="../SOURCES/$SPECCREATEURL"
2013-07-11 11:03:09 +02:00
fi
2014-10-31 22:27:05 +01:00
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 --git-branch $SPECCREATEGITBRANCH"
[ "$USER_FULLNAME" -a "$USER_EMAIL" ] && AUTOSPEC_CMDLINE="$AUTOSPEC_CMDLINE --packager-fullname=\"$USER_FULLNAME\" --packager-email=\"$USER_EMAIL\""
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "$AUTOSPEC_CMD -s \"$SPECCREATEURL\" $AUTOSPEC_CMDLINE \
--changelog \"package created using the webbuild interface\""
RET=$?
[ $RET -eq 0 ] && {
eval `$SUDO_WRAPPER specinfo $ENVIRONMENT "$USER" $PACKAGE ""`
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STARGET=developers STEXT=\"is working on <b>$PACKAGE</b> new package in <b>`print_environment_descr $ENVIRONMENT`</b> environment\" STIME=`date +%s`"
# prepare
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec --nodeps --define=\"_topdir $SPECVAR_WORKINGHOME/RPM\""
RET=$?
if [ $RET -eq 0 ]; then
:
REQUEST_NEXT="showbuilddocs"
fi
}
fi
2012-09-02 13:18:52 +02:00
else
echo "ERROR: both source archive URL and name are needed."
RET=1
fi
;;
2012-10-18 00:49:13 +02:00
"renamespec") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "mv $RENAMESPECFROM.spec $PACKAGE.spec && sed -i \"s|\(Name:[[:space:]]*\).*|\1$PACKAGE|\" $PACKAGE.spec"
2012-09-21 12:57:19 +02:00
RET=$?
2012-10-18 00:49:13 +02:00
[ $RET -eq 0 ] && {
2013-06-03 13:46:04 +02:00
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"renamed <b>$RENAMESPECFROM</b> to <b>$PACKAGE</b> in <b>`print_environment_descr $ENVIRONMENT`</b> environment\" STIME=`date +%s`"
2012-10-18 00:49:13 +02:00
echo "Specfile $RENAMESPECFROM successfully renamed to <b>$PACKAGE</b>."
}
2012-09-21 12:57:19 +02:00
;;
2012-10-18 00:49:13 +02:00
"deletespec") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rm -f $PACKAGE.spec"
2012-09-02 13:18:52 +02:00
RET=$?
2012-09-21 12:57:19 +02:00
[ $RET -eq 0 ] && REQUEST="exit"
2012-09-02 13:18:52 +02:00
;;
2012-10-18 00:49:13 +02:00
"autodistprepare") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
autodistjobs=
if [ "$AUTODISTPKGS" ]; then
for p in $AUTODISTPKGS; do
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
done
else
autodistjobs="$AUTODISTJOB"
fi
2012-11-19 23:52:30 +01:00
[ "$REPOSITORY" ] && REPOSITORYADD="--repository $REPOSITORY" || REPOSITORYADD="--repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}"
2014-11-13 14:30:28 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -p $autodistjobs $REPOSITORYADD --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web"
2012-10-18 00:49:13 +02:00
RET=$?
;;
"autodistupdate") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
2013-01-19 16:24:26 +01:00
[ "$DEBUG" = "true" ] && AUTODISTADD="$AUTODISTADD --debug" || AUTODISTADD=
if [ "$AUTODISTUPDATECHANGELOG" ]; then
AUTODISTADD="$AUTODISTADD --rebuild -- --changelog \"${AUTODISTUPDATECHANGELOG}\""
fi
2012-10-18 00:49:13 +02:00
autodistjobs=
2014-10-29 22:36:58 +01:00
if [ "$AUTODISTVERSION" ]; then
AUTODISTVER="\#$AUTODISTVERSION"
fi
2012-10-18 00:49:13 +02:00
if [ "$AUTODISTPKGS" ]; then
for p in $AUTODISTPKGS; do
2014-10-29 22:36:58 +01:00
autodistjobs="$autodistjobs $AUTODISTJOB/$p${AUTODISTVER}"
2012-10-18 00:49:13 +02:00
done
else
2014-10-29 22:36:58 +01:00
autodistjobs="$AUTODISTJOB${AUTODISTVER}"
2012-10-18 00:49:13 +02:00
fi
2012-11-19 23:52:30 +01:00
[ "$REPOSITORY" ] && REPOSITORYADD="--repository $REPOSITORY" || REPOSITORYADD="--repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}"
2014-10-29 22:36:58 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -u $autodistjobs $REPOSITORYADD --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web"
2012-10-18 00:49:13 +02:00
RET=$?
;;
2012-11-19 23:52:30 +01:00
"addpkgnote") echo "`date +%s` $USER $ENVIRONMENT $PKGNOTE" >> $WEBBUILD_STATEDIR/notes/$PACKAGE.notes; RET=$? ;;
2012-09-02 13:18:52 +02:00
esac
echo -n "</pre>"
if [ $RET -eq 0 ]; then
2013-06-04 02:46:14 +02:00
echo "Result: <font color=lightgreen><b>OK</b></font>"
2012-09-02 13:18:52 +02:00
else
echo "Result: <font color=red><b>ERROR ($RET)</b></font>"
fi
echo -n "</div>"
echo -n "]]></output>"
2012-09-21 12:57:19 +02:00
if [ "$REQUEST" = "exit" ]; then
echo -n "<editcontrols> </editcontrols>"
2013-06-03 13:46:04 +02:00
echo -n "<showlogcontrols> </showlogcontrols>"
2012-09-21 12:57:19 +02:00
echo -n "<operations> </operations>"
echo -n "<editor> </editor>"
echo -n "</webbuild>"
exit
fi
2012-11-19 23:52:30 +01:00
if [ $RET -eq 0 ]; then
REQUEST="edit"
print_editorcontrols
2013-06-03 13:46:04 +02:00
if [ "$PACKAGE" ]; then
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
print_showlogcontrols
fi
fi
2012-11-19 23:52:30 +01:00
else
REQUEST=
fi
2012-09-02 13:18:52 +02:00
fi
2012-09-21 12:57:19 +02:00
# maintainer mode editor
if [ "$MAINTAINERMODE" = "true" ]; then
2012-09-10 17:48:21 +02:00
if [ ! "$REQUEST" -o "$REQUEST" = "changerepository" -o \
"$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "reloadmaintainer" ]; then
2012-09-04 13:05:57 +02:00
echo -n "<editcontrols> </editcontrols>"
2013-06-03 13:46:04 +02:00
echo -n "<showlogcontrols> </showlogcontrols>"
2012-09-10 17:48:21 +02:00
echo -n "<operations> </operations>"
2012-09-21 12:57:19 +02:00
if [ "$REPOSITORY" ]; then
echo -n "<editor><![CDATA["
echo -n "<div class=maintainer>"
echo -n "<b>Recent packages in $REPOSITORY:</b><br>"
2014-09-28 12:34:41 +02:00
if [ "$local_ftp" -a -e $local_ftp/distromatic/$REPOSITORY ]; then
if [ $local_ftp/distromatic/$REPOSITORY/_recent.inc -nt $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY ]; then
cat $local_ftp/distromatic/$REPOSITORY/_recent.inc > $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY
cat $local_ftp/$REPOSITORY/distromatic.log > $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
fi
else
curl -s $REPS_BASE_URL/distromatic/$REPOSITORY/_recent.inc > $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY
curl -s $REPS_BASE_URL/$REPOSITORY/distromatic.log > $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
fi
2014-10-05 19:26:55 +02:00
cat $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY | sed "s|a \(href=.\)/|a target=new \1${SITE_BASE_URL}/|g"
2012-09-21 12:57:19 +02:00
echo -n "<br><b>Log:</b><br><pre>"
2014-09-28 12:34:41 +02:00
cat $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
2012-09-21 12:57:19 +02:00
echo -n "</pre></div>"
2012-10-18 00:49:13 +02:00
echo -n "<input type=button id=updatespecbutton value=\"refresh\" onclick="
2012-09-21 12:57:19 +02:00
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
2012-10-18 00:49:13 +02:00
REQUEST=
2012-09-04 13:05:57 +02:00
fi
2012-09-02 13:18:52 +02:00
fi
2012-10-18 00:49:13 +02:00
if [ "$REQUEST" = "changerepository" -o "$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "changeenvironment" ]; then
REQUEST=
fi
2012-11-19 23:52:30 +01:00
if [ "$PACKAGE" ]; then
[ "$AUTODISTJOB" ] || AUTODISTJOB=${PACKAGE/\/*}
AUTODISTJOB="${AUTODISTJOB/-/_}"
PACKAGE=${PACKAGE/*\/}
eval `$SUDO_WRAPPER specinfo $ENVIRONMENT "$USER" $PACKAGE ""`
[ $? -eq 0 ] && SPECAVAILABLE=1
fi
2012-09-21 12:57:19 +02:00
# specfile editor
2012-11-19 23:52:30 +01:00
if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmaintainermode" -o \
"$REQUEST" = "renamespec" -o "$REQUEST" = "addpkgnote" -a "$MAINTAINERMODE" != "true" ]; then
2012-09-10 17:48:21 +02:00
if [ "$SPECAVAILABLE" ]; then
2012-09-21 12:57:19 +02:00
# editor textarea
2012-11-19 23:52:30 +01:00
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>"
2014-07-08 18:55:58 +02:00
$SUDO_WRAPPER binary $ENVIRONMENT "$USER" $PACKAGE "cat $PACKAGE.spec"
2012-11-19 23:52:30 +01:00
echo -n "</textarea>]]></editor>"
2012-09-21 12:57:19 +02:00
# 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>"
2012-12-01 23:36:43 +01:00
print_editorcontrols
2013-06-03 13:46:04 +02:00
if [ "$PACKAGE" ]; then
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
print_showlogcontrols
fi
fi
2012-09-21 12:57:19 +02:00
fi
2013-07-11 11:03:09 +02:00
REQUEST=$REQUEST_NEXT
2012-09-21 12:57:19 +02:00
fi
# operation panel
if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "<operationpanel><![CDATA["
2012-11-19 23:52:30 +01:00
showEnvironmentPanel
2013-01-19 16:24:26 +01:00
[ "$PACKAGE" ] && {
2014-11-22 19:51:49 +01:00
echo -n "<hr><div style=\"background-color:#E0F2D0\">"
2013-01-19 16:24:26 +01:00
echo -n "Package: <b>$PACKAGE</b><br>Version: <b>"
[ "${SPECVAR_Epoch[0]}" ] && echo -n "${SPECVAR_Epoch[0]}:" || echo -n "0:"
2014-11-22 19:51:49 +01:00
echo -n "${SPECVAR_Version[0]}-${SPECVAR_Release[0]}</b></div>"
2013-01-19 16:24:26 +01:00
}
2014-11-22 19:51:49 +01:00
echo -n "<hr>Arch:<select id=rpmbuildarch>"
2012-09-21 12:57:19 +02:00
for f in i586 arm x86_64 ppc; do
SELECTED=
2013-01-19 16:24:26 +01:00
if [ "$f" = "$RPMBUILDARCH" ]; then
SELECTED="selected=\"selected\"";
elif [ ! "$RPMBUILDARCH" -a "$f" = "${AUTOPORT_ARCH[$ENVIRONMENT]}" ]; then
2012-09-21 12:57:19 +02:00
SELECTED="selected=\"selected\"";
fi
echo -n "<option value=\"$f\" $SELECTED>$f</option>"
done
echo -n "</select>"
2014-11-22 19:51:49 +01:00
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>"
2012-09-21 12:57:19 +02:00
# destination repository select
echo -n "<br>Send to:"
echo -n "<select id=sendrepository>"
2013-04-22 12:33:50 +02:00
if [ "$USER_ALLREPOSITORIES" ]; then
2013-12-14 11:57:03 +01:00
SEND_REPS="`repository_list`"
2013-04-22 12:33:50 +02:00
elif [ "$USER_CANMAINTAIN_REPOSITORIES" ]; then
2013-12-14 11:57:03 +01:00
SEND_REPS="$USER_CANMAINTAIN_REPOSITORIES"
2013-04-22 12:33:50 +02:00
else
SEND_REPS="devel-contrib"
fi
2013-12-14 11:57:03 +01:00
for repname in $SEND_REPS; do
# skip different milestone repositories
2014-04-25 12:10:30 +02:00
[ "${AUTOPORT_IMPORT_REPOSITORIES[$ENVIRONMENT]/$repname}" = "${AUTOPORT_IMPORT_REPOSITORIES[$ENVIRONMENT]}" -a \
$repname != "devel-$USER" ] && continue
2013-04-22 12:33:50 +02:00
SELECTED=
if [ "$SENDREPOSITORY" = "$repname" ]; then
SELECTED="selected=\"selected\"";
2014-04-25 12:10:30 +02:00
elif [ ! "$SENDREPOSITORY" -a "$REPOSITORY" = "$repname" ]; then
SELECTED="selected=\"selected\"";
elif [ ! "$SENDREPOSITORY" -a "${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}" = "$repname" -a ! "$SELECTED" ]; then
2013-04-22 12:33:50 +02:00
SELECTED="selected=\"selected\"";
2012-09-21 12:57:19 +02:00
fi
2013-04-22 12:33:50 +02:00
echo -n "<option value=\"$repname\" $SELECTED>$repname</option>"
2012-09-21 12:57:19 +02:00
done
echo -n "</select><br>"
2012-11-19 23:52:30 +01:00
[ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$STATE_ADVANCEDCONTROLS" ] && echo -n "<hr><div style=\"background-color:#FFFFDE\"><b>Autodist batch builds:</b><br>"
2012-09-21 12:57:19 +02:00
if [ "$PACKAGE" ]; then
2012-09-10 17:48:21 +02:00
if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
2012-10-18 00:49:13 +02:00
echo -n "Patch for $PACKAGE:<br>"
2012-09-21 12:57:19 +02:00
# autodist show patch
2012-11-19 23:52:30 +01:00
echo -n "<input type=button value=\"show current\" onclick="
2012-09-10 17:48:21 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=showpatch\");>"
2012-09-21 12:57:19 +02:00
# autodist remove patch
2012-10-18 00:49:13 +02:00
echo -n "<input type=button value=\"remove\" onclick="
2012-09-10 17:48:21 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
2012-09-21 12:57:19 +02:00
echo -n "REQUEST=removepatch\""
echo -n ",\"`cgi_encodevar "Remove current autodist patch for package <b>$PACKAGE</b>?"`\"); class=redbutton>"
2012-10-18 00:49:13 +02:00
# autodist auto patch
2012-11-19 23:52:30 +01:00
echo -n "<input type=button id=updatepatchbutton value=\"create/refresh\" onclick="
2012-10-18 00:49:13 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "REQUEST=autopatch\""
2012-11-19 23:52:30 +01:00
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>"
2012-09-10 17:48:21 +02:00
fi
2012-09-21 12:57:19 +02:00
fi
2012-10-18 00:49:13 +02:00
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
2012-09-21 12:57:19 +02:00
# autodist list-jobs
2012-10-18 00:49:13 +02:00
[ "$PACKAGE" -a "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ] && echo -n "<hr>"
2012-09-21 12:57:19 +02:00
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')+\"&"
2012-11-19 23:52:30 +01:00
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistjobchange\");>"
2012-09-21 12:57:19 +02:00
echo -n "<option value=\"\">-- select a job --</option>"
2012-11-19 23:52:30 +01:00
AUTODISTJOBSELECTED=
2012-10-18 00:49:13 +02:00
for f in `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist --list-jobs"`; do
2012-09-21 12:57:19 +02:00
SELECTED=
2012-11-19 23:52:30 +01:00
if [ "$AUTODISTJOB" -a "$AUTODISTJOB" = "$f" ]; then
SELECTED="selected=\"selected\""
AUTODISTJOBSELECTED=1
2013-01-19 16:24:26 +01:00
elif [ "$PACKAGE" = "$f" -a ! "$AUTODISTJOB" ]; then
# elif [ "$PACKAGE" = "$f" -a ! "$AUTODISTJOBSELECTED" -a "$REQUEST" != "autodistjobchange" ]; then
2012-09-21 12:57:19 +02:00
SELECTED="selected=\"selected\""
AUTODISTJOB=$f
2012-11-19 23:52:30 +01:00
AUTODISTJOBSELECTED=1
2012-09-21 12:57:19 +02:00
fi
JOBENCODED=`cgi_encodevar $f`
echo -n "<option value=\"$JOBENCODED\" $SELECTED>$f</option>"
done
2012-11-19 23:52:30 +01:00
if [ "$PACKAGE" -a ! "$AUTODISTJOBSELECTED" ]; then
SELECTED="selected=\"selected\""
AUTODISTJOB=$PACKAGE
echo -n "<option value=\"$PACKAGEENCODED\" $SELECTED>$PACKAGE (defaults)</option>"
2012-09-21 12:57:19 +02:00
fi
echo -n "</select>"
2014-11-22 19:51:49 +01:00
if [ "$AUTODISTJOBSELECTED" -a "$AUTODISTJOB" = "$PACKAGE" ]; then
echo -n "<br><font color=red>You should use autodist for this package!</font>"
fi
2012-09-21 12:57:19 +02:00
if [ "$AUTODISTJOB" ]; then
2013-01-19 16:24:26 +01:00
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;\">"
2012-10-18 00:49:13 +02:00
for p in `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist --list-pkgs $AUTODISTJOB"`; do
2012-09-21 12:57:19 +02:00
if [ "$AUTODISTPKGS" ]; then
for i in $AUTODISTPKGS; do
[ "$i" = "$p" ] && { SELECTED=checked; break; } || SELECTED=
done
else
2012-11-19 23:52:30 +01:00
[ "$p" = "$PACKAGE" ] && SELECTED=checked || SELECTED=
2012-09-21 12:57:19 +02:00
fi
echo -n "<label><input type=checkbox name=autodistpkgscheckbox value=\"$p\" $SELECTED>${p}</label>"
2012-09-06 18:55:33 +02:00
done
2012-09-21 12:57:19 +02:00
echo -n "</div>"
2012-09-10 17:48:21 +02:00
# autodist prepare
2012-09-21 12:57:19 +02:00
echo -n "<input type=button value=\"prepare\" onclick="
echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
2012-09-10 17:48:21 +02:00
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
2012-09-21 12:57:19 +02:00
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
2012-11-19 23:52:30 +01:00
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistprepare\");>"
2012-09-10 17:48:21 +02:00
# autodist update
2012-09-21 12:57:19 +02:00
echo -n "<input type=button value=\"update\" onclick="
echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
2012-09-10 17:48:21 +02:00
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
2013-01-19 16:24:26 +01:00
echo -n "DEBUG=\"+getElementById('debug').checked+\"&"
2012-09-10 17:48:21 +02:00
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
2012-09-21 12:57:19 +02:00
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
2013-01-19 16:24:26 +01:00
echo -n "AUTODISTUPDATECHANGELOG=\"+encodeURIComponent(getElementById('autodistupdatechangelog').value)+\"&"
2014-10-29 22:36:58 +01:00
echo -n "AUTODISTVERSION=\"+getElementById('autodistversion').value+\"&"
2012-11-19 23:52:30 +01:00
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistupdate\");>"
2012-09-10 17:48:21 +02:00
# autodist build
2012-09-21 12:57:19 +02:00
echo -n "<input type=button value=\"build\" onclick="
echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
2012-09-10 17:48:21 +02:00
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
2012-09-21 12:57:19 +02:00
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
2012-09-04 13:05:57 +02:00
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
2012-11-19 23:52:30 +01:00
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistbuild\"); class=boldbutton>"
2012-09-10 17:48:21 +02:00
# autodist install
[ ! "$USER_CANINSTALL" ] && DISABLED="disabled=disabled" || DISABLED=
2012-09-21 12:57:19 +02:00
echo -n "<input type=button value=\"install\" onclick="
echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
2012-09-10 17:48:21 +02:00
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
2012-09-21 12:57:19 +02:00
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
2012-11-19 23:52:30 +01:00
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistinstall\""
2012-12-01 23:36:43 +01:00
echo -n ",\"`cgi_encodevar "Install built packages for <b>"`\"+getSelectedValueById('autodistjobs')+\""
echo -n "`cgi_encodevar "</b> job in current environment?"`\""
2012-10-18 00:49:13 +02:00
echo -n "); class=redbutton $DISABLED>"
2012-09-10 17:48:21 +02:00
# autodist send
[ ! "$USER_ALLREPOSITORIES" ] && DISABLED="disabled=disabled" || DISABLED=
2012-09-21 12:57:19 +02:00
echo -n "<input type=button value=\"send\" onclick="
echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
2012-09-10 17:48:21 +02:00
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
2012-09-21 12:57:19 +02:00
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
2012-09-10 17:48:21 +02:00
echo -n "SENDREPOSITORY=\"+getSelectedValueById('sendrepository')+\"&"
2012-11-19 23:52:30 +01:00
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistsend\""
2012-09-21 12:57:19 +02:00
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>"
2012-10-18 00:49:13 +02:00
# autodist schedule
2014-10-29 22:36:58 +01:00
echo -n "<br>New version:<input type=text id=autodistversion value=\"\" style=\"width:20%\"> "
echo -n "<input type=button value=\"schedule job\" onclick="
2012-11-19 23:52:30 +01:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
2012-10-18 00:49:13 +02:00
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
2014-10-29 22:36:58 +01:00
echo -n "REQUEST=schedule&AUTODISTVERSION=\"+getElementById('autodistversion').value"
2012-10-18 00:49:13 +02:00
echo -n ",\"`cgi_encodevar "Schedule <b>"`\"+getSelectedValueById('autodistjobs')+\"`cgi_encodevar "</b> autodist job for automatic update?"`\"); class=boldbutton>"
2014-10-29 22:36:58 +01:00
# autodist update changelog
echo -n "<br>Rebuild changelog:<br>"
echo -n "<input type=text id=autodistupdatechangelog style=\"width:95%\">"
2012-10-18 00:49:13 +02:00
# autodist show schedule
2012-11-19 23:52:30 +01:00
echo -n "<input type=button value=\"show schedule\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
2012-10-18 00:49:13 +02:00
echo -n "REQUEST=showscheduled\");>"
# autodist unschedule
2012-11-19 23:52:30 +01:00
echo -n "<input type=button value=\"unschedule\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
2012-10-18 00:49:13 +02:00
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
echo -n "REQUEST=unschedule\"); class=redbutton>"
# autodist skip
2012-11-19 23:52:30 +01:00
echo -n "<input type=button value=\"skip\" onclick=ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
2012-10-18 00:49:13 +02:00
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
2012-11-19 23:52:30 +01:00
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>"
2012-09-21 12:57:19 +02:00
else
echo -n "<br>"
2012-09-02 13:18:52 +02:00
fi
2012-10-18 00:49:13 +02:00
# automatic port
2014-06-18 13:09:29 +02:00
if [ "${AUTOPORT_PORT_REPOSITORY[$ENVIRONMENT]}" ]; then
2012-11-19 23:52:30 +01:00
echo -n "Automatic port:"
2012-10-18 00:49:13 +02:00
echo -n "<input type=button id=autoportnp value=\"port\" onclick="
2012-11-19 23:52:30 +01:00
echo -n "p=getSelectedValueById('sendrepository');"
2012-10-18 00:49:13 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
2013-07-11 11:03:09 +02:00
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "SENDREPOSITORY=\"+p+\"&"
2012-10-18 00:49:13 +02:00
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "PACKAGE=$PACKAGEENCODED&REQUEST=autoportnp\""
2012-11-19 23:52:30 +01:00
echo -n ",\"`cgi_encodevar "Port <b>$PACKAGE</b> package in <b>"`\"+p+\"`cgi_encodevar "</b> with current specfile changes?"`\"); class=redbutton>"
2012-10-18 00:49:13 +02:00
echo -n "<input type=button id=autoportlog value=\"log\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autoportlog\");>"
fi
2012-09-21 12:57:19 +02:00
fi
if [ "$PACKAGE" ]; then
2014-11-22 19:51:49 +01:00
echo -n "<hr><div style=\"background-color:#E0F2D0\">"
## 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 "RPMBUILDARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
#echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue()));>"
2012-11-19 23:52:30 +01:00
## 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);>"
2012-09-10 17:48:21 +02:00
# add patches
2014-11-22 19:51:49 +01:00
echo -n "<b>Add patches:</b>"
2012-10-18 00:49:13 +02:00
echo -n "<input type=button id=addpatchbutton value=\"submit\" onclick=ajax_getvalues(\""
2012-09-10 17:48:21 +02:00
echo -n "REQUEST=addpatch&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
2013-06-01 00:30:05 +02:00
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
2012-09-10 17:48:21 +02:00
echo -n "ADDPATCHURL=\"+encodeURIComponent(getElementById('addpatchurl').value)+\"&"
2012-11-19 23:52:30 +01:00
echo -n "ADDPATCHNAME=\"+encodeURIComponent(getElementById('addpatchname').value));>"
echo -n " <a href=\"http://pastebin.com\" target=_new>pastebin</a><br>"
2014-11-22 19:51:49 +01:00
echo -n "URL:<input type=text id=addpatchurl value=\"\" style=\"width:80%\">"
2013-05-04 15:44:57 +02:00
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>"
2013-06-04 02:46:14 +02:00
# upload sources
echo -n "<hr><b>Upload source:</b>"
echo -n "<form name=\"form\" action=\"javascript:\" method=\"POST\" enctype=\"multipart/form-data\">"
echo -n "<input id=\"fileToUpload\" type=\"file\" size=\"10\" name=\"fileToUpload\" class=\"input\">"
echo -n "<button class=\"button\" id=\"buttonUpload\" onclick=ajaxFileUpload(\""
echo -n "REQUEST=uploadsource&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "UPLOADFILENAME=\"+encodeURIComponent(getElementById('fileToUpload').value));>Upload</button>"
echo -n "</form>"
2014-11-22 19:51:49 +01:00
echo -n "</div>"
2012-10-18 00:49:13 +02:00
# info from package sources
2014-11-22 19:51:49 +01:00
echo -n "<hr><div style=\"background-color:#A7DEDE\">"
2012-11-19 23:52:30 +01:00
echo -n "<b>Info from package in the works:</b><br>"
# show sources
2014-11-22 19:51:49 +01:00
echo -n "<select id=sourcefile style=\"width:98%\" onchange="
2012-11-19 23:52:30 +01:00
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
2014-11-22 19:51:49 +01:00
echo -n "<select id=patchfile style=\"width:98%\" onchange="
2012-11-19 23:52:30 +01:00
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>"
2013-06-01 00:30:05 +02:00
for i in `seq 1 ${#SPECVAR_Patch[*]}`; do
f=${SPECVAR_Patch[$i-1]}
2012-11-19 23:52:30 +01:00
patchname=${f/*\/}
patchname=${patchname/.patch}
patchname=${patchname/$PACKAGE-}
2013-07-11 11:03:09 +02:00
echo -n "<option value=\"$f\">$patchname (#${SPECVAR_Patch_idx[$i-1]})</option>"
2012-11-19 23:52:30 +01:00
done
echo -n "</select>"
# list build dir files
echo -n "<input type=button value=\"build dir files\" onclick="
2012-09-10 17:48:21 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=builddirfiles\");>"
2012-10-18 00:49:13 +02:00
# show package licenses
echo -n "<input type=button value=\"license(s)\" onclick="
2012-09-10 17:48:21 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=showlicenses\");>"
2012-10-18 00:49:13 +02:00
# 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="
2012-09-10 17:48:21 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=configurehelp\");>"
2012-10-18 00:49:13 +02:00
# 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\");>"
2014-11-22 19:51:49 +01:00
# add a note
echo -n "<label>"
echo -n "<input type=button id=addpkgnote value=\"add a note:\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "REQUEST=addpkgnote&PKGNOTE=\"+encodeURIComponent(getElementById('pkgnote').value));></label></span>"
echo -n "<span style=\"display:block;overflow:hidden;padding-right:5px;\">"
echo -n "<input type=text id=pkgnote value=\"\" style=\"width:100%\">"
echo -n "</span>"
2012-10-18 00:49:13 +02:00
# generic info
2012-09-10 17:48:21 +02:00
echo -n "<hr><b>Generic info:</b><br>"
2012-10-18 00:49:13 +02:00
# allowed groups
echo -n "<input type=button value=\"allowed groups\" onclick="
2012-09-10 17:48:21 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=allowedgroups\");>"
2012-10-18 00:49:13 +02:00
# approved licenses
echo -n "<input type=button value=\"approved licenses\" onclick="
2012-09-10 17:48:21 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=approvedlicenses\");>"
2013-01-19 16:24:26 +01:00
# templates
2014-11-22 19:51:49 +01:00
echo -n "<select id=autospectemplate style=\"width:98%\" onchange="
2013-01-19 16:24:26 +01:00
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
2013-06-03 13:46:04 +02:00
echo -n "</select>"
2012-10-18 00:49:13 +02:00
# macros
2014-11-22 19:51:49 +01:00
echo -n "<select id=macrosfile style=\"width:98%\" onchange="
2012-09-10 17:48:21 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=showmacrosfile&"
2012-11-19 23:52:30 +01:00
echo -n "MACROSFILE=\"+getSelectedValueById('macrosfile'));>"
echo -n "<option value=\"\">-- display a RPM macros file --</option>"
2012-09-10 17:48:21 +02:00
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>"
2014-11-22 19:51:49 +01:00
echo -n "</div>"
2012-09-21 12:57:19 +02:00
fi
echo -n "]]></operationpanel>"
fi
echo -n "<chatpanel><![CDATA["
# broadcast message
2014-07-05 23:54:48 +02:00
echo -n "<div style=\"position:absolute;width:220px;\">"
echo -n "<textarea id=broadcastmessage style=\"font-family:sans;height:36px;width:80%;float:left;font-size:8pt;resize:none;\" "
echo -n "onfocus=\"if(this.value==this.defaultValue)this.value='';\">Chat with online developers...</textarea>"
echo -n "<input type=button style=\"float:right\" onclick=ajax_getvalues(\""
2012-11-19 23:52:30 +01:00
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
2012-09-21 12:57:19 +02:00
echo -n "REQUEST=broadcastmessage&BROADCASTMESSAGE=\"+encodeURIComponent(getElementById('broadcastmessage').value));"
2014-07-05 23:54:48 +02:00
echo -n "getElementById('broadcastmessage').value=\"\"; value=\"Send\" />"
2012-11-19 23:52:30 +01:00
#echo -n "<input type=button value=\"send\" onClick="
2014-07-05 23:54:48 +02:00
echo -n "</div>]]></chatpanel>"
2012-09-21 12:57:19 +02:00
if [ "$REQUEST" != "" ]; then
2013-06-03 13:46:04 +02:00
echo -n "<output><![CDATA[<hr>"
echo -n "<b>Console output ($REQUEST"
2013-01-19 16:24:26 +01:00
[ "$PACKAGE" ] && echo -n " for $PACKAGE"
echo -n "):</b>"
2012-09-21 12:57:19 +02:00
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" \
2012-10-18 00:49:13 +02:00
-o "$REQUEST" = "autodistbuild" -o "$REQUEST" = "autodistinstall" -o "$REQUEST" = "autodistsend" ]; then
2012-09-21 12:57:19 +02:00
echo -n "id=outputbottom>"
2012-09-02 13:18:52 +02:00
else
2012-09-21 12:57:19 +02:00
echo -n "id=outputtop>"
2012-09-02 13:18:52 +02:00
fi
2012-09-21 12:57:19 +02:00
if [ "$REQUEST" != "showchangelogs" -a "$REQUEST" != "showbuilddocs" -a "$REQUEST" != "showlicenses" ]; then
echo -n "<pre><!-- SCROLL -->"
2012-09-02 13:18:52 +02:00
fi
2012-09-21 12:57:19 +02:00
RET=255
fi
case $REQUEST in
2012-11-19 23:52:30 +01:00
"savespec") echo "File <b>$PACKAGE.spec</b> saved."
RET=-1
;;
2012-10-18 00:49:13 +02:00
"smartupgrade") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "export LANG=C;sudo smart update && sudo smart upgrade"
2013-11-09 14:31:17 +01:00
RET=$?
;;
2014-10-29 22:36:58 +01:00
"runldconfig") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "export LANG=C;sudo /sbin/ldconfig"
2013-11-09 14:31:17 +01:00
RET=$?
;;
2014-07-10 13:31:20 +02:00
"showpatch") $SUDO_WRAPPER binary $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE"; RET=$? ;;
2012-10-18 00:49:13 +02:00
"removepatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE remove"
2012-09-02 13:18:52 +02:00
RET=$?
if [ $RET -eq 0 ]; then
2012-09-06 18:55:33 +02:00
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"removed the autodist patch for <b>$PACKAGE</b>\" STIME=`date +%s`"
2012-09-02 13:18:52 +02:00
fi ;;
2014-07-10 13:31:20 +02:00
"autopatch") $SUDO_WRAPPER binary $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE auto"
2012-10-18 00:49:13 +02:00
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 ;;
2014-07-10 13:31:20 +02:00
"updatepatch") $SUDO_WRAPPER binary $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE update"
2012-09-02 13:18:52 +02:00
RET=$?
if [ $RET -eq 0 ]; then
2012-09-06 18:55:33 +02:00
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist <b>update</b> patch for <b>$PACKAGE</b>\" STIME=`date +%s`"
2012-09-02 13:18:52 +02:00
fi ;;
2012-10-18 00:49:13 +02:00
"buildpatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE build"
2012-09-02 13:18:52 +02:00
RET=$?
if [ $RET -eq 0 ]; then
2012-09-06 18:55:33 +02:00
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist <b>build</b> patch for <b>$PACKAGE</b>\" STIME=`date +%s`"
2012-09-02 13:18:52 +02:00
fi ;;
2012-10-18 00:49:13 +02:00
"showscheduled") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule"; RET=$? ;;
2014-10-29 22:36:58 +01:00
"schedule") if [ "$AUTODISTVERSION" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule $AUTODISTJOB#$AUTODISTVERSION"
2012-10-18 00:49:13 +02:00
RET=$?
if [ $RET -eq 0 ]; then
2014-10-29 22:36:58 +01:00
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job <b>$AUTODISTJOB</b> for update to version $AUTODISTVERSION\" STIME=`date +%s`"
2012-10-18 00:49:13 +02:00
fi
else
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule $AUTODISTJOB"
RET=$?
if [ $RET -eq 0 ]; then
2012-11-19 23:52:30 +01:00
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job <b>$AUTODISTJOB</b> for automatic update\" STIME=`date +%s`"
2012-10-18 00:49:13 +02:00
fi
fi
;;
"unschedule") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool unschedule $AUTODISTJOB"
2012-09-02 13:18:52 +02:00
RET=$?
if [ $RET -eq 0 ]; then
2012-10-18 00:49:13 +02:00
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"unscheduled autodist job <b>$AUTODISTJOB</b>\" STIME=`date +%s`"
2012-09-02 13:18:52 +02:00
fi ;;
2012-09-21 12:57:19 +02:00
"autodistbuild") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
autodistjobs=
if [ "$AUTODISTPKGS" ]; then
for p in $AUTODISTPKGS; do
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
done
else
autodistjobs="$AUTODISTJOB"
fi
2014-10-29 22:36:58 +01:00
$SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -b $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web" &>/dev/null
2012-11-19 23:52:30 +01:00
[ $? -ne 0 ] && RET=$? || {
RET=-1
echo "Autodist build start. You may see the output in the <b>Webbuild jobs</b> box above."
}
2012-09-21 12:57:19 +02:00
#[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"successfully built <b>$PACKAGE</b>\" STIME=`date +%s`"
2012-09-10 17:48:21 +02:00
;;
2012-09-21 12:57:19 +02:00
"autodistinstall") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
autodistjobs=
if [ "$AUTODISTPKGS" ]; then
for p in $AUTODISTPKGS; do
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
done
else
autodistjobs="$AUTODISTJOB"
fi
2014-10-29 22:36:58 +01:00
$SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -i $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web" &>/dev/null
2012-11-19 23:52:30 +01:00
[ $? -ne 0 ] && RET=$? || {
RET=-1
echo "Autodist install start. You may see the output in the <b>Webbuild jobs</b> box above."
}
;;
2012-09-21 12:57:19 +02:00
"autodistsend") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
autodistjobs=
if [ "$AUTODISTPKGS" ]; then
for p in $AUTODISTPKGS; do
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
done
else
autodistjobs="$AUTODISTJOB"
fi
2014-10-29 22:36:58 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -s $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --server $SENDREPOSITORY --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web"
2012-09-10 17:48:21 +02:00
RET=$?
2013-07-11 11:03:09 +02:00
[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$AUTODISTPKGS $SPECVAR_Version-$SPECVAR_Release</b> from <i>`print_environment_descr $ENVIRONMENT`</i> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
2012-09-10 17:48:21 +02:00
;;
2012-12-01 23:36:43 +01:00
"autoport") if [ "$AUTOPORTPACKAGE" ]; then
2013-12-14 11:57:03 +01:00
if [ "$AUTOPORTRELEASEREPOSITORY" ]; then
AUTOPORT_APPEND="-d $AUTOPORTRELEASEREPOSITORY"
fi
$SUDO_WRAPPER background $ENVIRONMENT "$USER" $AUTOPORTPACKAGE "autoport $AUTOPORTPACKAGE -r $REPOSITORY $AUTOPORT_APPEND --user $USER" &>/dev/null
2012-12-01 23:36:43 +01:00
RET=$?
2013-11-09 14:31:17 +01:00
[ $RET -eq 0 ] && {
2012-11-19 23:52:30 +01:00
RET=-1
echo "Autoport started. You may see the output in the <b>Webbuild jobs</b> box above."
}
2012-12-01 23:36:43 +01:00
else
echo "ERROR: no port package specified!"
RET=1
fi
;;
2012-11-19 23:52:30 +01:00
"autospecupdatescheck") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a2"; RET=$? ;;
2014-10-05 19:27:35 +02:00
"rpmprepare") [ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
RPMARCHADD="--target $RPMBUILDARCH --define=\"cross_target_cpu $RPMBUILDARCH\""
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec $RPMARCHADD --nodeps --define=\"_topdir $SPECVAR_WORKINGHOME/RPM\""
RET=$?
;;
2012-10-18 00:49:13 +02:00
"rpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-build"
[ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
2012-11-19 23:52:30 +01:00
$SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a5,6 $RPMFORCEADD $RPMARCHADD" &>/dev/null
2012-10-18 00:49:13 +02:00
# && echo \"Webbuild HINT: now you may want to click on 'build requirements', add build requirements in .spec file and then 'recreate SRPMS'\""
2012-11-19 23:52:30 +01:00
[ $? -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>"
}
2012-10-18 00:49:13 +02:00
;;
2012-11-19 23:52:30 +01:00
"srpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--nodeps"
2014-06-10 00:19:26 +02:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE \
"rpmbuild -bs \
--define=\"_topdir $SPECVAR_WORKINGHOME/RPM\" \
$RPMFORCEADD $PACKAGE.spec"
2012-11-19 23:52:30 +01:00
RET=$? ;;
2012-09-21 12:57:19 +02:00
"autospeclistcheck")
2012-09-02 13:18:52 +02:00
[ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
2012-11-19 23:52:30 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a5 --list-check --force $RPMARCHADD"
2012-09-02 13:18:52 +02:00
RET=$? ;;
2014-10-29 22:36:58 +01:00
"autospecbuildreq")
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo /sbin/ldconfig"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a6"
2012-09-02 13:18:52 +02:00
RET=$? ;;
2012-11-19 23:52:30 +01:00
"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=$? ;;
2012-09-21 12:57:19 +02:00
"rpminstall") if [ "$USER_CANINSTALL" ]; then
2012-09-02 13:18:52 +02:00
[ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-install"
2012-11-19 23:52:30 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a11 $RPMFORCEADD"; RET=$?
2012-09-02 13:18:52 +02:00
else
echo "Install function disabled."
RET=1
fi ;;
2012-11-19 23:52:30 +01:00
"sendpackage") if [ "$SENDREPOSITORY" ]; then
2013-07-11 11:03:09 +02:00
if [ "$SENDRECREATESRPM" = "true" ]; then
2014-06-10 00:19:26 +02:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs \
--define=\"_topdir $SPECVAR_WORKINGHOME/RPM\" \
2014-09-05 22:36:46 +02:00
$PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY --arch $AUTODISTARCH"
2012-11-19 23:52:30 +01:00
RET=$?
else
2014-09-05 22:36:46 +02:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY --arch $AUTODISTARCH"
2012-11-19 23:52:30 +01:00
RET=$?
fi
2012-09-02 13:18:52 +02:00
if [ $RET -eq 0 ]; then
2013-07-11 11:03:09 +02:00
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$PACKAGE $SPECVAR_Version-$SPECVAR_Release</b> from <i>`print_environment_descr $ENVIRONMENT`</i> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
2012-11-19 23:52:30 +01:00
fi
else
echo "ERROR: send repository is not defined."
RET=255
fi
;;
"sendsource") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--nodeps"
if [ "$SENDREPOSITORY" ]; then
2013-07-11 11:03:09 +02:00
if [ "$SENDRECREATESRPM" = "true" ]; then
2014-06-10 00:19:26 +02:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs \
--define=\"_topdir $SPECVAR_WORKINGHOME/RPM\" \
$PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm"
2012-09-04 13:05:57 +02:00
RET=$?
2012-11-19 23:52:30 +01:00
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
2012-09-04 13:05:57 +02:00
else
2012-11-19 23:52:30 +01:00
$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
;;
2012-10-18 00:49:13 +02:00
"addpatch") if [ "$ADDPATCHURL" -a "$ADDPATCHNAME" ]; then
2013-01-19 16:24:26 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "curl -sSkL '$ADDPATCHURL' -o ../SOURCES/$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch"
2012-10-18 00:49:13 +02:00
RET=$?
2012-11-19 23:52:30 +01:00
[ $RET -eq 0 ] && {
2013-06-03 13:46:04 +02:00
echo -n "Patch added to sources with name '<b>$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch'</b>."
for l in 1 0 2 3; do
2013-11-09 14:31:17 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && patch --dry-run -s -p$l < $SPECVAR_RPMSOURCESDIR/$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch >/dev/null"
2013-06-03 13:46:04 +02:00
RET=$?
[ $RET -eq 0 ] && break
done
if [ $RET -eq 0 ]; then
2013-06-04 02:46:14 +02:00
echo -n "<br><font color=lightgreen>Info: good, patch applies successfully with -p$l option!</font>"
2013-06-03 13:46:04 +02:00
echo -n "<br><br><font color=gold>HINT: add the following lines in the appropriate sections:</font><br>"
else
2013-11-09 14:31:17 +01:00
l=0
2013-06-03 13:46:04 +02:00
echo -n "<br><font color=red>Warning: patch does not apply with '-p0' to '-p3' options!</font>"
echo "<br><br><font color=gold>HINT: you might want to retry from a clean build dir after pressing the 'unpack' button or check if it applies after changing working subdirectory in build tree.</font>"
echo -n "<br><font color=gold>HINT: add anyway the following lines in the appropriate sections and press 'prepare' to see patch command output:</font><br>"
fi
2013-06-04 02:46:14 +02:00
echo -n "<br><font color=gold>1) in the header after last 'Patch<n>:' entry (or after 'Source<n>:' if this is the first patch) :</font><br>"
2013-06-03 13:46:04 +02:00
if [ "${SPECVAR_Patch[*]}" ]; then
2013-06-04 02:46:14 +02:00
NEWPATCHNUM=$((${SPECVAR_Patch_idx[${#SPECVAR_Patch[@]}-1]}+1))
2013-06-03 13:46:04 +02:00
else
NEWPATCHNUM=0
fi
2013-06-01 00:30:05 +02:00
echo -ne "<br><pre>Patch$NEWPATCHNUM: $PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch</pre>"
echo -n "<font color=gold>2) in %prep section after %setup:</font><br>"
2013-06-03 13:46:04 +02:00
echo -ne "<br><pre>%patch$NEWPATCHNUM -p$l</pre>"
2012-11-19 23:52:30 +01:00
RET=-1
}
2012-10-18 00:49:13 +02:00
else
2013-06-04 02:46:14 +02:00
echo "<font color=red>ERROR: Patch URL or destination name not provided.</font>"
2012-10-18 00:49:13 +02:00
RET=1
fi ;;
2013-06-04 02:46:14 +02:00
"uploadsource") if [ "$UPLOADFILENAME" ]; then
UPLOADFILENAME="${UPLOADFILENAME/*\\}"
if [ -e $WEBBUILD_STATEDIR/uploads/$UPLOADFILENAME ]; then
tmpfile=`mktemp --suffix=webbuildtmp`
mv $WEBBUILD_STATEDIR/uploads/$UPLOADFILENAME $tmpfile
# $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "if [ -e $SPECVAR_RPMSOURCESDIR/${UPLOADFILENAME} ]; then echo \"Warning: file already exists in SOURCE directory\"; fi"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cp $tmpfile $SPECVAR_RPMSOURCESDIR/${UPLOADFILENAME}" $tmpfile
RET=$?
rm -f $tmpfile
if [ $RET -eq 0 ]; then
echo "<font color=lightgreen>Info: file ${UPLOADFILENAME} successfully added to SOURCES directory.</font>"
echo -n "<br><font color=gold>HINT: add the following line in the header after last 'Source<n>:' entry:</font>"
if [ "${SPECVAR_Source[*]}" ]; then
NEWSOURCENUM=$((${SPECVAR_Source_idx[${#SPECVAR_Source[*]}-1]}+1))
else
NEWSOURCENUM=0
fi
echo -ne "<br><pre>Source$NEWSOURCENUM: ${UPLOADFILENAME}</pre>"
RET=-1
else
echo "<font color=red>ERROR: could not copy file to SOURCES directory.</font>"
fi
else
echo "<font color=red>ERROR: Upload of source file ${UPLOADFILENAME} FAILED.</font>"
RET=-1
fi
else
echo "<font color=red>ERROR: upload filename is empty.</font>"
RET=1
fi ;;
2012-09-21 12:57:19 +02:00
"repositoryimport")
2012-11-19 23:52:30 +01:00
[ "$PACKAGES" ] || {
echo "ERROR: no packages(s) selected."
RET=1
break
}
2012-09-10 17:48:21 +02:00
for p in $PACKAGES; do
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
2012-10-18 00:49:13 +02:00
[ "$REPOSITORYFORCE" = "true" ] && FORCEADD="-f"
2014-05-23 21:17:27 +02:00
$SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "autodist-repository import $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD $FORCEADD -y"
2012-09-10 17:48:21 +02:00
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
2012-09-02 13:18:52 +02:00
;;
2012-09-21 12:57:19 +02:00
"repositoryrelease")
2012-11-19 23:52:30 +01:00
[ "$PACKAGES" ] || {
echo "ERROR: no package(s) selected."
RET=1
break
}
2012-09-10 17:48:21 +02:00
for p in $PACKAGES; do
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
2012-10-18 00:49:13 +02:00
[ "$REPOSITORYFORCE" = "true" ] && SIMULATEADD="$SIMULATEADD -f"
2014-05-23 21:17:27 +02:00
$SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "autodist-repository release $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
2012-09-10 17:48:21 +02:00
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
2012-09-02 13:18:52 +02:00
;;
2012-09-21 12:57:19 +02:00
"repositorydiff")
2012-11-19 23:52:30 +01:00
[ "$PACKAGES" ] || {
echo "ERROR: no package(s) selected."
RET=1
break
}
2012-09-10 17:48:21 +02:00
for p in $PACKAGES; do
2014-05-23 21:17:27 +02:00
$SUDO_WRAPPER 0 local "$USER" "" "autodist-repository diff $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO"
2012-09-10 17:48:21 +02:00
RET=$?
[ $RET -eq 0 ] || break
done
2012-09-02 13:18:52 +02:00
;;
2012-09-21 12:57:19 +02:00
"repositoryarchive")
2012-11-19 23:52:30 +01:00
[ "$PACKAGES" ] || {
echo "ERROR: no package(s) selected."
RET=1
break
}
2012-09-10 17:48:21 +02:00
for p in $PACKAGES; do
[ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD=
2014-05-23 21:17:27 +02:00
$SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "autodist-repository archive $SENDREPOSITORY $p -y"
2012-09-10 17:48:21 +02:00
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
2012-09-02 13:18:52 +02:00
;;
2012-11-19 23:52:30 +01:00
"repositorymassrebuild")
if [ ! "$PACKAGES" ]; then
echo "ERROR: no package(s) selected."
RET=1
elif [ ! "$MASSREBUILDCHANGELOG" ]; then
echo "ERROR: changelog was not specified."
RET=1
else
2014-07-05 23:54:48 +02:00
SCRIPTARGS=`echo -e $MASSREBUILDBUILDREQ | awk 'BEGIN {FS="\\\\n"} {for(i=1;i<=NF;i++) printf "--buildreq %s ", $i }'`
$SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autoport -r $SENDREPOSITORY -d $REPOSITORYIMPORTTO $PACKAGES -u \"$MASSREBUILDCHANGELOG\" -s \"$SCRIPTARGS\" --user $USER" &>/dev/null
2012-11-19 23:52:30 +01:00
[ $? -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
;;
2014-07-06 23:23:55 +02:00
"repositorymassrebuilddependant")
if [ ! "$PACKAGES" ]; then
echo "ERROR: no package(s) selected."
RET=1
else
$SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autoport -r $SENDREPOSITORY -d $REPOSITORYIMPORTTO $PACKAGES -ud --user $USER" &>/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."
}
fi
;;
2012-09-21 12:57:19 +02:00
"repositorysync")
if [ "$REPOSITORY" ]; then
2013-07-11 11:03:09 +02:00
$SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/10-openmamba-sync-back $REPOSITORY"
LOCALRET=$?
[ $LOCALRET -eq 0 ] && $SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/20-openmamba-apt $REPOSITORY"
2012-11-19 23:52:30 +01:00
LOCALRET=$?
[ $LOCALRET -eq 0 ] && $SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/40-openmamba-rsync $REPOSITORY"
LOCALRET=$?
[ $LOCALRET -ne 0 ] && RET=$LOCALRET || RET=-1
2012-09-21 12:57:19 +02:00
fi
;;
2013-07-11 11:03:09 +02:00
"autoportnp") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="-f" || AUTODISTADD=
2013-11-09 14:31:17 +01:00
$SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "autoport -np $PACKAGE -r $SENDREPOSITORY $AUTODISTADD --user $USER" &>/dev/null
2012-11-19 23:52:30 +01:00
[ $? -ne 0 ] && RET=$? || {
RET=-1
echo -n "Autoport started. You may see the output in the <b>Webbuild jobs</b> box above."
}
;;
2012-09-21 12:57:19 +02:00
"autoportlog") cat "$AUTOPORTLOGDIR/current.log"; RET=$? ;;
2012-11-19 23:52:30 +01:00
"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 \"^#\"" | \
2012-09-02 13:18:52 +02:00
while read line; do
echo $line
done
2012-11-19 23:52:30 +01:00
RET=-1
2012-09-02 13:18:52 +02:00
;;
2012-11-19 23:52:30 +01:00
"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
2012-12-01 23:36:43 +01:00
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDROOT/$SPECVAR_BUILDROOT && find"
2012-11-19 23:52:30 +01:00
RET=$?
fi
;;
2012-09-21 12:57:19 +02:00
"showchangelogs"|"showbuilddocs"|"showlicenses")
2012-09-10 17:48:21 +02:00
if [ "$REQUEST" = "showchangelogs" ]; then
PATTERN="-iname changelog -or -iname news -and -type f"
elif [ "$REQUEST" = "showlicenses" ]; then
2013-07-11 11:03:09 +02:00
PATTERN="-iname license\* -or -iname copying\* -or -iname authors\* -or -iname credits\* -and -type f"
2012-09-10 17:48:21 +02:00
elif [ "$REQUEST" = "showbuilddocs" ]; then
2013-07-11 11:03:09 +02:00
PATTERN="-iname readme\* -or -iname install\* -or -iname todo\* -or -iname pkgbuild\* -or -iname \*.desktop -and -type f"
2012-09-10 17:48:21 +02:00
fi
2013-07-11 11:03:09 +02:00
show_docs `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && find . $PATTERN -maxdepth 2"`
RET=-1
2012-09-10 17:48:21 +02:00
;;
2012-12-01 23:36:43 +01:00
"configurehelp") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && ./configure --help || ./waf configure --help"
2012-11-19 23:52:30 +01:00
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 ;;
2013-01-19 16:24:26 +01:00
"showautospectemplate") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat /usr/share/autospec/templates/$AUTOSPECTEMPLATE"
RET=$?
[ $RET -eq 0 ] && RET=-1 ;;
2012-11-19 23:52:30 +01:00
"showmacrosfile") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat /etc/rpm/macros.$MACROSFILE"
RET=$?
[ $RET -eq 0 ] && RET=-1 ;;
"showpatchfile") OUTPATCHFILE=${PATCHFILE/*\/}
case ${OUTPATCHFILE/*.} in
2014-07-10 13:31:20 +02:00
gz|gzip) $SUDO_WRAPPER binary $ENVIRONMENT "$USER" $PACKAGE "gunzip -c $SPECVAR_RPMSOURCESDIR/$OUTPATCHFILE" | parse_patch_output ;;
bz2) $SUDO_WRAPPER binary $ENVIRONMENT "$USER" $PACKAGE "bzcat $SPECVAR_RPMSOURCESDIR/$OUTPATCHFILE" | parse_patch_output ;;
*) $SUDO_WRAPPER binary $ENVIRONMENT "$USER" $PACKAGE "cat $SPECVAR_RPMSOURCESDIR/$OUTPATCHFILE" | parse_patch_output ;;
2012-11-19 23:52:30 +01:00
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
;;
2013-06-05 18:31:55 +02:00
"rpmmanagerinstall"|"rpmmanagerupgrade") if [ "$USER_CANINSTALL" ]; then
[ "$RPMMANAGERFORCE" = "true" ] && rpmforceadd="--force"
echo -n "<script>clearid(\"window\")</script>"
2013-07-11 11:03:09 +02:00
resolve_rpmmanagerdir "$RPMMANAGERDIR" "${AUTOPORT_ARCH[$ENVIRONMENT]}" "$REPOSITORY"
2013-06-05 18:31:55 +02:00
for f in $RPMMANAGERPACKAGES; do
2013-07-11 11:03:09 +02:00
installpackages="$installpackages $rpmmanagerdir/$f"
2013-06-05 18:31:55 +02:00
done
if [ "$installpackages" ]; then
if [ "$REQUEST" = "rpmmanagerinstall" ]; then
echo "Installing packages: $RPMMANAGERPACKAGES<br>"
2013-07-11 11:03:09 +02:00
if [ "$rpmmanagermode" = "environment" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -i $installpackages $rpmforceadd"
else
sudo rpm -i $installpackages $rpmforceadd
fi
elif [ "$REQUEST" = "rpmmanagerupgrade" ]; then
2013-06-05 18:31:55 +02:00
echo "Upgrading packages: $RPMMANAGERPACKAGES<br>"
2013-07-11 11:03:09 +02:00
if [ "$rpmmanagermode" = "environment" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -U $installpackages $rpmforceadd"
else
sudo rpm -U $installpackages $rpmforceadd
fi
2013-06-05 18:31:55 +02:00
fi
RET=$?
else
echo "<font color=red>ERROR: no packages to install.</font>"
RET=1
fi
else
echo "<font color=red>ERROR: install capability disabled for user.</font>"
RET=1
fi ;;
2012-09-21 12:57:19 +02:00
*) 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
2013-06-04 02:46:14 +02:00
echo "Result: <font color=lightgreen><b>OK</b></font>"
2012-11-19 23:52:30 +01:00
elif [ $RET -gt 0 ]; then
2012-09-21 12:57:19 +02:00
echo "Result: <font color=red><b>ERROR ($RET)</b></font>"
2012-09-02 13:18:52 +02:00
fi
2012-09-21 12:57:19 +02:00
echo -n "</div>"
echo -n "]]></output>"
2012-11-19 23:52:30 +01:00
# editor controls
if [ $RET -le 0 -a "$SPECAVAILABLE" -a ! "$MAINTAINERMODE" ]; then
print_editorcontrols
fi
2012-09-02 13:18:52 +02:00
2013-06-03 13:46:04 +02:00
if [ "$PACKAGE" ]; then
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
print_showlogcontrols
fi
fi
fi
2012-11-19 23:52:30 +01:00
2012-09-10 17:48:21 +02:00
if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "<packages> </packages>"
echo -n "<operationpanel><![CDATA["
2012-11-19 23:52:30 +01:00
showEnvironmentPanel
echo -n "<hr>"
2012-09-10 17:48:21 +02:00
if [ "$REPOSITORY" ]; then
echo -n "<b>Repository maintenance:</b><br>"
2012-10-18 00:49:13 +02:00
# echo -n "<select multiple size=8 id=package onchange="
2012-09-10 17:48:21 +02:00
# 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>"
2012-11-19 23:52:30 +01:00
echo -n "<label><input type=checkbox name=pkgsselectallcheckbox value=\"\" onclick=checkAllBoxes('packagescheckbox',this.checked);>select/unselect all</label>"
2012-09-10 17:48:21 +02:00
echo -n "<div class=multiselect>"
2014-09-28 12:34:41 +02:00
if [ "$local_ftp" -a -e $local_ftp/$REPOSITORY ]; then
if [ $local_ftp/$REPOSITORY/SRPMS.base -nt $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY ]; then
ls --color=none $local_ftp/$REPOSITORY/SRPMS.base/ | grep ".src.rpm$" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
fi
else
curl -s $REPS_BASE_URL/$REPOSITORY/SRPMS.base/ | grep .src.rpm | \
sed "s|.*\.src\.rpm\">\(.*\)</a>.*|\1|" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
2014-05-22 18:20:42 +02:00
fi
while read f; do
pkgname=${f/.src.rpm}
2012-09-10 17:48:21 +02:00
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>"
2014-05-22 18:20:42 +02:00
done < $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
2012-09-10 17:48:21 +02:00
echo -n "</div>"
2012-11-19 23:52:30 +01:00
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: "
2012-09-10 17:48:21 +02:00
echo -n "<select id=repositoryimportto>"
if [ "${REPOSITORY:0:10}" = "milestone2" ]; then
IMPORT_REPOSITORIES=$AUTOPORT_MILESTONE2_IMPORT_REPOSITORIES
else
2013-12-14 11:57:03 +01:00
IMPORT_REPOSITORIES="$AUTOPORT_DEVEL_IMPORT_REPOSITORIES devel-$USER $AUTOPORT_DEVEL_RELEASE_REPOSITORIES"
2012-09-10 17:48:21 +02:00
fi
for f in $IMPORT_REPOSITORIES; do
2014-02-01 14:56:17 +01:00
# [ "$f" = "$REPOSITORY" ] && continue
2012-10-18 00:49:13 +02:00
if [ ! "$USER_ALLREPOSITORIES" ]; then
for u in $USER_CANMAINTAIN_REPOSITORIES devel-$USER; do
2012-11-19 23:52:30 +01:00
[ "$u" = "$f" ] && echo -n "<option value=\"$f\">$f</option>"
# -a "$f" != "$REPOSITORY"
2012-10-18 00:49:13 +02:00
done
else
2012-11-19 23:52:30 +01:00
#[ "$f" != "$REPOSITORY" ] &&
echo -n "<option value=\"$f\">$f</option>"
2012-10-18 00:49:13 +02:00
fi
2012-09-10 17:48:21 +02:00
done
echo -n "</select><br>"
# repository compare
2012-10-18 00:49:13 +02:00
echo -n "<input type=button value=\"compare\" onclick="
2012-09-10 17:48:21 +02:00
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+\"&"
2012-10-18 00:49:13 +02:00
echo -n "REPOSITORYFORCE=\"+getElementById('repositoryforce').checked+\"&"
2012-09-10 17:48:21 +02:00
echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositorydiff\");>"
# repository import
2012-10-18 00:49:13 +02:00
echo -n "<input type=button value=\"import\" onclick="
2012-09-21 12:57:19 +02:00
echo -n "p=getCheckedValuesByName('packagescheckbox');"
2012-09-10 17:48:21 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
2012-09-21 12:57:19 +02:00
echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
2012-09-10 17:48:21 +02:00
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
echo -n "REPOSITORYIMPORTTO=\"+getSelectedValueById('repositoryimportto')+\"&"
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
2012-10-18 00:49:13 +02:00
echo -n "REPOSITORYFORCE=\"+getElementById('repositoryforce').checked+\"&"
2012-09-21 12:57:19 +02:00
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>"
2012-09-10 17:48:21 +02:00
# repository release
2012-10-18 00:49:13 +02:00
echo -n "<input type=button value=\"release\" onclick="
2012-09-21 12:57:19 +02:00
echo -n "p=getCheckedValuesByName('packagescheckbox');"
2012-09-10 17:48:21 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
2012-09-21 12:57:19 +02:00
echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
2012-09-10 17:48:21 +02:00
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
echo -n "REPOSITORYIMPORTTO=\"+getSelectedValueById('repositoryimportto')+\"&"
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
2012-10-18 00:49:13 +02:00
echo -n "REPOSITORYFORCE=\"+getElementById('repositoryforce').checked+\"&"
2012-09-21 12:57:19 +02:00
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>"
2012-09-10 17:48:21 +02:00
# repository archive
2012-10-18 00:49:13 +02:00
echo -n "<input type=button value=\"archive\" onclick="
2012-09-21 12:57:19 +02:00
echo -n "p=getCheckedValuesByName('packagescheckbox');"
2012-09-10 17:48:21 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
2012-09-21 12:57:19 +02:00
echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
2012-09-10 17:48:21 +02:00
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
echo -n "SENDREPOSITORY=$REPOSITORY&"
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
2012-10-18 00:49:13 +02:00
echo -n "REPOSITORYFORCE=\"+getElementById('repositoryforce').checked+\"&"
2012-09-21 12:57:19 +02:00
echo -n "REQUEST=repositoryarchive\""
echo -n ",\"`cgi_encodevar "Archive <b>"`\"+p+\"`cgi_encodevar "</b> in <b>$REPOSITORY</b>?"`\""
echo -n "); class=redbutton>"
2014-07-05 23:54:48 +02:00
# 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>"
# changelog for mass rebuild
2014-07-06 23:23:55 +02:00
echo -n "<hr><b>Mass rebuild of selected packages:</b><br>Changelog:"
2014-07-05 23:54:48 +02:00
echo -n "<input type=text id=massrebuildchangelog style=\"width:100%\">"
# autodist update buildrequirements
2014-07-06 23:23:55 +02:00
echo -n "Add build requirement(s):<br>"
2014-07-05 23:54:48 +02:00
echo -n "<textarea id=massrebuildbuildreq style=\"width:98%;font-size:8pt;resize:none;\" rows=2></textarea>"
2012-11-19 23:52:30 +01:00
# mass rebuild
2014-07-06 23:23:55 +02:00
echo -n "<input type=button value=\"rebuild\" onclick="
2012-11-19 23:52:30 +01:00
echo -n "p=getCheckedValuesByName('packagescheckbox');"
2012-09-21 12:57:19 +02:00
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
2012-11-19 23:52:30 +01:00
echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
2012-09-21 12:57:19 +02:00
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
2012-11-19 23:52:30 +01:00
echo -n "REPOSITORYIMPORTTO=\"+getSelectedValueById('repositoryimportto')+\"&"
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
echo -n "REPOSITORYFORCE=\"+getElementById('repositoryforce').checked+\"&"
echo -n "MASSREBUILDCHANGELOG=\"+encodeURIComponent(getElementById('massrebuildchangelog').value)+\"&"
2014-07-05 23:54:48 +02:00
echo -n "MASSREBUILDBUILDREQ=\"+encodeURIComponent(getElementById('massrebuildbuildreq').value)+\"&"
2012-11-19 23:52:30 +01:00
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>?"`\""
2012-09-21 12:57:19 +02:00
echo -n "); class=redbutton>"
2014-07-06 23:23:55 +02:00
# mass rebuild of dependant packages
echo -n "<input type=button value=\"rebuild dependant\" 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 "MASSREBUILDBUILDREQ=\"+encodeURIComponent(getElementById('massrebuildbuildreq').value)+\"&"
echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositorymassrebuilddependant\""
echo -n ",\"`cgi_encodevar "Rebuild package which depend on <b>"`\"+p+\"`cgi_encodevar "</b> in <b>$REPOSITORY</b> and send to <b>"`\"+getSelectedValueById('repositoryimportto')+"
echo -n "\"`cgi_encodevar "</b>?"`\""
echo -n "); class=redbutton>"
2012-09-10 17:48:21 +02:00
fi
echo -n "]]></operationpanel>"
fi
2012-09-21 12:57:19 +02:00
echo -n "<title>"
if [ "$MAINTAINERMODE" = "true" ]; then
[ "$REPOSITORY" ] && echo -n "$REPOSITORY " || echo -n "no repository "
echo -n "(Maintainer mode)"
else
2014-04-25 12:10:30 +02:00
if [ "$PACKAGE" ]; then
2013-01-19 16:24:26 +01:00
echo -n "$PACKAGE "
[ "${SPECVAR_Epoch[0]}" ] && echo -n "${SPECVAR_Epoch[0]}:"
echo -n "$SPECVAR_Version-$SPECVAR_Release " || echo -n "no package "
2014-04-25 12:10:30 +02:00
else
echo -n "no package "
fi
echo -n "("
print_environment_descr $ENVIRONMENT
echo -n ")"
2012-09-21 12:57:19 +02:00
fi
2014-06-18 13:15:44 +02:00
echo -n " :: openmamba webbuild @`hostname`</title>"
2012-09-02 13:18:52 +02:00
echo "</webbuild>"