webbuild-cgi: support for public social box and other fixes and improvements
This commit is contained in:
parent
5170d2815a
commit
dcff130bdf
@ -11,6 +11,34 @@ LOG=/var/autodist/webbuild/access_log
|
||||
DEFAULT_ENVIRONMENT=0
|
||||
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
|
||||
|
||||
function set_user_state_var() {
|
||||
local statevar=$1
|
||||
local statevalue=$2
|
||||
local stateuser=$3
|
||||
|
||||
[ ! "$stateuser" ] && stateuser=$USER
|
||||
|
||||
[ "$1" ] || return
|
||||
|
||||
[ -e $STATEDIR/users/$stateuser.state ] || touch $STATEDIR/users/$stateuser.state
|
||||
sed -i "/^$statevar=/d" $STATEDIR/users/$stateuser.state
|
||||
[ "$statevalue" ] && echo "$statevar=$statevalue" >> $STATEDIR/users/$stateuser.state
|
||||
}
|
||||
|
||||
function social_log() {
|
||||
local line=$1
|
||||
|
||||
[ "$1" ] || return
|
||||
|
||||
if [ ! "$STATE_FAKEUSER" ]; then
|
||||
STATE_SOCIALLOG_ID=0
|
||||
. $STATEDIR/users/webbuild.state
|
||||
STATE_SOCIALLOG_ID=`expr $STATE_SOCIALLOG_ID + 1`
|
||||
set_user_state_var STATE_SOCIALLOG_ID $STATE_SOCIALLOG_ID webbuild
|
||||
echo "SID=$STATE_SOCIALLOG_ID SPRIVACY=$STATE_PRIVACYMODE $line" >> $STATEDIR/social_log
|
||||
fi
|
||||
}
|
||||
|
||||
function cgi_encodevar() {
|
||||
local string="${1}"
|
||||
local strlen=${#string}
|
||||
@ -144,10 +172,12 @@ fi
|
||||
|
||||
# SECURITY
|
||||
USER_ENABLED=
|
||||
USER_ADMIN=
|
||||
USER_CANIMPORT=
|
||||
USER=${USER/.*\/}
|
||||
if [ "$SECRET" -a "$USER" ]; then
|
||||
if [ -r "$STATEDIR/users/$USER" ]; then
|
||||
. $STATEDIR/users/$USER
|
||||
if [ -r "$STATEDIR/users/$USER.conf" ]; then
|
||||
. $STATEDIR/users/$USER.conf
|
||||
fi
|
||||
if [ "$USER_ENABLED" ]; then
|
||||
USER_ENABLED=
|
||||
@ -172,10 +202,10 @@ if [ "$SECRET" -a "$USER" ]; then
|
||||
/usr/libexec/webbuild-checkpassword "$PASSWORD" "$SECRET" 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
tmpfile=`mktemp`
|
||||
cat $STATEDIR/users/$USER > $tmpfile
|
||||
cat $STATEDIR/users/$USER.conf > $tmpfile
|
||||
echo "USER_SECRET='$SECRET'" >> $tmpfile
|
||||
USER_ENABLED=1
|
||||
$SUDO_WRAPPER local "" "mv $tmpfile $STATEDIR/users/$USER"
|
||||
$SUDO_WRAPPER local "" "mv $tmpfile $STATEDIR/users/$USER.conf"
|
||||
else
|
||||
USER_ENABLED=
|
||||
fi
|
||||
@ -222,90 +252,205 @@ if [ "$USER_ENABLED" != "1" ]; then
|
||||
echo -n "ajax_getvalues(\"REQUEST=enablerequest\");>"
|
||||
echo -n "]]></output>"
|
||||
fi
|
||||
else
|
||||
echo -n "<output>Unauthorized!</output>"
|
||||
# else
|
||||
# echo -n "<output>Unauthorized!</output>"
|
||||
fi
|
||||
echo -n "<operationpanel> </operationpanel>"
|
||||
echo -n "</webbuild>"
|
||||
exit
|
||||
# echo -n "</webbuild>"
|
||||
# exit
|
||||
fi
|
||||
|
||||
echo -n "<socialbox><![CDATA["
|
||||
echo -n "<div class=\"socialbox\"><div class=\"scroll-pane\">"
|
||||
count=0
|
||||
[ -e "$STATEDIR/social_log" ] && tail -n 100 $STATEDIR/social_log | tac | while read line; do
|
||||
STYPE=
|
||||
eval $line
|
||||
[ "$SUSER" = "$USER" -a "$STYPE" != "broadcastmessage" ] && continue
|
||||
USER_GRAVATAR=`echo -n $SEMAIL | md5sum | sed "s| .*||"`
|
||||
echo -n "<div style=\"height:auto;\"><div style=\"position:relative;float:left;height:26px;width:24px;\">"
|
||||
echo -n "<img src=\"http://www.gravatar.com/avatar/$USER_GRAVATAR?s=22&d='http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=22'\" /></div>"
|
||||
DATENOW=`date +%s`
|
||||
HOURAGO=`expr \( $DATENOW - $STIME \) / 3600`
|
||||
MINAGO=`expr \( $DATENOW - $STIME \) / 60 % 60`
|
||||
SECAGO=`expr \( $DATENOW - $STIME \) % 60`
|
||||
TIMEAGO="${SECAGO}s"
|
||||
[ $MINAGO -gt 0 -o $HOURAGO -gt 0 ] && TIMEAGO="${MINAGO}m $TIMEAGO"
|
||||
[ $HOURAGO -gt 0 ] && TIMEAGO="${HOURAGO}h $TIMEAGO"
|
||||
echo -n "<div style=\"position:relative;float:right;height:auto;width:164px;\"><b>$SUSER</b> $STEXT <i>(${TIMEAGO} ago)</i></div></div><br>"
|
||||
# echo -n "<b>$SUSER</b> $STEXT <i>(${TIMEAGO} ago)</i><br>"
|
||||
count=`expr $count + 1`
|
||||
[ $count -ge 10 ] && break
|
||||
echo -n "<div style=\"clear:both;\"><hr></div>"
|
||||
done
|
||||
echo -n "</div></div>"
|
||||
echo -n "]]></socialbox>"
|
||||
if [ -e $STATEDIR/webbuild.state ]; then
|
||||
. $STATEDIR/users/webbuild.state
|
||||
else
|
||||
touch $STATEDIR/users/webbuild.state
|
||||
fi
|
||||
|
||||
if [ "$REQUEST" = "refresh" ]; then
|
||||
echo "</webbuild>"
|
||||
exit
|
||||
if [ "$USER_ADMIN" -a "$FAKEUSERSWITCH" != "" ]; then
|
||||
if [ "$FAKEUSERSWITCH" = "_disabled_" ]; then
|
||||
set_user_state_var STATE_FAKEUSER
|
||||
FAKEUSER=
|
||||
else
|
||||
set_user_state_var STATE_FAKEUSER $FAKEUSERSWITCH
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$USER" -a "$USER_ENABLED" ]; then
|
||||
|
||||
# set user state changes
|
||||
if [ "$ADVANCEDCONTROLSSWITCH" != "" ]; then
|
||||
if [ "$ADVANCEDCONTROLSSWITCH" = "true" ]; then
|
||||
set_user_state_var STATE_ADVANCEDCONTROLS 1
|
||||
else
|
||||
set_user_state_var STATE_ADVANCEDCONTROLS
|
||||
fi
|
||||
fi
|
||||
if [ "$PRIVACYMODESWITCH" != "" ]; then
|
||||
if [ "$PRIVACYMODESWITCH" = "true" ]; then
|
||||
set_user_state_var STATE_PRIVACYMODE 1
|
||||
else
|
||||
set_user_state_var STATE_PRIVACYMODE
|
||||
fi
|
||||
fi
|
||||
|
||||
# read user state file
|
||||
[ -e $STATEDIR/users/$USER.state ] && . $STATEDIR/users/$USER.state
|
||||
|
||||
if [ "$USER_ADMIN" -a "$STATE_FAKEUSER" != "" ]; then
|
||||
USER=$STATE_FAKEUSER
|
||||
USER_ENABLED=
|
||||
USER_ADMIN=
|
||||
USER_CANIMPORT=
|
||||
USER_CANINSTALL=
|
||||
USER_ALLENVIRONMENTS=
|
||||
USER_ALLREPOSITORIES=
|
||||
[ -e $STATEDIR/users/$USER.conf ] && . $STATEDIR/users/$USER.conf
|
||||
STATE_ADVANCEDCONTROLS=
|
||||
[ -e $STATEDIR/users/$USER.state ] && . $STATEDIR/users/$USER.state
|
||||
fi
|
||||
fi
|
||||
|
||||
# social box
|
||||
if [ "$REQUEST" = "refresh" -o ! "$USER" ]; then
|
||||
echo -n "<socialbox><![CDATA["
|
||||
echo -n "<div class=\"socialbox\"><div class=\"scroll-pane\">"
|
||||
count=0
|
||||
[ -e "$STATEDIR/social_log" ] && tail -n 100 $STATEDIR/social_log | tac | while read line; do
|
||||
STYPE=
|
||||
SPRIVACY=
|
||||
SUSER=
|
||||
eval $line
|
||||
[ "$SUSER" = "$USER" -a "$STYPE" != "broadcastmessage" ] && continue
|
||||
if [ "$SPRIVACY" -a ! "$USER" ]; then
|
||||
USER_GRAVATAR=
|
||||
else
|
||||
USER_GRAVATAR=`echo -n $SEMAIL | md5sum | sed "s| .*||"`
|
||||
fi
|
||||
echo -n "<div id=\"sociallog-$SID\" style=\"height:auto;\"><div style=\"position:relative;float:left;height:26px;width:24px;\">"
|
||||
echo -n "<img src=\"http://www.gravatar.com/avatar/$USER_GRAVATAR?s=22&d='http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=22'\" /></div>"
|
||||
DATENOW=`date +%s`
|
||||
DAYSAGO=`expr \( $DATENOW - $STIME \) / 86400`
|
||||
HOURAGO=`expr \( $DATENOW - $STIME \) / 3600 % 24`
|
||||
MINAGO=`expr \( $DATENOW - $STIME \) / 60 % 60`
|
||||
SECAGO=`expr \( $DATENOW - $STIME \) % 60`
|
||||
TIMEAGO="${SECAGO}s"
|
||||
if [ $DAYSAGO -gt 1 ]; then
|
||||
TIMEAGO="$DAYSAGO days"
|
||||
elif [ $DAYSAGO -eq 1 ]; then
|
||||
TIMEAGO="1 day ${HOURAGO} hours"
|
||||
elif [ $HOURAGO -gt 1 ]; then
|
||||
TIMEAGO="${HOURAGO} hours"
|
||||
elif [ $HOURAGO -eq 1 ]; then
|
||||
TIMEAGO="1 hour ${MINAGO} min"
|
||||
elif [ $MINAGO -gt 1 ]; then
|
||||
TIMEAGO="${MINAGO} minutes"
|
||||
elif [ $MINAGO -eq 1 ]; then
|
||||
TIMEAGO="1 min ${SECAGO} seconds"
|
||||
else
|
||||
TIMEAGO="${SECAGO} seconds"
|
||||
fi
|
||||
if [ "$SPRIVACY" -a ! "$USER" ]; then
|
||||
SUSER="A developer"
|
||||
fi
|
||||
echo -n "<div style=\"position:relative;float:right;height:auto;width:164px;\"><b>$SUSER</b> $STEXT <i>(${TIMEAGO} ago)</i></div></div><br>"
|
||||
count=`expr $count + 1`
|
||||
[ $count -ge 10 ] && break
|
||||
echo -n "<div style=\"clear:both;\"><hr></div>"
|
||||
done
|
||||
echo -n "</div></div>"
|
||||
echo -n "]]></socialbox>"
|
||||
|
||||
if [ ! "$USER_ENABLED" -o "$REQUEST" = "refresh" ]; then
|
||||
echo "</webbuild>"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# ENVIRONMENT select
|
||||
echo -n "<environments><![CDATA["
|
||||
echo -n "Build environment:<select id=environment "
|
||||
echo -n "onchange=javascript:ajax_getvalues(\"ENVIRONMENT=\"+this.value+\"&REQUEST=changeenvironment\");>"
|
||||
echo "<option value=\"\">-- Please select a build environment --</option>"
|
||||
if [ "$USER_CANIMPORT" ]; then
|
||||
[ "$MAINTAINERMODE" = "true" ] && CHECKED="checked"
|
||||
echo -n "Maintainer mode: <input type=checkbox id=\"maintain\" $CHECKED "
|
||||
echo -n "onclick=javascript:i=getElementById('repository').selectedIndex;"
|
||||
echo -n "ajax_getvalues(\"REPOSITORY=\"+getElementById('repository').options[i].text+\""
|
||||
echo -n "&MAINTAINERMODE=\"+getElementById('maintain').checked+\""
|
||||
echo -n "&PACKAGE=$PACKAGEENCODED&ENVIRONMENT=$ENVIRONMENT\");>"
|
||||
fi
|
||||
if [ "$USER_ADMIN" -o "$STATE_FAKEUSER" ]; then
|
||||
echo -n " Test user: <select id=adminuser "
|
||||
echo -n "onchange=javascript:ajax_getvalues(\"REQUEST=adminuser&"
|
||||
echo -n "FAKEUSERSWITCH=\"+this.value);>"
|
||||
echo -n "<option value=\"_disabled_\">-- disabled --</option>"
|
||||
for f in $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>"
|
||||
echo -n " | "
|
||||
fi
|
||||
# new session button
|
||||
echo -n "<input type=button id=newsessionbutton value=\"New session\" onclick=javascript:"
|
||||
echo -n "window.open(document.URL);>"
|
||||
# expert mode checkbox
|
||||
[ "$STATE_ADVANCEDCONTROLS" ] && CHECKED="checked=checked" || CHECKED=
|
||||
echo -n " <span style=\"white-space:nowrap\">Expert:<input type=checkbox id=\"advancedcontrols\" value=\"force\" "
|
||||
echo -n "onclick=javascript:ajax_getvalues(\""
|
||||
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "ADVANCEDCONTROLSSWITCH=\"+getElementById('advancedcontrols').checked); $CHECKED>"
|
||||
# privacy mode checkbox
|
||||
[ "$STATE_PRIVACYMODE" ] && CHECKED="checked=checked" || CHECKED=
|
||||
echo -n " <span style=\"white-space:nowrap\">Privacy:<input type=checkbox id=\"privacymode\" value=\"force\" "
|
||||
echo -n "onclick=javascript:ajax_getvalues(\""
|
||||
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "PRIVACYMODESWITCH=\"+getElementById('privacymode').checked); $CHECKED>"
|
||||
echo -n "</span>"
|
||||
if [ "$MAINTAINERMODE" != "true" ]; then
|
||||
# [ "$USER_CANIMPORT" -o "$STATE_FAKEUSER" -o "$USER_ADMIN" ] && echo -n "<br>"
|
||||
echo -n "<br>Build environment:<select id=environment "
|
||||
echo -n "onchange=javascript:ajax_getvalues(\"ENVIRONMENT=\"+this.value+\"&REQUEST=changeenvironment\");>"
|
||||
echo "<option value=\"\">-- Please select a build environment --</option>"
|
||||
|
||||
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
||||
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
||||
# [ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
||||
SELECTED=
|
||||
if [ "$ENVIRONMENT" ]; then
|
||||
[ "$ENVIRONMENT" = "$i" ] && SELECTED="selected=\"selected\"" || SELECTED=
|
||||
else
|
||||
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "$USER" ]; then
|
||||
SELECTED="selected=\"selected\""
|
||||
ENVIRONMENT=$i
|
||||
fi
|
||||
fi
|
||||
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "$USER" -o "${AUTOPORT_CHROOT_USER[$i]}" = "contrib" -o "$USER_ALLENVIRONMENTS" ]; then
|
||||
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "contrib" -a ! "$ENVIRONMENT" ]; then
|
||||
SELECTED="selected=\"selected\""
|
||||
ENVIRONMENT=$i
|
||||
fi
|
||||
echo -n "<option value=\"$i\" $SELECTED>"
|
||||
if [ "${AUTOPORT_CHROOT_USER[$i]}" ]; then
|
||||
echo -n "${AUTOPORT_CHROOT_USER[$i]} "
|
||||
SELECTED=
|
||||
if [ "$ENVIRONMENT" ]; then
|
||||
[ "$ENVIRONMENT" = "$i" ] && SELECTED="selected=\"selected\"" || SELECTED=
|
||||
else
|
||||
echo "autodist "
|
||||
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "$USER" ]; then
|
||||
SELECTED="selected=\"selected\""
|
||||
ENVIRONMENT=$i
|
||||
fi
|
||||
fi
|
||||
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
||||
echo -n "autoupdate"
|
||||
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||
echo -n "chroot"
|
||||
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||
echo -n "native"
|
||||
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||
echo -n "cross"
|
||||
else
|
||||
echo -n "unknown type"
|
||||
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "$USER" -o "${AUTOPORT_CHROOT_USER[$i]}" = "contrib" -o "$USER_ALLENVIRONMENTS" ]; then
|
||||
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "contrib" -a ! "$ENVIRONMENT" ]; then
|
||||
SELECTED="selected=\"selected\""
|
||||
ENVIRONMENT=$i
|
||||
fi
|
||||
echo -n "<option value=\"$i\" $SELECTED>"
|
||||
if [ "${AUTOPORT_CHROOT_USER[$i]}" ]; then
|
||||
echo -n "${AUTOPORT_CHROOT_USER[$i]} "
|
||||
else
|
||||
echo "autodist "
|
||||
fi
|
||||
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
||||
echo -n "autoupdate"
|
||||
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||
echo -n "chroot"
|
||||
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||
echo -n "native"
|
||||
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||
echo -n "cross"
|
||||
else
|
||||
echo -n "unknown type"
|
||||
fi
|
||||
echo -n " for ${AUTOPORT_ARCH[$i]} (${AUTOPORT_BASE_REPOSITORY[$i]} based)"
|
||||
echo -n "</option>"
|
||||
fi
|
||||
echo -n " for ${AUTOPORT_ARCH[$i]} (${AUTOPORT_BASE_REPOSITORY[$i]} based)"
|
||||
echo -n "</option>"
|
||||
fi
|
||||
done
|
||||
echo -n "</select>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
fi
|
||||
echo -n "]]></environments>"
|
||||
|
||||
if [ ! "$ENVIRONMENT" ]; then
|
||||
@ -373,109 +518,105 @@ if [ ! "$REPSEARCHTEXT" ]; then
|
||||
echo -n "</div>]]></searchbox>"
|
||||
fi
|
||||
|
||||
# REPOSITORIES select
|
||||
if [ ! "$REPOSITORY" ]; then
|
||||
echo -n "<repositories><![CDATA[Repository:<select id=repository "
|
||||
echo -n "onchange=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=\"+this.value+\""
|
||||
if [ "$USER_CANIMPORT" ]; then
|
||||
echo -n "&MAINTAINERMODE=\"+getElementById('maintain').checked+\""
|
||||
fi
|
||||
echo -n "&PACKAGE=$PACKAGEENCODED&REQUEST=changerepository\");>"
|
||||
echo -n "<option value=\"\">-- Select a repository --</option>"
|
||||
for f in `$SUDO_WRAPPER local "" "/usr/sbin/openmamba-repository list"`; do
|
||||
repname=`basename $f`
|
||||
echo -n "<option value=\"$repname\">$repname</option>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
if [ "$USER_CANIMPORT" ]; then
|
||||
[ "$MAINTAINERMODE" = "true" ] && CHECKED="checked"
|
||||
echo -n "<input type=checkbox id=\"maintain\" $CHECKED "
|
||||
echo -n "onclick=javascript:i=getElementById('repository').selectedIndex;"
|
||||
echo -n "ajax_getvalues(\"REPOSITORY=\"+getElementById('repository').options[i].text+\""
|
||||
echo -n "&MAINTAINERMODE=\"+getElementById('maintain').checked+\""
|
||||
echo -n "&PACKAGE=$PACKAGEENCODED&ENVIRONMENT=$ENVIRONMENT\");>maintainer mode "
|
||||
fi
|
||||
echo -n "]]></repositories>"
|
||||
echo -n "<packages> </packages>"
|
||||
echo -n "<operations> </operations>"
|
||||
fi
|
||||
|
||||
# PACKAGES (SRPM) select
|
||||
if [ "$REPOSITORY" -a "$REQUEST" = "changerepository" ]; then
|
||||
echo -n "<packages><![CDATA["
|
||||
echo -n "<select id=package "
|
||||
echo -n "onchange=javascript:i=getElementById('repository').selectedIndex;ajax_getvalues(\"REQUEST=changesrpm&"
|
||||
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>"
|
||||
for f in $local_ftp/$REPOSITORY/SRPMS.base/*.src.rpm; do
|
||||
[ -r $f ] || continue
|
||||
pkgname=`basename $f`
|
||||
pkgname=${pkgname/.src.rpm}
|
||||
pkgrel=${pkgname/*-}
|
||||
pkgname=${pkgname/-$pkgrel}
|
||||
pkgver=${pkgname/*-}
|
||||
pkgname=${pkgname/-$pkgver}
|
||||
if [ "$PACKAGE" = "$pkgname" ]; then
|
||||
SELECTED="selected=\"selected\"";
|
||||
REQUEST="changesrpm"
|
||||
else
|
||||
SELECTED=
|
||||
if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$MAINTAINERMODE" = "true" ]; then
|
||||
# REPOSITORIES select
|
||||
if [ ! "$REPOSITORY" -o "$REQUEST" = "changeenvironment" ]; then
|
||||
echo -n "<repositories><![CDATA[Repository:<select id=repository "
|
||||
echo -n "onchange=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=\"+this.value+\""
|
||||
if [ "$USER_CANIMPORT" ]; then
|
||||
echo -n "&MAINTAINERMODE=\"+getElementById('maintain').checked+\""
|
||||
fi
|
||||
echo -n "<option value=\"$pkgname\" $SELECTED>${pkgname} ${pkgver}-${pkgrel}</option>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
echo "]]></packages>"
|
||||
REQUEST=changesrpm
|
||||
fi
|
||||
echo -n "&PACKAGE=$PACKAGEENCODED&REQUEST=changerepository\");>"
|
||||
echo -n "<option value=\"\">-- Select a repository --</option>"
|
||||
for f in `$SUDO_WRAPPER local "" "/usr/sbin/openmamba-repository list"`; do
|
||||
repname=`basename $f`
|
||||
echo -n "<option value=\"$repname\">$repname</option>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
echo -n "]]></repositories>"
|
||||
echo -n "<packages> </packages>"
|
||||
echo -n "<operations> </operations>"
|
||||
fi
|
||||
|
||||
# SPECFILE creation
|
||||
if [ ! "$REQUEST" ]; then
|
||||
echo -n "<speccreate><![CDATA["
|
||||
echo -n " Start from URL:<input type=text id=speccreateurl value=\"\" size=\"55\">"
|
||||
echo -n " name:<input type=text id=speccreatename value=\"\" size=\"10\">"
|
||||
echo -n " type:<select id=speccreatetype>"
|
||||
for t in standard gnome kde3 kde4 library perl python standard-daemon; do
|
||||
echo -n "<option value=\"$t\">$t</option>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
echo -n " version:<input type=text id=speccreateversion value=\"\" size=\"6\">"
|
||||
echo -n "<input type=button id=speccreatebutton value=\"Create .spec\" onclick=javascript:ajax_getvalues(\""
|
||||
echo -n "REQUEST=speccreate&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
|
||||
echo -n "PACKAGE=\"+encodeURIComponent(getElementById('speccreatename').value)+\"&"
|
||||
echo -n "SPECCREATETYPE=\"+getElementById('speccreatetype').value+\"&"
|
||||
echo -n "SPECCREATEVERSION=\"+getElementById('speccreateversion').value+\"&"
|
||||
echo -n "SPECCREATEURL=\"+encodeURIComponent(getElementById('speccreateurl').value));>"
|
||||
echo "]]></speccreate>"
|
||||
fi
|
||||
|
||||
if [ "$REQUEST" = "changesrpm" ]; then
|
||||
if [ "$PACKAGE" ]; then
|
||||
# PACKAGES (SRPM) select
|
||||
if [ "$REPOSITORY" -a "$REQUEST" = "changerepository" ]; then
|
||||
echo -n "<packages><![CDATA[ SRPMS:"
|
||||
echo -n "<select id=package onchange=\"javascript:"
|
||||
echo -n "getElementById('preparebutton').disabled=(getElementById('package').selectedIndex == 0);\">"
|
||||
# i=getElementById('repository').selectedIndex;ajax_getvalues(\"REQUEST=changesrpm&"
|
||||
# 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>"
|
||||
for f in $local_ftp/$REPOSITORY/SRPMS.base/*.src.rpm; do
|
||||
[ -r $f ] || continue
|
||||
pkgname=`basename $f`
|
||||
pkgname=${pkgname/.src.rpm}
|
||||
pkgrel=${pkgname/*-}
|
||||
pkgname=${pkgname/-$pkgrel}
|
||||
pkgver=${pkgname/*-}
|
||||
pkgname=${pkgname/-$pkgver}
|
||||
if [ "$PACKAGE" = "$pkgname" ]; then
|
||||
SELECTED="selected=\"selected\"";
|
||||
REQUEST="changesrpm"
|
||||
else
|
||||
SELECTED=
|
||||
fi
|
||||
echo -n "<option value=\"$pkgname\" $SELECTED>${pkgname} ${pkgver}-${pkgrel}</option>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
echo -n "]]></packages>"
|
||||
echo -n "<operations><![CDATA["
|
||||
if [ "$MAINTAINERMODE" != "true" ]; then
|
||||
echo -n "<input type=button name=prepare value=\"prepare\" "
|
||||
echo -n "<input type=button name=prepare value=\"prepare\" id=preparebutton "
|
||||
echo -n "onclick=javascript:i=getElementById('repository').selectedIndex;j=getElementById('package').selectedIndex;"
|
||||
echo -n "ajax_getvalues(\"REQUEST=prepare&REPOSITORY=\"+getElementById('repository').options[i].value+\""
|
||||
echo -n "&ENVIRONMENT=$ENVIRONMENT&MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
|
||||
echo -n "PACKAGE=\"+encodeURIComponent(getElementById('package').options[j].value));>"
|
||||
echo -n "PACKAGE=\"+encodeURIComponent(getElementById('package').options[j].value)); disabled=disabled>"
|
||||
fi
|
||||
echo "]]></operations>"
|
||||
REQUEST="edit"
|
||||
else
|
||||
echo "<operations> </operations>"
|
||||
echo -n "]]></operations>"
|
||||
# if [ "$MAINTAINERMODE" = "true" ]; then
|
||||
# PACKAGE=
|
||||
# echo "<operationpanel> </operationpanel>"
|
||||
# fi
|
||||
REQUEST=changesrpm
|
||||
fi
|
||||
elif [ "$REQUEST" = "changespec" ]; then
|
||||
|
||||
# SPECFILE creation
|
||||
if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -a "$MAINTAINERMODE" != "true" ]; then
|
||||
echo -n "<speccreate><![CDATA["
|
||||
echo -n " Start from URL:<input type=text id=speccreateurl value=\"\" size=\"55\">"
|
||||
echo -n " name:<input type=text id=speccreatename value=\"\" size=\"10\">"
|
||||
echo -n " type:<select id=speccreatetype>"
|
||||
for t in standard gnome kde3 kde4 library perl python standard-daemon; do
|
||||
echo -n "<option value=\"$t\">$t</option>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
echo -n " version:<input type=text id=speccreateversion value=\"\" size=\"6\">"
|
||||
echo -n "<input type=button id=speccreatebutton value=\"Create .spec\" onclick=javascript:ajax_getvalues(\""
|
||||
echo -n "REQUEST=speccreate&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
|
||||
echo -n "PACKAGE=\"+encodeURIComponent(getElementById('speccreatename').value)+\"&"
|
||||
echo -n "SPECCREATETYPE=\"+getElementById('speccreatetype').value+\"&"
|
||||
echo -n "SPECCREATEVERSION=\"+getElementById('speccreateversion').value+\"&"
|
||||
echo -n "SPECCREATEURL=\"+encodeURIComponent(getElementById('speccreateurl').value));>"
|
||||
echo "]]></speccreate>"
|
||||
elif [ "$MAINTAINERMODE" = "true" ]; then
|
||||
echo -n "<speccreate> </speccreate>"
|
||||
fi
|
||||
else
|
||||
echo -n "<repositories> </repositories><packages> </packages><operations> </operations><speccreate> </speccreate>"
|
||||
fi
|
||||
if [ "$REQUEST" = "changespec" ]; then
|
||||
if [ "$PACKAGE" ]; then
|
||||
REQUEST="edit";
|
||||
fi
|
||||
elif [ "$REQUEST" = "broadcastmessage" ]; then
|
||||
BROADCASTMESSAGE=`echo $BROADCASTMESSAGE | sed "s|<|\<|g"`
|
||||
echo "SUSER=$USER STYPE=broadcastmessage SEMAIL=$USER_EMAIL STEXT=\"said:"<i>$BROADCASTMESSAGE</i>"\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER STYPE=broadcastmessage SEMAIL=$USER_EMAIL STEXT=\"said:"<i>$BROADCASTMESSAGE</i>"\" STIME=`date +%s`"
|
||||
REQUEST=
|
||||
fi
|
||||
|
||||
if [ ! "$PACKAGE" -a "$MAINTAINERMODE" != "true" ]; then
|
||||
if [ "$MAINTAINERMODE" != "true" -a ! "$PACKAGE" ]; then
|
||||
echo "<editor> </editor>"
|
||||
echo "<editcontrols> </editcontrols>"
|
||||
echo "<operationpanel> </operationpanel>"
|
||||
@ -546,6 +687,9 @@ if [ "$REPOSITORY" != "" -a "$MAINTAINERMODE" = "true" ]; then
|
||||
echo -n "<br><b>Log:</b><br><pre>"
|
||||
cat $local_ftp/$REPOSITORY/distromatic.log
|
||||
echo -n "</pre></div>"
|
||||
echo -n "<input type=button id=updatespecbutton value=\"reload\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "MAINTAINERMODE=$MAINTAINERMODE&REQUEST=reloadmaintainer\");>"
|
||||
echo -n "]]></editor>"
|
||||
fi
|
||||
fi
|
||||
@ -557,7 +701,7 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" ]; then
|
||||
fi
|
||||
if [ "$MAINTAINERMODE" != "true" -a "$SPECAVAILABLE" ]; then
|
||||
if [ "$REQUEST" = "edit" ]; then
|
||||
echo "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"is working on <b>$PACKAGE</b>\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"is working on <b>$PACKAGE</b>\" STIME=`date +%s`"
|
||||
fi
|
||||
echo -n "<editcontrols><![CDATA[Current <b>$PACKAGE.spec</b> in build environment: "
|
||||
echo -n "new version (empty=autodetect):<input type=text id=updatespecversion value=\"\" size=\"12\">"
|
||||
@ -588,8 +732,100 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" ]; then
|
||||
if [ "$MAINTAINERMODE" = "true" -o "$SPECAVAILABLE" ]; then
|
||||
echo -n "<operationpanel><![CDATA[<hr>"
|
||||
if [ "$MAINTAINERMODE" != "true" ]; then
|
||||
if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
|
||||
echo -n "<b>Last logs:</b> "
|
||||
echo -n "Package: <b>$PACKAGE</b>"
|
||||
echo -n "<br>Target arch:<select id=rpmbuildarch>"
|
||||
for f in i586 arm x86_64 ppc; do
|
||||
SELECTED=
|
||||
if [ ! "$RPMBUILDARCH" -a "$f" = "${AUTOPORT_ARCH[$ENVIRONMENT]}" ]; then
|
||||
SELECTED="selected=\"selected\"";
|
||||
fi
|
||||
echo -n "<option value=\"$f\" $SELECTED>$f</option>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
echo -n "<label style=\"vertical-align:middle;\"><input type=checkbox id=\"rpmforce\" value=\"force\">force</label>"
|
||||
[ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$STATE_ADVANCEDCONTROLS" ] && echo -n "<hr><b>Autodist automatic builds:</b><br>"
|
||||
if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
||||
echo -n "Patch:<input type=button value=\"show\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=showpatch\");>"
|
||||
echo -n "<input type=button value=\"remove\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=removepatch\"); class=redbutton>"
|
||||
echo -n "<input type=button id=updatepatchbutton value=\"update\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
||||
echo -n "REQUEST=updatepatch\"); class=redbutton>"
|
||||
echo -n "<input type=button id=buildpatchbutton value=\"build\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
||||
echo -n "REQUEST=buildpatch\"); class=redbutton>"
|
||||
# autodist schedule
|
||||
echo -n "<br>Schedule:<input type=button value=\"show\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=showscheduled\");>"
|
||||
# autodist unschedule
|
||||
echo -n "<input type=button value=\"unschedule\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=unschedule\"); class=redbutton>"
|
||||
# autodist skip
|
||||
echo -n "<input type=button value=\"skip\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=skip\"); class=redbutton>"
|
||||
fi
|
||||
if [ "$STATE_ADVANCEDCONTROLS" ]; then
|
||||
# autodist list-jobs
|
||||
echo -n "Job:<select id=autodistjobs>"
|
||||
echo -n "<option value=\"$PACKAGEENCODED\">$PACKAGE</option>"
|
||||
for f in `$SUDO_WRAPPER $ENVIRONMENT "" "autodist --list-jobs"`; do
|
||||
[ "$AUTODISTJOB" = "$f" ] && SELECTED="selected=\"selected\"" || SELECTED=
|
||||
JOBENCODED=`cgi_encodevar $f`
|
||||
echo -n "<option value=\"$JOBENCODED\" $SELECTED>$f</option>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
# autodist prepare
|
||||
echo -n "<br><input type=button value=\"prepare\" onclick=javascript:"
|
||||
echo -n "j=getElementById('rpmbuildarch').selectedIndex;"
|
||||
echo -n "i=getElementById('autodistjobs').selectedIndex;ajax_getvalues(\""
|
||||
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
|
||||
echo -n "AUTODISTARCH=\"+getElementById('rpmbuildarch').options[j].value+\"&"
|
||||
echo -n "AUTODISTJOB=\"+getElementById('autodistjobs').options[i].value+\"&"
|
||||
echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistprepare\");>"
|
||||
# autodist update
|
||||
echo -n "<input type=button value=\"update\" onclick=javascript:"
|
||||
echo -n "j=getElementById('rpmbuildarch').selectedIndex;"
|
||||
echo -n "i=getElementById('autodistjobs').selectedIndex;ajax_getvalues(\""
|
||||
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
|
||||
echo -n "AUTODISTARCH=\"+getElementById('rpmbuildarch').options[j].value+\"&"
|
||||
echo -n "AUTODISTJOB=\"+getElementById('autodistjobs').options[i].value+\"&"
|
||||
echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistupdate\");>"
|
||||
# autodist build
|
||||
echo -n "<input type=button value=\"build\" onclick=javascript:"
|
||||
echo -n "j=getElementById('rpmbuildarch').selectedIndex;"
|
||||
echo -n "i=getElementById('autodistjobs').selectedIndex;ajax_getvalues(\""
|
||||
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
|
||||
echo -n "AUTODISTARCH=\"+getElementById('rpmbuildarch').options[j].value+\"&"
|
||||
echo -n "AUTODISTJOB=\"+getElementById('autodistjobs').options[i].value+\"&"
|
||||
echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistbuild\"); class=boldbutton>"
|
||||
# autodist install
|
||||
[ ! "$USER_CANINSTALL" ] && DISABLED="disabled=disabled" || DISABLED=
|
||||
echo -n "<input type=button value=\"install\" onclick=javascript:"
|
||||
echo -n "j=getElementById('rpmbuildarch').selectedIndex;"
|
||||
echo -n "i=getElementById('autodistjobs').selectedIndex;ajax_getvalues(\""
|
||||
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
|
||||
echo -n "AUTODISTARCH=\"+getElementById('rpmbuildarch').options[j].value+\"&"
|
||||
echo -n "AUTODISTJOB=\"+getElementById('autodistjobs').options[i].value+\"&"
|
||||
echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistinstall\"); class=redbutton $DISABLED>"
|
||||
# autodist send
|
||||
[ ! "$USER_ALLREPOSITORIES" ] && DISABLED="disabled=disabled" || DISABLED=
|
||||
echo -n "<input type=button value=\"send\" onclick=javascript:"
|
||||
echo -n "j=getElementById('rpmbuildarch').selectedIndex;"
|
||||
echo -n "i=getElementById('autodistjobs').selectedIndex;ajax_getvalues(\""
|
||||
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
|
||||
echo -n "AUTODISTARCH=\"+getElementById('rpmbuildarch').options[j].value+\"&"
|
||||
echo -n "AUTODISTJOB=\"+getElementById('autodistjobs').options[i].value+\"&"
|
||||
echo -n "ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&REQUEST=autodistsend\"); class=redbutton $DISABLED>"
|
||||
# autodist force checkbox
|
||||
fi
|
||||
if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
||||
# autodist logs
|
||||
echo -n "<hr><b>Last autodist logs:</b> "
|
||||
echo -n "OK <input id=\"logstatusOK\" type=\"radio\" name=\"logstatus\" value=\"OK\"> "
|
||||
echo -n "FAILED<input type=\"radio\" name=\"logstatus\" value=\"FAILED\" checked=\"checked\"><br>"
|
||||
echo -n "<input type=button value=\"prepare\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
||||
@ -600,19 +836,10 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" ]; then
|
||||
echo -n "REQUEST=showlog&LOGTYPE=build&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
||||
echo -n "<input type=button value=\"install\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=showlog&LOGTYPE=install&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
||||
if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
||||
echo -n "<hr><b>Scheduled builds:</b><br>"
|
||||
echo -n "<input type=button value=\"show\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=showscheduled\");>"
|
||||
echo -n "<input type=button value=\"unschedule\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=unschedule\"); class=redbutton>"
|
||||
echo -n "<input type=button value=\"skip\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=skip\"); class=redbutton>"
|
||||
fi
|
||||
echo -n "<hr>"
|
||||
echo -n "<input type=button value=\"send\" onclick=javascript:ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=showlog&LOGTYPE=send&LOGSTATUSOK=\"+document.all.logstatusOK.checked);>"
|
||||
fi
|
||||
echo -n "Package: <b>$PACKAGE</b><br>"
|
||||
echo -n "<b>RPM packaging commands:</b><br>"
|
||||
echo -n "<hr><b>RPM packaging commands:</b><br>"
|
||||
# check for updates
|
||||
echo -n "<input type=button value=\"check for updates\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autospecupdatescheck\");>"
|
||||
@ -652,16 +879,6 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" ]; then
|
||||
echo -n "<input type=button id=rpminstallbutton value=\"install\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=rpminstall&"
|
||||
echo -n "RPMFORCE=\"+getElementById('rpmforce').checked); class=redbutton $DISABLED>"
|
||||
echo -n "<br>target arch:<select id=rpmbuildarch>"
|
||||
for f in i586 arm x86_64 ppc; do
|
||||
SELECTED=
|
||||
if [ ! "$RPMBUILDARCH" -a "$f" = "${AUTOPORT_ARCH[$ENVIRONMENT]}" ]; then
|
||||
SELECTED="selected=\"selected\"";
|
||||
fi
|
||||
echo -n "<option value=\"$f\" $SELECTED>$f</option>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
echo -n "<label style=\"vertical-align:middle;\"><input type=checkbox id=\"rpmforce\" value=\"force\">force</label>"
|
||||
echo -n "<hr><b>Add patches:</b>"
|
||||
echo -n "<input type=button id=addpatchbutton value=\"submit\" onclick=javascript:ajax_getvalues(\""
|
||||
echo -n "REQUEST=addpatch&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
@ -703,7 +920,7 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" ]; then
|
||||
if [ "$MAINTAINERMODE" = "true" ]; then
|
||||
echo -n "<hr><b>Repository maintenance:</b><br>"
|
||||
echo -n "Package: <b>$PACKAGE</b><br>"
|
||||
echo -n "Source: <b>$REPOSITORY</b><br>"
|
||||
echo -n "Origin: <b>$REPOSITORY</b><br>"
|
||||
echo -n "Destination: "
|
||||
echo -n "<select id=repositoryimportto>"
|
||||
for f in ${AUTOPORT_IMPORT_REPOSITORIES[$ENVIRONMENT]}; do
|
||||
@ -723,22 +940,22 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" ]; then
|
||||
echo -n "SENDREPOSITORY=\"+getElementById('sendrepository').options[i].value+\"&"
|
||||
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
|
||||
echo -n "REQUEST=repositoryarchive\"); class=redbutton>"
|
||||
echo -n "<hr><input type=button value=\"import to:\" onclick=javascript:"
|
||||
echo -n "i=getElementById('repositoryimportto').selectedIndex;j=getElementById('sendrepository').selectedIndex;"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REPOSITORYIMPORTTO=\"+getElementById('repositoryimportto').options[i].value+\"&"
|
||||
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
|
||||
echo -n "SENDREPOSITORY=\"+getElementById('sendrepository').options[j].value+\"&"
|
||||
echo -n "REQUEST=repositoryimport\");>"
|
||||
echo -n "<select id=repositoryimportto>"
|
||||
for f in ${AUTOPORT_IMPORT_REPOSITORIES[$ENVIRONMENT]}; do
|
||||
if [ "$MAINTAINERMODE" = "true" ]; then
|
||||
[ "$f" != "$REPOSITORY" ] && echo -n "<option value=\"$f\">$f</option>"
|
||||
else
|
||||
[ "$f" != "${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}" ] && echo -n "<option value=\"$f\">$f</option>"
|
||||
fi
|
||||
done
|
||||
echo -n "</select>"
|
||||
# echo -n "<hr><input type=button value=\"import to:\" onclick=javascript:"
|
||||
# echo -n "i=getElementById('repositoryimportto').selectedIndex;j=getElementById('sendrepository').selectedIndex;"
|
||||
# echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
# echo -n "REPOSITORYIMPORTTO=\"+getElementById('repositoryimportto').options[i].value+\"&"
|
||||
# echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
|
||||
# echo -n "SENDREPOSITORY=\"+getElementById('sendrepository').options[j].value+\"&"
|
||||
# echo -n "REQUEST=repositoryimport\");>"
|
||||
# echo -n "<select id=repositoryimportto>"
|
||||
# for f in ${AUTOPORT_IMPORT_REPOSITORIES[$ENVIRONMENT]}; do
|
||||
# if [ "$MAINTAINERMODE" = "true" ]; then
|
||||
# [ "$f" != "$REPOSITORY" ] && echo -n "<option value=\"$f\">$f</option>"
|
||||
# else
|
||||
# [ "$f" != "${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}" ] && echo -n "<option value=\"$f\">$f</option>"
|
||||
# fi
|
||||
# done
|
||||
# echo -n "</select>"
|
||||
else
|
||||
# repository compare
|
||||
echo -n "<input type=button value=\"compare\" onclick=javascript:"
|
||||
@ -772,7 +989,7 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" ]; then
|
||||
echo -n "REPOSITORYSIMULATE=\"+getElementById('repositorysimulate').checked+\"&"
|
||||
echo -n "REQUEST=repositoryarchive\"); class=redbutton>"
|
||||
fi
|
||||
echo -n "<br><input type=checkbox id=\"repositorysimulate\" value=\"simulate\">simulate</label>"
|
||||
echo -n "<input type=checkbox id=\"repositorysimulate\" value=\"simulate\">simulate</label>"
|
||||
fi
|
||||
if [ "$MAINTAINERMODE" != "true" ]; then
|
||||
if [ ! "${AUTOPORT_DISABLE[$ENVIRONMENT]}" -a ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
||||
@ -783,24 +1000,6 @@ if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" ]; then
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autoportlog\");>"
|
||||
fi
|
||||
|
||||
if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
||||
echo -n "<hr><b>Autodist:</b><br>"
|
||||
echo -n "Patch:<input type=button value=\"show\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=showpatch\");>"
|
||||
echo -n "<input type=button value=\"remove\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=removepatch\"); class=redbutton>"
|
||||
echo -n "<input type=button id=updatepatchbutton value=\"update\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
||||
echo -n "REQUEST=updatepatch\"); class=redbutton>"
|
||||
echo -n "<input type=button id=buildpatchbutton value=\"build\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
|
||||
echo -n "REQUEST=buildpatch\"); class=redbutton>"
|
||||
fi
|
||||
|
||||
echo -n "<hr><b>Info:</b><br>"
|
||||
echo -n "<input type=button value=\"allowed groups\" onclick=javascript:"
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=allowedgroups\");>"
|
||||
@ -865,7 +1064,7 @@ else
|
||||
echo -n "<output><![CDATA["
|
||||
echo "<div align=left class=output "
|
||||
if [ "$REQUEST" = "rpmbuild" -o "$REQUEST" = "autoportnp" -o "$REQUEST" = "rpmprepare" \
|
||||
-o "$REQUEST" = "sendpackage" -o "$REQUEST" = "sendsource" ]; then
|
||||
-o "$REQUEST" = "sendpackage" -o "$REQUEST" = "sendsource" -o "$REQUEST" = "autospeclistcheck" ]; then
|
||||
echo -n "id=outputbottom"
|
||||
else
|
||||
echo -n "id=outputtop"
|
||||
@ -878,29 +1077,44 @@ else
|
||||
"removepatch") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE remove"
|
||||
RET=$?
|
||||
if [ $RET -eq 0 ]; then
|
||||
echo "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"removed the autodist patch for <b>$PACKAGE</b>\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"removed the autodist patch for <b>$PACKAGE</b>\" STIME=`date +%s`"
|
||||
fi ;;
|
||||
"updatepatch") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE update"
|
||||
RET=$?
|
||||
if [ $RET -eq 0 ]; then
|
||||
echo "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist <b>update</b> patch for <b>$PACKAGE</b>\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist <b>update</b> patch for <b>$PACKAGE</b>\" STIME=`date +%s`"
|
||||
fi ;;
|
||||
"buildpatch") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool makepatch $PACKAGE build"
|
||||
RET=$?
|
||||
if [ $RET -eq 0 ]; then
|
||||
echo "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist <b>build</b> patch for <b>$PACKAGE</b>\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist <b>build</b> patch for <b>$PACKAGE</b>\" STIME=`date +%s`"
|
||||
fi ;;
|
||||
"showscheduled") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool schedule"; RET=$? ;;
|
||||
"unschedule") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool unschedule $PACKAGE"
|
||||
RET=$?
|
||||
if [ $RET -eq 0 ]; then
|
||||
echo "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"unscheduled autodist job <b>$PACKAGE</b>\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"unscheduled autodist job <b>$PACKAGE</b>\" STIME=`date +%s`"
|
||||
fi ;;
|
||||
"skip") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist-tool skip $PACKAGE"
|
||||
RET=$?
|
||||
if [ $RET -eq 0 ]; then
|
||||
echo "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"added autodist job <b>$PACKAGE</b> to skipped list\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"added autodist job <b>$PACKAGE</b> to skipped list\" STIME=`date +%s`"
|
||||
fi ;;
|
||||
"autodistprepare") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
|
||||
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist -p $AUTODISTJOB --arch $AUTODISTARCH $AUTODISTADD"
|
||||
RET=$? ;;
|
||||
"autodistupdate") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
|
||||
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist -u $AUTODISTJOB --arch $AUTODISTARCH $AUTODISTADD"
|
||||
RET=$? ;;
|
||||
"autodistbuild") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
|
||||
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist -b $AUTODISTJOB --arch $AUTODISTARCH $AUTODISTADD"
|
||||
RET=$? ;;
|
||||
"autodistinstall") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
|
||||
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist -i $AUTODISTJOB --arch $AUTODISTARCH $AUTODISTADD"
|
||||
RET=$? ;;
|
||||
"autodistsend") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
|
||||
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autodist -s $AUTODISTJOB --arch $AUTODISTARCH $AUTODISTADD"
|
||||
RET=$? ;;
|
||||
"buildrootfiles") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "cd @RPMBUILDROOT@ && find @BUILDROOT@"; RET=$? ;;
|
||||
"autospecupdatescheck") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a2"; RET=$? ;;
|
||||
"rpmprepare") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "rpmbuild -bp $PACKAGE.spec"; RET=$? ;;
|
||||
@ -911,7 +1125,7 @@ else
|
||||
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a5 $RPMFORCEADD $RPMARCHADD"
|
||||
RET=$?
|
||||
if [ $RET -eq 0 ]; then
|
||||
echo "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"successfully built <b>$PACKAGE</b>\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"successfully built <b>$PACKAGE</b>\" STIME=`date +%s`"
|
||||
fi
|
||||
sed -i "|RPMBUILD=$PACKAGE USER=$USER ENVIRONMENT=$ENVIRONMENT|d" $STATEDIR/buildingnow_log
|
||||
#kill `pstree -p 25541 | sed 's/(/\n(/g' | grep '(' | sed 's/(\(.*\)).*/\1/' | tr "\n" " "`
|
||||
@ -935,7 +1149,7 @@ else
|
||||
RET=1
|
||||
fi ;;
|
||||
"addpatch") if [ "$ADDPATCHURL" -a "$ADDPATCHNAME" ]; then
|
||||
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "curl \"$ADDPATCHURL\" -o ../SOURCES/$PACKAGE-$ADDPATCHNAME.patch"
|
||||
$SUDO_WRAPPER $ENVIRONMENT $PACKAGE "curl -s \"$ADDPATCHURL\" -o ../SOURCES/$PACKAGE-$ADDPATCHNAME.patch"
|
||||
RET=$?
|
||||
[ $RET -eq 0 ] && echo "Patch added with name $PACKAGE-$ADDPATCHNAME.patch"
|
||||
else
|
||||
@ -945,7 +1159,7 @@ else
|
||||
"sendpackage") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autospec -u $PACKAGE -a10 --server $SENDREPOSITORY"
|
||||
RET=$?
|
||||
if [ $RET -eq 0 ]; then
|
||||
echo "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$PACKAGE</b> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$PACKAGE</b> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
|
||||
fi ;;
|
||||
"sendsource") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force --nodeps"
|
||||
if [ "$SENDREPOSITORY" ]; then
|
||||
@ -960,7 +1174,7 @@ else
|
||||
$SUDO_WRAPPER local $PACKAGE "openmamba-repository import $SENDREPOSITORY $PACKAGE -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
|
||||
RET=$?
|
||||
if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
|
||||
echo "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"imported <b>$PACKAGE</b> from <b>$SENDREPOSITORY</b> to <b>$REPOSITORYIMPORTTO</b>\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"imported <b>$PACKAGE</b> from <b>$SENDREPOSITORY</b> to <b>$REPOSITORYIMPORTTO</b>\" STIME=`date +%s`"
|
||||
fi
|
||||
;;
|
||||
"repositoryrelease")
|
||||
@ -968,7 +1182,7 @@ else
|
||||
$SUDO_WRAPPER local $PACKAGE "openmamba-repository release $SENDREPOSITORY $PACKAGE -d $REPOSITORYIMPORTTO $SIMULATEADD -y"
|
||||
RET=$?
|
||||
if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
|
||||
echo "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"released <b>$PACKAGE</b> from <b>$SENDREPOSITORY</b> to <b>$REPOSITORYIMPORTTO</b>\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"released <b>$PACKAGE</b> from <b>$SENDREPOSITORY</b> to <b>$REPOSITORYIMPORTTO</b>\" STIME=`date +%s`"
|
||||
fi
|
||||
;;
|
||||
"repositorydiff")
|
||||
@ -980,7 +1194,7 @@ else
|
||||
$SUDO_WRAPPER local $PACKAGE "openmamba-repository archive $SENDREPOSITORY $PACKAGE -y"
|
||||
RET=$?
|
||||
if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then
|
||||
echo "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"archived <b>$PACKAGE</b> in <b>$SENDREPOSITORY</b>\" STIME=`date +%s`" >> $STATEDIR/social_log
|
||||
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"archived <b>$PACKAGE</b> in <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
|
||||
fi
|
||||
;;
|
||||
"autoportnp") $SUDO_WRAPPER $ENVIRONMENT $PACKAGE "autoport -np $PACKAGE"; RET=$? ;;
|
||||
|
Loading…
Reference in New Issue
Block a user