[openrtm-commit:00960] r398 - trunk/rtmtools

openrtm @ openrtm.org openrtm @ openrtm.org
2013年 1月 31日 (木) 20:39:34 JST


Author: n-ando
Date: 2013-01-31 20:39:34 +0900 (Thu, 31 Jan 2013)
New Revision: 398

Added:
   trunk/rtmtools/make_packages
Log:
Eclipse all in one package build script make_package was added.

Added: trunk/rtmtools/make_packages
===================================================================
--- trunk/rtmtools/make_packages	                        (rev 0)
+++ trunk/rtmtools/make_packages	2013-01-31 11:39:34 UTC (rev 398)
@@ -0,0 +1,553 @@
+#!/bin/sh
+#
+# @file make_package
+# @brief Making eclipse packages
+# @author Noriaki Ando <n-ando at aist.go.jp>
+#
+#------------------------------
+#
+# This script makes eclipse package for Linux, Windows and Mac OS X.
+# It tries to download Eclipse SDK all in one package, and adds EMF,
+# EMF Xcore, GEF, XSD and rtmtools, and makes them packaging again to
+# be distributed.
+#
+# ** Environment variables
+#
+# The following vairables can/should be set to run this script.
+#
+# 1. Especially ECLIPSE_VERSION, DOWNLOAD_SITE, REPOSITORY, LANGPACK_URL
+# have to be set appropriate value based on chosen eclipse version.
+# Current default is eclipse 3.8.1
+#
+# 2. OPENRTP_SITE, WORK_DIR, PKG_DIR, OS and BIT can be set for your environment.
+#
+#
+# - ECLIPSE_HOME: A directory path to an Eclipse SDK. Under this
+#                 directory, .eclipseproduct, eclipse.ini, plugins and
+#                 eclipse executable should exist. If this
+#                 env.variable is not set, this script tries to search
+#                 eclipse directory under some directories that is set
+#                 in a env.variable ECLIPSE_DIRS written in the head
+#                 of this script.
+#
+# - ECLIPSE_VERSION: Eclipse version string to be
+#                 downloaded. Generally it would be R-x.y.z-<date>.
+#
+# - DOWNLOAD_SITE: Eclipse binary package download site URL. It should
+#                 specify a directory contains eclipse binary.
+#
+# - REPOSITORY: Plugin repository URL of eclipse update site. This
+#                 repository must contains eclipse official plugins
+#                 such as EMF, GRF and XSD.
+#
+# - LANGPACK_URL: URL of language pack for Eclipse SDK package.
+#
+# - OPENRTP_SITE: OpenRTP tools update site for directory.
+#
+# - WORK_DIR: Working directory to download eclipse package, extract
+#                 it and re-packaging it.
+#
+# - PKG_DIR: Created packages are stored this directory.
+#
+# - OS: Supported OS name of eclipse package.
+#
+# - BIT: Supported OS's platform
+#
+
+#------------------------------
+# Global variables
+#------------------------------
+# These global variables are used in the script.
+#
+# ECLIPSE_DIRS: eclipse directory that is previously installed on the system.
+#               This is only used for equinox to install plugins.
+#
+# ECLIPSE_<OS>_<BIT>: URL to Eclipse package for <OS> <BIT>bit
+#               binary. <OS> and <BIT> should appear in OS and BIT global variable.
+#
+# PLUGINS: Plugins to be installed for OpenRTP tools.
+#
+# OPENRTP_PLUGINS: OpenRTP plugins without Japanese language pack
+#
+# OPENRTP_PLUGINS_NL: OpenRTP language pack.
+#
+# FILE_NAME: File name of downloaded eclipse package.
+#
+# URL: URL of downloaded eclipse packages.
+#
+# OPENRTP_JA_VER: OpenRTP (Japanese package) version string
+#
+# OPENRTP_EN_VER: OpenRTP version string
+#
+# EQUINOX_LAUNCHER: Equinox launcher jar file with path.
+#
+# NL_FILE_NAME: langpack file name.
+#
+#------------------------------
+
+# Eclipse search directories
+ECLIPSE_DIRS="$HOME/eclipse $HOME ../ ../../ ../..//usr/lib/ /usr/share"
+
+# Eclipse SDK package information
+#ECLIPSE_VERSION="R-3.8-201206081200"
+true ${ECLIPSE_VERSION:="R-3.8.1-201209141540"}
+true ${DOWNLOAD_SITE:="http://ftp.jaist.ac.jp/pub/eclipse/eclipse/downloads/drops/${ECLIPSE_VERSION}"}
+ECLIPSE_SHORTVER=`echo $ECLIPSE_VERSION | awk 'BEGIN{FS="-";}{print $2;}'`
+ECLIPSE_WIN32_32="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-win32.zip"
+ECLIPSE_WIN32_64="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-win32-x86_64.zip"
+ECLIPSE_LINUX_32="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-linux-gtk.tar.gz"
+ECLIPSE_LINUX_64="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-linux-gtk-x86_64.tar.gz"
+ECLIPSE_MACOS_32="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-macosx-cocoa.tar.gz"
+ECLIPSE_MACOS_64="${DOWNLOAD_SITE}/eclipse-SDK-${ECLIPSE_SHORTVER}-macosx-cocoa-x86_64.tar.gz"
+
+# Eclipse plugins information
+true ${REPOSITORY:="http://download.eclipse.org/releases/juno/"}
+PLUGINS="org.eclipse.emf.sdk.feature.group
+         org.eclipse.emf.ecore.xcore.sdk.feature.group
+         org.eclipse.gef.sdk.feature.group
+         org.eclipse.xsd.sdk.feature.group"
+
+# Language package information
+true ${LANGPACK_URL:="http://sourceforge.jp/frs/redir.php?m=iij&f=%2Fblancofw%2F56316%2FNLpackja-eclipse-SDK-3.8.0-blancofw20120628.zip"}
+
+# openrtp tool information
+HERE=`pwd`
+true ${OPENRTP_SITE:="file:${HERE}/sitetool/openrtp_site"}
+OPENRTP_PLUGINS="jp.go.aist.rtm.rtcbuilder.feature.feature.group
+         jp.go.aist.rtm.rtsystemeditor.feature.feature.group"
+OPENRTP_PLUGINS_NL="jp.go.aist.rtm.rtcbuilder.nl1.feature.feature.group
+         jp.go.aist.rtm.rtsystemeditor.nl1.feature.feature.group"
+
+# Working dir for download/extract/pack eclipse files
+true ${WORK_DIR:="./work"}
+# Package store directory
+true ${PKG_DIR:="./packages"}
+
+# Supported OS/type
+true ${OS:="WIN32 LINUX MACOS"}
+true ${BIT:="32 64"}
+
+# These variables are overwritten in the script.
+FILE_NAME=""
+URL=""
+
+echo "ECLIPSE_VERSION: $ECLIPSE_VERSION"
+echo "DOWNLOAD_SITE:   $DOWNLOAD_SITE"
+echo "REPOSITORY:      $REPOSITORY"
+echo "LANGPACK_URL:    $LANGPACK_URL"
+echo "OPENRTP_SITE:    $OPENRTP_SITE"
+echo "WORK_DIR:        $WORK_DIR"
+echo "PKG_DIR:         $PKG_DIR"
+echo "OS:              $OS"
+echo "BIT:             $BIT"
+
+#------------------------------
+# functions
+#------------------------------
+
+#------------------------------------------------------------
+# get_version
+#
+# This function gets version number and project version string
+# from version text file.
+# ------------------------------------------------------------
+get_version()
+{
+    if test ! -f ./version ; then
+        echo "version file not found. Aborting."
+        exit 1
+    fi
+    if test "x$VERSION" = "x" || test "x$PROJECT_VERSION" = "x" ; then
+        echo "Environment variable VERSION/PROJECT_VERSION is not set."
+        echo "Getting from ./version text."
+        . ./version
+    fi
+    ver=`echo $PROJECT_VERSION | sed -e 's/\.//g'`
+    # openrtp package name
+    OPENRTP_JA_VER="openrtp${ver}-ja"
+    OPENRTP_EN_VER="openrtp${ver}"
+    return 0
+}
+
+#------------------------------------------------------------
+# find_eclipsehome
+#
+# This function checks ECLIPSE_HOME env variable and if it is
+# not set, it searches an eclipse directory under ECLIPSE_DIRS,
+# and set ECLIPSE_HOME env variable.
+# ------------------------------------------------------------
+find_eclipsehome()
+{
+    if test ! "x$ECLIPSE_HOME" = "x" ; then
+        if test -d $ECLIPSE_HOME ; then
+            return 0
+        fi
+        echo "ECLIPSE_HOME $ECLIPSE_HOME does not exist."
+    fi
+    echo "Environment variable ECLIPSE_HOME is not set. Searching..."
+    for d in $ECLIPSE_DIRS ; do
+        tmp=`find -L $d -name .eclipseproduct`
+        if test "x$tmp" = "x" ; then
+            continue
+        fi
+        for e in $tmp ; do
+            edir=`dirname $e`
+            if test -f $edir/eclipse.ini && test -d $edir/plugins ; then
+                export ECLIPSE_HOME="$edir"
+                return 0
+            fi
+        done
+    done
+    echo "eclipse not found. Please install eclipse and set ECLIPSE_HOME."
+    exit 1
+}
+
+#------------------------------------------------------------
+# find_equinox()
+#------------------------------------------------------------
+find_equinox()
+{
+    equinox=`ls $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar`
+    for e in $equinox ; do
+        EQUINOX_LAUNCHER=$e
+        return 0
+    done
+    echo "Equinox Launcher jar file not found. Aborting."
+    exit 1
+}
+
+#------------------------------------------------------------
+# download_eclipse
+#------------------------------------------------------------
+download_eclipse()
+{
+    if test $# -ne 1 ; then
+        echo "download_eclipse should have one argument. Aborting."
+        exit 1
+    fi
+    if test ! -d $WORK_DIR ; then
+        mkdir -p $WORK_DIR
+    fi
+    URL=$1
+    fname=`basename $URL`
+    FILE_NAME=$WORK_DIR/`basename $URL`
+    if test "x$FILE_NAME" = "x" ; then
+        echo "Invalid URL has been given: $URL"
+        echo "Aborting..."
+        exit 1
+    fi
+
+    suffix=`echo $fname | sed 's/eclipse-.*\.[0-9]-//'`
+    ver=`echo $fname | sed 's/eclipse-.*-\([0-9].*[0-9]\)-.*/\1/' | sed -e 's/\.//g'`
+    PKG_NAME_JA="eclipse${ver}-${OPENRTP_JA_VER}-$suffix"
+    PKG_NAME_EN="eclipse${ver}-${OPENRTP_EN_VER}-$suffix"
+
+    if test -f $FILE_NAME; then
+        echo "$FILE_NAME already exists."
+        return 0
+    fi
+    echo "Downloading $FILE_NAME..."
+    wget -O "$FILE_NAME" "$URL"
+    if test $? -ne 0 ; then
+        echo "wget failed. Aborting..."
+        exit 1
+    fi
+    file_info=`ls $FILE_NAME`
+    echo "Donwload done: $file_info"
+    return 0
+}
+
+#------------------------------------------------------------
+# extract_eclipse
+#------------------------------------------------------------
+extract_eclipse()
+{
+    rm -rf $WORK_DIR/eclipse
+    zip=`echo $FILE_NAME | grep '[zZ][iI][pP]'`
+    tar=`echo $FILE_NAME | grep '[tT][aA][rR].[gG][zZ]'`
+    if test ! "x$zip" = "x" ; then
+        echo "Extracting zip file..."
+        unzip $FILE_NAME -d $WORK_DIR && return 0
+        echo "Failed to extract zip file: $FILE_NAME. Aborting..."
+        exit 1
+    elif test ! "x$tar" = "x" ; then
+        echo "Extracting tar.gz file..."
+        tar xvzf $FILE_NAME -C $WORK_DIR && return 0
+        echo "Failed to extract tar.gz file: $FILE_NAME. Aborting..."
+        exit 1
+    else
+        echo "Unknown file extention. Aborting..."
+        exit 1
+    fi
+    return 1
+}
+
+#------------------------------------------------------------
+# install_plugins
+#------------------------------------------------------------
+install_plugins()
+{
+    cmd="java -jar $EQUINOX_LAUNCHER"
+    app_opt="-application org.eclipse.equinox.p2.director"
+    dest_opt="-destination $WORK_DIR/eclipse"
+    repo_opt="-repository $REPOSITORY"
+
+    for p in $PLUGINS ; do
+        echo "$cmd $app_opt $dest_opt $repo_opt -installIU $p"
+        $cmd $app_opt $dest_opt $repo_opt -installIU $p
+        if test $? -ne 0 ; then
+            echo "Plugin: $p installation failed. Aborting."
+            return 0
+        fi
+    done
+}
+
+#------------------------------------------------------------
+# insall_rtmtools
+#
+# Installing OpenRTP tools features
+#------------------------------------------------------------
+install_rtmtools()
+{
+    cmd="java -jar $EQUINOX_LAUNCHER"
+    app_opt="-application org.eclipse.equinox.p2.director"
+    dest_opt="-destination $WORK_DIR/eclipse"
+    repo_opt="-repository $OPENRTP_SITE"
+
+    for p in $OPENRTP_PLUGINS ; do
+        echo "$cmd $app_opt $dest_opt $repo_opt -installIU $p"
+        $cmd $app_opt $dest_opt $repo_opt -installIU $p
+        if test $? -ne 0 ; then
+            echo "Plugin: $p installation failed. Aborting."
+            return 0
+        fi
+    done
+}
+
+#------------------------------------------------------------
+# insall_rtmtools
+#
+# Installing OpenRTP language packages
+#------------------------------------------------------------
+install_rtmtools_nl()
+{
+    cmd="java -jar $EQUINOX_LAUNCHER"
+    app_opt="-application org.eclipse.equinox.p2.director"
+    dest_opt="-destination $WORK_DIR/eclipse"
+    repo_opt="-repository $OPENRTP_SITE"
+
+    for p in $OPENRTP_PLUGINS_NL ; do
+        echo "$cmd $app_opt $dest_opt $repo_opt -installIU $p"
+        $cmd $app_opt $dest_opt $repo_opt -installIU $p
+        if test $? -ne 0 ; then
+            echo "Plugin: $p installation failed. Aborting."
+            return 0
+        fi
+    done
+}
+
+#------------------------------------------------------------
+# create_package
+#
+# Packing eclise directory
+#------------------------------------------------------------
+create_package()
+{
+    if test $# -ne 1 ; then
+        echo "create_package needs at least one argument."
+        exit 1
+    fi
+    pkg_name=`basename $1`
+    zip=`echo $pkg_name | grep '[zZ][iI][pP]'`
+    tar=`echo $pkg_name | grep '[tT][aA][rR].[gG][zZ]'`
+    echo $zip
+    echo $tar
+    if test ! "x$zip" = "x" ; then
+        echo "Creating zip file..."
+        cd $WORK_DIR
+        find eclipse > .zip_list
+        (cat .zip_list | zip -@ $pkg_name)
+        rm -f .zip_list
+        cd ..
+        if test $? -ne 0 ;then
+            echo "Failed to archive zip file: $pkg_name. Aborting..."
+            exit 1
+        fi
+    elif test ! "x$tar" = "x" ; then
+        echo "Creating tar.gz file..."
+        cd $WORK_DIR
+        tar cvzf $pkg_name eclipse
+        cd ..
+        if test $? -ne 0 ; then
+            echo "Failed to archive tar.gz file: $pkg_name. Aborting..."
+            exit 1
+        fi
+    else
+        echo "Unknown file extention. Aborting..."
+        exit 1
+    fi
+    if test ! -d $PKG_DIR ; then
+        mkdir -p $PKG_DIR
+    fi
+    mv $WORK_DIR/$pkg_name $PKG_DIR
+    return 0
+
+}
+
+#------------------------------------------------------------
+# download_langpack
+#
+# Downloading Eclipse's language pack
+#------------------------------------------------------------
+download_langpack()
+{
+    echo "Downloading Eclipse language pack: $LANGPACK_URL"
+    NL_FILE_NAME=`echo $LANGPACK_URL | sed -e 's/.*\(NLpackja.*\.zip\)/\1/'`
+    if test "x$NL_FILE_NAME" = "x" ; then
+        echo "Invalid URL specified"
+    fi
+    if test ! -f $NL_FILE_NAME ; then
+        wget -O $WORK_DIR/$NL_FILE_NAME $LANGPACK_URL
+    fi
+    if test $? -ne 0 ; then
+        echo "Downloading language pack failed. Aborting."
+        exit 1
+    fi
+    return 0
+}
+
+#------------------------------------------------------------
+# apply_langpack
+#
+# Extract language pack archive and apply it to eclipse
+#------------------------------------------------------------
+apply_langpack()
+{
+    unzip $WORK_DIR/$NL_FILE_NAME -d $WORK_DIR
+    if test $? -ne 0 ; then
+        echo "Unzipping $NF_FILE_NAME failed. Aborting."
+        exit 1
+    fi
+    return 0
+}
+
+#------------------------------------------------------------
+# cleanup_workdir
+#
+# Cleanup working directory
+#------------------------------------------------------------
+cleanup_workdir()
+{
+    rm -rf $WORK_DIR/eclipse
+}
+
+#------------------------------
+# main
+#------------------------------
+export LC_ALL=C
+cd `dirname $0`
+
+get_version
+
+find_eclipsehome
+find_equinox
+
+for os in $OS ; do
+    for bit in $BIT ; do
+        eval "url=\$ECLIPSE_${os}_${bit}"
+        download_eclipse $url
+        extract_eclipse
+        install_plugins
+        install_rtmtools
+        # English version
+        create_package $PKG_NAME_EN
+
+        # Japanese version
+        download_langpack
+        apply_langpack
+        install_rtmtools_nl
+        create_package $PKG_NAME_JA
+
+        cleanup_workdir
+    done
+done
+
+# end of script
+#------------------------------------------------------------
+# * Development notes
+#
+# ** Eclipse download site
+# http://www.eclipse.org/downloads/
+#
+# *** Eclipse project archived downloads site
+# http://archive.eclipse.org/eclipse/downloads/index.php
+#
+# *** NLPack
+# http://sourceforge.jp/projects/blancofw/wiki/nlpack.eclipse.juno-I201206281030
+#
+# *** Plugin download site
+# http://download.eclipse.org/releases/<code name>/
+# code name: indigo, juno, etc...
+#
+# Plugin installation from CUI
+# http://o440.wordpress.com/2011/03/21/eclipse-plugin-cui-installation/
+#
+# ** How to install plugins from command line
+#
+# Plugin installation from command line has two ways. But using
+# org.eclipse.update.core.standaloneUpdate is obsolete. Now we should
+# use org.eclipse.equinox.p2.director
+#
+# [OLD]
+# java -jar <eclipse_dir>/plugins/org.eclipse.equinox.launcher_<ver>
+#      -application  org.eclipse.update.core.standaloneUpdate
+#      -command search -from <repository URL>
+# Commands (install, uninstall, addSite, removeSite, search, enable, disable)
+# See http://help.eclipse.org/indigo/index.jsp?
+#     topic=/org.eclipse.platform.doc.isv/reference/misc/update_standalone.html
+#
+# [NEW]
+# java -jar ~/eclipse-3.8/plugins/org.eclipse.equinox.launcher_<ver>.jar
+#      -application org.eclipse.equinox.p2.director
+#      -repository http://download.eclipse.org/releases/juno/
+#      -installIU org.eclipse.emf.sdk.feature.group
+#      -destination /home/n-ando/work/eclipse/eclipse_linux64/
+#
+# Options:
+# -application org.eclipse.equinox.p2.director
+# -metadataRepository
+# -artifactRepository
+# -repository
+# -installIU
+# -uninstallIU
+# -destination
+# -list
+# -profile
+# -profileProperties
+# -bundlepool
+# -p2.os
+# -p2.ws
+# -p2.arch
+# -roaming
+# -shared
+# -verifyOnly
+#
+# See: http://help.eclipse.org/galileo/index.jsp?
+#      topic=/org.eclipse.platform.doc.isv/guide/p2_director.html
+#
+# To install rtmtools, thw following plugins features should be installed.
+# - org.eclipse.emf.sdk.feature.group
+# - org.eclipse.emf.ecore.xcore.sdk.feature.group
+# - org.eclipse.gef.sdk.feature.group
+# - org.eclipse.xsd.sdk.feature.group
+#
+# for CDT
+# - org.eclipse.cdt.feature.group
+#
+# for plugins
+# Repository for juno: http://download.eclipse.org/releases/juno/
+#
+# ** Eclipse s Client Agent name
+#  Jakarta Commons-HttpClient/3.1
+#
+#------------------------------------------------------------


Property changes on: trunk/rtmtools/make_packages
___________________________________________________________________
Added: svn:executable
   + *



More information about the openrtm-commit mailing list