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
183 # Setup scratchbox variables
186 # Setup scratchbox targets if option -t was used
187 if [ ! -z $__sbox_targets_temp ]; then
188 __sbox_targets=`echo $__sbox_targets_temp|$__sed -e 's/:/ /g'`
191 ###########################################################
192 # ARCHITECTURE DEPENDENT MODULES
193 ###########################################################
194 # For each scratchbox target
195 for target in $__sbox_targets; do
196 msg_begin "Checking distro and arch for target $target"
200 msg " Distribution..: $__distro"
201 msg " Architecture..: $__arch"
202 msg " Build Options.: $__build_pkg_options"
204 if [ ! -d $__pkg_dir ]; then
205 msg_begin " Creating dir for $__distro $__arch packages"
206 $__mkdir -p $__pkg_dir
210 msg_begin " Changing current sbox target to $target"
211 change_sbox_target $target
215 for module in `echo $__lib_modules:$__python_modules|$__sed -e 's/:/ /g'`; do
216 msg " Building $module packages for $__distro $__arch"
218 update_debian_dir $module
220 if [ -d $__tmp_dir/$module/$module ]; then
221 msg_begin " Removing temporary $module"
222 rm -rf $__tmp_dir/$module/$module
226 msg_begin " Copying $module dir to $__tmp_dir"
227 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
230 # msg_begin " Cleaning $module repository"
231 # git_clean_repository $module/$module
234 msg_begin " Building $module packages"
235 build_pkg $__tmp_dir/$module
238 if [ -z $__no_signing ]; then
239 msg_begin " Signing $module packages"
240 sign_pkgs $__tmp_dir/$module
244 msg_begin " Installing $module packages"
245 install_pkgs $__tmp_dir/$module
248 msg_begin " Copying $module packages"
249 if [ "x$__arch" != "xarmel" ]; then
250 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__pkg_dir
252 mv $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
255 msg_begin " Removing temporary $module"
256 rm -rf $__tmp_dir/$module/$module
260 msg_begin " Uninstalling packages $__installed_packages"
265 ###########################################################
266 # ARCHITECTURE INDEPENDENT MODULES
267 ###########################################################
268 # For each scratchbox target
269 for target in $__sbox_targets; do
270 msg_begin "Checking distro and arch for target $target"
274 msg " Distribution..: $__distro"
275 msg " Architecture..: $__arch"
276 msg " Build Options.: $__build_pkg_options"
278 if [ "x$__arch" = "xarmel" ]; then
279 warn "Skipping target $target for architecture independent packages"
284 __pkg_dir=`dirname $__pkg_dir`/$__arch
286 if [ ! -d $__pkg_dir ]; then
287 msg_begin " Creating dir for $__distro $__arch packages"
288 $__mkdir -p $__pkg_dir
292 msg_begin " Changing current sbox target to $target"
293 change_sbox_target $target
297 for module in `echo $__python_efl_utils_module|$__sed -e 's/:/ /g'`; do
299 msg " Building $module packages for $__distro $__arch"
300 update_debian_dir $module
303 if [ ! -d $__tmp_dir/$module ]; then
304 mkdir $__tmp_dir/$module
307 if [ -d $__tmp_dir/$module/$module ]; then
308 msg_begin " Removing temporary $module"
309 rm -rf $__tmp_dir/$module/$module
314 msg_begin " Copying $module dir to $__tmp_dir"
315 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
316 #cp -f -u -r $module $__tmp_dir
319 # msg_begin " Cleaning $module repository"
320 # git_clean_repository $module/$module
323 msg_begin " Building $module packages"
324 build_pkg $__tmp_dir/$module
327 if [ -z $__no_signing ]; then
328 msg_begin " Signing $module packages"
329 sign_pkgs $__tmp_dir/$module
333 msg_begin " Installing $module packages"
334 install_pkgs $__tmp_dir/$module
337 msg_begin " Copying $module packages"
338 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
341 msg_begin " Removing temporary $module"
342 rm -rf $__tmp_dir/$module/$module
346 msg_begin " Uninstalling packages $__installed_packages"
351 ###########################################################
353 ###########################################################
354 # For each scratchbox target
355 for target in $__sbox_targets; do
356 msg_begin "Checking distro and arch for target $target"
360 msg " Distribution..: $__distro"
361 msg " Architecture..: $__arch"
362 msg " Build Options.: $__build_pkg_options"
364 if [ "x$__arch" = "xarmel" ]; then
365 warn "Skipping target $target for architecture independent packages"
370 __pkg_dir=`dirname $__pkg_dir`/$__arch
372 if [ ! -d $__pkg_dir ]; then
373 msg_begin " Creating dir for $__distro $__arch packages"
374 $__mkdir -p $__pkg_dir
378 msg_begin " Changing current sbox target to $target"
379 change_sbox_target $target
383 for module in `echo $__virtual_packages|$__sed -e 's/:/ /g'`; do
384 msg " Building $module packages for $__distro $__arch"
386 update_debian_dir $module
388 if [ ! -d $__tmp_dir/$module ]; then
389 mkdir $__tmp_dir/$module
392 if [ -d $__tmp_dir/$module/$module ]; then
393 msg_begin " Removing temporary $module"
394 rm -rf $__tmp_dir/$module/$module
398 msg_begin " Copying $module dir to $__tmp_dir"
399 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
400 #cp -f -u -r $module $__tmp_dir/$module
403 msg_begin " Building $module packages"
404 build_pkg $__tmp_dir/$module
407 if [ -z $__no_signing ]; then
408 msg_begin " Signing $module packages"
409 sign_pkgs $__tmp_dir/$module
413 msg_begin " Installing $module packages"
414 install_pkgs $__tmp_dir/$module
417 msg_begin " Copying $module packages"
418 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
421 msg_begin " Removing temporary $module"
422 rm -rf $__tmp_dir/$module/$module
426 msg_begin " Uninstalling packages $__installed_packages"