File: make_src_tarball

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (224 lines) | stat: -rwxr-xr-x 5,293 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#!/bin/bash
#----------------------------------------------------------------------
# Build a source tarball for wxWidgets and wxPython

#set -o xtrace
##set -o errexit

spectemplate=distrib/wxPythonFull.spec.in

if [ ! -d wx/lib -o ! -e ${spectemplate} ]; then
    echo "Please run this script from the root wxPython directory."
    exit 1
fi


#----------------------------------------------------------------------
# Initialization

version=`python -c "import setup;print setup.VERSION"`
wxpdir=`pwd`
if [ "$WXWIN" != "" ]; then
    wxdir=$WXWIN
else
    wxdir=${wxpdir}/../wxWidgets
fi

distdir=${wxpdir}/dist
builddir=${wxpdir}/_build_

pythonbin=/usr/bin/python
tarname=wxPython-src

pyver=2.6
ver2=`echo ${version} | cut -c 1,2,3`
tarver=${tarname}-${version}
pythonbin=/usr/bin/python
python=${pythonbin}${pyver}
if [ ! -e ${python} ]; then
    echo "${python} not found!"
    exit 1
fi


function makespec {
    echo "*** Writing ${distdir}/wxPython.spec"
    cat ${spectemplate} \
	| sed s:@PYTHON@:${python}:g \
	| sed s:@PYVER@:${pyver}:g \
	| sed s:@TARNAME@:${tarname}:g \
	| sed s:@VERSION@:${version}:g \
	| sed s:@VER2@:${ver2}:g \
	> ${distdir}/wxPython.spec
}


#----------------------------------------------------------------------
# Copy the sources from the local workspace

function cleanup {
    RMFILES=`find . -name "$1"`
    if [ "$RMFILES" != "" ]; then
	rm -rf $RMFILES
    fi
}


echo "*** Copying workspace tree"
mkdir -p ${builddir}
mkdir -p ${distdir}
pushd ${builddir} > /dev/null
if [ -e ${tarver} ]; then
    rm -rf ${tarver}
fi
mkdir -p ${tarver}

# copy root dir contents
cp -pf --link ${wxdir}/* ${tarver} > /dev/null 2>&1

# copy some specific top level dirs
for d in art build debian demos docs include interface lib \
         locale patches samples src utils; do
    if [ -e ${wxdir}/$d ]; then
	cp -Rpf --link ${wxdir}/$d ${tarver} #> /dev/null 2>&1
    fi
done
mkdir ${tarver}/distrib
cp -Rpf --link ${wxdir}/distrib/scripts ${tarver}/distrib


# now do the same thing for wxPython, but use the DIRLIST to select dirs to copy
for dir in `grep -v '#' ${wxpdir}/distrib/DIRLIST`; do
    mkdir -p ${tarver}/wxPython/${dir}
    cp -pf --link ${wxpdir}/${dir}/* ${tarver}/wxPython/${dir} > /dev/null 2>&1
done

# using DIRLIST as above will normally skip any files starting
# with a dot, but there are a few .files that we do want to
# copy...
cp -pf --link ${wxpdir}/distrib/msw/.[a-zA-Z]* ${tarver}/wxPython/distrib/msw  > /dev/null 2>&1

# cleanup
echo "*** Removing uneeded stuff from copy of workspace tree"
pushd ${tarver} > /dev/null
cleanup .cvsignore
cleanup CVS
cleanup CVSROOT
cleanup .svn
rm BuildCVS.txt
rm -f ChangeLog
rm *.spec
rm -rf distrib/msw/tmake
rm locale/*.mo
cleanup ".#*"
cleanup "#*#"
cleanup "*~"
cleanup "*.orig"
cleanup "*.rej"
cleanup "*.pyc"
##cleanup core  # pubsub has a "core" subpackage
cleanup "core.[0-9]*"
rm -f wxPython/samples/embedded/embedded
rm -f wxPython/samples/embedded/embedded.o

# ports that are not supported yet
cleanup mgl
cleanup motif
cleanup os2
##cleanup x11
cleanup univ
cleanup wine

rm -f wxPython/wx/*  > /dev/null 2>&1

popd > /dev/null
popd > /dev/null



#----------------------------------------------------------------------
# Make the spec file and copy to ${builddir}/${tarver} so it will be
# in the tar file when it's built

makespec
cp ${distdir}/wxPython.spec ${builddir}/${tarver}/wxPython.spec


#----------------------------------------------------------------------
# Build the tar file

echo "*** Creating language catalogs..."
pushd ${builddir}/${tarver}/locale > /dev/null
make allmo
popd > /dev/null

echo "*** Creating tarball..."
cp distrib/README.1st.txt ${builddir}/${tarver}
pushd ${builddir} > /dev/null
tar cf ${distdir}/${tarver}.tar ${tarver} > /dev/null

#ext=gz
#cmd="gzip"
ext=bz2
cmd="bzip2 --best"

echo "*** Compressing..."
if [ -e ${distdir}/${tarver}.tar.$ext ]; then
    rm ${distdir}/${tarver}.tar.$ext
fi
$cmd ${distdir}/${tarver}.tar

popd > /dev/null


#----------------------------------------------------------------------
# Make the SRPM 

echo "*** Building SRPM..."

rpmtop=${builddir}/rpmtop
for dir in SOURCES SPECS BUILD RPMS SRPMS; do
    if [ ! -d ${rpmtop}/${dir} ]; then
	mkdir -p ${rpmtop}/${dir}
    fi
done

cp ${distdir}/${tarver}.tar.bz2 ${rpmtop}/SOURCES
	rpmbuild -bs \
	    --define "_topdir ${rpmtop}" \
	    --define "_tmppath ${builddir}" \
	    --define "release 1" \
	    ${distdir}/wxPython.spec

echo "*** Moving RPM to ${distdir}"
mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}


#----------------------------------------------------------------------
# Make another tarball with only the things needed for the Debian build

echo "*** Making trimmed tarball for Debian builds"
pushd ${builddir} > /dev/null

mv ${tarver} wxwidgets${ver2}-${version}

# remove some of the platform specific dirs
for dir in msw msdos msvc mac cocoa osx dfb palmos; do
    find . -name ${dir} -type d -print | xargs rm -rf
done

tar cf ${distdir}/wxwidgets${ver2}_${version}.orig.tar wxwidgets${ver2}-${version}
gzip -9 ${distdir}/wxwidgets${ver2}_${version}.orig.tar

popd > /dev/null

#----------------------------------------------------------------------
# Cleanup

echo "*** Cleaning up"
rm -rf ${rpmtop}
rm -rf ${builddir}