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
161 if [ $__not_all_pkgs -eq 1 ]; then
162 __lib_modules=$__lib_modules_temp
163 __python_modules=$__python_modules_temp
164 __python_efl_utils_module=$__python_efl_utils_module_temp
165 __python_dispatcher_module=$__python_dispatcher_module_temp
166 __virtual_packages=$__virtual_packages_temp
178 # Setup scratchbox variables
181 # Setup scratchbox targets if option -t was used
182 if [ ! -z $__sbox_targets_temp ]; then
183 __sbox_targets=`echo $__sbox_targets_temp|$__sed -e 's/:/ /g'`
186 ###########################################################
187 # ARCHITECTURE DEPENDENT MODULES
188 ###########################################################
189 # For each scratchbox target
190 for target in $__sbox_targets; do
191 msg_begin "Checking distro and arch for target $target"
195 msg " Distribution..: $__distro"
196 msg " Architecture..: $__arch"
197 msg " Build Options.: $__build_pkg_options"
199 if [ ! -d $__pkg_dir ]; then
200 msg_begin " Creating dir for $__distro $__arch packages"
201 $__mkdir -p $__pkg_dir
205 msg_begin " Changing current sbox target to $target"
206 change_sbox_target $target
210 for module in `echo $__lib_modules:$__python_modules|$__sed -e 's/:/ /g'`; do
211 msg " Building $module packages for $__distro $__arch"
213 update_debian_dir $module
215 if [ -d $__tmp_dir/$module/$module ]; then
216 msg_begin " Removing temporary $module"
217 rm -rf $__tmp_dir/$module/$module
221 msg_begin " Copying $module dir to $__tmp_dir"
222 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
225 # msg_begin " Cleaning $module repository"
226 # git_clean_repository $module/$module
229 msg_begin " Building $module packages"
230 build_pkg $__tmp_dir/$module
233 if [ -z $__no_signing ]; then
234 msg_begin " Signing $module packages"
235 sign_pkgs $__tmp_dir/$module
239 msg_begin " Installing $module packages"
240 install_pkgs $__tmp_dir/$module
243 msg_begin " Copying $module packages"
244 if [ "x$__arch" != "xarmel" ]; then
245 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__pkg_dir
247 mv $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
250 msg_begin " Removing temporary $module"
251 rm -rf $__tmp_dir/$module/$module
255 msg_begin " Uninstalling packages $__installed_packages"
260 ###########################################################
261 # ARCHITECTURE INDEPENDENT MODULES
262 ###########################################################
263 # For each scratchbox target
264 for target in $__sbox_targets; do
265 msg_begin "Checking distro and arch for target $target"
269 msg " Distribution..: $__distro"
270 msg " Architecture..: $__arch"
271 msg " Build Options.: $__build_pkg_options"
273 if [ "x$__arch" = "xarmel" ]; then
274 warn "Skipping target $target for architecture independent packages"
279 __pkg_dir=`dirname $__pkg_dir`/$__arch
281 if [ ! -d $__pkg_dir ]; then
282 msg_begin " Creating dir for $__distro $__arch packages"
283 $__mkdir -p $__pkg_dir
287 msg_begin " Changing current sbox target to $target"
288 change_sbox_target $target
292 for module in `echo $__python_efl_utils_module|$__sed -e 's/:/ /g'`; do
294 msg " Building $module packages for $__distro $__arch"
295 update_debian_dir $module
298 if [ ! -d $__tmp_dir/$module ]; then
299 mkdir $__tmp_dir/$module
302 if [ -d $__tmp_dir/$module/$module ]; then
303 msg_begin " Removing temporary $module"
304 rm -rf $__tmp_dir/$module/$module
309 msg_begin " Copying $module dir to $__tmp_dir"
310 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
311 #cp -f -u -r $module $__tmp_dir
314 # msg_begin " Cleaning $module repository"
315 # git_clean_repository $module/$module
318 msg_begin " Building $module packages"
319 build_pkg $__tmp_dir/$module
322 if [ -z $__no_signing ]; then
323 msg_begin " Signing $module packages"
324 sign_pkgs $__tmp_dir/$module
328 msg_begin " Installing $module packages"
329 install_pkgs $__tmp_dir/$module
332 msg_begin " Copying $module packages"
333 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
336 msg_begin " Removing temporary $module"
337 rm -rf $__tmp_dir/$module/$module
341 msg_begin " Uninstalling packages $__installed_packages"
346 ###########################################################
348 ###########################################################
349 # For each scratchbox target
350 for target in $__sbox_targets; do
351 msg_begin "Checking distro and arch for target $target"
355 msg " Distribution..: $__distro"
356 msg " Architecture..: $__arch"
357 msg " Build Options.: $__build_pkg_options"
359 if [ "x$__arch" = "xarmel" ]; then
360 warn "Skipping target $target for architecture independent packages"
365 __pkg_dir=`dirname $__pkg_dir`/$__arch
367 if [ ! -d $__pkg_dir ]; then
368 msg_begin " Creating dir for $__distro $__arch packages"
369 $__mkdir -p $__pkg_dir
373 msg_begin " Changing current sbox target to $target"
374 change_sbox_target $target
378 for module in `echo $__virtual_packages|$__sed -e 's/:/ /g'`; do
379 msg " Building $module packages for $__distro $__arch"
381 update_debian_dir $module
383 if [ ! -d $__tmp_dir/$module ]; then
384 mkdir $__tmp_dir/$module
387 if [ -d $__tmp_dir/$module/$module ]; then
388 msg_begin " Removing temporary $module"
389 rm -rf $__tmp_dir/$module/$module
393 msg_begin " Copying $module dir to $__tmp_dir"
394 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
395 #cp -f -u -r $module $__tmp_dir/$module
398 msg_begin " Building $module packages"
399 build_pkg $__tmp_dir/$module
402 if [ -z $__no_signing ]; then
403 msg_begin " Signing $module packages"
404 sign_pkgs $__tmp_dir/$module
408 msg_begin " Installing $module packages"
409 install_pkgs $__tmp_dir/$module
412 msg_begin " Copying $module packages"
413 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
416 msg_begin " Removing temporary $module"
417 rm -rf $__tmp_dir/$module/$module
421 msg_begin " Uninstalling packages $__installed_packages"