Changeset 682 for trunk/technical/common


Ignore:
Timestamp:
Aug 13, 2004, 5:16:46 PM (20 years ago)
Author:
joergs
Message:

cleanup and automatic RPM changelog generation

File:
1 edited

Legend:

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

    r681 r682  
    1111# - mit Parameter geht das Skript davon aus,
    1212#       dass der Parameter ein SRPM Paket ist.
    13 #       Dieses wird nach oldwotan kopiert, dort entpackt und dann gebaut.
    14 # - Dazu muss ein ssh-pubkey in oldwotans /root/.ssh/authorized_keys gelegt
    15 #   werden (build.sh verwendet ssh)
     13#       Dieses wird entpackt und dann gebaut.
    1614# Wichtige Einstellungen:
    1715# - Standardm�ig baut build.sh mit --clean, wenns schnell gehen soll, die
     
    1917# - BUILD_DIST ist standard sles7-i386, kann auch durch entsprechenden Export
    2018#   berschrieben werden.
    21 # - die fertigen Pakete werden nach DEST_DIR (kann durch env gesetzt werden)
    22 #   in die vorgegebene Hierarchie (src, i386/sles/7) auf den lokalen Rechner
    23 #   kopiert. Vorgabe ist /tmp/smartclient_build
     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
    2422
    2523CONFIG_FILE=/usr/local/etc/build
     
    4038
    4139[ -z $DEST_DIR ] && DEST_DIR="/tmp/build.$BUILDUSER"
     40
     41[ -z "$BUILD_USES_SVN" ] && BUILD_USES_SVN="yes"
     42
     43
    4244
    4345if [ -r $CONFIG_FILE ]; then
     
    8486        PACKAGE=$(awk '/^Name:/ {print $2}' <$SPECFILE)
    8587        VERSION=$(awk '/^Version:/ {print $2}' <$SPECFILE)
     88else
     89        # parameter is src.rpm file
     90        PACKAGE=`echo $1 | sed 's/-[0-9]*\..*.src.rpm//'`
     91        VERSION=`echo $1 | sed 's/.*-\([0-9]*\..*\)-.*.src.rpm/\1/'`
     92fi
     93
     94echo $PACKAGE $VERSION $BUILD_DIST $BUILD_MODE
     95
     96rm -rf ${BUILDTEMP}/src/${PACKAGE};
     97mkdir -p ${BUILDTEMP}/src/${PACKAGE} ${BUILDTEMP}/${BUILD_DIST};
     98
     99if [ "$1" ]; then
     100        cp -a "$1" ${BUILDTEMP}/src/${PACKAGE}
     101        cd ${BUILDTEMP}/src/${PACKAGE}; rpm2cpio $1 | cpio -i
     102else
     103        cp -a $SPECFILE ${BUILDTEMP}/src/${PACKAGE}
    86104       
    87         # if config file exist, source it.
    88         # after this, the variable SOURCES should be set
    89         if [ -r SOURCES ]; then
    90                 . SOURCES
     105        # uses Subversion (svn) to generate more information for the RPM
     106        if [ "$BUILD_USES_SVN" = "yes" ]; then
     107                echo "receiving subversion information ..."
     108                # set RELEASE number (last modification in this directory)
     109                # requires subversion (but connection to server isn't neccessary)
     110                SVN_BUILD_RELEASE=$(svn info . | sed -n 's/^Last Changed Rev: \([0-9]*\)/\1/p')
     111                if [ "$SVN_BUILD_RELEASE" ]; then
     112                        sed "s/^Release:.*/Release: $SVN_BUILD_RELEASE/g" $SPECFILE > ${BUILDTEMP}/src/${PACKAGE}/$SPECFILE
     113                fi
     114                echo "Subversion status:" > Changes
     115                # additional infos for the Changes file (see if everything is checked in)
     116                svn status -v | grep -v '^? ' >> Changes
     117                echo >> Changes
     118                echo "ChangeLog:" >> Changes
     119                # requires connection to the subversion server
     120                svn log -v . > ChangeLog.new && mv ChangeLog.new ChangeLog
     121                cat ChangeLog >> Changes
     122                cat Changes >> ${BUILDTEMP}/src/${PACKAGE}/$SPECFILE
     123        fi
     124        # just make sure, that the Changes file exist
     125        touch Changes
     126       
     127        # if "SOURCES" file exist, create tar file on the fly
     128        if [ -r "SOURCES" ]; then
    91129                # create a tar file from the sources
    92                 CREATE_TAR="yes"
     130                tar cvjf ${BUILDTEMP}/src/${PACKAGE}/$PACKAGE-$VERSION.tar.bz2 --files-from SOURCES
    93131        else
    94132                # legacy method:
     
    96134                test -e Makefile && make
    97135                TARFILE=$(ls  *.tar.[gb]z*| awk '{print $1}')
     136                cp -a $TARFILE ${BUILDTEMP}/src/${PACKAGE}
    98137        fi
    99         SRC_FILES="$SPECFILE $TARFILE"
    100 else
    101         # parameter is src.rpm file
    102         PACKAGE=`echo $1 | sed 's/-[0-9]*\..*.src.rpm//'`
    103         VERSION=`echo $1 | sed 's/.*-\([0-9]*\..*\)-.*.src.rpm/\1/'`
    104         SRC_FILES="$1"
    105 fi
    106 
    107 echo $PACKAGE $VERSION $BUILD_DIST $BUILD_MODE
    108 
    109 # Cleaning up and install tempdir
    110 #ssh -${SSH_VERSION} ${FQBUILDHOST} "\
    111         rm -rf ${BUILDTEMP}/src/${PACKAGE}; \
    112         mkdir -p ${BUILDTEMP}/src/${PACKAGE} ${BUILDTEMP}/${BUILD_DIST};
    113 
    114 #scp -oProtocol=$SSH_VERSION $SRC_FILES ${FQBUILDHOST}:${BUILDTEMP}/src/${PACKAGE}
    115 cp -a $SRC_FILES ${BUILDTEMP}/src/${PACKAGE}
    116 
    117 if [ "$CREATE_TAR" = "yes" ]; then
    118         tar cvjf ${BUILDTEMP}/src/${PACKAGE}/$PACKAGE-$VERSION.tar.bz2 --files-from SOURCES
    119 fi
    120 
    121 if [ "$1" ]; then
    122         # extract RPM in a tempoary directory
    123         #ssh -${SSH_VERSION} ${FQBUILDHOST} "\
    124                 cd ${BUILDTEMP}/src/${PACKAGE}; rpm2cpio $1 | cpio -i           
    125138fi
    126139
     
    142155
    143156chmod a+x $BUILDSCRIPT
    144 
    145 #cat /tmp/tmpscript.$$
    146 
    147 #scp -oProtocol=$SSH_VERSION /tmp/tmpscript.$$ ${FQBUILDHOST}:${BUILDTEMP}/src/${PACKAGE}/buildscript
    148 #rm /tmp/tmpscript.$$
    149 
    150 # build and file rpms
    151 #ssh -oProtocol=$SSH_VERSION root@${FQBUILDHOST} \
    152 #       . ~$BUILDUSER/${BUILDTEMP}/src/${PACKAGE}/buildscript
    153 
    154157sudo su -c $BUILDSCRIPT
    155158rm -f $BUILDSCRIPT
    156159
    157 #ssh -oProtocol=$SSH_VERSION ${FQBUILDHOST} \
    158         rm -f ${BUILDTEMP}/${BUILD_DIST}/${PACKAGE}-*.*.rpm
    159         cp -a ${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}-${VERSION}-*.*.rpm ${BUILDTEMP}/${BUILD_DIST}
     160rm -f ${BUILDTEMP}/${BUILD_DIST}/${PACKAGE}-*.*.rpm
     161cp -a ${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}-${VERSION}-*.*.rpm ${BUILDTEMP}/${BUILD_DIST}
    160162
    161163mkdir -p ${DEST_DIR}/src
    162164# delete all old versions of this package
    163165rm -f ${DEST_DIR}/src/${PACKAGE}-*.src.rpm
    164 #if !(scp -oProtocol=$SSH_VERSION root@${FQBUILDHOST}:${BUILD_ROOT}/usr/src/packages/SRPMS/${PACKAGE}-${VERSION}-*.src.rpm ${DEST_DIR}/src ); then
    165         #ERROR=1
    166 #fi
     166
    167167if !(cp -a ${BUILD_ROOT}/usr/src/packages/SRPMS/${PACKAGE}-${VERSION}-*.src.rpm ${DEST_DIR}/src 2> /dev/null); then
    168168        ERROR=1
     
    172172# delete all old versions of this package
    173173rm -f ${DEST_DIR}/${BUILD_DIST}/${PACKAGE}-*.rpm
    174 #if !(scp -oProtocol=$SSH_VERSION #root@${FQBUILDHOST}:${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}-${VERSION}-*.*.rpm ${DEST_DIR}/${BUILD_DIST} ); then
    175 #       ERROR=2
    176 #fi
     174
    177175if !(cp -a ${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}-${VERSION}-*.*.rpm ${DEST_DIR}/${BUILD_DIST} ); then
    178176        ERROR=2
Note: See TracChangeset for help on using the changeset viewer.