Author: mchristensen
Date: 2008-01-25 14:24:40 -0500 (Fri, 25 Jan 2008)
New Revision: 93952

Added:
   trunk/release/obs/
   trunk/release/obs/bin/
   trunk/release/obs/bin/include/
   trunk/release/obs/bin/include/colors
   trunk/release/obs/bin/osc-make-all
Log:
Scripts to make working with the opensuse build service easier.

osc-make-all will query osc for the supported build platforms 
for a project and then build on each, reporting failurs and
successes.  I wrote this to help sanity-check packages before
checking into the build service.



Added: trunk/release/obs/bin/include/colors
===================================================================
--- trunk/release/obs/bin/include/colors        2008-01-25 19:14:30 UTC (rev 
93951)
+++ trunk/release/obs/bin/include/colors        2008-01-25 19:24:40 UTC (rev 
93952)
@@ -0,0 +1,234 @@
+# Author: Thomas Wiest
+# Copyright (C) Novell Inc. 2007
+# Licence: GPL v2
+#
+# Initialize the color vars
+ESC=$(echo -e '\e')
+ENORM="${ESC}[0m"
+EBOLD="${ESC}[1m"
+EUNDERLINE="${ESC}[4m"
+EBLINK="${ESC}[5m"
+EREVVID="${ESC}[7m"
+EBLACK="${ESC}[30m"
+ERED="${ESC}[31m"
+EGREEN="${ESC}[32m"
+EYELLOW="${EBOLD}${ESC}[33m"
+EBLUE="${ESC}[34m"
+EMAGENTA="${ESC}[35m"
+ECYAN="${ESC}[36m"
+EWHITE="${ESC}[37m"
+
+function echo_in_blue()
+{
+        if [ "$1" != "" ] 
+        then
+                echo "${EBLUE}${1}${ENORM}"
+        fi
+}
+
+function echo_in_green()
+{
+        if [ "$1" != "" ] 
+        then
+                echo "${EGREEN}${1}${ENORM}"
+        fi
+}
+
+function echo_in_green_and_blink()
+{
+        if [ "$1" != "" ] 
+        then
+                echo "${EGREEN}${EBLINK}${1}${ENORM}"
+        fi
+}
+
+function echo_in_yellow()
+{
+        if [ "$1" != "" ] 
+        then
+                echo "${EYELLOW}${1}${ENORM}"
+        fi
+}
+
+function echo_in_red()
+{
+        if [ "$1" != "" ] 
+        then
+                echo "${ERED}${1}${ENORM}"
+        fi
+}
+
+function echo_passed()
+{
+        echo_in_green "Done."
+}
+
+function echo_passed_w_periods()
+{
+       echo
+       echo_w_periods "$1"
+       echo_passed
+}
+
+function echo_failed()
+{
+       echo "${ERED}${EBLINK}FAILED!${ENORM}"
+       if [ "$1" != "" ] && [ -f "$1" ]
+       then
+               echo "${ERED}$(cat $1)${ENORM}"
+               echo
+       fi
+}
+
+function echo_failed_n_exit()
+{
+       echo_failed "$1"
+
+       echo "Exiting..."
+       exit
+}
+
+function echo_failed_n_exit_w_periods()
+{
+       echo
+       echo_w_periods "$1"
+       echo_failed_n_exit
+}
+
+function echo_dash_line_by_size()
+{
+       echo_dash_line ${#1}
+}
+
+function echo_line()
+{
+       # $1 - Char
+       # $2 - How many
+
+       if [ "$2" != "" ]
+       then
+               for IX in $(seq $2)
+               do
+                       echo -n "$1"
+               done
+       fi
+}
+
+function echo_dash_line()
+{
+       if [ "$1" != "" ]
+       then
+               echo_line '-' "$1"
+       fi
+}
+
+function echo_in_center()
+{
+       # $1 - Padding Char
+       # $2 - string
+       # $3 - total length with padding
+       
+       STRLEN=${#2}
+
+       if [ $STRLEN -gt $3 ]
+       then
+               STRLEN=${STRLEN:0:$3}
+       fi
+
+       STRLEN=$((STRLEN / 2))
+       ISSTRODD=$((${#2} % 2))
+
+
+       LINELEN=$3
+       LINELEN=$((LINELEN / 2))
+
+       LINELEN=$((LINELEN - $STRLEN))
+
+       if [ $ISSTRODD -eq 1 ]
+       then
+               LINELEN=$((LINELEN - 1))
+       fi
+
+       echo_line "$1" "$LINELEN"
+       echo -n $2
+       LINELEN=$((LINELEN - 1))
+       echo_line "$1" "$LINELEN"
+
+       if [ $ISSTRODD -eq 1 ]
+       then
+               echo -n "$1"
+       fi
+}
+
+function echo_in_center_of_dash_line()
+{
+       echo_in_center "-" "$1" "$2"
+}
+
+function echo_in_box()
+{
+       if [ -n "$1" ]
+       then
+               local PARAMLEN=${#1}
+               local DASHLEN=$((PARAMLEN+2))
+               local IX=
+
+               echo -n " "
+               echo_dash_line $DASHLEN
+               echo
+               echo "| $1 |"
+               echo -n " "
+               echo_dash_line $DASHLEN
+               echo
+       fi
+}
+
+function echo_w_periods()
+{
+       local PARAM1="$1"
+       local COUNTER2=
+       local NUMPRDS=
+       local IXLEN=
+
+       if [ "$MAXLEN" == "" ]
+       then
+               local MAXLEN=65
+       fi
+
+       if [ "$PARAM1" != "" ]
+       then
+               echo -n "$PARAM1"
+               IXLEN=${#PARAM1}
+               let NUMPRDS=$((MAXLEN-IXLEN))
+               for COUNTER2 in $(seq $NUMPRDS)
+               do
+                       echo -n "."
+               done
+
+               echo -n " "
+       else
+               for COUNTER2 in $(seq $MAXLEN)
+               do
+                       echo -n "."
+               done
+       fi
+}
+
+function unset_colors()
+{
+       ESC=
+       ENORM=
+       EBOLD=
+       EUNDERLINE=
+       EBLINK=
+       EREVVID=
+       EBLACK=
+       ERED=
+       EGREEN=
+       EYELLOW=
+       EBLUE=
+       EMAGENTA=
+       ECYAN=
+       EWHITE=
+}
+

Added: trunk/release/obs/bin/osc-make-all
===================================================================
--- trunk/release/obs/bin/osc-make-all  2008-01-25 19:14:30 UTC (rev 93951)
+++ trunk/release/obs/bin/osc-make-all  2008-01-25 19:24:40 UTC (rev 93952)
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+# Marc Christensen <[EMAIL PROTECTED]>
+# 
+# Builds a package on all supported its distributions
+#
+
+# Include some pretty colors and functions that use them
+. ~/bin/include/colors
+
+# Get the name of out spec file.
+# This script expects to work with one spec file that has
+# the name of the project (should be the current direcory's
+# name followed by '.spec').
+SPEC_FILE=$(basename $(pwd)).spec
+
+# make a new timestamp file so we know which RPMs were made
+# during this run of the script.
+TM_STAMP=/tmp/make_all_tmstmp
+[ -f $TM_STAMP ] && rm $TM_STAMP
+touch $TM_STAMP
+
+# Create a new failed log
+FAILED_LOG=/tmp/make_all_failed
+[ -f $FAILED_LOG ] && rm $FAILED_LOG 
+touch $FAILED_LOG
+
+if [ ! -f ${SPEC_FILE} ]; then
+   echo
+   echo "A proper spec file could not be found. You must exicute this script 
from"
+   echo "within the package's directory.  Exiting"
+   echo
+   exit 1
+fi 
+
+# Build on each platform
+osc build 2> /dev/null | sed -e '/^[[:space:]]*$/,/^[[:space:]]*$/d' |
+while read I;
+do 
+   MYDIST=$(echo ${I} | sed -e '[EMAIL PROTECTED]:space:]][[:space:]]*@ @g')
+   MYDISTUND=$(echo ${I} | sed -e '[EMAIL PROTECTED]:space:]][[:space:[EMAIL 
PROTECTED]@g')
+   BUILD_LOG="/var/tmp/${MYDISTUND}-build.log"
+   echo 
+   echo "#############################################"
+   echo "Exicuting the following command:"
+   echo "osc build ${MYDIST} ${SPEC_FILE}"
+   osc build ${I} ${SPEC_FILE} > ${BUILD_LOG} 2>&1
+   if ! (tail -50 $BUILD_LOG | grep -E 
"/var/tmp/build-root.*/usr/src/(redhat|packages)/.*rpm"); then
+      echo "${MYDIST} build failed, check ${BUILD_LOG}" >> $FAILED_LOG
+      echo_in_red "${MYDIST} build failed, check ${BUILD_LOG}" 
+   else
+      echo_in_green "${MYDIST} build succeeded!"
+   fi
+done
+
+# Find the RPMs that were built
+echo 
+echo The following RPMs were built:
+echo
+find /var/tmp/build-root-Mono_*/usr/src/packages -cnewer $TM_STAMP -iname 
"*rpm"
+rm $TM_STAMP
+echo
+echo_in_red "The following builds failed:"
+echo 
+cat $FAILED_LOG
+echo


Property changes on: trunk/release/obs/bin/osc-make-all
___________________________________________________________________
Name: svn:executable
   + *

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to