Fetching source files from staff.get-e.org git repository
authoretrunko <eblima@gmail.com>
Tue, 4 Dec 2007 19:31:25 +0000 (19:31 +0000)
committeretrunko <eblima@gmail.com>
Tue, 4 Dec 2007 19:31:25 +0000 (19:31 +0000)
trunk/build-all.sh

index 69f2b22..f62a7f9 100755 (executable)
@@ -15,23 +15,26 @@ __git_repo="git://staff.get-e.org/"
 __e17_libs="e17/libs"
 __e17_proto="e17/proto"
 __e17_python_efl="$__e17_proto/python-efl"
-__users="users"
+__e17_python_etk="users/cmarcelo"
 
 # modules
-__lib_modules="edb eet evas ecore embryo edje efreet epeg epsilon emotion etk ewl e_dbus exml enhance"
-__python_modules="python-evas python-ecore python-edje python-epsilon python-e_dbus"
-__user_modules="python-etk"
+#__lib_modules="edb eet evas ecore embryo edje efreet epeg epsilon emotion etk ewl e_dbus exml enhance"
+__lib_modules="eet:evas:ecore:embryo:edje:epsilon:etk:e_dbus"
+__python_modules="python-evas:python-ecore:python-edje:python-epsilon:python-e_dbus"
+__python_etk_module="python-etk"
 
 # dpkg definitions
 __uname=`which uname`
 __arch=`$__uname -m`
-__common_build_pkg_options="-rfakeroot -us -uc -D"
+__common_build_pkg_options="-rfakeroot -us -uc -D -tc"
 __build_pkg_options="$__common_build_pkg_options -sa"
 if [ "x$__arch" = "xarm" ] ; then
     __build_pkg_options="$__common_build_pkg_options -B"
 fi
 
 # other definitions
+__sed=`which sed`
+__mkdir=`which mkdir`
 __date=`which date`
 __today=`$__date +%Y%m%d`
 
@@ -41,48 +44,16 @@ __distro=`$__head -1 /etc/apt/sources.list|cut -d" " -f3`
 __base_pkg_dir="$__this_script_dir/packages_$__today"
 __pkg_dir="$__base_pkg_dir/$__distro/$__arch"
 
-__output_file="$__base_pkg_dir/packages_$__today.log"
-
-
-function clone() {
-    local repo
-    repo=$1
-    `$__git_clone $repo 2>&1 >> $__output_file`
-    return $?
-}
-
-function pull() {
-    `$__git_pull 2>&1 >> $__output_file`
-    return $?
-}
-
-function clean() {
-    echo "clean"
-    return $?
-}
-
-function build_pkg() {
-    echo "build_pkg"
-    return $?
-}
-
-function install_pkg() {
-    echo "install_pkg"
-    return $?
-}
-
-function uninstall_pkg() {
-    echo "uninstall_pkg"
-    return $?
-}
+__output_file="$PWD/$__base_pkg_dir/packages_$__today.log"
 
+# Function definitions
 function log_to_file() {
     local now
     local msg
     msg=$1
 
     if [ ! -r $__output_file ]; then
-        error "Log file  $__output_file does not exist"
+        error "log_to_file(): Log file does not exist"
     fi
 
     now=`$__date +%H:%M:%S`
@@ -94,21 +65,27 @@ function start_log() {
     now=`$__date -R`
 
     if [ ! -r $__output_file ]; then
+        msg_begin "Creating log file"
         touch $__output_file
+        msg_end $?
+    else
+        echo "" >> $__output_file
     fi
 
     if [ $? != 0 ] ; then
-        error "Could not create log file $__output_file"
+        error "start_log(): Could not create $__output_file file"
     fi
 
-    echo "*********************************************************" >> $__output_file
-    echo "* Started $__this_script: $now *" >> $__output_file
-    echo "*********************************************************" >> $__output_file
-    echo "" >> $__output_file
-    echo "Configuration:" >> $__output_file
-    echo "   Distro.: $__distro" >> $__output_file
-    echo "   Arch...: $__arch" >> $__output_file
-    echo "" >> $__output_file
+cat << EOF >> $__output_file
+*********************************************************
+* Started $__this_script: $now *
+*********************************************************
+
+Configuration:
+   Distro.: $__distro
+   Arch...: $__arch
+
+EOF
 }
 
 function finish_log() {
@@ -116,28 +93,104 @@ function finish_log() {
     now=`$__date -R`
 
     if [ ! -r $__output_file ]; then
-        error "Log file  $__output_file does not exist"
+        error "finish_log(): Log file does not exist"
     fi
 
-    echo "" >> $__output_file
-    echo "* Finished $__this_script: $now" >> $__output_file
-    echo "" >> $__output_file
+cat << EOF >> $__output_file
+
+* Finished $__this_script: $now
+EOF
+}
+
+function clone() {
+    local repo
+    repo=$1
+    `$__git_clone $repo.git 2>&1>> $__output_file`
+    return $?
+}
+
+function pull() {
+    `$__git_pull 2>&1>> $__output_file`
+    return $?
+}
+
+function clean() {
+    return $?
+}
+
+function build_pkg() {
+    echo "build_pkg"
+    return $?
+}
+
+function install_pkg() {
+    echo "install_pkg"
+    return $?
+}
+
+function uninstall_pkg() {
+    echo "uninstall_pkg"
+    return $?
+}
+
+function get_sources() {
+    local modules
+    local repo
+    modules=`echo $1|$__sed -e 's/:/ /g'`
+    repo=$2
+
+    for module in $modules; do
+        if [ -d $module/$module/.git ]; then
+            log_to_file "Updating existing repository at $PWD/$module/$module"
+            cd $module/$module
+            msg_begin "  Updating $module repository"
+            pull
+            msg_end $?
+            cd - 2>&1 >> /dev/null
+        elif [ -d $module/$module ]; then
+            log_to_file "Removing invalid repository at $PWD/$module/$module"
+            rm -rf $module/$module
+        fi
+
+        if [ ! -d $module/$module ]; then
+            cd $module
+            msg_begin "  Cloning $repo/$module.git"
+            clone $repo/$module
+            msg_end $?
+            cd - 2>&1 >> /dev/null
+        elif [ ! -d $module ]; then
+            error "Directory $module does not exist."
+        fi
+    done
 }
 
 # Initial checks
+
+# Distro variable must not be empty
+msg_begin "Checking maemo distro"
+test "x$__distro" != "x"
+msg_end $?
+
 # Check if we're running inside scratchbox
 msg_begin "Checking for scratchbox environment"
 test -r /targets/links/scratchbox.config
 msg_end $?
 
 # Begin
-mkdir -p $__pkg_dir
+$__mkdir -p $__pkg_dir
 start_log
 log_to_file "Created $__pkg_dir"
 
-# Check for fakeroot
+# Download modules under e17/libs
+msg "Downloading e17 modules"
+get_sources $__lib_modules $__git_repo$__e17_libs
+
+# Download python modules under proto/python/efl
+msg "Downloading python modules"
+get_sources $__python_modules $__git_repo$__e17_python_efl
 
-# Download official modules
+# Download python-etk module
+get_sources $__python_etk_module $__git_repo$__e17_python_etk
 
 # Build package