Changeset 695 for trunk


Ignore:
Timestamp:
Nov 21, 2004, 11:01:59 PM (20 years ago)
Author:
joergs
Message:

optimized: skip building rpms that do already exist in the current version

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

Legend:

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

    r694 r695  
    2424# %users  ALL=(ALL)       NOPASSWD: /bin/su
    2525# for automatic building
     26#
     27# return codes:
     28# 0: success
     29# 1: skipped (current RPM already in dest dir)
     30# >1: error
     31
    2632
    2733CONFIG_FILE=/usr/local/etc/build
     
    98104
    99105if [ "$1" ]; then
    100         cp -a "$1" ${BUILDTEMP}/src/${PACKAGE}
    101         cd ${BUILDTEMP}/src/${PACKAGE}; rpm2cpio $1 | cpio -i
     106        EXPECTED_DEST_RPM_FILENAME=${DEST_DIR}/${BUILD_DIST}/`echo $1 | sed 's/\.src\./.*./'`
     107        if [ -f $EXPECTED_DEST_RPM_FILENAME ]; then
     108                echo
     109                echo "Build of \"${PACKAGE}\" unnecessary. Current RPM already at " $EXPECTED_DEST_RPM_FILENAME
     110                echo
     111                exit 1
     112        else
     113                cp -a "$1" ${BUILDTEMP}/src/${PACKAGE}
     114                cd ${BUILDTEMP}/src/${PACKAGE}; rpm2cpio $1 | cpio -i
     115        fi
    102116else
    103117        cp -a $SPECFILE ${BUILDTEMP}/src/${PACKAGE}
     
    111125                # in case of local modification a "m" is added to the release number
    112126                SVN_BUILD_MODIFIED=$(svn status -v | grep "^ *M" | wc -l)
    113                 if [ $SVN_BUILD_MODIFIED -gt 0 ]; then
     127                # checks if a file is commited,
     128                # but update on its directory is not performed
     129                SVN_LAST_MODIFICATION=$(svn status -v | sed -n 's/^ *[0-9]* *\([0-9]*\) .*/\1/p' | sort -n | tail -1)
     130                if [ $SVN_BUILD_MODIFIED -gt 0 ]; then 
    114131                        SVN_BUILD_RELEASE=${SVN_BUILD_RELEASE}m
     132                elif [ $SVN_LAST_MODIFICATION -ne $SVN_BUILD_RELEASE ]; then
     133                        SVN_BUILD_RELEASE=${SVN_BUILD_RELEASE}p
    115134                else # check if RPM has been build already
    116135                        EXPECTED_DEST_RPM_FILENAME=${DEST_DIR}/${BUILD_DIST}/${PACKAGE}-${VERSION}-${SVN_BUILD_RELEASE}.*.rpm
     
    118137                                echo
    119138                                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"
    121139                                echo
    122                                 exit
     140                                exit 1
    123141                        fi                     
    124142                fi
     
    174192#!/bin/bash
    175193# local buildscript
    176 #. /work/src/bin/.profile
    177194export BUILD_ROOT=$BUILD_ROOT
    178195export BUILD_DIST=$BUILD_DIST
     
    190207mkdir -p ${DEST_DIR}/src
    191208# delete all old versions of this package
    192 rm -f ${DEST_DIR}/src/${PACKAGE}-*.src.rpm
     209for i in ${DEST_DIR}/src/${PACKAGE}-*.src.rpm; do
     210        if [ -f $i -a ${PACKAGE} = "`rpm -qp --qf "%{NAME}\n" $i`" ]; then
     211                rm $i
     212        fi
     213done
     214#rm -f ${DEST_DIR}/src/${PACKAGE}-*.src.rpm
    193215
    194216if !(cp -a ${BUILD_ROOT}/usr/src/packages/SRPMS/${PACKAGE}-${VERSION}-*.src.rpm ${DEST_DIR}/src 2> /dev/null); then
    195         ERROR=1
     217        ERROR=4
    196218fi
    197219
    198220mkdir -p ${DEST_DIR}/${BUILD_DIST}
    199221# delete all old versions of this package
    200 rm -f ${DEST_DIR}/${BUILD_DIST}/${PACKAGE}-*.rpm
     222for i in ${DEST_DIR}/${BUILD_DIST}/${PACKAGE}-*.rpm; do
     223        if [ -f $i -a ${PACKAGE} = "`rpm -qp --qf "%{NAME}\n" $i`" ]; then
     224                rm $i
     225        fi
     226done
     227#rm -f ${DEST_DIR}/${BUILD_DIST}/${PACKAGE}-*.rpm
    201228
    202229if !(cp -a ${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}*${VERSION}-*.*.rpm ${DEST_DIR}/${BUILD_DIST} ); then
    203         ERROR=2
     230        ERROR=8
    204231fi
    205232
  • trunk/technical/common/build/buildall.pl

    r694 r695  
    4040getopts('xb:d:');
    4141
    42 
     42my $skipped_last = 0;
    4343
    4444if (!$opt_b && !$opt_d)  {
     
    105105  $mypath = $src_root.$ArrayofBuilds[$i][0];
    106106
    107   if ($ArrayofBuilds[$i][2])
     107  if( $ArrayofBuilds[$i][2] && !$skipped_last )
    108108    {
    109109      $ENV{'BUILD_MODE'}=$ArrayofBuilds[$i][2];
     
    111111  else
    112112    {
    113       $ENV{'BUILD_MODE'}="--clean";
     113      $ENV{'BUILD_MODE'}="--verify";
    114114    }
    115115  $ENV{'BUILD_DIST'}=$ArrayofBuilds[$i][1];
     
    160160        print LOG_FD if $do_log;
    161161  }
    162   close PIPE; my $retval=$?;
     162  close PIPE; my $retval=$?>>8;
    163163  close LOG_FD if $do_log;
    164164 
    165   if ( $retval == 0 )
    166    {
     165  if ( $retval == 0 ) {
    167166     $ArrayofBuilds[$i][3] = "OK";
    168167     print"******                                                      ******\n";
    169168     print"******   building of $ArrayofBuilds[$i][0]: OK                    \n" ;
    170169     print"******                                                      ******\n";
    171    }
    172   else
    173    {
     170  } elsif ( $retval == 1 ) {
     171        $ArrayofBuilds[$i][3] = "skipped";
     172        $skipped_last = 1;
     173  } else {
    174174     $ArrayofBuilds[$i][3] = "*FAILED*";
    175175     print"******                                                      ******\n";
Note: See TracChangeset for help on using the changeset viewer.