echo "===== $component: building for $build_variant ====="
# FIXME: install build dependencies here
- DEB_BUILD_OPTIONS=$build_variant dpkg-buildpackage -rfakeroot -us -uc -sa -D || exit
+ DEB_BUILD_OPTIONS=$build_variant dpkg-buildpackage -rfakeroot -us -uc -sa -d || exit
# install results
srcname=`grep Source: debian/control |cut -f2 -d' '`
+++ /dev/null
-#!/bin/sh
-
-###########################################################
-# Maemo-efl building script
-# Helper functions for utility scripts.
-###########################################################
-
-COLOR_GOOD="\033[1;32m"
-COLOR_WARN="\033[1;33m"
-COLOR_ERROR="\033[1;31m"
-COLOR_NORMAL="\033[0m"
-
-# usage <>
-function usage() {
- cat << EOF
-
-Usage: $__this_script [OPTIONS]
-
-Build script for Maemo EFL debian packages.
-
-Options:
- -n Don't sign packages.
- -c Don't update source repositories.
- -h Show this usage guide.
- -s PATH Specify alternate scratchbox path (default: $__sbox_path).
- -t A:B:Z Specify scratchbox building targets (default: all targets installed).
- -p P1:P2:PN Specify packges to build (default: build all packages available).
-
-EOF
-}
-
-# error <message>
-error() {
- echo -e " ${COLOR_ERROR}* E:${COLOR_NORMAL} $*"
- exit 1
-}
-
-# warn <message>
-warn() {
- echo -e " ${COLOR_WARN}* W:${COLOR_NORMAL} $*"
-}
-
-# msg <message>
-msg() {
- echo -e " ${COLOR_GOOD}*${COLOR_NORMAL} $*"
-}
-
-# msg_begin <message>
-msg_begin() {
- echo -en " ${COLOR_GOOD}*${COLOR_NORMAL} $* ..."
-}
-
-# msg_end <error-code>
-msg_end() {
- echo -en "\033[72G"
- if [ $1 -eq 0 ]; then
- echo -e "[ ${COLOR_GOOD}ok${COLOR_NORMAL} ]"
- else
- echo -e "[${COLOR_ERROR}fail${COLOR_NORMAL}]"
- exit 1
- fi
-}
-
-
# Note: var-definitions.sh and helper-functions.sh needed.
###########################################################
-function create_log_file() {
+create_log_file() {
if [ ! -r $__output_file ]; then
msg_begin "Creating log file"
touch $__output_file
fi
}
-function log_to_file() {
+log_to_file() {
local now
local msg
msg=$1
echo "$now: $msg" >> $__output_file
}
-function start_log() {
+start_log() {
local now
now=`$__date -R`
EOF
}
-function finish_log() {
+finish_log() {
local now
now=`$__date -R`
* Finished $__this_script: $now
EOF
}
-
--- /dev/null
+#!/bin/sh
+
+###########################################################
+# Maemo-efl building script
+# Helper functions for utility scripts.
+###########################################################
+
+COLOR_GOOD="\033[1;32m"
+COLOR_WARN="\033[1;33m"
+COLOR_ERROR="\033[1;31m"
+COLOR_NORMAL="\033[0m"
+
+# error <message>
+error() {
+ echo -e " ${COLOR_ERROR}* E:${COLOR_NORMAL} $*"
+ exit 1
+}
+
+# warn <message>
+warn() {
+ echo -e " ${COLOR_WARN}* W:${COLOR_NORMAL} $*"
+}
+
+# msg <message>
+msg() {
+ echo -e " ${COLOR_GOOD}*${COLOR_NORMAL} $*"
+}
+
+# msg_begin <message>
+msg_begin() {
+ echo -en " ${COLOR_GOOD}*${COLOR_NORMAL} $* ..."
+}
+
+# msg_end <error-code>
+msg_end() {
+#echo -en "\033[72G"
+echo -en " "
+ if [ $1 -eq 0 ]; then
+ echo -e "${COLOR_GOOD}ok${COLOR_NORMAL}"
+ else
+ echo -e "${COLOR_ERROR}failed${COLOR_NORMAL}"
+ exit 1
+ fi
+}
# Note: var-definitions.sh needed.
###########################################################
-function configure_pkg() {
+configure_pkg() {
local dir
dir=$1
return 0
}
-function build_pkg() {
+update_changelog() {
+ local rev
+ local rev_tmp
+ local fst
+ rev=$1
+
+ if [ x$rev == xHEAD ]; then
+ msg_begin "Getting latest repository revision number"
+ svn_latest_rev
+ msg_end $?
+ rev=$__svn_latest_rev
+ fi
+ rev_tmp=`echo $rev | $__sed -nr 's/^([0-9]+)$/\1/p'`
+ if [ -z "$rev_tmp" ]; then
+ error "Invalid revision number '$rev'"
+ fi
+ rev=$rev_tmp
+ msg_begin "Updating changelog files to svn$rev"
+ for module in `echo $__all_modules|$__sed -e 's/:/ /g'`; do
+ if [ -e $module/debian/changelog ]; then
+ fst=`$__head -1 $module/debian/changelog | grep svn`
+ if [ -n "$fst" ]; then
+ cp -f $module/debian/changelog $module/debian/changelog.orig
+ fst=`echo $fst | $__sed -nr "s/(.*)svn([0-9]+)(.*)/\1svn$rev\3/p"`
+ echo "$fst" > $module/debian/changelog
+ $__tail -n +2 $module/debian/changelog.orig >> $module/debian/changelog
+ fi
+ fi
+ done
+ msg_end $?
+}
+
+update_debian_dir() {
+
+ local module
+ local TO_REPLACE
+ local replacement_lowercase
+ local version_file
+ local version_number
+ local replacement
+ module=$1
+
+ if [ -d ./$module/$module/debian ]; then
+ msg_begin " Removing existing debian directory"
+ rm -rf ./$module/$module/debian
+ msg_end $?
+ fi
+
+ mkdir -p $module/$module/debian
+
+ msg_begin " Copying specific debian directory"
+ if [ -d ./$module/debian ]; then
+ $__tar c --exclude=.svn --exclude=.git --exclude=changelog.orig $module/debian | $__tar x --directory $module/
+ if [ -d ./$module/debian_$__distro ]; then
+ cp -r ./$module/debian_$__distro/* ./$module/$module/debian/
+ fi
+ else
+ if [ -d ./$module/debian_$__distro ]; then
+ $__tar c --exclude=.svn --exclude=.git --exclude=changelog.orig $module/debian_$__distro | $__tar x --directory $module/
+ else
+ echo ""
+ warn "Missing debian directory for $module. Ignoring"
+ return
+ fi
+ fi
+ msg_end $?
+
+ if [ -e ./$module/$module/debian/control.in ]; then
+ msg_begin " Replacing versions in control file"
+#TO_REPLACE=`grep -o -E '@([A-Z]|[0-9])+(-|_)*([A-Z]|[0-9])+_VERSION@' ./$module/$module/debian/control.in | cut -d @ -f 2 | sort -u`
+ TO_REPLACE=`grep -o -E '@([A-Z]|[0-9])+((-|_)*([A-Z]|[0-9]))*_VERSION@' ./$module/$module/debian/control.in | cut -d @ -f 2 | sort -u`
+ cp ./$module/$module/debian/control.in ./$module/$module/debian/control.temp
+
+ for replacement in $TO_REPLACE
+ do
+ replacement_lowercase=`echo $replacement | tr "[:upper:]" "[:lower:]"`
+ version_file=$__versions_dir/$replacement_lowercase
+ if [ ! -e $version_file ]; then
+ echo ""
+ warn "Could not find a replacement for $replacement"
+ continue
+ fi
+ version_number=`cat $version_file`
+ sed -i s/@$replacement@/$version_number/g ./$module/$module/debian/control.temp
+ done
+
+ mv ./$module/$module/debian/control.temp ./$module/$module/debian/control
+ msg_end $?
+ fi
+}
+
+generate_versions() {
+ if [ ! -d $__versions_dir ]; then
+ msg_begin "Creating versions dir $__versions_dir"
+ $__mkdir -p $__versions_dir
+ msg_end $?
+ fi
+
+ msg_begin "Generating version files"
+ for module in `echo $__all_modules |$__sed -e 's/:/ /g'`; do
+ if [ -e $module/debian/changelog ]; then
+ VERSION=`$__dpkg_parsechangelog -l$module/debian/changelog | grep Version: | cut -d" " -f2 | cut -d- -f1`
+ REVISION=`$__dpkg_parsechangelog -l$module/debian/changelog | grep Version: | cut -d- -f2`
+ if [ -z \$REVISION ]; then
+ echo "$VERSION" > $__versions_dir/"$module"_version
+ else
+ echo "$VERSION-$REVISION" > $__versions_dir/"$module"_version
+ fi
+ fi
+ done
+ msg_end $?
+}
+
+build_pkg() {
local dir
dir=$1
VERSION=\`$__sbox_dpkg_parsechangelog | grep Version: | cut -d" " -f2 | cut -d- -f1\`
REVISION=\`$__sbox_dpkg_parsechangelog | grep Version: | cut -d- -f2\`
-TO_REPLACE=\`grep -o -E '@([A-Z]|[0-9])+(-|_)*([A-Z]|[0-9])+_VERSION@' ./debian/control.in | cut -d @ -f 2 | sort -u\`
-
-# Test if we should process control.in file or not.
-if [ -z $__not_all_pkgs ]; then
- cp ./debian/control.in ./debian/control.temp
-
- for replacement in \$TO_REPLACE
- do
- replacement_lowercase=\`echo \$replacement | tr "[:upper:]" "[:lower:]"\`
- version_file=$__versions_dir/\$replacement_lowercase
- version_number=\`cat \$version_file\`
- sed -i s/@\$replacement@/\$version_number/g ./debian/control.temp
- done
-
- mv ./debian/control.temp ./debian/control
-else
- builddeps=\`$__sbox_dpkg_checkbuilddeps ./debian/control 2>&1 | grep Unmet | cut -d: -f3\`
- target_lowercase=\`echo $target | cut -d_ -f1 | tr "[:upper:]" "[:lower:]"\`
- if [ -z $__pkgslist_updated ];then
+builddeps=\`$__sbox_dpkg_checkbuilddeps ./debian/control 2>&1 | grep Unmet | cut -d: -f3\`
+target_lowercase=\`echo $target | cut -d_ -f1 | tr "[:upper:]" "[:lower:]"\`
- has_extras_rep=\`grep 'deb http://repository.maemo.org/extras' $__srclist_file\`
- if [ -z "\$has_extras_rep" ];then
- echo "deb http://repository.maemo.org/extras \$target_lowercase free non-free" >> $__srclist_file
- fi
+if [ -z $__pkgslist_updated ];then
- has_extras_rep=\`grep 'deb-src http://repository.maemo.org/extras' $__srclist_file\`
- if [ -z "\$has_extras_rep" ];then
- echo "deb-src http://repository.maemo.org/extras \$target_lowercase free non-free" >> $__srclist_file
- fi
-
- apt-get update >> $dir/sbox_apt_update.log 2>&1
- __pkgslist_updated=1
+ has_extras_rep=\`grep 'deb http://repository.maemo.org/extras' $__srclist_file\`
+ if [ -z "\$has_extras_rep" ];then
+ echo "deb http://repository.maemo.org/extras \$target_lowercase free non-free" >> $__srclist_file
fi
- if [ -n "\$builddeps" ];then
- echo \$builddeps | while read line
- do
- pkg_name=\`echo \$line | cut -d'(' -f1 | tr -d "[:blank:]"\`
- pkg_version=\`echo \$line | cut -d= -f2 | cut -d')' -f1 | tr -d "[:blank:]"\`
- apt-get -y install \$pkg_name=\$pkg_version >> $dir/sbox_builddeps.log 2>&1
- done
+ has_extras_rep=\`grep 'deb-src http://repository.maemo.org/extras' $__srclist_file\`
+ if [ -z "\$has_extras_rep" ];then
+ echo "deb-src http://repository.maemo.org/extras \$target_lowercase free non-free" >> $__srclist_file
fi
+
+ apt-get update >> $dir/sbox_apt_update.log 2>&1
+ __pkgslist_updated=1
+fi
+
+if [ -n "\$builddeps" ];then
+ echo \$builddeps | while read line
+ do
+ pkg_name=\`echo \$line | cut -d'(' -f1 | tr -d "[:blank:]"\`
+ pkg_version=\`echo \$line | cut -d= -f2 | cut -d')' -f1 | tr -d "[:blank:]"\`
+ apt-get -y install \$pkg_name=\$pkg_version >> $dir/sbox_builddeps.log 2>&1
+ done
fi
# $__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
-if [ -z \$REVISION ]
-then
- echo "\$VERSION" > $__versions_dir/`basename $dir`_version
-else
- echo "\$VERSION-\$REVISION" > $__versions_dir/`basename $dir`_version
-fi
-
exit \$?
EOF
return $?
}
-function install_pkgs() {
+install_pkgs() {
local dir
dir=$1
return 0
}
-function uninstall_pkgs() {
+uninstall_pkgs() {
cat << EOF > $__tmp_dir/sbox_uninstall_pkgs
#!/bin/sh
return $?
}
-function sign_pkgs() {
+sign_pkgs() {
local dir
dir=$1
cd $dir
+ print $__debsign
$__debsign *.changes >> $dir/sign_pkgs.log 2>&1 || return 1
cd - > /dev/null 2>&1
return 0
}
-
# Note: helper-functions.sh and var-definitions.sh needed.
###########################################################
-function clone_repository() {
+git_clone_repository() {
local repo
repo=$1
$__git_clone $repo.git >> $__output_file 2>&1
return $?
}
-function update_repository() {
+git_update_repository() {
local repo
repo=$1
return 0
}
-function clean_repository() {
+git_clean_repository() {
local repo
repo=$1
return 0
}
-function get_sources() {
+svn_checkout_repository() {
+ local repo
+ local rev
+ repo=$1
+ rev=$2
+
+ if [ -n "$rev" ]; then
+ rev="-r $rev"
+ fi
+ $__svn_checkout $repo $rev >> $__output_file 2>&1
+ return $?
+}
+
+svn_update_repository() {
+ local repo
+ local rev
+ repo=$1
+ rev=$2
+
+ if [ -n "$rev" ]; then
+ rev="-r $rev"
+ fi
+
+ if [ ! -d $repo ]; then
+ error " Trying to update invalid repository"
+ fi
+
+ cd $repo
+ $__svn_update $repo $rev>> $__output_file 2>&1 || return 1
+ cd - > /dev/null 2>&1
+
+ return 0
+}
+
+svn_latest_rev() {
+ __svn_latest_rev=`$__svn info $__svn_repo | $__grep "Last Changed Rev:" | cut -d" " -f4`
+}
+
+get_sources() {
local modules
local repo
+ local git
+ local pkg_version
+ local svn_rev
+ local rep_rev
+ local svn_rev_str
+
modules=`echo $1|$__sed -e 's/:/ /g'`
repo=$2
cd $module
- if [ -d $module/.git ]; then
- if [ ! $__update_repositories -eq 0 ]; then
- log_to_file "Updating existing repository at $PWD/$module"
+ pkg_version=`$__dpkg_parsechangelog | $__grep Version: | cut -d" " -f2`
+ svn_rev=`echo $pkg_version | $__sed -nr 's/.*svn([0-9]+).*/\1/p'`
+ git=`echo $repo|$__grep "git://"`
+
+ if [ -n "$svn_rev" ]; then
+ svn_rev_str="(rev: $svn_rev)"
+ else
+ svn_rev_str=
+ fi
+
+ if [ $__force_remove -eq 1 ]; then
+ if [ -d $module ]; then
+ rm -rf $module
+ fi
+ fi
+
+ if [ -n "$git" ]; then
+ if [ -d $module/.git ]; then
+ if [ ! $__update_repositories -eq 0 ]; then
+ log_to_file "Updating existing repository at $PWD/$module"
+
+ msg_begin " Updating $module repository"
+ git_update_repository $module
+ msg_end $?
+ else
+ log_to_file "Skipping update of $module repository"
+ fi
+ elif [ -d $module ]; then
+ log_to_file "Removing invalid repository at $PWD/$module"
+ rm -rf $module
+ fi
- msg_begin " Updating $module repository"
- update_repository $module
+ if [ ! -d $module ]; then
+ msg_begin " Cloning $repo/$module.git"
+ git_clone_repository $repo/$module
msg_end $?
- else
- log_to_file "Skipping update of $module repository"
fi
- elif [ -d $module ]; then
- log_to_file "Removing invalid repository at $PWD/$module"
- rm -rf $module
- fi
+ else
+ if [ -d $module/.svn ]; then
+ rep_rev=`$__svn info $module | $__sed -nr 's/Revision: ([0-9]*)/\1/p'`
+ if [ ! $__update_repositories -eq 0 -a "x$rep_rev" != "x$svn_rev" ]; then
+ log_to_file "Updating existing repository at $PWD/$module"
+ msg_begin " Updating $module repository $svn_rev_str"
+ svn_update_repository $module $svn_rev
+ msg_end 0
+ rep_rev=`$__svn info $module | $__sed -nr 's/Revision: ([0-9]*)/\1/p'`
+ if [ "x$rep_rev" != "x$svn_rev" ]; then
+ warn "Unable to update the repository to rev. $svn_rev"
+ fi
+ else
+ log_to_file "Skipping update of $module repository"
+ fi
+ elif [ -d $module ]; then
+ log_to_file "Removing invalid repository at $PWD/$module"
+ rm -rf $module
+ fi
+
+ if [ ! -d $module ]; then
+ msg_begin " Checking out $repo$module $svn_rev_str"
+ svn_checkout_repository $repo$module $svn_rev
+ if [ $? -ne 0 ]; then
+ warn "Unable to checkput the repository to rev. $svn_rev"
+ else
+ msg_end 0
+ fi
+ fi
- if [ ! -d $module ]; then
- msg_begin " Cloning $repo/$module.git"
- clone_repository $repo/$module
- msg_end $?
fi
cd ..
done
}
+download_modules() {
+ # Download e17 modules
+ if [ ! -z $__lib_modules ];then
+ msg "Downloading e17 modules"
+ get_sources $__lib_modules $__svn_repo
+ fi
+
+ # Download python modules under proto/python/efl
+ if [ ! -z $__python_modules ];then
+ msg "Downloading python modules"
+ get_sources $__python_modules $__svn_repo$__e17_python_efl
+ fi
+
+ # Download python-efl-utils module$
+ if [ ! -z $__python_efl_utils_module ];then
+ get_sources $__python_efl_utils_module $__git_repo$__e17_python_efl_utils
+ fi
+
+ # Download python-dispatcher module
+ #get_sources $__python_dispatcher_module $__git_repo$__e17_python_dispatcher
+}
+
+clean_modules() {
+ msg_begin "Cleaning up modules directories"
+ for module in `echo $__all_modules|$__sed -e 's/:/ /g'`; do
+ if [ -d $module/$module ]; then
+ rm -rf $module/$module
+ fi
+ done
+ msg_end $?
+}
# and helper-functions.sh needed.
###########################################################
-function setup_distro() {
+setup_distro() {
local target
local sources_list_file
local 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`
+ __distro=`$__head -1 $sources_list_file | cut -d" " -f3 | cut -d"/" -f1`
__arch=`$__grep SBOX_CPU= $target_conf_file | cut -d= -f2`
+ if [ "x$__arch" == "xi686" ]; then
+ __arch="i386"
+ elif [ "x$__arch" == "xarm" ]; then
+ __arch="armel"
+ fi
__pkg_dir="$__base_pkg_dir/$__distro/$__arch"
- if [ "x$__arch" = "xarm" ] ; then
+ if [ "x$__arch" = "xarmel" ] ; then
__build_pkg_options="$__common_build_pkg_options -B"
else
__build_pkg_options="$__common_build_pkg_options -I.svn -I.git -I.gitignore -I.cvsignore -sa"
return $ret
}
-function setup_sbox() {
+setup_sbox() {
if [ ! -d $__sbox_path ]; then
error "Invalid scratchbox path: $__sbox_path"
fi
__sbox_targets=`$__sbox_sb_conf list --targets`
}
-function change_sbox_target() {
+change_sbox_target () {
local target
target=$1
return $?
}
+init_checks () {
+
+ if [ x$USER == xroot ]; then
+ error "You should not run this script as root"
+ fi
+
+ if [ -r /targets/links/scratchbox.config ]; then
+ error "You should run this script outside the scratchbox environment."$
+ fi
+}
+
+setup_dirs () {
+ if [ ! -d $__base_pkg_dir ]; then
+ msg_begin "Creating base packages dir $__base_pkg_dir"
+ $__mkdir -p $__base_pkg_dir
+ msg_end $?
+ fi
+
+ # Create tmp dir
+ if [ ! -d $__tmp_dir ]; then
+ msg_begin "Creating tmp dir $__tmp_dir"
+ $__mkdir -p $__tmp_dir
+ msg_end $?
+ fi
+
+}
# Variable definitions
###########################################################
-__tmp_hash=`mktemp XXXXXXXX`
+__tmp_hash=`mktemp XXXXXXXX` || exit 1
+rm -f $__tmp_hash
# Paths
__tmp_dir="/tmp/`whoami`_build_maemo-efl/$__tmp_hash"
# Binaries
__date=`which date`
__git=`which git`
+__svn=`which svn`
__head=`which head`
__mkdir=`which mkdir`
__sed=`which sed`
__grep=`which grep`
__egrep=`which egrep`
__debsign=`which debsign`
+__tar=`which tar`
+__tail=`which tail`
+__head=`which head`
+__dpkg_parsechangelog=`which dpkg-parsechangelog`
+
+# svn definitions
+__svn_checkout="$__svn co"
+__svn_update="$__svn up"
+__svn_repo="http://svn.enlightenment.org/svn/e/trunk/"
# git definitions
__git_clone="$__git clone -q"
# e17 git repositories paths
__e17_libs="e17/libs"
__e17_proto="e17/proto"
-__e17_python_efl="$__e17_proto/python-efl"
+__e17_python_efl="BINDINGS/python/"
__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"
+__lib_modules="eet:evas:ecore:embryo:edje:epsilon:etk:e_dbus"
+#__other_modules="himf-ecore:himf-ecore-chinook:lightmediascanner:python-lightmediascanner"
+__other_modules=""
+__python_modules="python-evas:python-ecore:python-edje:python-epsilon:python-e_dbus:python-etk"
__python_efl_utils_module="python-efl_utils"
__python_dispatcher_module="python-dispatcher"
-__virtual_packages="efl-core python-efl-core"
+__virtual_packages="efl-core:python-efl-core"
+
+update_all_modules () {
+ __all_modules=$__lib_modules:$__other_modules:$__python_modules:$__python_efl_utils_module:$__python_dispatcher_module:$__virtual_packages
+}
# dpkg definitions
__common_build_pkg_options="-rfakeroot -us -uc -D"
# Other
__update_repositories=1
+__force_remove=0
__installed_packages=""
-
+__export_dir=""
+__not_all_pkgs=0