OLD | NEW |
(Empty) | |
| 1 #!/bin/sh |
| 2 |
| 3 # Utility command to generate an rpm package file for gsutil. |
| 4 # This tool takes no arguments and leaves the resulting rpm package |
| 5 # file at this location under your home rpmbuild tree: |
| 6 # $HOME/rpmbuild/RPMS/noarch/gsutil-$VERSION-<N>.noarch.rpm |
| 7 # where <N> is the build number. |
| 8 |
| 9 SPEC_FILE_IN=gsutil.spec.in |
| 10 SPEC_FILE=gsutil.spec |
| 11 |
| 12 # Pre-process the rpm spec file. |
| 13 python pkg_util.py |
| 14 |
| 15 # Get package name and version from spec file. |
| 16 NAME=`awk <$SPEC_FILE '/^Name:/ {print $2}'` |
| 17 if [ "$NAME" = "" ] |
| 18 then |
| 19 echo "Error: Name variable not set properly in $SPEC_FILE." |
| 20 exit 1 |
| 21 fi |
| 22 |
| 23 VERSION=`awk <$SPEC_FILE '/^Version:/ {print $2}'` |
| 24 ROOT=$NAME-$VERSION |
| 25 STAGING_DIR=$HOME/rpmbuild/SOURCES/$ROOT |
| 26 |
| 27 # Update VERSION file to reflect current version. |
| 28 echo $VERSION >VERSION |
| 29 |
| 30 # Make sure STAGING_DIR is set so we don't do a recursive rm below |
| 31 # on an indeterminate location. |
| 32 if [ "$STAGING_DIR" = "" ] |
| 33 then |
| 34 echo "Can't proceed - STAGING_DIR not set properly." |
| 35 exit 1 |
| 36 fi |
| 37 |
| 38 # Create staging dir and copy package files there, filtering .svn dirs |
| 39 # and .pyc files. |
| 40 rm -rf $STAGING_DIR |
| 41 mkdir -p $STAGING_DIR |
| 42 find . -print | grep -v "\.svn" | grep -v "\.pyc$" | cpio -pud $STAGING_DIR |
| 43 |
| 44 # Generate archive from staging area contents, then clean up staging area. |
| 45 CUR_DIR=$PWD |
| 46 cd $STAGING_DIR/.. |
| 47 zip -r $ROOT.zip $ROOT |
| 48 |
| 49 cd $CUR_DIR |
| 50 rm -rf $STAGING_DIR |
| 51 |
| 52 # New build RPM package based on generated spec file and archive contents. |
| 53 rpmbuild -ba gsutil.spec |
| 54 |
OLD | NEW |