Making things a bit more readable.
[maemo-efl] / trunk / build-all.sh
1 #!/bin/bash
2
3 source "helper-functions.sh"
4 __this_script=`basename $0`
5 __this_script_dir=`dirname $0`
6
7 # git definitions
8 __git=`which git`
9 __git_clone="$__git clone"
10 __git_pull="$__git pull"
11 __git_clean="$__git clean"
12 __git_repo="git://staff.get-e.org/"
13
14 # e17 repositories paths
15 __e17_libs="e17/libs"
16 __e17_proto="e17/proto"
17 __e17_python_efl="$__e17_proto/python-efl"
18 __users="users"
19
20 # modules
21 __lib_modules="edb eet evas ecore embryo edje efreet epeg epsilon emotion etk ewl e_dbus exml enhance"
22 __python_modules="python-evas python-ecore python-edje python-epsilon python-e_dbus"
23 __user_modules="python-etk"
24
25 # dpkg definitions
26 __uname=`which uname`
27 __arch=`$__uname -m`
28 __common_build_pkg_options="-rfakeroot -us -uc -D"
29 __build_pkg_options="$__common_build_pkg_options -sa"
30 if [ "x$__arch" = "xarm" ] ; then
31     __build_pkg_options="$__common_build_pkg_options -B"
32 fi
33
34 # other definitions
35 __date=`which date`
36 __today=`$__date +%Y%m%d`
37
38 __head=`which head`
39 __distro=`$__head -1 /etc/apt/sources.list|cut -d" " -f3`
40
41 __base_pkg_dir="$__this_script_dir/packages_$__today"
42 __pkg_dir="$__base_pkg_dir/$__distro/$__arch"
43
44 __output_file="$__base_pkg_dir/packages_$__today.log"
45
46
47 function clone() {
48     local repo
49     repo=$1
50     `$__git_clone $repo 2>&1 >> $__output_file`
51     return $?
52 }
53
54 function pull() {
55     `$__git_pull 2>&1 >> $__output_file`
56     return $?
57 }
58
59 function clean() {
60     echo "clean"
61     return $?
62 }
63
64 function build_pkg() {
65     echo "build_pkg"
66     return $?
67 }
68
69 function install_pkg() {
70     echo "install_pkg"
71     return $?
72 }
73
74 function uninstall_pkg() {
75     echo "uninstall_pkg"
76     return $?
77 }
78
79 function log_to_file() {
80     local now
81     local msg
82     msg=$1
83
84     if [ ! -r $__output_file ]; then
85         error "Log file  $__output_file does not exist"
86     fi
87
88     now=`$__date +%H:%M:%S`
89     echo "$now: $msg" >> $__output_file
90 }
91
92 function start_log() {
93     local now
94     now=`$__date -R`
95
96     if [ ! -r $__output_file ]; then
97         touch $__output_file
98     fi
99
100     if [ $? != 0 ] ; then
101         error "Could not create log file $__output_file"
102     fi
103
104     echo "*********************************************************" >> $__output_file
105     echo "* Started $__this_script: $now *" >> $__output_file
106     echo "*********************************************************" >> $__output_file
107     echo "" >> $__output_file
108     echo "Configuration:" >> $__output_file
109     echo "   Distro.: $__distro" >> $__output_file
110     echo "   Arch...: $__arch" >> $__output_file
111     echo "" >> $__output_file
112 }
113
114 function finish_log() {
115     local now
116     now=`$__date -R`
117
118     if [ ! -r $__output_file ]; then
119         error "Log file  $__output_file does not exist"
120     fi
121
122     echo "" >> $__output_file
123     echo "* Finished $__this_script: $now" >> $__output_file
124     echo "" >> $__output_file
125 }
126
127 # Initial checks
128 # Check if we're running inside scratchbox
129 msg_begin "Checking for scratchbox environment"
130 test -r /targets/links/scratchbox.config
131 msg_end $?
132
133 # Begin
134 mkdir -p $__pkg_dir
135 start_log
136 log_to_file "Created $__pkg_dir"
137
138 # Check for fakeroot
139
140 # Download official modules
141
142 # Build package
143
144 # Install package
145
146 # Download user modules (python-etk)
147
148 # Build package
149
150 # Install package
151
152 # Uninstall all packages
153
154 # END
155 finish_log