3 ###########################################################
4 # Maemo-efl building script
6 ###########################################################
8 source "./scripts/message-functions.sh"
9 source "./scripts/var-definitions.sh"
10 source "./scripts/log-functions.sh"
11 source "./scripts/repository-functions.sh"
12 source "./scripts/package-functions.sh"
13 source "./scripts/setup-functions.sh"
15 ###########################################################
17 ###########################################################
20 # Parse comand line options
24 Usage: $__this_script [OPTIONS]
25 Build script for Maemo EFL debian packages.
27 -n Don't sign packages.
28 -c Don't update source repositories.
29 -h Show this usage guide.
30 -s PATH Specify alternate scratchbox path (default: $__sbox_path).
31 -r Remove module sub-directories (not the high level debian dir)
33 -t A:B:Z Specify scratchbox building targets
34 (default: all targets installed).
35 -u svn_rev Update the latest revision number to "svn_rev" and exit. This
36 only works on revision numbers that has the svn label on
37 the version part (e.g 0.9.9.043+svn32000-maemo1) Also,
38 this option will not create a new entry on the changelog
39 file, it will only change its first line. If you want to
40 update to the latest repository revision number, just use
42 -p P1:P2:PN Specify packges to build (default: build all packages available).
47 while getopts "anchre:s:t:u:p:" opt ; do
51 __python_modules_temp=""
52 __python_efl_utils_module_temp=""
53 __python_dispatcher_module_temp=""
54 __virtual_packages_temp=""
56 __parameters=`echo "$OPTARG" | $__sed -e 's/:/ /g'`
57 for i in $__parameters; do
58 for module in `echo "$__lib_modules"|$__sed -e 's/:/ /g'`; do
59 if [ x$module == x$i ]; then
60 __lib_modules_temp=$__lib_modules_temp:$i
65 for module in `echo "$__python_modules"|$__sed -e 's/:/ /g'`; do
66 if [ x$module == x$i ]; then
67 __python_modules_temp=$__python_modules_temp:$i
71 for module in `echo "$__python_efl_utils_module"|$__sed -e 's/:/ /g'`; do
72 if [ x$module == x$i ]; then
73 __python_efl_utils_module_temp=$__python_efl_utils_module_temp:$i
78 for module in `echo "$__python_dispatcher_module" |$__sed -e 's/:/ /g'`; do
79 if [ x$module == x$i ]; then
80 __python_dispatcher_module_temp=$__python_dispatcher_module_temp:$i
85 for module in `echo "$__virtual_packages" |$__sed -e 's/:/ /g'`; do
86 if [ x$module == x$i ]; then
87 __virtual_packages_temp=$__virtual_packages_temp:$i
93 __lib_modules_temp=`echo "$__lib_modules_temp" | tr "[:upper:]" "[:lower:]"`
94 __python_modules_temp=`echo "$__python_modules_temp" | tr "[:upper:]" "[:lower:]"`
95 __python_efl_utils_module_temp=`echo "$__python_efl_utils_module_temp" | tr "[:upper:]" "[:lower:]"`
96 __python_dispatcher_module_temp=`echo "$__python_dispatcher_module_temp" | tr "[:upper:]" "[:lower:]"`
97 __virtual_packages_temp=`echo "$__virtual_packages_temp" | tr "[:upper:]" "[:lower:]"`
100 __update_repositories=0
104 if [ "x$__sbox_path" = "x" ] || [ ! -d $__sbox_path ]; then
105 error "Invalid export path: $__export_dir"
118 if [ "x$__sbox_path" = "x" ] || [ ! -d $__sbox_path ]; then
119 error "Invalid scratchbox path: $__sbox_path"
127 __sbox_targets_temp=`echo $OPTARG | tr "[:lower:]" "[:upper:]"`
130 __changelog_update=$OPTARG
139 ############################
141 ###########################
146 # Remove modules subdirectories and exit
147 if [ $__force_remove -eq 1 ]; then
152 # Modify debian changelog
153 if [ -n "$__changelog_update" ]; then
154 update_changelog $__changelog_update
162 if [ $__not_all_pkgs -eq 1 ]; then
163 __lib_modules=$__lib_modules_temp
164 __python_modules=$__python_modules_temp
165 __python_efl_utils_module=$__python_efl_utils_module_temp
166 __python_dispatcher_module=$__python_dispatcher_module_temp
167 __virtual_packages=$__virtual_packages_temp
181 # Setup scratchbox variables
184 # Setup scratchbox targets if option -t was used
185 if [ ! -z $__sbox_targets_temp ]; then
186 __sbox_targets=`echo $__sbox_targets_temp|$__sed -e 's/:/ /g'`
189 ###########################################################
190 # ARCHITECTURE DEPENDENT MODULES
191 ###########################################################
192 # For each scratchbox target
193 for target in $__sbox_targets; do
194 msg_begin "Checking distro and arch for target $target"
198 msg " Distribution..: $__distro"
199 msg " Architecture..: $__arch"
200 msg " Build Options.: $__build_pkg_options"
202 if [ ! -d $__pkg_dir ]; then
203 msg_begin " Creating dir for $__distro $__arch packages"
204 $__mkdir -p $__pkg_dir
208 msg_begin " Changing current sbox target to $target"
209 change_sbox_target $target
213 for module in `echo $__lib_modules:$__python_modules|$__sed -e 's/:/ /g'`; do
214 msg " Building $module packages for $__distro $__arch"
216 update_debian_dir $module
218 if [ -d $__tmp_dir/$module/$module ]; then
219 msg_begin " Removing temporary $module"
220 rm -rf $__tmp_dir/$module/$module
224 msg_begin " Copying $module dir to $__tmp_dir"
225 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
228 # msg_begin " Cleaning $module repository"
229 # git_clean_repository $module/$module
232 msg_begin " Building $module packages"
233 build_pkg $__tmp_dir/$module
236 if [ -z $__no_signing ]; then
237 msg_begin " Signing $module packages"
238 sign_pkgs $__tmp_dir/$module
242 msg_begin " Installing $module packages"
243 install_pkgs $__tmp_dir/$module
246 msg_begin " Copying $module packages"
247 if [ "x$__arch" != "xarmel" ]; then
248 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__pkg_dir
250 mv $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
253 msg_begin " Removing temporary $module"
254 rm -rf $__tmp_dir/$module/$module
258 msg_begin " Uninstalling packages $__installed_packages"
263 ###########################################################
264 # ARCHITECTURE INDEPENDENT MODULES
265 ###########################################################
266 # For each scratchbox target
267 for target in $__sbox_targets; do
268 msg_begin "Checking distro and arch for target $target"
272 msg " Distribution..: $__distro"
273 msg " Architecture..: $__arch"
274 msg " Build Options.: $__build_pkg_options"
276 if [ "x$__arch" = "xarmel" ]; then
277 warn "Skipping target $target for architecture independent packages"
282 __pkg_dir=`dirname $__pkg_dir`/$__arch
284 if [ ! -d $__pkg_dir ]; then
285 msg_begin " Creating dir for $__distro $__arch packages"
286 $__mkdir -p $__pkg_dir
290 msg_begin " Changing current sbox target to $target"
291 change_sbox_target $target
295 for module in `echo $__python_efl_utils_module|$__sed -e 's/:/ /g'`; do
297 msg " Building $module packages for $__distro $__arch"
298 update_debian_dir $module
301 if [ ! -d $__tmp_dir/$module ]; then
302 mkdir $__tmp_dir/$module
305 if [ -d $__tmp_dir/$module/$module ]; then
306 msg_begin " Removing temporary $module"
307 rm -rf $__tmp_dir/$module/$module
312 msg_begin " Copying $module dir to $__tmp_dir"
313 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
314 #cp -f -u -r $module $__tmp_dir
317 # msg_begin " Cleaning $module repository"
318 # git_clean_repository $module/$module
321 msg_begin " Building $module packages"
322 build_pkg $__tmp_dir/$module
325 if [ -z $__no_signing ]; then
326 msg_begin " Signing $module packages"
327 sign_pkgs $__tmp_dir/$module
331 msg_begin " Installing $module packages"
332 install_pkgs $__tmp_dir/$module
335 msg_begin " Copying $module packages"
336 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
339 msg_begin " Removing temporary $module"
340 rm -rf $__tmp_dir/$module/$module
344 msg_begin " Uninstalling packages $__installed_packages"
349 ###########################################################
351 ###########################################################
352 # For each scratchbox target
353 for target in $__sbox_targets; do
354 msg_begin "Checking distro and arch for target $target"
358 msg " Distribution..: $__distro"
359 msg " Architecture..: $__arch"
360 msg " Build Options.: $__build_pkg_options"
362 if [ "x$__arch" = "xarmel" ]; then
363 warn "Skipping target $target for architecture independent packages"
368 __pkg_dir=`dirname $__pkg_dir`/$__arch
370 if [ ! -d $__pkg_dir ]; then
371 msg_begin " Creating dir for $__distro $__arch packages"
372 $__mkdir -p $__pkg_dir
376 msg_begin " Changing current sbox target to $target"
377 change_sbox_target $target
381 for module in `echo $__virtual_packages|$__sed -e 's/:/ /g'`; do
382 msg " Building $module packages for $__distro $__arch"
384 update_debian_dir $module
386 if [ ! -d $__tmp_dir/$module ]; then
387 mkdir $__tmp_dir/$module
390 if [ -d $__tmp_dir/$module/$module ]; then
391 msg_begin " Removing temporary $module"
392 rm -rf $__tmp_dir/$module/$module
396 msg_begin " Copying $module dir to $__tmp_dir"
397 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
398 #cp -f -u -r $module $__tmp_dir/$module
401 msg_begin " Building $module packages"
402 build_pkg $__tmp_dir/$module
405 if [ -z $__no_signing ]; then
406 msg_begin " Signing $module packages"
407 sign_pkgs $__tmp_dir/$module
411 msg_begin " Installing $module packages"
412 install_pkgs $__tmp_dir/$module
415 msg_begin " Copying $module packages"
416 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
419 msg_begin " Removing temporary $module"
420 rm -rf $__tmp_dir/$module/$module
424 msg_begin " Uninstalling packages $__installed_packages"