Changeset 694 for trunk/technical/common/build/build.sh
- Timestamp:
- Nov 21, 2004, 9:00:02 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/technical/common/build/build.sh
r692 r694 1 1 #!/bin/bash 2 # Remote build script (iboernig@suse.de) 2 # build script 3 # 3 4 # $Id$ 4 5 # 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 22 26 23 27 CONFIG_FILE=/usr/local/etc/build 24 28 BUILD_CMD=build 25 #SSH_VERSION="1"26 #BUILDHOST="oldwotan"27 #FQBUILDHOST="$BUILDHOST.suse.de"28 #BUILDTEMP=abuildtmp29 29 BUILDUSER=$USER 30 BUILDTEMP=/tmp/abuildtmp/$BUILDUSER31 32 BUILDSCRIPT=$BUILDTEMP/buildscript.$$33 30 34 31 [ -z "$BUILD_MODE" ] && BUILD_MODE="--verify" … … 38 35 39 36 [ -z $DEST_DIR ] && DEST_DIR="/tmp/build.$BUILDUSER" 37 BUILDTEMP=$DEST_DIR/buildsrc/ 38 BUILDSCRIPT=$BUILDTEMP/buildscript.$$ 40 39 41 40 [ -z "$BUILD_USES_SVN" ] && BUILD_USES_SVN="yes" … … 95 94 96 95 rm -rf ${BUILDTEMP}/src/${PACKAGE}; 97 mkdir -p ${BUILDTEMP}/src/${PACKAGE} ${BUILDTEMP}/${BUILD_DIST}; 96 mkdir -p ${BUILDTEMP}/src/${PACKAGE} 97 # ${BUILDTEMP}/${BUILD_DIST}; 98 98 99 99 if [ "$1" ]; then … … 109 109 # requires subversion (but connection to server isn't neccessary) 110 110 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 111 125 if [ "$SVN_BUILD_RELEASE" ]; then 112 126 sed "s/^Release:.*/Release: $SVN_BUILD_RELEASE/g" $SPECFILE > ${BUILDTEMP}/src/${PACKAGE}/$SPECFILE … … 143 157 144 158 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 145 161 cp -av `cat SPECSOURCES` ${BUILDTEMP}/src/${PACKAGE} 146 162 … … 151 167 TARFILE=$(ls *.tar.[gb]z*| awk '{print $1}') 152 168 cp -av $TARFILE ${BUILDTEMP}/src/${PACKAGE} 153 154 155 156 169 fi 157 158 170 fi 159 171 … … 165 177 export BUILD_ROOT=$BUILD_ROOT 166 178 export BUILD_DIST=$BUILD_DIST 167 export BUILD_RPMS=${ BUILDTEMP}/${BUILD_DIST}:$BUILD_RPMS179 export BUILD_RPMS=${DEST_DIR}/${BUILD_DIST}:$BUILD_RPMS 168 180 export BUILD_PREPARE_SPEC=$BUILD_PREPARE_SPEC 169 181 170 182 cd ${BUILDTEMP}/src/${PACKAGE} 171 #build $BUILD_MODE --prefer-rpms ${BUILDTEMP}/${BUILD_DIST}172 #build $BUILD_MODE173 183 $BUILD_CMD $BUILD_MODE 174 184 EOF … … 178 188 rm -f $BUILDSCRIPT 179 189 180 rm -f ${BUILDTEMP}/${BUILD_DIST}/${PACKAGE}-*.*.rpm181 cp -a ${BUILD_ROOT}/usr/src/packages/RPMS/*/${PACKAGE}-${VERSION}-*.*.rpm ${BUILDTEMP}/${BUILD_DIST}182 183 190 mkdir -p ${DEST_DIR}/src 184 191 # delete all old versions of this package … … 197 204 fi 198 205 206 echo 199 207 if [ $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"; 204 210 else 205 echo "Build of ${PACKAGE}completed!"211 echo "Build of \"${PACKAGE}\" completed!" 206 212 echo "Packages can be found in ${DEST_DIR}" 207 213 fi 214 echo 208 215 209 216 exit $ERROR
Note:
See TracChangeset
for help on using the changeset viewer.