]> granicus.if.org Git - libjpeg-turbo/commitdiff
Replace clunky doexit() mechanism with a better means of error trapping
authorDRC <dcommander@users.sourceforge.net>
Wed, 17 Feb 2010 01:07:46 +0000 (01:07 +0000)
committerDRC <dcommander@users.sourceforge.net>
Wed, 17 Feb 2010 01:07:46 +0000 (01:07 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@117 632fc199-4ca6-4c93-a231-07263d6284db

release/makedpkg
release/makemacpkg
release/makerpm
release/makesrpm

index f45ee9fce785f5e82eaafbb7f15993983b3ccd18..5fe949c3e44fccebc3b3a271956a7398bfc7f9b8 100644 (file)
@@ -1,15 +1,18 @@
 #!/bin/sh
 
 set -u
+set -e
+trap onexit INT
+trap onexit TERM
+trap onexit EXIT
 
 TMPDIR=
 
-doexit()
+onexit()
 {
        if [ ! "$TMPDIR" = "" ]; then
                sudo rm -rf $TMPDIR
        fi
-       exit $1
 }
 
 usage()
@@ -26,27 +29,27 @@ DEBARCH=$4
 SRCDIR=$5
 
 umask 022
-TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX || doexit -1`
-mkdir $TMPDIR/DEBIAN || doexit -1
+TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
+mkdir $TMPDIR/DEBIAN
 (cat $SRCDIR/release/deb-control.tmpl | sed s/{__PKGNAME}/$PACKAGE_NAME/g \
        | sed s/{__VERSION}/$VERSION/g | sed s/{__BUILD}/$BUILD/g \
-       | sed s/{__ARCH}/$DEBARCH/g > $TMPDIR/DEBIAN/control) || doexit -1
+       | sed s/{__ARCH}/$DEBARCH/g > $TMPDIR/DEBIAN/control)
 
 if [ "$DEBARCH" = "amd64" ]; then
        __LIB=lib
 else
        __LIB=lib32
 fi
-make install prefix=$TMPDIR/opt/$PACKAGE_NAME libdir=$TMPDIR/opt/$PACKAGE_NAME/$__LIB || doexit -1
-rm -f $TMPDIR/opt/$PACKAGE_NAME/$__LIB/*.la || doexit -1
-mkdir -p $TMPDIR/usr/$__LIB || doexit -1
-mv $TMPDIR/opt/$PACKAGE_NAME/$__LIB/libturbojpeg.* $TMPDIR/usr/$__LIB || doexit -1
+make install prefix=$TMPDIR/opt/$PACKAGE_NAME libdir=$TMPDIR/opt/$PACKAGE_NAME/$__LIB
+rm -f $TMPDIR/opt/$PACKAGE_NAME/$__LIB/*.la
+mkdir -p $TMPDIR/usr/$__LIB
+mv $TMPDIR/opt/$PACKAGE_NAME/$__LIB/libturbojpeg.* $TMPDIR/usr/$__LIB
 /sbin/ldconfig -n $TMPDIR/opt/$PACKAGE_NAME/$__LIB
 /sbin/ldconfig -n $TMPDIR/usr/$__LIB
-mkdir -p $TMPDIR/usr/include || doexit -1
-mv $TMPDIR/opt/$PACKAGE_NAME/include/turbojpeg.h $TMPDIR/usr/include || doexit -1
+mkdir -p $TMPDIR/usr/include
+mv $TMPDIR/opt/$PACKAGE_NAME/include/turbojpeg.h $TMPDIR/usr/include
 
-sudo chown -Rh root:root $TMPDIR/* || doexit -1
-dpkg -b $TMPDIR $PACKAGE_NAME\_$DEBARCH.deb || doexit -1
+sudo chown -Rh root:root $TMPDIR/*
+dpkg -b $TMPDIR $PACKAGE_NAME\_$DEBARCH.deb
 
-doexit 0
+exit
index 461da9c440949013d6599196e61032c83ece1e39..8460b7ee81f13777b838cf9a5de8b8055f5512ab 100644 (file)
@@ -1,15 +1,18 @@
 #!/bin/sh
 
 set -u
+set -e
+trap onexit INT
+trap onexit TERM
+trap onexit EXIT
 
 TMPDIR=
 
-doexit()
+onexit()
 {
        if [ ! "$TMPDIR" = "" ]; then
                sudo rm -rf $TMPDIR
        fi
-       exit $1
 }
 
 usage()
@@ -35,16 +38,16 @@ if [ -f $PACKAGE_NAME.dmg ]; then
 fi
 
 umask 022
-TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX || doexit -1`
+TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
 PKGROOT=$TMPDIR/pkg/Package_Root
-mkdir -p $PKGROOT || doexit -1
-mkdir -p $PKGROOT/opt/$PACKAGE_NAME/bin || doexit -1
-make install prefix=$PKGROOT/opt/$PACKAGE_NAME || doexit -1
-rm -f $PKGROOT/opt/$PACKAGE_NAME/lib/*.la || doexit -1
-mkdir -p $PKGROOT/usr/lib || doexit -1
-mv $PKGROOT/opt/$PACKAGE_NAME/lib/libturbojpeg.* $PKGROOT/usr/lib || doexit -1
-mkdir -p $PKGROOT/usr/include || doexit -1
-mv $PKGROOT/opt/$PACKAGE_NAME/include/turbojpeg.h $PKGROOT/usr/include || doexit -1
+mkdir -p $PKGROOT
+mkdir -p $PKGROOT/opt/$PACKAGE_NAME/bin
+make install prefix=$PKGROOT/opt/$PACKAGE_NAME
+rm -f $PKGROOT/opt/$PACKAGE_NAME/lib/*.la
+mkdir -p $PKGROOT/usr/lib
+mv $PKGROOT/opt/$PACKAGE_NAME/lib/libturbojpeg.* $PKGROOT/usr/lib
+mkdir -p $PKGROOT/usr/include
+mv $PKGROOT/opt/$PACKAGE_NAME/include/turbojpeg.h $PKGROOT/usr/include
 
 if [ $UNIVERSAL = 1 ]; then
        if [ ! -d $SRCDIR/osxx86 ]; then
@@ -55,61 +58,61 @@ if [ $UNIVERSAL = 1 ]; then
        sh $SRCDIR/configure CC=gcc-4.0 CXX=g++-4.0 \
                CFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -O3 -m32' \
                CXXFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -O3 -m32' \
-               LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -m32' || doexit -1
-       make prefix=$TMPDIR/dist.x86 install || doexit -1
+               LDFLAGS='-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -m32'
+       make prefix=$TMPDIR/dist.x86 install
        popd
        lipo -create -arch i386 $TMPDIR/dist.x86/lib/libjpeg.62.dylib -arch x86_64 \
                $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.62.dylib \
-               -output $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.62.dylib || doexit -1
+               -output $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.62.dylib
        lipo -create -arch i386 $TMPDIR/dist.x86/lib/libjpeg.a -arch x86_64 \
                $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.a \
-               -output $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.a || doexit -1
+               -output $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.a
        lipo -create -arch i386 $TMPDIR/dist.x86/lib/libturbojpeg.dylib -arch x86_64 \
                $PKGROOT/usr/lib/libturbojpeg.dylib \
-               -output $PKGROOT/usr/lib/libturbojpeg.dylib || doexit -1
+               -output $PKGROOT/usr/lib/libturbojpeg.dylib
        lipo -create -arch i386 $TMPDIR/dist.x86/lib/libturbojpeg.a -arch x86_64 \
                $PKGROOT/usr/lib/libturbojpeg.a \
-               -output $PKGROOT/usr/lib/libturbojpeg.a || doexit -1
+               -output $PKGROOT/usr/lib/libturbojpeg.a
 fi
 
-install_name_tool -id /opt/$PACKAGE_NAME/lib/libjpeg.62.dylib $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.62.dylib || doexit -1
-install_name_tool -id libturbojpeg.dylib $PKGROOT/usr/lib/libturbojpeg.dylib || doexit -1
+install_name_tool -id /opt/$PACKAGE_NAME/lib/libjpeg.62.dylib $PKGROOT/opt/$PACKAGE_NAME/lib/libjpeg.62.dylib
+install_name_tool -id libturbojpeg.dylib $PKGROOT/usr/lib/libturbojpeg.dylib
 
-mkdir -p $PKGROOT/Library/Documentation/$PACKAGE_NAME || doexit -1
-chmod 1775 $PKGROOT/Library || doexit -1
-chmod 775 $PKGROOT/Library/Documentation || doexit -1
-mkdir -p $TMPDIR/pkg/Resources || doexit -1
+mkdir -p $PKGROOT/Library/Documentation/$PACKAGE_NAME
+chmod 1775 $PKGROOT/Library
+chmod 775 $PKGROOT/Library/Documentation 
+mkdir -p $TMPDIR/pkg/Resources 
 
 (cat $SRCDIR/release/Description.plist.tmpl | sed s/{__VERSION}/$VERSION/g \
        | sed s/{__APPNAME}/$PACKAGE_NAME/g \
-       > $TMPDIR/pkg/Description.plist) || doexit -1
+       > $TMPDIR/pkg/Description.plist) 
 (cat $SRCDIR/release/Info.plist.tmpl | sed s/{__VERSION}/$VERSION/g    \
-       | sed s/{__BUILD}/$BUILD/g > $TMPDIR/pkg/Info.plist) || doexit -1
+       | sed s/{__BUILD}/$BUILD/g > $TMPDIR/pkg/Info.plist) 
 (cat $SRCDIR/release/uninstall.sh.tmpl \
        | sed s/{__APPNAME}/$PACKAGE_NAME/g \
-       > $PKGROOT/opt/$PACKAGE_NAME/bin/uninstall) || doexit -1
+       > $PKGROOT/opt/$PACKAGE_NAME/bin/uninstall) 
 chmod 755 $PKGROOT/opt/$PACKAGE_NAME/bin/uninstall
 
-install -m 644 $SRCDIR/LICENSE.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LICENSE.txt || doexit -1
-install -m 644 $SRCDIR/LGPL.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LGPL.txt || doexit -1
-install -m 644 $SRCDIR/README-turbo.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/README-turbo.txt || doexit -1
-install -m 644 $SRCDIR/README $PKGROOT/Library/Documentation/$PACKAGE_NAME/README || doexit -1
-install -m 644 $SRCDIR/libjpeg.doc $PKGROOT/Library/Documentation/$PACKAGE_NAME/libjpeg.doc || doexit -1
+install -m 644 $SRCDIR/LICENSE.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LICENSE.txt 
+install -m 644 $SRCDIR/LGPL.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LGPL.txt 
+install -m 644 $SRCDIR/README-turbo.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/README-turbo.txt 
+install -m 644 $SRCDIR/README $PKGROOT/Library/Documentation/$PACKAGE_NAME/README 
+install -m 644 $SRCDIR/libjpeg.doc $PKGROOT/Library/Documentation/$PACKAGE_NAME/libjpeg.doc 
 
-sudo chown -R root:admin $PKGROOT || doexit -1
-sudo chown -R root:0 $PKGROOT/usr || doexit -1
-cp $SRCDIR/release/License.rtf $SRCDIR/release/Welcome.rtf $SRCDIR/release/ReadMe.rtf $TMPDIR/pkg/Resources/ || doexit -1
+sudo chown -R root:admin $PKGROOT 
+sudo chown -R root:0 $PKGROOT/usr 
+cp $SRCDIR/release/License.rtf $SRCDIR/release/Welcome.rtf $SRCDIR/release/ReadMe.rtf $TMPDIR/pkg/Resources/ 
 
 mkdir $TMPDIR/dmg
 $PACKAGEMAKER -build -v -p $TMPDIR/dmg/$PACKAGE_NAME.pkg \
        -f $PKGROOT -r $TMPDIR/pkg/Resources \
-       -i $TMPDIR/pkg/Info.plist -d $TMPDIR/pkg/Description.plist || doexit -1
-install -m 644 $SRCDIR/release/uninstall.applescript $TMPDIR || doexit -1
-sudo osacompile -t APPL -o "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app" $TMPDIR/uninstall.applescript || doexit -1
-sudo chown -R $USER "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app" || doexit -1
+       -i $TMPDIR/pkg/Info.plist -d $TMPDIR/pkg/Description.plist 
+install -m 644 $SRCDIR/release/uninstall.applescript $TMPDIR 
+sudo osacompile -t APPL -o "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app" $TMPDIR/uninstall.applescript 
+sudo chown -R $USER "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app" 
 hdiutil create -fs HFS+ -volname $PACKAGE_NAME-$VERSION \
        -srcfolder "$TMPDIR/dmg" \
-       $TMPDIR/$PACKAGE_NAME.dmg || doexit -1
-cp $TMPDIR/$PACKAGE_NAME.dmg . || doexit -1
+       $TMPDIR/$PACKAGE_NAME.dmg 
+cp $TMPDIR/$PACKAGE_NAME.dmg . 
 
-doexit 0
+exit
index 0b34f24e521c3caef8ef851d63917fa92740e996..aaeaf3d7255f51a2b16ab1f6ece82655922f078f 100644 (file)
@@ -1,15 +1,18 @@
 #!/bin/sh
 
 set -u
+set -e
+trap onexit INT
+trap onexit TERM
+trap onexit EXIT
 
 TMPDIR=
 
-doexit()
+onexit()
 {
        if [ ! "$TMPDIR" = "" ]; then
                sudo rm -rf $TMPDIR
        fi
-       exit $1
 }
 
 usage()
@@ -25,15 +28,15 @@ BUILD=$3
 RPMARCH=$4
 SRCDIR=$5
 
-TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX || doexit -1`
-mkdir -p $TMPDIR/RPMS || doexit -1
-ln -fs `pwd` $TMPDIR/BUILD || doexit -1
+TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
+mkdir -p $TMPDIR/RPMS
+ln -fs `pwd` $TMPDIR/BUILD
 rm -f $PACKAGE_NAME.$RPMARCH.rpm
 rpmbuild -bb --define "_name $PACKAGE_NAME" \
        --define "_blddir $TMPDIR/buildroot" --define "_topdir $TMPDIR" \
        --define "_version $VERSION" --define "_build $BUILD" \
        --define "_srcdir $SRCDIR" --target $RPMARCH \
-       $SRCDIR/release/libjpeg-turbo.spec || doexit -1
+       $SRCDIR/release/libjpeg-turbo.spec
 cp $TMPDIR/RPMS/$RPMARCH/$PACKAGE_NAME-$VERSION-$BUILD.$RPMARCH.rpm $PACKAGE_NAME.$RPMARCH.rpm
 
-doexit 0
+exit
index cb54879514001466f2b68aa586b431a65e70a5c3..4519779f0e8d2e77b826dfba5f7e3485f96f7a72 100644 (file)
@@ -1,15 +1,18 @@
 #!/bin/sh
 
 set -u
+set -e
+trap onexit INT
+trap onexit TERM
+trap onexit EXIT
 
 TMPDIR=
 
-doexit()
+onexit()
 {
        if [ ! "$TMPDIR" = "" ]; then
                sudo rm -rf $TMPDIR
        fi
-       exit $1
 }
 
 usage()
@@ -30,19 +33,19 @@ if [ ! -f ./$TARBALL ]; then
        exit -1
 fi
 
-TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX || doexit -1`
-mkdir -p $TMPDIR/RPMS || doexit -1
-mkdir -p $TMPDIR/SRPMS || doexit -1
-mkdir -p $TMPDIR/BUILD || doexit -1
-mkdir -p $TMPDIR/SOURCES || doexit -1
-mkdir -p $TMPDIR/SPECS || doexit -1
+TMPDIR=`mktemp -d /tmp/$PACKAGE_NAME-build.XXXXXX`
+mkdir -p $TMPDIR/RPMS
+mkdir -p $TMPDIR/SRPMS
+mkdir -p $TMPDIR/BUILD
+mkdir -p $TMPDIR/SOURCES
+mkdir -p $TMPDIR/SPECS
 rm -f $PACKAGE_NAME.src.rpm
 cp $TARBALL $TMPDIR/SOURCES
 cat $SRCDIR/release/libjpeg-turbo.spec | sed s/%{_name}/$PACKAGE_NAME/g \
        | sed s/%{_version}/$VERSION/g | sed s/%{_build}/$BUILD/g \
        | sed s/%{_blddir}/%{_tmppath}/g | sed s@%{_srcdir}/@@g \
-       | sed s/#--\>//g >$TMPDIR/SPECS/libjpeg-turbo.spec || doexit -1
-rpmbuild -bs --define "_topdir $TMPDIR" $TMPDIR/SPECS/libjpeg-turbo.spec || doexit -1
+       | sed s/#--\>//g >$TMPDIR/SPECS/libjpeg-turbo.spec
+rpmbuild -bs --define "_topdir $TMPDIR" $TMPDIR/SPECS/libjpeg-turbo.spec
 cp $TMPDIR/SRPMS/$PACKAGE_NAME-$VERSION-$BUILD.src.rpm $PACKAGE_NAME.src.rpm
 
-doexit 0
+exit