[Kde-extra-gear] cvs2pkg script
Sebastian Stein
s5228@informatik.htw-dresden.de
Sun, 21 Jul 2002 00:08:51 +0200
--FL5UXtIhxfXey3p5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi again,
so some days ago, Klas and I decided to create a small bash script to
automate package generation from cvs. We know there is something called
cvs2pack, but it was told to me that it doesn't really work at all.
So I did it again, but this time not in Perl.
So I would be glad if you can test the attached script. You have to copy it
to your kdeextragear-1/ directory and than do e.g.:
cvs2pkg.sh kbruch
or
cvs2pkg.sh vimpart
It will create a gz, bz2 or both packages. Please make sure that your CVS
tree is up to date, because I commented out the cvs update commands for
testing purposes.
Please notice, that the created package won't compile with make -f
Makefile.cvs, because of the problem with kreatecd in Makefile.am.in like
explained in the other mail. But you can delete the strings (2) from
Makefile.am.in and everything will work fine.
Steinchen
--
KBruch: application to automatically generate tasks with fractions
Package: KDE Edu in KDE 3.2 (http://edu.kde.org/kbruch/)
CVS: kdeextragear-1/kbruch
State: finished
CVS Snapshot: http://www.hpfsc.de/download/kbruch-0.20.tar.gz
--FL5UXtIhxfXey3p5
Content-Type: application/x-sh
Content-Disposition: attachment; filename="cvs2pkg.sh"
Content-Transfer-Encoding: quoted-printable
#! /bin/sh=0A=0A# Author: Sebastian Stein <seb.stein@hpfsc.de>=0A# License:=
GPL (http://www.gnu.org/)=0A# Last modification: 2002-07-20=0A# TODO:=0A# =
o add a option to update/not update cvs before packageing=0A# o distcle=
an temp_dir/doc=0A=0A# the user could decide between a bz2, gz or both arch=
ives=0AOPTIONS=3D"gz bz2 both"=0A=0A# test if a module name was given=0Aif =
[ $# -ne 1 ]; then=0A echo "Usage: cvs2pkg program"=0A exit 1=0Afi=0A=0A# w=
e do not want a / at the end of the directory=0Anew_1=3D`echo $1 | sed -e "=
s/\///"`=0Aif [ $new_1 !=3D $1 ]; then=0A echo "please no / at the end of t=
he program module"=0A exit 1=0Afi=0A=0A# test if the given name is a sub-di=
rectory=0Atest -d $1=0Aif [ $? -ne 0 ]; then=0A echo "$1 is not a sub-direc=
tory"=0A exit 1=0Afi=0A=0A# the temporary directory=0Atemp_dir=3D"$1_cvs"=
=0A=0A# update to the current cvs state=0A# !! comment next line out=0Aecho=
"cvs update $1"=0A=0A# if a doc is avaible we update the docs as well=0Aif=
[ -d doc/$1 ]; then=0A # !! comment next line out=0A echo "cvs update doc/=
$1"=0Afi=0A=0A# we also update the admin directory=0A# !! comment next line=
out=0Aecho "cvs update admin"=0A=0A# add a temporary directory=0Amkdir $te=
mp_dir=0A=0A# check if we were able to create temp_dir=0Atest -d $temp_dir=
=0Aif [ $? -ne 0 ]; then=0A echo "Can not create a temporary directory $tem=
p_dir"=0A echo "Action stopped"=0A exit 1=0Afi=0A=0A# copy all files of the=
module to temp_dir=0Acp -R $1 $temp_dir=0A=0A# if a handbook exists, we al=
so copy it to the directory=0Aif [ -d doc/$1 ]; then=0A mkdir -p $temp_dir/=
doc/$1=0A cp -R doc/$1 $temp_dir/doc=0A cp doc/* $temp_dir/doc=0Afi=0A=0A# =
copy the admin directory=0Acp -R admin $temp_dir=0A=0A# and all files from =
the base dir=0Acp * $temp_dir=0A=0A# we now enter the temp_dir and delete a=
ll unwanted files=0A# maybe add some more file like install instructions...=
=0Acd $temp_dir/$1=0Amake distclean=0Acd ..=0A=0A# the same for the doc dir=
ectory=0A# maybe we have to do the make distclean in doc/ and not doc/app=
=0Aif [ -d doc/$1 ]; then=0A cd doc/$1=0A make distclean=0A cd ../..=0Afi=
=0Acd ..=0A=0A# make a tar of temp_dir=0Atar cf $1.tar $temp_dir=0A=0A# the=
user could decide between gz, bz2 and both=0Aecho "Choose the package form=
at:"=0Aselect opt in $OPTIONS; do=0A if [ "$opt" =3D "gz" ]; then=0A gzip =
$1.tar=0A rm -R $temp_dir=0A break=0A elif [ "$opt" =3D "bz2" ]; then=0A =
bzip2 $1.tar=0A rm -R $temp_dir=0A break=0A else=0A cp $1.tar $1.tar.tm=
p=0A gzip $1.tar=0A mv $1.tar.tmp $1.tar=0A bzip2 $1.tar=0A rm -R $temp=
_dir=0A break=0A fi=0Adone=0A=0A# cool, everything went ok!=0Aecho "Finish=
, created packages:"=0Als $1.tar*=0A
--FL5UXtIhxfXey3p5--