###########################################################
__this_script=`basename $0`
__this_script_dir=`dirname $0`
+__orig_path=$PATH
# Binaries
__date=`which date`
__git_clone="$__git clone -q"
__git_pull="$__git pull -q -n"
__git_clean="$__git clean -q -x -d"
-
+__git_reset="$__git reset --hard HEAD"
__git_repo="git://staff.get-e.org/"
-# e17 repositories paths
+# e17 git repositories paths
__e17_libs="e17/libs"
__e17_proto="e17/proto"
__e17_python_efl="$__e17_proto/python-efl"
__e17_python_etk="users/cmarcelo"
-# modules
+# 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:epsilon:etk:e_dbus"
__python_modules="python-evas:python-ecore:python-edje:python-epsilon:python-e_dbus"
__python_etk_module="python-etk"
# dpkg definitions
-__common_build_pkg_options="-rfakeroot -us -uc -D -tc"
+__common_build_pkg_options="-I.svn -I.git -I.gitignore -I.cvsignore -rfakeroot -us -uc -D -tc"
# Packages dirs and log file
__today=`$__date +%Y%m%d`
__output_file="$PWD/$__base_pkg_dir/packages_$__today.log"
# Scratchbox definitions
-__scratchbox=/scratchbox
+__sbox_path="/scratchbox"
# Other
__update_repositories=1
Options:
-c Don't update source repositories.
-h Show this usage guide.
- -s PATH Specify alternate scratchbox path (default: $__scratchbox).
+ -s PATH Specify alternate scratchbox path (default: $__sbox_path).
EOF
}
* Started $__this_script: $now *
*********************************************************
-Configuration:
- Distro.: $__distro
- Arch...: $__arch
-
EOF
}
function clone() {
local repo
repo=$1
- `$__git_clone $repo.git 2>&1 >> $__output_file`
+ `$__git_clone $repo.git >> $__output_file 2>&1 `
return $?
}
function pull() {
- `$__git_pull 2>&1 >> $__output_file`
+ `$__git_pull >> $__output_file 2>&1`
return $?
}
function clean() {
- `$__git_clean 2>&1>> $__output_file`
+ `$__git_reset >> $__output_file 2>&1`
+ `$__git_clean >> $__output_file 2>&1`
return $?
}
msg_begin " Updating $module repository"
pull
msg_end $?
- cd - 2>&1 >> /dev/null
+ cd - > /dev/null 2>&1
else
log_to_file "Skipping update of $module repository"
fi
msg_begin " Cloning $repo/$module.git"
clone $repo/$module
msg_end $?
- cd - 2>&1 >> /dev/null
+ cd - > /dev/null 2>&1
elif [ ! -d $module ]; then
error "Directory $module does not exist."
fi
done
}
-# XXX: FIXME Figure out a better way to get the distro string
-function check_distro() {
+function setup_distro() {
local target
local sources_list_file
local target_conf_file
local ret
target=$1
- sources_list_file=$__scratchbox/users/$USER/targets/$target/etc/apt/sources.list
- target_conf_file=$__scratchbox/users/$USER/targets/$target.config
+ sources_list_file=$__sbox_path/users/$USER/targets/$target/etc/apt/sources.list
+ target_conf_file=$__sbox_path/users/$USER/targets/$target.config
ret=1
- log_to_file "check_distro(): Target $target"
- log_to_file "check_distro(): sources.list file : $sources_list_file"
- log_to_file "check_distro(): config file: $target_conf_file"
+ log_to_file "setup_distro(): Target $target"
+ log_to_file "setup_distro(): sources.list file : $sources_list_file"
+ log_to_file "setup_distro(): config file: $target_conf_file"
if [ "x$target" != "x" ] && [ -r $sources_list_file ] && [ -r $target_conf_file ]; then
+ # XXX: FIXME Figure out a better way to get the distro string
__distro=`$__head -1 $sources_list_file|cut -d" " -f3`
__arch=`grep SBOX_CPU= $target_conf_file|cut -d= -f2`
__pkg_dir="$__base_pkg_dir/$__distro/$__arch"
fi
if [ $ret -eq 0 ]; then
- log_to_file "check_distro(): Configuration:"
- log_to_file "check_distro(): distro...........: $__distro"
- log_to_file "check_distro(): arch.............: $__arch"
- log_to_file "check_distro(): build options....: $__build_pkg_options"
- log_to_file "check_distro(): pkg_dir..........: $__pkg_dir"
+ log_to_file "setup_distro(): Configuration:"
+ log_to_file "setup_distro(): distro...........: $__distro"
+ log_to_file "setup_distro(): arch.............: $__arch"
+ log_to_file "setup_distro(): build options....: $__build_pkg_options"
+ log_to_file "setup_distro(): pkg_dir..........: $__pkg_dir"
fi
- log_to_file "check_distro(): Returning $ret"
+ log_to_file "setup_distro(): Returning $ret"
return $ret
}
+function setup_sbox() {
+ if [ ! -d $__sbox_path ]; then
+ error "Invalid scratchbox path: $__sbox_path"
+ fi
+
+ __sbox="$__sbox_path/login"
+ __sbox_sb_conf="$__sbox /scratchbox/tools/bin/sb-conf"
+
+ __sbox_maemo3_debian_bin_path="/scratchbox/devkits/maemo3-debian/bin"
+ __sbox_dpkg_buildpackage="$__sbox $__sbox_maemo3_debian_bin_path/dpkg-buildpackage"
+
+ __sbox_debian_sarge_bin_path="/scratchbox/devkits/debian-sarge/bin"
+ __sbox_dch="$__sbox $__sbox_debian_sarge_bin_path/dch"
+
+ PATH="$__orig_path:$__sbox_maemo3_debian_bin_path:$__sbox_debian_sarge_bin_path"
+}
+
###########################################################
# Begin script
###########################################################
# Parse comand line options
-while getopts "chs" opt ; do
+while getopts "chs:" opt ; do
case "$opt" in
c)
__update_repositories=0
exit 0
;;
s)
- __scratchbox=$OPTARG
+ __sbox_path=$OPTARG
+ if [ "x$__sbox_path" = "x" ] || [ ! -d $__sbox_path ]; then
+ error "Invalid scratchbox path: $__sbox_path"
+ fi
;;
[?])
usage
# Create log file
create_log_file
+start_log
# Download modules under e17/libs
msg "Downloading e17 modules"
# Download python-etk module
get_sources $__python_etk_module $__git_repo$__e17_python_etk
+# Setup scratchbox variables
+setup_sbox
+
# For each scratchbox target
-for target in `$__scratchbox/tools/bin/sb-conf list --targets`; do
+for target in `$__sbox_sb_conf list --targets`; do
msg_begin "Checking distro and arch for target $target"
- check_distro $target
+ setup_distro $target
msg_end $?
msg " Distribution..: $__distro"
$__mkdir -p $__pkg_dir
msg_end $?
fi
- # Build package
- # Install packages
+ # For each module
+ for module in `echo $__lib_modules $__python_modules $__python_etk_module|$__sed -e 's/:/ /g'`; do
+ msg " Building $module packages for $__distro $__arch"
+ cd $module/$module
+
+ if [ -d ./debian ]; then
+ msg_begin " Removing existing debian directory"
+ rm -rf ./debian
+ msg_end $?
+ fi
- # Clean tree
+ cp -r ../debian .
+ # Build package
+ `$__sbox_dpkg_buildpackage $__build_pkg_options >> $__output_file 2>&1`
+
+ # Install packages
+
+ # Clean tree
+ clean
+
+ cd - > /dev/null 2>&1
+ done
done
# Uninstall all packages