#!/bin/bash # # webbuild cgi script # Copyright (c) 2012-2015 by Silvan Calarco # . /usr/share/autodist/webbuild-functions . /usr/share/autodist/webbuild-functions-private AUTOSPEC_CMD="autospec --colors web" # register all GET and POST variables cgi_getvars BOTH ALL #[ "$PACKAGE" ] && PACKAGEENCODED=`cgi_encodevar "$PACKAGE"` || PACKAGEENCODED= [ "$PACKAGE" ] && PACKAGEENCODED=`cgi_encodevar "$PACKAGE"` || PACKAGEENCODED= #cgi_getvars POST if [ "${REQUEST:0:7}" != "refresh" ]; then echo "`date` - USER=$USER&REQUEST=$REQUEST&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGE&MAINTAINERMODE=$MAINTAINERMODE" >> $LOG fi # read configuration after cgi_getvars to prevent variables overriding . /etc/sysconfig/autoport if [ "$REQUEST" != "rpmmanagerdownload" ]; then echo -e "Content-type: text/xml\nPragma: no-cache\n" echo -n "" fi # SECURITY USER_ENABLED= USER_ADMIN= USER_CANMAINTAIN= USER_CANSENDMESSAGES= USER=${USER/.*\/} if [ "$REMOTE_ADDR" = "127.0.0.1" -a "$USER" = "" ]; then USER=admin fi if [ "$USER" ]; then if [ -r "$WEBBUILD_STATEDIR/users/$USER.conf" ]; then . $WEBBUILD_STATEDIR/users/$USER.conf fi if [ "$USER_ENABLED" ]; then if [ "$USER_EMAIL" ]; then grep "USER_EMAIL=" $WEBBUILD_STATEDIR/users/$USER.conf >/dev/null || echo "USER_EMAIL=$USER_EMAIL" >> $WEBBUILD_STATEDIR/users/$USER.conf fi USER_ENABLED= if [ "$SECRET" = "$USER_SECRET" ]; then [ "$REMOTE_ADDR" = "127.0.0.1" -o "$USER_SECRET" ] && USER_ENABLED=1 || USER_ENABLED= elif [ "$REQUEST" = "password" ]; then 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 if [ $? -eq 0 ]; then 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 USER_ENABLED=1 else USER_ENABLED= fi elif [ "${REQUEST:0:7}" != "refresh" ]; then # no "$USER_SECRET" set; require password echo -n "" echo -n " " echo -n "]]>" echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n "" exit fi fi elif [ "${REQUEST:0:7}" != "refresh" ]; then echo -n "" echo -n " " echo -n "]]>" echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n "" exit fi if [ "$USER_ENABLED" != "1" -a "${REQUEST:0:7}" != "refresh" ]; then echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " echo -n " " if [ "$USER" ]; then if [ "$REQUEST" = "enablerequest" ]; then echo "REQUEST_DATE=\"`date`\" REQUEST_USER=$USER REQUEST_USER_EMAIL=$USER_EMAIL REQUEST_TYPE=$REQUEST REQUEST_SECRET='$SECRET'" >> $WEBBUILD_STATEDIR/requests echo -n "Your request has been submitted. Please wait for approval and retry later." elif [ "$REQUEST" = "password" ]; then echo -n "Invalid password. Please reload and retry or ask the maintainer in case of problems." elif [ "`grep \" REQUEST_USER=$USER \" $WEBBUILD_STATEDIR/requests`" ]; then echo -n "Your request is pending for approval. Please try again later or ask the maintainer in case of problems." else echo -n "" echo -n "]]>" fi # else # echo -n "Unauthorized!" fi echo -n " " echo -n "" exit fi if [ -e $WEBBUILD_STATEDIR/webbuild.state ]; then . $WEBBUILD_STATEDIR/users/webbuild.state else touch $WEBBUILD_STATEDIR/users/webbuild.state fi if [ "$USER_ADMIN" -a "$FAKEUSERSWITCH" != "" ]; then if [ "$FAKEUSERSWITCH" = "_disabled_" ]; then set_user_state_var STATE_FAKEUSER FAKEUSER= else set_user_state_var STATE_FAKEUSER $FAKEUSERSWITCH fi fi if [ "$USER" -a "$USER_ENABLED" ]; then # set user state changes if [ "$AUTODISTCURRENT" != "" ]; then if [ "$AUTODISTCURRENT" = "true" ]; then set_user_state_var STATE_AUTODISTCURRENT 1 else set_user_state_var STATE_AUTODISTCURRENT 0 fi fi if [ "$ADVANCEDCONTROLSSWITCH" != "" ]; then if [ "$ADVANCEDCONTROLSSWITCH" = "true" ]; then set_user_state_var STATE_ADVANCEDCONTROLS 1 else set_user_state_var STATE_ADVANCEDCONTROLS fi fi if [ "$PRIVACYMODESWITCH" != "" ]; then if [ "$PRIVACYMODESWITCH" = "true" ]; then set_user_state_var STATE_PRIVACYMODE 1 else set_user_state_var STATE_PRIVACYMODE fi fi if [ "$JOBSSHOWALL" != "" ]; then if [ "$JOBSSHOWALL" = "true" ]; then set_user_state_var STATE_JOBSSHOWALL 1 else set_user_state_var STATE_JOBSSHOWALL fi fi # read user state file [ -e $WEBBUILD_STATEDIR/users/$USER.state ] && . $WEBBUILD_STATEDIR/users/$USER.state if [ "$USER_ADMIN" -a "$STATE_FAKEUSER" != "" ]; then USER=$STATE_FAKEUSER USER_ENABLED= USER_ADMIN= USER_CANMAINTAIN= USER_CANINSTALL= USER_ENVIRONMENTS= USER_ALLENVIRONMENTS= USER_ALLREPOSITORIES= [ -e $WEBBUILD_STATEDIR/users/$USER.conf ] && . $WEBBUILD_STATEDIR/users/$USER.conf STATE_ADVANCEDCONTROLS= [ -e $WEBBUILD_STATEDIR/users/$USER.state ] && . $WEBBUILD_STATEDIR/users/$USER.state fi else USER= fi # # Public requests # if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then if [ "$WEBBUILD_URL" -a "${WEBBUILD_URL/\/localhost\//}" = "$WEBBUILD_URL" ]; then 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 "" 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 fi tail -n 100 $WEBBUILD_STATEDIR/social_log | while read line; do STYPE= SPRIVACY= SUSER= STARGET= SID= eval $line [ "$SID" ] || continue [ $SID -ge $FROMID ] || continue [ "$STARGET" = "developers" -a ! "$USER" ] && continue [ "$SUSER" = "$USER" -a "$STARGET" == "developers" ] && continue if [ "$SPRIVACY" -a ! "$USER" ]; then USER_GRAVATAR= else USER_GRAVATAR=`echo -n $SEMAIL | md5sum | sed "s| .*||"` fi echo -n "
" echo -n "
" if [ "$SPRIVACY" -a ! "$USER" ]; then SUSER="a developer" elif [ "$USER" = "$SUSER" ]; then SUSER="you" fi echo -n "
$SUSER $STEXT
" echo -n "

]]>
" count=$(($count + 1)) done echo -n "
" fi fi if [ "$USER_ENABLED" != "1" ]; then echo -n "" exit fi # # Enabled users requests # 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 if [ "$REQUEST" = "rpmmanagerdownload" ]; then resolve_rpmmanagerdir "$RPMMANAGERDIR" "${AUTOPORT_ARCH[$ENVIRONMENT]}" "$REPOSITORY" for f in $RPMMANAGERPACKAGES; do installpackages="$installpackages $rpmmanagerdir/$f" done if [ "$rpmmanagermode" = "environment" ]; then download_file $ENVIRONMENT "$installpackages" else download_file "" "$installpackages" fi RET=$? exit fi # delete a note if [ "$REQUEST" = "removenote" ]; then if [ "$USER" = "$NOTEUSER" -o "$USER_ADMIN" ]; then [ -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 "" 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' USER_EMAIL='$REQUEST_USER_EMAIL' _EOF else cat >> $WEBBUILD_STATEDIR/users/$REQUEST_USER.conf << _EOF USER_ENABLED=0 USER_EMAIL='$REQUEST_USER_EMAIL' _EOF fi fi sed -i "/ REQUEST_USER=$REQUEST_USER /d" $WEBBUILD_STATEDIR/requests echo -n "" exit fi # send data for cookie if [ "$REQUEST" = "password" ]; then echo -n "$USER$USER_SECRET" fi # kill processes or clean log if [ "$REQUEST" = "killtree" ]; then killline=`grep "^$KILLPID " $WEBBUILD_STATEDIR/processes` if [ "$killline" ]; then if [ $KILLPID -ge 1 ]; then if [ -e /proc/$KILLPID ]; then $SUDO_WRAPPER killtree $KILLPID "$USER" else set -- $killline rm -f $5 sed -i "/^$KILLPID /d" $WEBBUILD_STATEDIR/processes fi else echo "ERROR: Invalid PID" fi fi REQUEST=refresh fi # refresh processes list if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then echo -n "Pending admin requests:" while read line; do eval $line echo -n "
$REQUEST_USER: " case $REQUEST_TYPE in "enablerequest") echo -n "enable request" ;; *) echo -n "unknown request" ;; esac echo -n " " echo -n " " done < $WEBBUILD_STATEDIR/requests echo -n "" fi numprocess=0 tac $WEBBUILD_STATEDIR/processes | \ while read line; do set -- $line RETCODE=$6 PROCESSLOG=$5 # if [ -e /proc/$1 -o $5 -lt 256 ]; then numprocess=$(($numprocess + 1)) cmdline=`echo "$line" | sed "s|$1 $2 $3 $4 $5 $RETCODE ||"` cmdline=`echo "$cmdline" | sed "s| --colors web||"` PACKAGE_ENCODED=`cgi_encodevar $4` [ $numprocess -eq 1 ] && { # echo -n "
" u="$(uptime)" f="$(df / -k -h --output=avail,pcent|tail -n1)" b=`ps ax|grep "rpmbuild .*\.spec$"|while read l; do basename "${l/.spec}"; done` echo -n "Load: ${u/*: } | Disk: $f | " [ "$b" ] && echo -n "Building now: $b | " [ "`ps cax|grep smart`" ] && echo "Updating | " if [ "$STATE_JOBSSHOWALL" != "1" ]; then echo "$USER's jobs: [Show all jobs]" else echo "All jobs: [Only show my jobs]" fi echo -n "
" } [ "$STATE_JOBSSHOWALL" = "1" -o "$USER" = "$2" ] || continue if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then echo -n "\"running...\"" elif [ ! -e $PROCESSLOG ]; then sed -i "\,$1 $USER.* $PROCESSLOG ,d" $WEBBUILD_STATEDIR/processes continue else if [ $RETCODE -eq 256 ]; then $SUDO_WRAPPER finishprocess $1 "$USER" $5 RETCODE=$? fi if [ $RETCODE -eq 0 ]; then # echo -n "OK" echo -n "\"OK\"" else # echo -n "ERROR ($RETCODE)" echo -n "\"ERROR\"" fi fi echo -n "$2 on `print_environment_descr $3`: " if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then echo -n "\"" echo -n "$cmdline\" " else echo -n "\"" echo -n "$cmdline\" (`date -r $5 +'%F %T'`)" fi if [ "$2" = "$USER" -o "$USER_ADMIN" ]; then if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then echo -n " [" echo -n "kill" else echo -n " [" echo -n "x" fi echo -n "]" fi echo -n "
" done # [ $numprocess -gt 0 ] && echo -n "
" echo -n "]]>
" exit fi # message send request (social_log) if [ "$REQUEST" = "message" -a "$USER" -a "$USER_CANSENDMESSAGES" ]; then # external (autodist) social messages [ "$MESSAGETYPE" ] || MESSAGETYPE=broadcastmessage social_log "SUSER=$USER STYPE=$MESSAGETYPE SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`" echo "" exit fi # repsearch request if [ "$REQUEST" = "repsearch" ]; then echo -n "Search results for \"$REPSEARCHTEXT\":
" # echo -n "
"
   REPSEARCHTEXT_FMT=`echo "${REPSEARCHTEXT}" | sed "s|[[:space:]]|+|g"`
   curl -s "${WEBBUILD_DISTROQUERY_URL}?query=${REPSEARCHTEXT_FMT}&search_milestone2=true&search_milestone3=true&search_devel=true\
&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"
#   $SUDO_WRAPPER 0 local "$USER" "" "autodist-repository search -i ${REPSEARCHTEXT/-/\-}" | \
#      parse_search_output ${AUTOPORT_ARCH[$ENVIRONMENT]}
#      sed "s|\(.*(source).*\)|\1|;
#           s|\(.*(${AUTOPORT_ARCH[$ENVIRONMENT]}).*\)|\1|"
#   echo -n "
" echo "
" echo "]]>
" exit fi # environment search request if [ "$REQUEST" = "environmentsearch" ]; then echo -n "Environment search results for \"$ENVSEARCHTEXT\":
" echo -n "
"
   echo -n "Installed packages providing '$ENVSEARCHTEXT':
" WHAT_PROVIDES=`$SUDO_WRAPPER binary $ENVIRONMENT "$USER" "" "rpm -q --what-provides \"$ENVSEARCHTEXT\"" | sort -u` echo -n "$WHAT_PROVIDES
" if [ "${WHAT_PROVIDES:0:10}" != "no package" ]; then for f in $WHAT_PROVIDES; do echo -n "
$f installed package info:
" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -qi $f" if [ $? -eq 0 ]; then echo -n "
$f provides:
" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -q $f --provides" echo -n "
$f requirements:
" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "rpm -q $f --requires" fi done fi # sed "s|\(.*(source).*\)|\1|; # s|\(.*(${AUTOPORT_ARCH[$ENVIRONMENT]}).*\)|\1|" echo -n "
" echo "
]]>
" exit fi # rpm manager if [ "$REQUEST" = "rpmmanager" ]; then environment_descr=`print_environment_descr $ENVIRONMENT` echo -n "
" echo -n "
" echo -n "RPM manager for $environment_descr environment
" # select rpm manager resource directory to display echo "" # multiselect echo -n "
" echo -n "
" echo -n "
" resolve_rpmmanagerdir "$RPMMANAGERDIR" "${AUTOPORT_ARCH[$ENVIRONMENT]}" "$REPOSITORY" rpmmanagerfiles=$rpmmanagerdir/$rpmmanagermask if [ "${rpmmanagermode}" = "environment" ]; then # local files in environment $SUDO_WRAPPER binary $ENVIRONMENT "$USER" "" "ls -t $rpmmanagerfiles 2>/dev/null" | \ while read f; do pkgname=`basename $f` echo -n "" done else # files in real local repositories ls -t $rpmmanagerfiles 2>/dev/null | \ while read f; do pkgname=`basename $f` echo -n "" done fi echo -n "
" echo -n "
" if [ "$USER_CANINSTALL" ]; then # force rpm install/upgrade operation echo -n "  " # rpm manager install packages echo -n ""`\"+p+" echo -n "\"`cgi_encodevar " in $environment_descr environment?"`\"" echo -n ");>  " # rpm manager upgrade packages echo -n ""`\"+p+" echo -n "\"`cgi_encodevar " in $environment_descr environment?"`\"" echo -n ");>  " fi # rpm manager close link echo -n "
CLOSE
" echo "]]>
" exit fi # set current user environment if not passed if [ ! "$ENVIRONMENT" ]; then for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do [ "${AUTOPORT_ARCH[$i]}" ] || continue if [ "${AUTOPORT_CHROOT_USER[$i]}" = "$USER" ]; then ENVIRONMENT=$i break fi if [ "${AUTOPORT_CHROOT_USER[$i]}" = "contrib" ]; then ENVIRONMENT=$i fi done [ "$ENVIRONMENT" ] || ENVIRONMENT=$DEFAULT_ENVIRONMENT fi if [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then WORKINGROOT="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/" WORKINGHOME="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/usr/src/" BUILDLOGDIR="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autodist/log/" AUTOPORTLOGDIR="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autoport/${AUTOPORT_ARCH[$ENVIRONMENT]}/" elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then WORKINGROOT="/" WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} | cut -d: -f6` [ -e "$WORKINGHOME/RPM" ] || WORKINGHOME="/usr/src/" BUILDLOGDIR="/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autodist/log/" AUTOPORTLOGDIR="/home/${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}/.autoport/${AUTOPORT_ARCH[$ENVIRONMENT]}/" else WORKINGROOT="/" WORKINGHOME="/var/autodist/" BUILDLOGDIR="/var/autodist/log/" AUTOPORTLOGDIR="/var/autodist/.autoport/${AUTOPORT_ARCH[$ENVIRONMENT]}/" fi # show log if [ "$REQUEST" = "showlog" -o "$REQUEST" = "autobuildedit" ]; then showlog if [ "$REQUEST" = "autobuildedit" ]; then REQUEST=edit else echo -n "" exit fi fi echo -n "" # rpm manager echo -n "" # expert mode checkbox [ "$STATE_ADVANCEDCONTROLS" ] && CHECKED="checked=checked" || CHECKED= echo -n " Autodist:" # privacy mode checkbox [ "$STATE_PRIVACYMODE" ] && CHECKED="checked=checked" || CHECKED= echo -n " Privacy:" echo -n "" # maintainer mode checkbox if [ "$USER_CANMAINTAIN" ]; then [ "$MAINTAINERMODE" = "true" ] && CHECKED="checked" echo -n "Maintainer:" fi # switch user select if [ "$USER_ADMIN" -o "$STATE_FAKEUSER" ]; then echo -n " | " echo -n " Test user: " fi echo -n "]]>" if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$ENVIRONMENT]}" != "x86_64" ]; then SUDO_WRAPPER="linux32 $SUDO_WRAPPER" fi echo -n "Build environment:" echo -n "]]>" if [ "$MAINTAINERMODE" = "true" ]; then echo -n " " elif [ ! "$REQUEST" -o "$REQUEST" = "changeenvironment" -o "$REQUEST" = "switchmaintainermode" \ -o "$REQUEST" = "prepare" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "edit" ]; then # SPECFILES select echo -n "" echo -n "" $SUDO_WRAPPER binary $ENVIRONMENT "$USER" "" "ls *.spec 2>/dev/null| sed \"s|.spec$||\" | sort -f" | while read f; do specname=${f/.spec} [ "$PACKAGE" = "$specname" ] && SELECTED="selected=\"selected\"" || SELECTED= echo -n "" done echo -n ".spec]]>" fi [ "$PACKAGE" -a ! "$REQUEST" ] && REQUEST=edit # clean output when changing environment if [ ! "$REPOSITORY" -a ! "$PACKAGE" -a ! "$REQUEST" = "repsearch" ]; then echo -n " " echo -n " " echo -n " " fi # REPOSITORIES search if [ ! "$REPSEARCHTEXT" ]; then echo -n "Search repositories:" #" if [ "$PACKAGE" ]; then echo -n "" echo -n "]]>" fi if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$MAINTAINERMODE" = "true" ]; then # REPOSITORIES select if [ "$MAINTAINERMODE" = "true" -o ! "$REPOSITORY" -o "$REQUEST" = "changeenvironment" ]; then echo -n "" echo -n "" for f in `repository_list`; do repname=`basename $f` [ "$repname" = "$REPOSITORY" ] && SELECTED="selected=selected" || SELECTED= if [ "$MAINTAINERMODE" = "true" -a ! "$USER_ALLREPOSITORIES" ]; then for u in $USER_CANMAINTAIN_REPOSITORIES; do [ "$u" = "$repname" ] && echo -n "" done else echo -n "" fi done echo -n "" echo -n "]]>" # echo -n " " echo -n " " echo -n " " fi else echo -n "autobuilds:" # autobuild edit previous echo -n "" # autobuild edit select echo -n "" # autobuild edit next echo -n " \" onclick=" echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&" echo -n "PACKAGE=\"+encodeURIComponent(getSelectedValueById(\"autobuildedit\",1).substring(0,getSelectedValueById(\"autobuildedit\",1).indexOf(';')))+\"&" echo -n "LOGTYPE=\"+getSelectedValueById(\"autobuildedit\",1).substring(getSelectedValueById(\"autobuildedit\",1).indexOf(';')+1)+\"&LOGSTATUSOK=&" echo -n "REQUEST=autobuildedit\");>" # autodist current checkbox (in progress) [ "$STATE_AUTODISTCURRENT" = "1" ] && SELECTED="checked" || SELECTED= echo -n "" echo -n " ]]>" echo -n " " echo -n " " echo -n " " 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 $AUTODISTJOB to skipped list\" STIME=`date +%s`" fi if [ "$NEXTPACKAGE" ]; then PACKAGE=$NEXTPACKAGE PACKAGEENCODED=`cgi_encodevar $PACKAGE` LOGTYPE=$NEXTLOGTYPE AUTODISTJOB= showlog REQUEST="edit" fi fi fi if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then # PACKAGES (SRPM) select if [ "$REQUEST" = "changerepository" -o "$REQUEST" = "switchmaintainermode" -a "$MAINTAINERMODE" != "true" ]; then echo -n "" #(getElementById('package').selectedIndex);>" echo "" SRPMBUTTONDISABLED="disabled=disabled" 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\">\(.*\).*|\1|" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY fi while read f; do pkgname=${f%.src.rpm} pkgrel=${pkgname/*-} pkgname=${pkgname%-$pkgrel} pkgver=${pkgname/*-} pkgname=${pkgname%-$pkgver} if [ "$PACKAGE" = "$pkgname" ]; then SELECTED="selected=\"selected\"" SRPMBUTTONDISABLED= else SELECTED= fi echo -n "" done < $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY echo -n "" echo -n "]]>" if [ "$MAINTAINERMODE" != "true" ]; then echo -n "" if [ "${AUTOPORT_PORT_REPOSITORY[$ENVIRONMENT]}" ]; then echo -n "" fi echo -n "]]>" fi fi # SPECFILE creation if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -a "$MAINTAINERMODE" != "true" ]; then echo -n "" echo -n " Start from URL:" echo -n " name:" echo -n " type:" echo -n " version:" echo -n " branch/tag:" echo -n "" echo "]]>" elif [ "$MAINTAINERMODE" = "true" ]; then echo -n " " fi #else # echo -n " " fi if [ "$REQUEST" = "changespec" ]; then if [ "$PACKAGE" ]; then REQUEST="edit"; fi elif [ "$REQUEST" = "broadcastmessage" ]; then social_log "SUSER=$USER STYPE=broadcastmessage SEMAIL=$USER_EMAIL STEXT=\"said:"`var2html BROADCASTMESSAGE`"\" STIME=`date +%s`" REQUEST= fi if [ "$SPECTEXT" ]; then # save specfile tmpfile=`mktemp --suffix=.webbuildspectmp` echo -n $SPECTEXT | perl -MURI::Escape -e 'print uri_unescape(<>)' > $tmpfile chmod 644 $tmpfile 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 RET=$? [ $RET -eq 0 ] || { echo -n "ERROR: could not save file ${PACKAGE/*\/}.spec! Please report the problem, thanks.]]>" exit 1 } rm -f $tmpfile fi if [ "$REQUEST" = "edit" -o "$REQUEST" = "prepare" ]; then if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then social_log "SUSER=$USER SEMAIL=$USER_EMAIL STARGET=developers STEXT=\"is working on $PACKAGE in `print_environment_descr $ENVIRONMENT` environment\" STIME=`date +%s`" fi fi # Here requests which update the specfile, so editor is refreshed after if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccreate" -o \ "$REQUEST" = "rebuildspec" -o "$REQUEST" = "renamespec" -o "$REQUEST" = "deletespec" -o \ "$REQUEST" = "autodistprepare" -o "$REQUEST" = "autodistupdate" -o "$REQUEST" = "addpkgnote" ]; then if [ "$REQUEST" = "speccreate" ]; then OUTPUTMODE="outputtop" else OUTPUTMODE="outputbottom" fi echo -n "Console output:
" echo -n "
"
   RET=255
   case $REQUEST in
      "prepare") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a1 --server $REPOSITORY"; RET=$? ;;
      "updatespec") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-update"
                    [ "$DEBUG" = "true" ] && RPMFORCEADD="$RPMFORCEADD --debug"
                    [ "$USER_FULLNAME" -a "$USER_EMAIL" ] && RPMUSERADD="--packager-fullname=\"$USER_FULLNAME\" --packager-email=\"$USER_EMAIL\""
                    if [ "$UPDATESPECVERSION" -a "$REBUILDSPECCHANGELOG" ]; then
                       echo "ERROR: new version and changelog can't be specified together"
                    elif [ "$REBUILDSPECCHANGELOG" ]; then
                       $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a4 $RPMFORCEADD --rebuild \
                          --changelog \"$REBUILDSPECCHANGELOG\" $RPMUSERADD"
                    elif [ "$UPDATESPECVERSION" ]; then
                       $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a3,4 $RPMFORCEADD $UPDATESPECVERSION \
                          $RPMUSERADD"
                    else
                       $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a2:4 $RPMFORCEADD $UPDATESPECVERSION \
                          $RPMUSERADD"
                    fi
                    RET=$?
                    ;;
      "speccreate") if [ "$SPECCREATEURL" -a "$PACKAGE" ]; then
                       FOUND_EXISTING=`curl -s "${WEBBUILD_DISTROQUERY_URL}?package=$PACKAGE&search_milestone2=true&search_milestone3=true&search_devel=true&search_sources=true&query_compact=true&replyplain=true&searchbox=false"`
                       if [ "$FOUND_EXISTING" != "" ]; then
                          echo -n "
" echo "ERROR: package already exists, please update from appropriate version:" echo -n "
Search results for \"$PACKAGE\":$FOUND_EXISTING" echo -n "
" RET=1 continue else if [ "${SPECCREATEURL/\/}" = "$SPECCREATEURL" ]; then # local source in /SOURCES SPECCREATEURL="../SOURCES/$SPECCREATEURL" fi 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 $PACKAGE new package in `print_environment_descr $ENVIRONMENT` 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 else echo "ERROR: both source archive URL and name are needed." RET=1 fi ;; "renamespec") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "mv $RENAMESPECFROM.spec $PACKAGE.spec && sed -i \"s|\(Name:[[:space:]]*\).*|\1$PACKAGE|\" $PACKAGE.spec" RET=$? [ $RET -eq 0 ] && { social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"renamed $RENAMESPECFROM to $PACKAGE in `print_environment_descr $ENVIRONMENT` environment\" STIME=`date +%s`" echo "Specfile $RENAMESPECFROM successfully renamed to $PACKAGE." } ;; "deletespec") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rm -f $PACKAGE.spec" RET=$? [ $RET -eq 0 ] && REQUEST="exit" ;; "autodistprepare") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD= autodistjobs= if [ "$AUTODISTPKGS" ]; then for p in $AUTODISTPKGS; do autodistjobs="$autodistjobs $AUTODISTJOB/$p" done else autodistjobs="$AUTODISTJOB" fi [ "$REPOSITORY" ] && REPOSITORYADD="--repository $REPOSITORY" || REPOSITORYADD="--repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -p $autodistjobs $REPOSITORYADD --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web" RET=$? ;; "autodistupdate") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD= [ "$DEBUG" = "true" ] && AUTODISTADD="$AUTODISTADD --debug" || AUTODISTADD= if [ "$AUTODISTUPDATECHANGELOG" ]; then AUTODISTADD="$AUTODISTADD --rebuild -- --changelog \"${AUTODISTUPDATECHANGELOG}\"" fi autodistjobs= if [ "$AUTODISTVERSION" ]; then AUTODISTVER="\#$AUTODISTVERSION" fi if [ "$AUTODISTPKGS" ]; then for p in $AUTODISTPKGS; do autodistjobs="$autodistjobs $AUTODISTJOB/$p${AUTODISTVER}" done else autodistjobs="$AUTODISTJOB${AUTODISTVER}" fi [ "$REPOSITORY" ] && REPOSITORYADD="--repository $REPOSITORY" || REPOSITORYADD="--repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -u $autodistjobs $REPOSITORYADD --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web" RET=$? ;; "addpkgnote") echo "`date +%s` $USER $ENVIRONMENT $PKGNOTE" >> $WEBBUILD_STATEDIR/notes/$PACKAGE.notes; RET=$? ;; esac echo -n "
" if [ $RET -eq 0 ]; then echo "Result: OK" else echo "Result: ERROR ($RET)" fi echo -n "
" echo -n "]]>
" if [ "$REQUEST" = "exit" ]; then echo -n " " echo -n " " echo -n " " echo -n " " echo -n "" exit fi if [ $RET -eq 0 ]; then REQUEST="edit" print_editorcontrols if [ "$PACKAGE" ]; then if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then print_showlogcontrols fi fi else REQUEST= fi fi # maintainer mode editor if [ "$MAINTAINERMODE" = "true" ]; then if [ ! "$REQUEST" -o "$REQUEST" = "changerepository" -o \ "$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "reloadmaintainer" ]; then echo -n " " echo -n " " echo -n " " if [ "$REPOSITORY" ]; then echo -n "" echo -n "Recent packages in $REPOSITORY:
" 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 cat $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY | sed "s|a \(href=.\)/|a target=new \1${SITE_BASE_URL}/|g" echo -n "
Log:
"
         cat $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
         echo -n "
" echo -n "" echo -n "]]>
" else echo -n " " fi REQUEST= fi fi if [ "$REQUEST" = "changerepository" -o "$REQUEST" = "switchmaintainermode" -o "$REQUEST" = "changeenvironment" ]; then REQUEST= fi if [ "$PACKAGE" ]; then [ "$AUTODISTJOB" ] || AUTODISTJOB=${PACKAGE/\/*} AUTODISTJOB="${AUTODISTJOB//[-]/_}" PACKAGE=${PACKAGE/*\/} eval `$SUDO_WRAPPER specinfo $ENVIRONMENT "$USER" $PACKAGE ""` [ $? -eq 0 ] && SPECAVAILABLE=1 fi # specfile editor if [ "$REQUEST" = "edit" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "switchmaintainermode" -o \ "$REQUEST" = "renamespec" -o "$REQUEST" = "addpkgnote" -a "$MAINTAINERMODE" != "true" ]; then if [ "$SPECAVAILABLE" ]; then # editor textarea echo -n "" echo -n "Packaging notes for $PACKAGE:" while read ndate nuser nenv line; do echo "
$nuser: \"$line\"" if [ "$USER" = "$nuser" -o "$USER_ADMIN" ]; then echo -n " [" echo -n "x]" fi done < $WEBBUILD_STATEDIR/notes/$PACKAGE.notes echo -n "" fi echo -n "Current $PACKAGE.spec in build environment:]]>
" # else # echo "" # 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 "" # echo -n "]]>" print_editorcontrols if [ "$PACKAGE" ]; then if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then print_showlogcontrols fi fi fi REQUEST=$REQUEST_NEXT fi # operation panel if [ "$MAINTAINERMODE" != "true" ]; then echo -n "" if [ "$PACKAGE" ]; then echo -n "Package: $PACKAGE
Version: " [ "${SPECVAR_Epoch[0]}" ] && echo -n "${SPECVAR_Epoch[0]}:" echo -n "${SPECVAR_Version[0]}-${SPECVAR_Release[0]}
" fi showEnvironmentPanel echo -n "" echo -n "
Build/Send options:
Arch:" echo -n " " echo -n " " # destination repository select echo -n "
Send to:" echo -n "
" [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$STATE_ADVANCEDCONTROLS" ] && echo -n "
Autodist batch builds:
" if [ "$PACKAGE" ]; then if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then echo -n "Patch for $PACKAGE:
" # autodist show patch echo -n "" # autodist remove patch echo -n "$PACKAGE
?"`\"); class=redbutton>" # autodist auto patch echo -n "$PACKAGE
?"`\"); class=redboldbutton>" ## autodist update patch #echo -n "update patch for package $PACKAGE?"`\"); class=redbutton>" ## autodist build patch #echo -n "build patch for package $PACKAGE?"`\"); class=redbutton>" fi fi if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then # autodist list-jobs [ "$PACKAGE" -a "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ] && echo -n "
" echo -n "Job:" if [ "$AUTODISTJOBSELECTED" -a "$AUTODISTJOB" = "${PACKAGE//[-]/_}" ]; then echo -n "
You should use autodist for this package!" fi if [ "$AUTODISTJOB" ]; then echo -n "
Job packages:" echo -n "" echo -n "
" for p in `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist --list-pkgs $AUTODISTJOB"`; do if [ "$AUTODISTPKGS" ]; then for i in $AUTODISTPKGS; do [ "$i" = "$p" ] && { SELECTED=checked; break; } || SELECTED= done else [ "$p" = "$PACKAGE" ] && SELECTED=checked || SELECTED= fi echo -n "" done echo -n "
" # autodist prepare echo -n "" # autodist update echo -n "" # autodist build echo -n "" # autodist install [ ! "$USER_CANINSTALL" ] && DISABLED="disabled=disabled" || DISABLED= echo -n ""`\"+getSelectedValueById('autodistjobs')+\"" echo -n "`cgi_encodevar " job in current environment?"`\"" echo -n "); class=redbutton $DISABLED>" # autodist send [ ! "$USER_ALLREPOSITORIES" ] && DISABLED="disabled=disabled" || DISABLED= echo -n ""`\"+getSelectedValueById('autodistjobs')+\"`cgi_encodevar " job to "`\"+" echo -n "getSelectedValueById('sendrepository')+\"`cgi_encodevar "?"`\"); class=redbutton $DISABLED>" # autodist schedule echo -n "
New version: " echo -n ""`\"+getSelectedValueById('autodistjobs')+\"`cgi_encodevar " autodist job for automatic update?"`\"); class=boldbutton>" # autodist update changelog echo -n "
Rebuild changelog:
" echo -n "" # autodist show schedule echo -n "" # autodist unschedule echo -n "" # autodist skip echo -n ""`\"+getSelectedValueById('autodistjobs')+\"`cgi_encodevar " from being checked for automatic updates for a period?"`\"" echo -n "); class=redbutton>
" else echo -n "
" fi # automatic port if [ "${AUTOPORT_PORT_REPOSITORY[$ENVIRONMENT]}" ]; then echo -n "Automatic port:" echo -n "$PACKAGE package in "`\"+p+\"`cgi_encodevar " with current specfile changes?"`\"); class=redbutton>" echo -n "" fi fi if [ "$PACKAGE" ]; then echo -n "
" ## check for updates #echo -n "" ## recreate SRPM #echo -n "" # add patches echo -n "Add patches:" echo -n "" echo -n " pastebin
" echo -n "URL:" echo -n "
$PACKAGE-${SPECVAR_Version}-" echo -n ".patch" echo -n "
" # upload sources echo -n "
Upload source:" echo -n "
" echo -n "" echo -n "" echo -n "
" echo -n "
" # info from package sources echo -n "
" echo -n "Info from package in the works:
" # show sources echo -n "" # show patches echo -n "" # list build dir files echo -n "" # show package licenses echo -n "" # show package build docs echo -n "" # show package configure help echo -n "" # show package configure log echo -n "" # buildroot files echo -n "" # show package changelog echo -n "" # add a note echo -n "" echo -n "" echo -n "" echo -n "" # generic info echo -n "
Generic info:
" # allowed groups echo -n "" # approved licenses echo -n "" # templates echo -n "" # macros echo -n "
" echo -n "
" fi echo -n "
Host maintainance:
" ## run ldconfig #echo -n "" # environment search echo -n "
Provides:
" # system upgrade echo -n "" echo -n "]]>" fi echo -n "" echo -n "" echo -n "" #echo -n "]]>" if [ "$REQUEST" != "" ]; then echo -n "" echo -n "Console output ($REQUEST" [ "$PACKAGE" ] && echo -n " for $PACKAGE" echo -n "):" echo -n "
" else echo -n "id=\"outputtop\">" fi if [ "$REQUEST" != "showchangelogs" -a "$REQUEST" != "showbuilddocs" -a "$REQUEST" != "showlicenses" ]; then echo -n "
"
   fi
   RET=255
fi

case $REQUEST in
   "savespec") echo "File $PACKAGE.spec saved."
               RET=-1
               ;;
   "smartupgrade") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "export LANG=C;sudo smart update && sudo smart upgrade"
                   RET=$?
                   ;;
   "runldconfig") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "export LANG=C;sudo /sbin/ldconfig"
                  RET=$?
                  ;;
   "showpatch") $SUDO_WRAPPER binary $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE"; RET=$? ;;
   "removepatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE remove"
                     RET=$?
                     if [ $RET -eq 0 ]; then
                        social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"removed the autodist patch for $PACKAGE\" STIME=`date +%s`"
                     fi ;;
   "autopatch") $SUDO_WRAPPER binary $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE auto"
                     RET=$?
                     if [ $RET -eq 0 ]; then
                        social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist patch for $PACKAGE\" STIME=`date +%s`"
                     fi ;;
   "updatepatch") $SUDO_WRAPPER binary $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE update"
                     RET=$?
                     if [ $RET -eq 0 ]; then
                        social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist update patch for $PACKAGE\" STIME=`date +%s`"
                     fi ;;
   "buildpatch") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "autodist-tool makepatch $PACKAGE build"
                    RET=$?
                    if [ $RET -eq 0 ]; then
                       social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"made an autodist build patch for $PACKAGE\" STIME=`date +%s`"
                    fi ;;
   "showscheduled") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule"; RET=$? ;;
   "schedule") if [ "$AUTODISTVERSION" ]; then
                  $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule $AUTODISTJOB#$AUTODISTVERSION"
                  RET=$?
                  if [ $RET -eq 0 ]; then
                     social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job $AUTODISTJOB for update to version $AUTODISTVERSION\" STIME=`date +%s`"
                  fi
               else
                  $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool schedule $AUTODISTJOB"
                  RET=$?
                  if [ $RET -eq 0 ]; then
                     social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"scheduled autodist job $AUTODISTJOB for automatic update\" STIME=`date +%s`"
                  fi
               fi
               ;;
   "unschedule") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist-tool unschedule $AUTODISTJOB"
                    RET=$?
                    if [ $RET -eq 0 ]; then
                       social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"unscheduled autodist job $AUTODISTJOB\" STIME=`date +%s`"
                    fi ;;
   "autodistbuild") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
                       autodistjobs=
                       if [ "$AUTODISTPKGS" ]; then
                          for p in $AUTODISTPKGS; do
                             autodistjobs="$autodistjobs $AUTODISTJOB/$p"
                          done
                       else
                          autodistjobs="$AUTODISTJOB"
                       fi
                       $SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -b $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web" &>/dev/null
                       [ $? -ne 0 ] && RET=$? || {
                          RET=-1
                          echo "Autodist build start. You may see the output in the Webbuild jobs box above."
                       }
                       #[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"successfully built $PACKAGE\" STIME=`date +%s`"
                       ;;
   "autodistinstall") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
                      autodistjobs=
                      if [ "$AUTODISTPKGS" ]; then
                         for p in $AUTODISTPKGS; do
                            autodistjobs="$autodistjobs $AUTODISTJOB/$p"
                         done
                      else
                         autodistjobs="$AUTODISTJOB"
                      fi
                      $SUDO_WRAPPER background $ENVIRONMENT "$USER" "$PACKAGE" "autodist -v -i $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web" &>/dev/null
                      [ $? -ne 0 ] && RET=$? || {
                         RET=-1
                         echo "Autodist install start. You may see the output in the Webbuild jobs box above."
                      }
                      ;;
   "autodistsend") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
                      autodistjobs=
                      if [ "$AUTODISTPKGS" ]; then
                         for p in $AUTODISTPKGS; do
                            autodistjobs="$autodistjobs $AUTODISTJOB/$p"
                         done
                      else
                         autodistjobs="$AUTODISTJOB"
                      fi
                      $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -s $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --server $SENDREPOSITORY --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web"
                      RET=$?
                      [ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent $AUTODISTPKGS $SPECVAR_Version-$SPECVAR_Release from `print_environment_descr $ENVIRONMENT` to $SENDREPOSITORY\" STIME=`date +%s`"
                      ;;
   "autoport") if [ "$AUTOPORTPACKAGE" ]; then
                  if [ "$AUTOPORTRELEASEREPOSITORY" ]; then
                     AUTOPORT_APPEND="-d $AUTOPORTRELEASEREPOSITORY"
                  fi
                  $SUDO_WRAPPER background $ENVIRONMENT "$USER" $AUTOPORTPACKAGE "autoport $AUTOPORTPACKAGE -r $REPOSITORY $AUTOPORT_APPEND --user $USER" &>/dev/null
                  RET=$?
                  [ $RET -eq 0 ] && {
                     RET=-1
                     echo "Autoport started. You may see the output in the Webbuild jobs box above."
                  }
               else
                  echo "ERROR: no port package specified!"
                  RET=1
               fi
               ;;
   "autospecupdatescheck") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a2"; RET=$? ;;
   "rpmprepare") [ "$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=$?
                 ;;
   "rpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-build"
               [ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
                  RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
               $SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a5,6 $RPMFORCEADD $RPMARCHADD" &>/dev/null
#                 && echo \"Webbuild HINT: now you may want to click on 'build requirements', add build requirements in .spec file and then 'recreate SRPMS'\""
               [ $? -ne 0 ] && RET=$? || {
                  RET=-1
                  echo -n "Build started. You may see the output in the Webbuild jobs box above."
                  echo -n "

HINT: when build is done add or update build requirements to specfile and recreate SRPM." } ;; "srpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--nodeps" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE \ "rpmbuild -bs \ --define=\"_topdir $SPECVAR_WORKINGHOME/RPM\" \ $RPMFORCEADD $PACKAGE.spec" RET=$? ;; "autospeclistcheck") [ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \ RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\"" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a5 --list-check --force $RPMARCHADD" RET=$? ;; "autospecbuildreq") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo /sbin/ldconfig" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a6" RET=$? ;; "rpmchecks") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a8"; RET=$? ;; "rpmsimulateinstall") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a7"; RET=$? ;; "rpminstall") if [ "$USER_CANINSTALL" ]; then [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-install" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a11 $RPMFORCEADD"; RET=$? else echo "Install function disabled." RET=1 fi ;; "sendpackage") if [ "$SENDREPOSITORY" ]; then if [ "$SENDRECREATESRPM" = "true" ]; then $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs \ --define=\"_topdir $SPECVAR_WORKINGHOME/RPM\" \ $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY --arch $AUTODISTARCH" RET=$? else $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY --arch $AUTODISTARCH" RET=$? fi if [ $RET -eq 0 ]; then social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent $PACKAGE $SPECVAR_Version-$SPECVAR_Release from `print_environment_descr $ENVIRONMENT` to $SENDREPOSITORY\" STIME=`date +%s`" fi else echo "ERROR: send repository is not defined." RET=255 fi ;; "sendsource") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--nodeps" if [ "$SENDREPOSITORY" ]; then if [ "$SENDRECREATESRPM" = "true" ]; then $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bs \ --define=\"_topdir $SPECVAR_WORKINGHOME/RPM\" \ $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm" RET=$? if [ $RET -eq 0 ]; then social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent edited $PACKAGE source to $SENDREPOSITORY\" STIME=`date +%s`" fi else $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOSITORY --norpm" RET=$? if [ $RET -eq 0 ]; then social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent $PACKAGE source to $SENDREPOSITORY\" STIME=`date +%s`" fi fi else echo "ERROR: send repository is not defined." RET=255 fi ;; "addpatch") if [ "$ADDPATCHURL" -a "$ADDPATCHNAME" ]; then $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "curl -sSkL '$ADDPATCHURL' -o ../SOURCES/$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch" RET=$? [ $RET -eq 0 ] && { echo -n "Patch added to sources with name '$PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch'." for l in 1 0 2 3; do $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" RET=$? [ $RET -eq 0 ] && break done if [ $RET -eq 0 ]; then echo -n "
Info: good, patch applies successfully with -p$l option!" echo -n "

HINT: add the following lines in the appropriate sections:
" else l=0 echo -n "
Warning: patch does not apply with '-p0' to '-p3' options!" echo "

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." echo -n "
HINT: add anyway the following lines in the appropriate sections and press 'prepare' to see patch command output:
" fi echo -n "
1) in the header after last 'Patch:' entry (or after 'Source:' if this is the first patch) :
" if [ "${SPECVAR_Patch[*]}" ]; then NEWPATCHNUM=$((${SPECVAR_Patch_idx[${#SPECVAR_Patch[@]}-1]}+1)) else NEWPATCHNUM=0 fi echo -ne "
Patch$NEWPATCHNUM:        $PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch
" echo -n "2) in %prep section after %setup:
" echo -ne "
%patch$NEWPATCHNUM -p$l
" RET=-1 } else echo "ERROR: Patch URL or destination name not provided." RET=1 fi ;; "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 "Info: file ${UPLOADFILENAME} successfully added to SOURCES directory." echo -n "
HINT: add the following line in the header after last 'Source:' entry:" if [ "${SPECVAR_Source[*]}" ]; then NEWSOURCENUM=$((${SPECVAR_Source_idx[${#SPECVAR_Source[*]}-1]}+1)) else NEWSOURCENUM=0 fi echo -ne "
Source$NEWSOURCENUM:       ${UPLOADFILENAME}
" RET=-1 else echo "ERROR: could not copy file to SOURCES directory." fi else echo "ERROR: Upload of source file ${UPLOADFILENAME} FAILED." RET=-1 fi else echo "ERROR: upload filename is empty." RET=1 fi ;; "repositoryimport") [ "$PACKAGES" ] || { echo "ERROR: no packages(s) selected." RET=1 break } for p in $PACKAGES; do [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD= [ "$REPOSITORYFORCE" = "true" ] && FORCEADD="-f" $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "autodist-repository import $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD $FORCEADD -y" RET=$? if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"imported $p from $SENDREPOSITORY to $REPOSITORYIMPORTTO\" STIME=`date +%s`" fi [ $RET -eq 0 ] || break done ;; "repositoryrelease") [ "$PACKAGES" ] || { echo "ERROR: no package(s) selected." RET=1 break } for p in $PACKAGES; do [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD= [ "$REPOSITORYFORCE" = "true" ] && SIMULATEADD="$SIMULATEADD -f" $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "autodist-repository release $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO $SIMULATEADD -y" RET=$? if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"released $p from $SENDREPOSITORY to $REPOSITORYIMPORTTO\" STIME=`date +%s`" fi [ $RET -eq 0 ] || break done ;; "repositorydiff") [ "$PACKAGES" ] || { echo "ERROR: no package(s) selected." RET=1 break } for p in $PACKAGES; do $SUDO_WRAPPER 0 local "$USER" "" "autodist-repository diff $SENDREPOSITORY $p -d $REPOSITORYIMPORTTO" RET=$? [ $RET -eq 0 ] || break done ;; "repositoryarchive") [ "$PACKAGES" ] || { echo "ERROR: no package(s) selected." RET=1 break } for p in $PACKAGES; do [ "$REPOSITORYSIMULATE" = "true" -o ! "$USER_CANMAINTAIN" ] && SIMULATEADD="-s" || SIMULATEADD= $SUDO_WRAPPER 0 local "$USER" "$PACKAGE" "autodist-repository archive $SENDREPOSITORY $p -y" RET=$? if [ ! "$SIMULATEADD" -a $RET -eq 0 ]; then social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"archived $p from $SENDREPOSITORY\" STIME=`date +%s`" fi [ $RET -eq 0 ] || break done ;; "repositorymassrebuild") if [ ! "$PACKAGES" ]; then echo "ERROR: no package(s) selected." RET=1 elif [ ! "$MASSREBUILDCHANGELOG" ]; then echo "ERROR: changelog was not specified." RET=1 else 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 [ $? -ne 0 ] && RET=$? || { RET=-1 echo -n "Mass rebuild started. You may see the output in the Webbuild jobs box above." } # if [ $RET -eq 0 ]; then # social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"mass rebuilt $PACKAGES from $SENDREPOSITORY and sent them to $REPOSITORYIMPORTTO\" STIME=`date +%s`" # fi fi ;; "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 Webbuild jobs box above." } fi ;; "repositorysync") if [ "$REPOSITORY" ]; then $SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/10-openmamba-sync-back $REPOSITORY" LOCALRET=$? [ $LOCALRET -eq 0 ] && $SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/20-openmamba-apt $REPOSITORY" LOCALRET=$? [ $LOCALRET -eq 0 ] && $SUDO_WRAPPER background local "$USER" "" "/etc/cron.hourly/40-openmamba-rsync $REPOSITORY" LOCALRET=$? [ $LOCALRET -ne 0 ] && RET=$LOCALRET || RET=-1 fi ;; "autoportnp") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="-f" || AUTODISTADD= $SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "autoport -np $PACKAGE -r $SENDREPOSITORY $AUTODISTADD --user $USER" &>/dev/null [ $? -ne 0 ] && RET=$? || { RET=-1 echo -n "Autoport started. You may see the output in the Webbuild jobs box above." } ;; "autoportlog") cat "$AUTOPORTLOGDIR/current.log"; RET=$? ;; "allowedgroups") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "$AUTOSPEC_CMD --eval rpm_allowed_groups" RET=$? [ $RET -eq 0 ] && RET=-1 ;; "approvedlicenses") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "$AUTOSPEC_CMD --eval rpm_approved_licenses | grep -v \"^#\"" | \ while read line; do echo $line done RET=-1 ;; "builddirfiles") if [ ! "$SPECVAR_BUILDDIR" ]; then echo "ERROR: BUILDDIR is undefined" RET=1 else $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR && find $SPECVAR_BUILDDIR" RET=$? [ $RET -eq 0 ] && RET=-1 fi ;; "buildrootfiles") if [ ! "$SPECVAR_BUILDROOT" ]; then echo "ERROR: BUILDROOT is undefined" RET=1 else $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDROOT/$SPECVAR_BUILDROOT && find" RET=$? fi ;; "showchangelogs"|"showbuilddocs"|"showlicenses") if [ "$REQUEST" = "showchangelogs" ]; then PATTERN="-iname changelog -or -iname news -and -type f" elif [ "$REQUEST" = "showlicenses" ]; then PATTERN="-iname license\* -or -iname copying\* -or -iname authors\* -or -iname credits\* -and -type f" elif [ "$REQUEST" = "showbuilddocs" ]; then PATTERN="-iname readme\* -or -iname install\* -or -iname todo\* -or -iname pkgbuild\* -or -iname \*.desktop -and -type f" fi show_docs `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && find . $PATTERN -maxdepth 2"` RET=-1 ;; "configurehelp") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && ./configure --help || ./waf configure --help" RET=$? [ $RET -eq 0 ] && RET=-1 ;; "configurelog") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && cat config.log" RET=$? [ $RET -eq 0 ] && RET=-1 ;; "showautospectemplate") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat /usr/share/autospec/templates/$AUTOSPECTEMPLATE" RET=$? [ $RET -eq 0 ] && RET=-1 ;; "showmacrosfile") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cat /etc/rpm/macros.$MACROSFILE" RET=$? [ $RET -eq 0 ] && RET=-1 ;; "showpatchfile") OUTPATCHFILE=${PATCHFILE/*\/} case ${OUTPATCHFILE/*.} in gz|gzip) $SUDO_WRAPPER 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 ;; 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 ;; "rpmmanagerinstall"|"rpmmanagerupgrade") if [ "$USER_CANINSTALL" ]; then [ "$RPMMANAGERFORCE" = "true" ] && rpmforceadd="--force" echo -n "" resolve_rpmmanagerdir "$RPMMANAGERDIR" "${AUTOPORT_ARCH[$ENVIRONMENT]}" "$REPOSITORY" for f in $RPMMANAGERPACKAGES; do installpackages="$installpackages $rpmmanagerdir/$f" done if [ "$installpackages" ]; then if [ "$REQUEST" = "rpmmanagerinstall" ]; then echo "Installing packages: $RPMMANAGERPACKAGES
" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -i $installpackages $rpmforceadd 2>&1" elif [ "$REQUEST" = "rpmmanagerupgrade" ]; then echo "Upgrading packages: $RPMMANAGERPACKAGES
" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -U $installpackages $rpmforceadd 2>&1" fi RET=$? else echo "ERROR: no packages to install." RET=1 fi else echo "ERROR: install capability disabled for user." RET=1 fi ;; *) RET=0 ;; esac if [ "$REQUEST" != "" ]; then if [ "$REQUEST" != "showchangelogs" -a "$REQUEST" != "showbuilddocs" -a "$REQUEST" != "showlicenses" ]; then echo -n "
" fi if [ $RET -eq 0 ]; then echo "Result: OK" elif [ $RET -gt 0 ]; then echo "Result: ERROR ($RET)" fi echo -n "
" echo -n "]]>
" # editor controls if [ $RET -le 0 -a "$SPECAVAILABLE" -a ! "$MAINTAINERMODE" ]; then print_editorcontrols fi if [ "$PACKAGE" ]; then if [ "$STATE_ADVANCEDCONTROLS" -o "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then print_showlogcontrols fi fi fi if [ "$MAINTAINERMODE" = "true" ]; then echo -n " " echo -n "" echo "Repository: $REPOSITORY
" showEnvironmentPanel echo -n "
" if [ "$REPOSITORY" ]; then # send options echo -n "Send options:" # destination repository echo -n "
Destination: " echo -n "
" # force checkbox echo -n "" # simulate checkbox echo -n "" # operations box echo -n "

" echo -n "Operations on selected packages:
" # echo -n "select/unselect all" echo -n "
" 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\">\(.*\).*|\1|" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY fi while read f; do pkgname=${f/.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 "" done < $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY echo -n "
" ## repository sync #echo -n " $REPOSITORY updates immediately available from public server?"`\"" #echo -n "); class=redbutton>" # repository compare echo -n "" # repository import echo -n ""`\"+p+\"`cgi_encodevar " from $REPOSITORY to "`\"+getSelectedValueById('repositoryimportto')+" echo -n "\"`cgi_encodevar "?"`\"" echo -n "); class=redbutton>" # repository release echo -n ""`\"+p+\"`cgi_encodevar " in $REPOSITORY to "`\"+getSelectedValueById('repositoryimportto')+" echo -n "\"`cgi_encodevar "?"`\"" echo -n "); class=redbutton>" # repository archive echo -n ""`\"+p+\"`cgi_encodevar " in $REPOSITORY?"`\"" echo -n "); class=redbutton>" # mass rebuild echo -n ""`\"+p+\"`cgi_encodevar " from $REPOSITORY and send to "`\"+getSelectedValueById('repositoryimportto')+" echo -n "\"`cgi_encodevar "?"`\"" echo -n "); class=redbutton>" # mass rebuild of dependant packages echo -n ""`\"+p+\"`cgi_encodevar " in $REPOSITORY and send to "`\"+getSelectedValueById('repositoryimportto')+" echo -n "\"`cgi_encodevar "?"`\"" echo -n "); class=redbutton>" # changelog for mass rebuild echo -n "
Rebuild changelog:" echo -n "" # autodist update buildrequirements echo -n "Add build requirement(s):
" echo -n "" echo -n "

" fi echo -n "]]>
" fi echo -n "" if [ "$MAINTAINERMODE" = "true" ]; then [ "$REPOSITORY" ] && echo -n "$REPOSITORY " || echo -n "no repository " echo -n "(Maintainer mode)" else if [ "$PACKAGE" ]; then echo -n "$PACKAGE " [ "${SPECVAR_Epoch[0]}" ] && echo -n "${SPECVAR_Epoch[0]}:" echo -n "$SPECVAR_Version-$SPECVAR_Release " || echo -n "no package " else echo -n "no package " fi echo -n "(" print_environment_descr $ENVIRONMENT echo -n ")" fi echo -n " :: openmamba webbuild @`hostname`" echo ""