Fixes in build-all.sh script
authoretrunko <eblima@gmail.com>
Tue, 6 May 2008 21:17:51 +0000 (21:17 +0000)
committeretrunko <eblima@gmail.com>
Tue, 6 May 2008 21:17:51 +0000 (21:17 +0000)
trunk/build-all.sh

index c596988..a4c2c11 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 source "helper-functions.sh"
 
@@ -23,8 +23,8 @@ __debsign=`which debsign`
 
 # git definitions
 __git_clone="$__git clone -q"
-__git_pull="$__git pull -q -n"
-__git_clean="$__git clean -q -x -d"
+__git_pull="$__git pull -q"
+__git_clean="$__git clean -q -x -d -f"
 __git_reset="$__git reset --hard HEAD"
 __git_repo="git://staff.get-e.org/"
 
@@ -33,20 +33,26 @@ __e17_libs="e17/libs"
 __e17_proto="e17/proto"
 __e17_python_efl="$__e17_proto/python-efl"
 __e17_python_etk="users/cmarcelo"
+__e17_python_efl_utils="users/barbieri"
+#__e17_python_dispatcher="users/ulisses"
 
 # modules to build
 #__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:imlib2:epeg:epsilon:etk:e_dbus"
+__other_modules="himf-ecore:himf-ecore-chinook:lightmediascanner:python-lightmediascanner"
 __python_modules="python-evas:python-ecore:python-edje:python-epsilon:python-e_dbus"
 __python_etk_module="python-etk"
+__python_efl_utils_module="python-efl_utils"
+#__python_dispatcher_module="python-dispatcher"
+__virtual_packages="efl-core python-efl-core"
 
 # dpkg definitions
 __common_build_pkg_options="-rfakeroot -us -uc -D"
 
 # Packages dirs and log file
 __today=`$__date +%Y%m%d`
-__base_pkg_dir="$__this_script_dir/efl_packages_$__today"
-__output_file="$PWD/$__base_pkg_dir/efl_packages_$__today.log"
+__base_pkg_dir="$__this_script_dir/packages_$__today"
+__output_file="$PWD/$__base_pkg_dir/packages_$__today.log"
 
 # Scratchbox definitions
 __sbox_path="/scratchbox"
@@ -167,26 +173,45 @@ function clean_repository() {
     return 0
 }
 
