Gerald Carter wrote:
> On 8 Sep 2002, Vance Lankhaar wrote:
> 
> 
>>>Try this (when in the Redhat directory):
>>>
>>>$ cp ../Mandrake/makerpms-cvs.sh .
>>>$ sh makerpms-cvs.sh 2.2.6
>>
> 
> This won't work I don't think.

OK, so I was wrong, you would have to change 'Mandrake' to RedHat in my 
script


   IIRC the makerpms.s script for the redhat
> stuff checks for dependencies on different RPM versions...
> 
> This is what I used to create build scripts when I need them out
> of cvs...
> 
> ------cut here--------------------------------
> #!/bin/sh
> 
> TEMPLATES="makerpms.sh.tmpl samba2.spec.tmpl samba2-devel.spec.tmpl"
> 
> if [ ! "$2" ]; then
>         echo "Usage: $0 <version> <release>"
>         exit 1;
> fi
> 
> for file in $TEMPLATES; do
> 
>         newfile=`echo $file | sed 's/.tmpl//'`
>         echo Creating $newfile...
>         cat $file | sed "s/PVERSION/$1/g" | sed "s/PRELEASE/$2/g" > 
> $newfile
> 
> done
> ------cut here--------------------------------

Mine does that (except it uses 0.`date +%Y%m%d` as the release number), 
then renames the samba directory to match the version, changes back to 
the packaging directory and runs makerpms.sh, (hopefully) renaming the 
directory back at the end.

------cut here--------------------------------
#!/bin/bash
# makerpms-cvs.sh
# A quick script to build RPMs from cvs to test packaging
# Buchan Milne <[EMAIL PROTECTED]>

[ $# -lt 1 ] &&  echo "Usage: $0 <Samba version>" && exit 1

VERSION=$1
RELEASE=0.`date +%Y%m%d`
shift

# Replace PRELEASE and PVERSION with release number in all files ending with
# .tmpl

FILES=$(find . -name "*.tmpl" -type f)

for i in $FILES;do
         NEW=$(echo $i|sed -e 's/\.tmpl//g');
         cat $i |sed -e 's/PVERSION/'$VERSION'/g; 
s/PRELEASE/'$RELEASE'/g'> $NEW
;
done

#Change up three directories, rename directory to samba-$VERSION, change 
back
#then run makerpms.sh

(
CURRENT=$(pwd)
cd $(dirname $(dirname $(dirname $CURRENT)))
SAMBA_DIR=$(basename $(dirname $(dirname $CURRENT)))
mv $SAMBA_DIR samba-$VERSION
cd samba-$VERSION/packaging/Mandrake
sh makerpms.sh $@
cd $(dirname $(dirname $(dirname $CURRENT)))
mv samba-$VERSION $SAMBA_DIR
)
------cut here--------------------------------

We could probably have it detect the linux distro in another 2 lines of 
bash, adjust it to live one directory up, and then have one script that 
would work for all rpm-based distros.

Of course, this effort may be better spent on making one spec file which 
will build right on all rpm-based distros, but that would mean everyone 
would need to agree on subpackages (or not ;-)), or we would need lots 
of conditionals for subpackages.

Buchan

-- 
|----------------Registered Linux User #182071-----------------|
Buchan Milne                Mechanical Engineer, Network Manager
Cellphone * Work            +27 82 472 2231 * +27 21 8828820x121
Stellenbosch Automotive Engineering         http://www.cae.co.za
GPG Key                   http://ranger.dnsalias.com/bgmilne.asc
1024D/60D204A7 2919 E232 5610 A038 87B1 72D6 AC92 BA50 60D2 04A7

Reply via email to