1 |
#!/bin/bash |
2 |
|
3 |
#This script produced with the aid of "The Debian System concepts and techniques" By Martin F. Krafft |
4 |
# Its purpose is to produce a .deb for escript |
5 |
|
6 |
|
7 |
#A ~ in front of the version number indicates a pre-release and will sort earlier than versions without ~ |
8 |
VERSION=~3.0-1 |
9 |
SRCDIR=`pwd` |
10 |
WRAPPERNAME=escript |
11 |
#ALTWRAPPERNAME=finleypython |
12 |
OUTPUTROOT=$SRCDIR/build/package/lenny/escript |
13 |
LIBOUT=$OUTPUTROOT/usr/lib/escript |
14 |
BINOUT=$OUTPUTROOT/usr/bin |
15 |
PKGFILES=$SRCDIR/packaging/lenny |
16 |
|
17 |
# check to be sure we are running from the project root and that we look like the root user |
18 |
|
19 |
if [ `whoami` != 'root' ] |
20 |
then |
21 |
echo "Please execute this script under fakeroot." |
22 |
echo "fakeroot $0" |
23 |
exit 1 |
24 |
fi |
25 |
|
26 |
if [ ! -d escript/src ] |
27 |
then |
28 |
echo "Please execute this script from the root of the project" |
29 |
exit 3 |
30 |
fi |
31 |
|
32 |
if [ -d $OUTPUTROOT ] |
33 |
then |
34 |
rm -rf $OUTPUTROOT || (echo "Error could not clean build area";exit 2) |
35 |
fi |
36 |
|
37 |
ARCHV=`uname -m` |
38 |
|
39 |
|
40 |
case "$ARCHV" in |
41 |
"i686" ) ARCH="i686";; |
42 |
"x86_64" ) ARCH="amd64";; |
43 |
*) echo "Unknown architecture $ARCHV. Unable to build package";exit 3;; |
44 |
esac |
45 |
|
46 |
mkdir -p $OUTPUTROOT |
47 |
|
48 |
#First copy debian skeleton |
49 |
cp -r $PKGFILES/escript/* $OUTPUTROOT |
50 |
|
51 |
|
52 |
mkdir -p $OUTPUTROOT/usr/share/man/man1 |
53 |
|
54 |
#copy the man page |
55 |
cp $SRCDIR/doc/manpage/man1/$WRAPPERNAME.1 $OUTPUTROOT/usr/share/man/man1 |
56 |
#cp $SRCDIR/doc/manpage/man1/$WRAPPERNAME.1 $OUTPUTROOT/usr/share/man/man1/$ALTWRAPPERNAME.1 |
57 |
gzip $OUTPUTROOT/usr/share/man/man1/$WRAPPERNAME.1 |
58 |
#gzip $OUTPUTROOT/usr/share/man/man1/$ALTWRAPPERNAME.1 |
59 |
|
60 |
#copy the documentation |
61 |
cp $SRCDIR/release/doc/escript_examples.tar.gz $OUTPUTROOT/usr/share/doc/escript/ |
62 |
cp $SRCDIR/release/doc/install/install.pdf $OUTPUTROOT/usr/share/doc/escript |
63 |
cp $SRCDIR/release/doc/user/guide.pdf $OUTPUTROOT/usr/share/doc/escript |
64 |
cp -r $SRCDIR/release/doc/epydoc $OUTPUTROOT/usr/share/doc/escript/python_html |
65 |
|
66 |
mkdir -p $LIBOUT/lib |
67 |
mkdir -p $BINOUT |
68 |
#Should be using install here? |
69 |
cp $SRCDIR/lib/* $LIBOUT/lib |
70 |
cp -r $SRCDIR/esys $LIBOUT |
71 |
|
72 |
# We should be using the standard python |
73 |
export ESCRIPT_ROOT=/usr/lib/escript |
74 |
|
75 |
sed -e "s%STDLOCATION=0%STDLOCATION=1%" \ |
76 |
< $SRCDIR/bin/escript > $BINOUT/$WRAPPERNAME |
77 |
|
78 |
#end content from finley_wrapper_writer.sh |
79 |
|
80 |
cd $BINOUT |
81 |
#ln -s $WRAPPERNAME $ALTWRAPPERNAME |
82 |
cd $SRCDIR |
83 |
|
84 |
#Nuke any svn stuff that made it in |
85 |
find $OUTPUTROOT -name ".svn" | xargs rm -rf |
86 |
|
87 |
|
88 |
#Say what version of the debian packaging format we are using: |
89 |
#This is NOT the package version |
90 |
echo 2.0 > $OUTPUTROOT/../debian-binary |
91 |
|
92 |
#Check some permissions |
93 |
chmod og=rx $BINOUT/$WRAPPERNAME |
94 |
if [ -f $LIBOUT/pythonMPI ] |
95 |
then |
96 |
chmod og=rx $LIBOUT/pythonMPI |
97 |
fi |
98 |
|
99 |
cd $OUTPUTROOT |
100 |
|
101 |
cd usr/share/doc/escript/ |
102 |
gzip changelog.Debian |
103 |
|
104 |
cd $OUTPUTROOT |
105 |
#Fix directory perms |
106 |
chmod -R og-w . |
107 |
|
108 |
cd DEBIAN |
109 |
|
110 |
#Now we need to update the architecture |
111 |
mv control control.old |
112 |
sed -e "s%Architecture: i386%Architecture: $ARCH%" < control.old > control |
113 |
rm control.old |
114 |
|
115 |
tar czf ../../control.tar.gz . |
116 |
cd .. |
117 |
tar czf ../data.tar.gz usr |
118 |
cd .. |
119 |
|
120 |
ar rcu escript-$VERSION\_$ARCH.deb debian-binary control.tar.gz data.tar.gz |
121 |
|
122 |
|
123 |
|
124 |
|