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
160 if [ $__not_all_pkgs -eq 1 ]; then
161 __lib_modules=$__lib_modules_temp
162 __python_modules=$__python_modules_temp
163 __python_efl_utils_module=$__python_efl_utils_module_temp
164 __python_dispatcher_module=$__python_dispatcher_module_temp
165 __virtual_packages=$__virtual_packages_temp
179 # Setup scratchbox variables
182 # Setup scratchbox targets if option -t was used
183 if [ ! -z $__sbox_targets_temp ]; then
184 __sbox_targets=`echo $__sbox_targets_temp|$__sed -e 's/:/ /g'`
187 ###########################################################
188 # ARCHITECTURE DEPENDENT MODULES
189 ###########################################################
190 # For each scratchbox target
191 for target in $__sbox_targets; do
192 msg_begin "Checking distro and arch for target $target"
196 msg " Distribution..: $__distro"
197 msg " Architecture..: $__arch"
198 msg " Build Options.: $__build_pkg_options"
200 if [ ! -d $__pkg_dir ]; then
201 msg_begin " Creating dir for $__distro $__arch packages"
202 $__mkdir -p $__pkg_dir
206 msg_begin " Changing current sbox target to $target"
207 change_sbox_target $target
211 for module in `echo $__lib_modules:$__python_modules|$__sed -e 's/:/ /g'`; do
212 msg " Building $module packages for $__distro $__arch"
214 update_debian_dir $module
216 if [ -d $__tmp_dir/$module/$module ]; then
217 msg_begin " Removing temporary $module"
218 rm -rf $__tmp_dir/$module/$module
222 msg_begin " Copying $module dir to $__tmp_dir"
223 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
226 # msg_begin " Cleaning $module repository"
227 # git_clean_repository $module/$module
230 msg_begin " Building $module packages"
231 build_pkg $__tmp_dir/$module
234 if [ -z $__no_signing ]; then
235 msg_begin " Signing $module packages"
236 sign_pkgs $__tmp_dir/$module
240 msg_begin " Installing $module packages"
241 install_pkgs $__tmp_dir/$module
244 msg_begin " Copying $module packages"
245 if [ "x$__arch" != "xarmel" ]; then
246 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__pkg_dir
248 mv $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
251 msg_begin " Removing temporary $module"
252 rm -rf $__tmp_dir/$module/$module
256 msg_begin " Uninstalling packages $__installed_packages"
261 ###########################################################
262 # ARCHITECTURE INDEPENDENT MODULES
263 ###########################################################
264 # For each scratchbox target
265 for target in $__sbox_targets; do
266 msg_begin "Checking distro and arch for target $target"
270 msg " Distribution..: $__distro"
271 msg " Architecture..: $__arch"
272 msg " Build Options.: $__build_pkg_options"
274 if [ "x$__arch" = "xarmel" ]; then
275 warn "Skipping target $target for architecture independent packages"
280 __pkg_dir=`dirname $__pkg_dir`/$__arch
282 if [ ! -d $__pkg_dir ]; then
283 msg_begin " Creating dir for $__distro $__arch packages"
284 $__mkdir -p $__pkg_dir
288 msg_begin " Changing current sbox target to $target"
289 change_sbox_target $target
293 for module in `echo $__python_efl_utils_module|$__sed -e 's/:/ /g'`; do
295 msg " Building $module packages for $__distro $__arch"
296 update_debian_dir $module
299 if [ ! -d $__tmp_dir/$module ]; then
300 mkdir $__tmp_dir/$module
303 if [ -d $__tmp_dir/$module/$module ]; then
304 msg_begin " Removing temporary $module"
305 rm -rf $__tmp_dir/$module/$module
310 msg_begin " Copying $module dir to $__tmp_dir"
311 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
312 #cp -f -u -r $module $__tmp_dir
315 # msg_begin " Cleaning $module repository"
316 # git_clean_repository $module/$module
319 msg_begin " Building $module packages"
320 build_pkg $__tmp_dir/$module
323 if [ -z $__no_signing ]; then
324 msg_begin " Signing $module packages"
325 sign_pkgs $__tmp_dir/$module
329 msg_begin " Installing $module packages"
330 install_pkgs $__tmp_dir/$module
333 msg_begin " Copying $module packages"
334 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
337 msg_begin " Removing temporary $module"
338 rm -rf $__tmp_dir/$module/$module
342 msg_begin " Uninstalling packages $__installed_packages"
347 ###########################################################
349 ###########################################################
350 # For each scratchbox target
351 for target in $__sbox_targets; do
352 msg_begin "Checking distro and arch for target $target"
356 msg " Distribution..: $__distro"
357 msg " Architecture..: $__arch"
358 msg " Build Options.: $__build_pkg_options"
360 if [ "x$__arch" = "xarmel" ]; then
361 warn "Skipping target $target for architecture independent packages"
366 __pkg_dir=`dirname $__pkg_dir`/$__arch
368 if [ ! -d $__pkg_dir ]; then
369 msg_begin " Creating dir for $__distro $__arch packages"
370 $__mkdir -p $__pkg_dir
374 msg_begin " Changing current sbox target to $target"
375 change_sbox_target $target
379 for module in `echo $__virtual_packages|$__sed -e 's/:/ /g'`; do
380 msg " Building $module packages for $__distro $__arch"
382 update_debian_dir $module
384 if [ ! -d $__tmp_dir/$module ]; then
385 mkdir $__tmp_dir/$module
388 if [ -d $__tmp_dir/$module/$module ]; then
389 msg_begin " Removing temporary $module"
390 rm -rf $__tmp_dir/$module/$module
394 msg_begin " Copying $module dir to $__tmp_dir"
395 $__tar c --exclude=.svn --exclude=.git $module | $__tar x --directory $__tmp_dir
396 #cp -f -u -r $module $__tmp_dir/$module
399 msg_begin " Building $module packages"
400 build_pkg $__tmp_dir/$module
403 if [ -z $__no_signing ]; then
404 msg_begin " Signing $module packages"
405 sign_pkgs $__tmp_dir/$module
409 msg_begin " Installing $module packages"
410 install_pkgs $__tmp_dir/$module
413 msg_begin " Copying $module packages"
414 mv $__tmp_dir/$module/*.dsc $__tmp_dir/$module/*.tar.gz $__tmp_dir/$module/*.deb $__tmp_dir/$module/*.changes $__pkg_dir
417 msg_begin " Removing temporary $module"
418 rm -rf $__tmp_dir/$module/$module
422 msg_begin " Uninstalling packages $__installed_packages"