Changeset 694 for trunk/technical


Ignore:
Timestamp:
Nov 21, 2004, 9:00:02 PM (20 years ago)
Author:
joergs
Message:

reduced the number of uses directories
buildall and build now uses the same dest directory
added comments
code cleanup
checks if rpm is already available in current release

Location:
trunk/technical/common/build
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/technical/common/build/build.sh

    r692 r694  
    11#!/bin/bash
    2 # Remote build script (iboernig@suse.de)
     2# build script
     3#
    34# $Id$
    45#
    5 # Kurze Featuritis:
    6 # - build.sh sollte im Pfad liegen.
    7 #       Ein Link von ~/bin/build.sh ist eine gute Wahl ;)
    8 # - ohne Parameter aufgerufen,
    9 #   erzeugt build.sh mit Hilfe des Makefiles in aktuellen Verzeichnis
    10 #   ein tar-Archiv, bertr�t dieses nach Oldwotan und baut es dort
    11 # - mit Parameter geht das Skript davon aus,
    12 #       dass der Parameter ein SRPM Paket ist.
    13 #       Dieses wird entpackt und dann gebaut.
    14 # Wichtige Einstellungen:
    15 # - Standardm�ig baut build.sh mit --clean, wenns schnell gehen soll, die
    16 #   Umgebungsvariable BUILD_MODE="--no-init" exportieren
    17 # - BUILD_DIST ist standard sles7-i386, kann auch durch entsprechenden Export
    18 #   berschrieben werden.
    19 # - die fertigen Pakete werden nach DEST_DIR (kann durch env gesetzt werden) #   in die vorgegebene Hierarchie (src, i386/sles/7) auf den lokalen Rechner #   kopiert.
    20 #
    21 # nutzt sudo
     6# builds RPM in an clean chroot build environment.
     7# uses the Suse build script.
     8#
     9# without parameter, it checks the directory for the files
     10# SOURCES or SPECSOURCES.
     11# The files definied in there are copied to the
     12# build system.
     13#
     14# when used with parameter,
     15# this parameter is expected to be a source rpm
     16#
     17# config file:
     18# /usr/local/etc/build
     19# lists the sources for the different distributions
     20#
     21# the rest is controlled by environment variables
     22#
     23# build.sh uses sudo su. /etc/sudoers needs a line like:
     24# %users  ALL=(ALL)       NOPASSWD: /bin/su
     25# for automatic building
    2226
    2327CONFIG_FILE=/usr/local/etc/build
    2428BUILD_CMD=build
    25 #SSH_VERSION="1"
    26 #BUILDHOST="oldwotan"
    27 #FQBUILDHOST="$BUILDHOST.suse.de"
    28 #BUILDTEMP=abuildtmp
    2929BUILDUSER=$USER
    30 BUILDTEMP=/tmp/abuildtmp/$BUILDUSER
    31 
    32 BUILDSCRIPT=$BUILDTEMP/buildscript.$$
    3330
    3431[ -z "$BUILD_MODE" ] && BUILD_MODE="--verify"
     
    3835
    3936[ -z $DEST_DIR ] && DEST_DIR="/tmp/build.$BUILDUSER"
     37BUILDTEMP=$DEST_DIR/buildsrc/
     38BUILDSCRIPT=$BUILDTEMP/buildscript.$$
    4039
    4140[ -z "$BUILD_USES_SVN" ] && BUILD_USES_SVN="yes"
     
    9594
    9695rm -rf ${BUILDTEMP}/src/${PACKAGE};
    97 mkdir -p ${BUILDTEMP}/src/${PACKAGE} ${BUILDTEMP}/${BUILD_DIST};
     96mkdir -p ${BUILDTEMP}/src/${PACKAGE}
     97# ${BUILDTEMP}/${BUILD_DIST};
    9898
    9999if [ "$1" ]; then
     
    109109                # requires subversion (but connection to server isn't neccessary)
    110110                SVN_BUILD_RELEASE=$(svn info . | sed -n 's/^Last Changed Rev: \([0-9]*\)/\1/p')
     111                # in case of local modification a "m" is added to the release number
     112                SVN_BUILD_MODIFIED=$(svn status -v | grep "^ *M" | wc -l)
     113                if [ $SVN_BUILD_MODIFIED -gt 0 ]; then
     114                        SVN_BUILD_RELEASE=${SVN_BUILD_RELEASE}m
     115                else # check if RPM has been build already
     116                        EXPECTED_DEST_RPM_FILENAME=${DEST_DIR}/${BUILD_DIST}/${PACKAGE}-${VERSION}-${SVN_BUILD_RELEASE}.*.rpm
     117                        if [ -f $EXPECTED_DEST_RPM_FILENAME ]; then
     118                                echo
     119                                echo "Build of \"${PACKAGE}\" unnecessary. Current RPM already at " $EXPECTED_DEST_RPM_FILENAME
     120                                echo "verify if 'svn update' has been performed on the source directory"
     121                                echo
     122                                exit
     123                        fi                     
     124                fi
    111125                if [ "$SVN_BUILD_RELEASE" ]; then
    112126                        sed "s/^Release:.*/Release: $SVN_BUILD_RELEASE/g" $SPECFILE > ${BUILDTEMP}/src/${PACKAGE}/$SPECFILE
     
    143157       
    144158        elif [ -r "SPECSOURCES" ]; then
     159                # SPECSOURCES have to list the files that are referenced in the .spec file
     160                # these ´files are copied to the build environment
    145161                cp -av `cat SPECSOURCES` ${BUILDTEMP}/src/${PACKAGE}
    146162       
     
    151167                TARFILE=$(ls  *.tar.[gb]z*| awk '{print $1}')
    152168                cp -av $TARFILE ${BUILDTEMP}/src/${PACKAGE}
    153        
    154 
    155                
    156169        fi
    157 
    158170fi
    159171
     
    165177export BUILD_ROOT=$BUILD_ROOT
    166178export BUILD_DIST=$BUILD_DIST
    167 export BUILD_RPMS=${BUILDTEMP}/${BUILD_DIST}:$BUILD_RPMS
     179export BUILD_RPMS=${DEST_DIR}/${BUILD_DIST}:$BUILD_RPMS
    168180export BUILD_PREPARE_SPEC=$BUILD_PREPARE_SPEC
    169181
    170182cd ${BUILDTEMP}/src/${PACKAGE}
    171 #build $BUILD_MODE --prefer-rpms ${BUILDTEMP}/${BUILD_DIST}
    172 #build $BUILD_MODE
    173183$BUILD_CMD $BUILD_MODE
    174184EOF
     
    178188rm -f $BUILDSCRIPT
    179189
    180 rm -f ${BUILDTEMP}/${BUILD_DIST}/${PACKAGE}-*.*.rpm
    181 cp -a ${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}-${VERSION}-*.*.rpm ${BUILDTEMP}/${BUILD_DIST}
    182 
    183190mkdir -p ${DEST_DIR}/src
    184191# delete all old versions of this package
     
    197204fi
    198205
     206echo
    199207if [ $ERROR -ne 0 ]; then
    200     echo "ERROR while building packet $PACKAGE";
    201         for i in `seq 5`; do
    202                 echo -n "";
    203         done
     208
     209        echo "ERROR while building packet $PACKAGE";
    204210else
    205         echo "Build of ${PACKAGE} completed!"
     211        echo "Build of \"${PACKAGE}\" completed!"
    206212        echo "Packages can be found in ${DEST_DIR}"
    207213fi
     214echo
    208215
    209216exit $ERROR
  • trunk/technical/common/build/buildall.pl

    r687 r694  
    2929
    3030# Pfad, zu dem die Pfade in buildlist stehen
    31 my $smartclient_root="../../";   
    32 
    33 my $BUILD_DEST_DIR="/tmp/smartclient_build/";
     31my $src_root="../../";   
     32
     33
     34my $BUILD_DEST_DIR="/tmp/build.$ENV{'USER'}/";
    3435my $INSTALL_SRC_SKEL_DIR="/net/dist/data/dist/sles/8/skeleton-i386/smartclient/";
    3536
     
    102103  {
    103104  print("$ArrayofBuilds[$i][0]\t\t$ArrayofBuilds[$i][1]\t\t$ArrayofBuilds[$i][2]\n");
    104   $mypath = $smartclient_root.$ArrayofBuilds[$i][0];
     105  $mypath = $src_root.$ArrayofBuilds[$i][0];
    105106
    106107  if ($ArrayofBuilds[$i][2])
     
    119120  tr/\//\_/;
    120121  `mkdir -p $BUILD_DEST_DIR`;
    121   my $logfilename = "$BUILD_DEST_DIR/$_$ArrayofBuilds[$i][1].log";
     122  `mkdir -p $BUILD_DEST_DIR/log`;
     123  my $logfilename = "$BUILD_DEST_DIR/log/$_$ArrayofBuilds[$i][1].log";
    122124
    123125  my $build_cmd="cd $mypath && $build";
Note: See TracChangeset for help on using the changeset viewer.