+function configure_pkg() {
+    local dir
+    dir=$1
+
+    cd $dir/`basename $dir`
+
+    if [ -x ./autogen.sh ]; then
+        NOCONFIGURE=1 ./autogen.sh >> $dir/sbox_build_pkgs.log 2>&1 || return 1
+    fi
+
+    cd - > /dev/null 2>&1
+
+    return 0
+}
+
 function build_pkg() {
     local dir
     dir=$1
 
+    configure_pkg $dir || return 1
+
+    local DEB_BUILD_OPTIONS=n8x0
+    if [ "x$__distro" = "xgregale" ]; then
+        DEB_BUILD_OPTIONS=n770
+    fi
+
     cat << EOF > $dir/sbox_build_pkgs
-#!/bin/bash
+#!/bin/sh
 
 export DEBFULLNAME="$DEBFULLNAME"
 export DEBEMAIL="$DEBEMAIL"
+export DEB_BUILD_OPTIONS="$DEB_BUILD_OPTIONS"
 
 cd $dir/`basename $dir`
 
-if [ -x ./autogen.sh ]; then
-    NOCONFIGURE=1 ./autogen.sh >> $dir/sbox_build_pkgs.log 2>&1 || exit 1
-fi
-
-VERSION=\`$__sbox_dpkg_parsechangelog | grep Version: | cut -d" " -f2 | cut -d- -f1\`
-REVISION=\`$__sbox_dpkg_parsechangelog | grep Version: | cut -d- -f2\`
+VERSION=\`$__sbox_dpkg_parsechangelog | grep Version: | cut -d" " -f2 | cut -d- -f1 >> $dir/sbox_build_pkgs.log 2>&1 || exit 1\`
+REVISION=\`$__sbox_dpkg_parsechangelog | grep Version: | cut -d- -f2 >> $dir/sbox_build_pkgs.log 2>&1 || exit 1\`
 
-$__sbox_dch -v \$VERSION+cvs$__today-\$REVISION -D $__distro "Snapshot CVS release of $__today" >> $dir/sbox_build_pkgs.log 2>&1 || exit 1
+# $__sbox_dch -v \$VERSION+cvs$__today-\$REVISION -D $__distro "Snapshot CVS release of $__today" >> $dir/sbox_build_pkgs.log 2>&1 || exit 1
 $__sbox_dpkg_buildpackage $__build_pkg_options >> $dir/sbox_build_pkgs.log 2>&1
 exit \$?
 EOF
@@ -201,7 +226,7 @@ function install_pkgs() {
     dir=$1
 
     cat << EOF > $dir/sbox_install_pkgs
-#!/bin/bash
+#!/bin/sh
 
 cd $dir
 $__sbox_dpkg --install *.deb >> $dir/sbox_install_pkgs.log 2>&1
@@ -226,7 +251,7 @@ EOF
 function uninstall_pkgs() {
 
     cat << EOF > /tmp/sbox_uninstall_pkgs
-#!/bin/bash
+#!/bin/sh
 
 cd /tmp
 $__sbox_dpkg --purge $__installed_packages >> /tmp/sbox_uninstall_pkgs.log 2>&1
@@ -235,7 +260,7 @@ EOF
 
     __installed_packages=""
     $__chmod 755 /tmp/sbox_uninstall_pkgs
-    $__sbox /tmp/sbox_uninstall_pkgs
+    #$__sbox /tmp/sbox_uninstall_pkgs
     return $?
 }
 
@@ -410,9 +435,18 @@ get_sources $__python_modules $__git_repo$__e17_python_efl
 # Download python-etk module
 get_sources $__python_etk_module $__git_repo$__e17_python_etk
 
+# Download python-efl-utils module
+get_sources $__python_efl_utils_module $__git_repo$__e17_python_efl_utils
+
+# Download python-dispatcher module
+#get_sources $__python_dispatcher_module $__git_repo$__e17_python_dispatcher
+
 # Setup scratchbox variables
 setup_sbox
 
+###########################################################
+# ARCHITECTURE DEPENDENT MODULES
+###########################################################
 # For each scratchbox target
 for target in `$__sbox_sb_conf list --targets`; do
     msg_begin "Checking distro and arch for target $target"
@@ -434,8 +468,7 @@ for target in `$__sbox_sb_conf list --targets`; do
     msg_end $?
 
     # For each module
-    for module in `echo $__lib_modules $__python_modules $__python_etk_module|$__sed -e 's/:/ /g'`; do
-
+    for module in `echo $__lib_modules:$__python_modules:$__python_etk_module|$__sed -e 's/:/ /g'`; do
         msg "  Building $module packages for $__distro $__arch"
 
         if [ -d ./$module/$module/debian ]; then
@@ -445,12 +478,20 @@ for target in `$__sbox_sb_conf list --targets`; do
         fi
 
         msg_begin "  Copying specific debian directory"
-        if [ -d ./$module/debian_$__distro ]; then
-            cp -r ./$module/debian_$__distro ./$module/$module/debian
-        elif [ -d ./$module/debian ]; then
+        if [ -d ./$module/debian ]; then
             cp -r ./$module/debian ./$module/$module/
+
+            if [ -d ./$module/debian_$__distro ]; then
+                cp -r ./$module/debian_$__distro/* ./$module/$module/debian/
+            fi
         else
-            error "  Missing debian directory for $module"
+            if [ -d ./$module/debian_$__distro ]; then
+                cp -r ./$module/debian_$__distro ./$module/$module/debian
+            else
+                echo ""
+                warn "Missing debian directory for $module. Ignoring"
+                continue
+            fi
         fi
         msg_end $?
 
@@ -497,5 +538,174 @@ for target in `$__sbox_sb_conf list --targets`; do
     msg_end $?
 done
 
+exit 0
+###########################################################
+# ARCHITECTURE INDEPENDENT MODULES
+###########################################################
+# For each scratchbox target
+for target in `$__sbox_sb_conf list --targets`; do
+    msg_begin "Checking distro and arch for target $target"
+    setup_distro $target
+    msg_end $?
+
+    msg "  Distribution..: $__distro"
+    msg "  Architecture..: $__arch"
+    msg "  Build Options.: $__build_pkg_options"
+
+    if [ "x$__arch" = "xarm" ]; then
+        warn "Skipping target $target for architecture independent packages"
+        continue
+    fi
+
+    __arch="all"
+    __pkg_dir=`dirname $__pkg_dir`/$__arch
+
+    if [ ! -d $__pkg_dir ]; then
+        msg_begin "  Creating dir for $__distro $__arch packages"
+        $__mkdir -p $__pkg_dir
+        msg_end $?
+    fi
+
+    msg_begin "  Changing current sbox target to $target"
+    change_sbox_target $target
+    msg_end $?
+
+    # For each module
+    for module in $__python_efl_utils_module; do
+        msg "  Building $module packages for $__distro $__arch"
+
+        if [ ! -d /tmp/$module ]; then
+            mkdir /tmp/$module
+        fi
+
+        if [ -d /tmp/$module/$module ]; then
+            msg_begin "  Removing temporary $module"
+            rm -rf /tmp/$module/$module
+            msg_end $?
+        fi
+
+        msg_begin "  Copying specific debian directory"
+        if [ -d ./$module/debian ]; then
+            cp -r ./$module/debian ./$module/$module/
+
+            if [ -d ./$module/debian_$__distro ]; then
+                cp -r ./$module/debian_$__distro/* ./$module/$module/debian/
+            fi
+        else
+            echo ""
+            warn "  Missing debian directory for $module. Ignoring"
+            continue
+        fi
+        msg_end $?
+
+        msg_begin "  Copying $module dir to /tmp"
+        cp -u -r $module /tmp
+        msg_end $?
+
+        msg_begin "  Cleaning $module repository"
+        clean_repository $module/$module
+        msg_end $?
+
+        msg_begin "  Building $module packages"
+        build_pkg /tmp/$module
+        msg_end $?
+
+        msg_begin "  Signing $module packages"
+        sign_pkgs /tmp/$module
+        msg_end $?
+
+        msg_begin "  Installing $module packages"
+        install_pkgs /tmp/$module
+        msg_end $?
+
+        msg_begin "  Copying $module packages"
+        mv /tmp/$module/*.dsc /tmp/$module/*.tar.gz /tmp/$module/*.deb /tmp/$module/*.changes $__pkg_dir
+        msg_end $?
+
+        msg_begin "  Removing temporary $module"
+        rm -rf /tmp/$module/$module
+        msg_end $?
+    done
+
+    msg_begin "  Uninstalling packages $__installed_packages"
+    uninstall_pkgs
+    msg_end $?
+done
+
+###########################################################
+# VIRTUAL PACKAGES
+###########################################################
+# For each scratchbox target
+for target in `$__sbox_sb_conf list --targets`; do
+    msg_begin "Checking distro and arch for target $target"
+    setup_distro $target
+    msg_end $?
+
+    msg "  Distribution..: $__distro"
+    msg "  Architecture..: $__arch"
+    msg "  Build Options.: $__build_pkg_options"
+
+    if [ "x$__arch" = "xarm" ]; then
+        warn "Skipping target $target for architecture independent packages"
+        continue
+    fi
+
+    __arch="all"
+    __pkg_dir=`dirname $__pkg_dir`/$__arch
+
+    if [ ! -d $__pkg_dir ]; then
+        msg_begin "  Creating dir for $__distro $__arch packages"
+        $__mkdir -p $__pkg_dir
+        msg_end $?
+    fi
+
+    msg_begin "  Changing current sbox target to $target"
+    change_sbox_target $target
+    msg_end $?
+
+    # For each module
+    for module in $__virtual_packages; do
+        msg "  Building $module packages for $__distro $__arch"
+
+        if [ ! -d /tmp/$module ]; then
+            mkdir /tmp/$module
+        fi
+
+        if [ -d /tmp/$module/$module ]; then
+            msg_begin "  Removing temporary $module"
+            rm -rf /tmp/$module/$module
+            msg_end $?
+        fi
+
+        msg_begin "  Copying $module dir to /tmp"
+        cp -u -r $module /tmp/$module
+        msg_end $?
+
+        msg_begin "  Building $module packages"
+        build_pkg /tmp/$module
+        msg_end $?
+
+        msg_begin "  Signing $module packages"
+        sign_pkgs /tmp/$module
+        msg_end $?
+
+        msg_begin "  Installing $module packages"
+        install_pkgs /tmp/$module
+        msg_end $?
+
+        msg_begin "  Copying $module packages"
+        mv /tmp/$module/*.dsc /tmp/$module/*.tar.gz /tmp/$module/*.deb /tmp/$module/*.changes $__pkg_dir
+        msg_end $?
+
+        msg_begin "  Removing temporary $module"
+        rm -rf /tmp/$module/$module
+        msg_end $?
+    done
+
+    msg_begin "  Uninstalling packages $__installed_packages"
+    uninstall_pkgs
+    msg_end $?
+done
+
 # END
 finish_log