repository_list() { if [ "$WEBBUILD_REPOSITORIES" ]; then echo "${WEBBUILD_REPOSITORIES[*]}" else $SUDO_WRAPPER 0 local "$USER" "" "/usr/sbin/openmamba-repository list" fi } function showlog() { local LOGDIR LOGFILES LOGFILE1 LOGFILE2 LOGFILE3 LOGFILE4 if [ "$LOGTYPE" = "processoutput" -o "$LOGTYPE" = "processtail" ]; then LOGFILES=$LOGFILE LOGOUTPUTID=outputbottom else LOGOUTPUTID=outputbottom case $LOGTYPE in autoupdate) LOGFILE=update; ;; buildinstall|rebuild) LOGFILE=build ;; *) LOGFILE=$LOGTYPE ;; esac if [ "$LOGSTATUSOK" = "true" ]; then LOGFILE=$LOGFILE/ok LOGSTATUSAPPEND=" ok" else LOGFILE=$LOGFILE/failed LOGSTATUSAPPEND=" failed" fi LOGFILE1=$LOGFILE/${PACKAGE/\//_}.${AUTOPORT_ARCH[$ENVIRONMENT]} LOGFILE2=$LOGFILE/${PACKAGE/\//_}__*.${AUTOPORT_ARCH[$ENVIRONMENT]} LOGFILE3=$LOGFILE/*_${PACKAGE/\//_}__*.${AUTOPORT_ARCH[$ENVIRONMENT]} LOGFILE4=$LOGFILE/*_${PACKAGE/\//_}.${AUTOPORT_ARCH[$ENVIRONMENT]} LOGDIR=`environment_logdir $ENVIRONMENT 1` LOGFILES="$LOGDIR/$LOGFILE1 $LOGDIR/$LOGFILE2 $LOGDIR/$LOGFILE3 $LOGDIR/$LOGFILE4" # sort by most recent and take first LOGFILES=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls -t $LOGFILES 2>/dev/null | head -1"` fi echo -n "Console output for $PACKAGE ($LOGTYPE$LOGSTATUSAPPEND):" echo "
" for f in $LOGFILES; do if [ -r $f ]; then LOGFILESIZE=`stat -c %s $f` LOGDATE=`stat -c %y $f` else LOGFILESIZE=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "stat -c %s $f"` LOGDATE=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "stat -c %y $f"` [ $? -eq 0 ] || continue fi echo -n "`basename $f` ($LOGDATE; $LOGFILESIZE):" echo -n "
"
      if [ "$LOGTYPE" = "processtail" ]; then
         echo -n ""
         tail -n +0 -f $f --pid $PROCESSPID | stdbuf -oL sed "s|<|\<|g"
         echo -n ""
      else
         if [ $LOGFILESIZE -lt 524288 ]; then
            if [ -r $f ]; then
               cat $f | parse_build_output $PACKAGE
            else
               $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "cat $f" | parse_build_output $PACKAGE
            fi
         else
            if [ -r $f ]; then
               head -c 262144 $f | parse_build_output $PACKAGE
               echo "
<------ CUT (long file) ------->" tail -c 262144 $f | parse_build_output $PACKAGE else $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "head -c 262144 $f" | parse_build_output $PACKAGE echo "
<------ CUT (long file) ------->" $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "tail -c 262144 $f" | parse_build_output $PACKAGE fi fi fi echo -n "
" done echo -n "
]]>
" } function showEnvironmentPanel() { echo -n "Environment: " if [ "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" ]; then echo -n "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} - " else echo -n "autodist - " fi if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then echo -n "update" elif [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then echo -n "chroot" elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then echo -n "native" elif [ "${AUTOPORT_CROSS[$ENVIRONMENT]}" ]; then echo -n "cross" else echo -n "unknown type" fi echo -n " (${AUTOPORT_ARCH[$ENVIRONMENT]})" #echo "
Base repository: ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}" # toolchain echo -n "
" local toolchain_output=`LANGUAGE=C $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "gcc --version | head -n1; LANGUAGE=C ld -v"` local gcc_ver=`echo $toolchain_output | sed "s|.*(GCC) \([0-9.]*\) .*|\1|"` local binutils_ver=`echo $toolchain_output | sed "s|.*GNU \(.*\) (GNU Binutils.*)\(.*\)|\1 \2|"` echo "Toolchain: gcc $gcc_ver, $binutils_ver" # system upgrade echo -n "
" ## run ldconfig #echo -n "" # rpm manager echo -n "" # environment search echo -n "
Provides:
" } function print_showlogcontrols() { echo -n "Show last autodist logs: " echo -n "" echo -n "" echo -n "" echo -n "" echo -n " with status: " echo -n "OK " echo -n "FAILED " # close tag echo -n "]]>" } function print_editorcontrols() { echo -n "" echo -n "" # specfile reload echo -n "$PACKAGE.spec?

Warning: current unsaved .spec file changes will be lost."`\");>" # specfile delete echo -n "$PACKAGE.spec?"`\")>" # specfile rename echo -n "" echo -n ".spec" # add a note echo -n "
" echo -n "" echo -n "" echo -n "" # specfile update echo -n "
" echo -n "" echo -n " (automatic or specify new version:" echo -n " or new release changelog:" echo -n ")" echo -n "" echo -n "" echo -n "
" # close tag echo -n "]]>
" } function show_docs() { local f RET ftype for f in $@; do echo -n "$f
" done echo -n "
" for f in $@; do echo -n "

File $f:

"
      ftype="`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && file $f"`"
      if [ "${ftype/text}" = "${ftype}" ]; then
         echo "

Binary file; skipping." continue fi $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE \ "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && head -c 10240 $f | sed \"s|<|\<|g;s|[[:cntrl:]]\[[0-9;]*m||g\"" | parse_generic_output RET=$? echo -n "

" done return $RET } function download_file() { local RET local download_environment=$1 local download_files=$2 local f for f in $download_files; do echo $f >> /tmp/down echo -e "Content-Type: application/octet-stream" echo -e "Content-Disposition: attachment; filename=\"${f/*\/}\"\n" if [ "$download_environment" ]; then $SUDO_WRAPPER binary $download_environment "$USER" "" "cat $f 2>/dev/null" else cat $f 2>/dev/null fi done RET=$? return $RET } function resolve_rpmmanagerdir() { local RPMMANAGERDIR=$1 local RPMMANAGERARCH=$2 local REPOSITORY=$3 case $RPMMANAGERDIR in REP_SRPMS) rpmmanagerdir=$local_ftp/$REPOSITORY/SRPMS.base rpmmanagermask="*.src.rpm" rpmmanagermode=repository ;; REP_RPMS) rpmmanagerdir=$local_ftp/$REPOSITORY/RPMS.$RPMMANAGERARCH rpmmanagermask="*.$RPMMANAGERARCH.rpm" rpmmanagermode=repository ;; REP_RPMSNOARCH) rpmmanagerdir=$local_ftp/$REPOSITORY/RPMS.$RPMMANAGERARCH rpmmanagermask="*.noarch.rpm" rpmmanagermode=repository ;; SRPMS) rpmmanagerdir=../SRPMS rpmmanagermask="*.src.rpm" rpmmanagermode=environment ;; RPMSNOARCH) rpmmanagerdir=../RPMS/noarch rpmmanagermask="*.noarch.rpm" rpmmanagermode=environment ;; *) rpmmanagerdir=../RPMS/$RPMMANAGERARCH rpmmanagermask="*.$RPMMANAGERARCH.rpm" rpmmanagermode=environment ;; esac }