[openrtm-commit:00978] r404 - trunk/rtmtools

openrtm @ openrtm.org openrtm @ openrtm.org
2013年 2月 5日 (火) 00:17:06 JST


Author: n-ando
Date: 2013-02-05 00:17:06 +0900 (Tue, 05 Feb 2013)
New Revision: 404

Added:
   trunk/rtmtools/install_plugins
   trunk/rtmtools/mirror_site
Modified:
   trunk/rtmtools/build_all
   trunk/rtmtools/build_features
   trunk/rtmtools/build_plugins
   trunk/rtmtools/make_packages
Log:
Build scripts have been modified to skip non-existing dir search. mirror_site, install_plugins scripts have been added.

Modified: trunk/rtmtools/build_all
===================================================================
--- trunk/rtmtools/build_all	2013-02-04 01:29:53 UTC (rev 403)
+++ trunk/rtmtools/build_all	2013-02-04 15:17:06 UTC (rev 404)
@@ -168,6 +168,9 @@
     fi
     echo "Environment variable ECLIPSE_HOME is not set. Seaching..."
     for d in $ECLIPSE_DIRS ; do
+        if test ! -d $d ; then
+            continue
+        fi
         tmp=`find -L $d -name .eclipseproduct`
         if test "x$tmp" = "x" ; then
             continue

Modified: trunk/rtmtools/build_features
===================================================================
--- trunk/rtmtools/build_features	2013-02-04 01:29:53 UTC (rev 403)
+++ trunk/rtmtools/build_features	2013-02-04 15:17:06 UTC (rev 404)
@@ -159,6 +159,9 @@
     fi
     echo "Environment variable ECLIPSE_HOME is not set. Searching..."
     for d in $ECLIPSE_DIRS ; do
+        if test ! -d $d ; then
+            continue
+        fi
         tmp=`find -L $d -name .eclipseproduct`
         if test "x$tmp" = "x" ; then
             continue

Modified: trunk/rtmtools/build_plugins
===================================================================
--- trunk/rtmtools/build_plugins	2013-02-04 01:29:53 UTC (rev 403)
+++ trunk/rtmtools/build_plugins	2013-02-04 15:17:06 UTC (rev 404)
@@ -165,6 +165,9 @@
     fi
     echo "Environment variable ECLIPSE_HOME is not set. Seaching..."
     for d in $ECLIPSE_DIRS ; do
+        if test ! -d $d ; then
+            continue
+        fi
         tmp=`find -L $d -name .eclipseproduct`
         if test "x$tmp" = "x" ; then
             continue

Added: trunk/rtmtools/install_plugins
===================================================================
--- trunk/rtmtools/install_plugins	                        (rev 0)
+++ trunk/rtmtools/install_plugins	2013-02-04 15:17:06 UTC (rev 404)
@@ -0,0 +1,80 @@
+#!/bin/sh
+#
+# @file install_plugins
+# @brief Plugin installation script
+# @author Noriaki Ando <n-ando at aist.go.jp>
+#
+#------------------------------
+#
+# This script installs eclipse plugins into existing eclipse dir.
+#
+# install_plugins <eclipse dir>
+#
+# ** Environment variables
+#
+# - REPOSITORY: Plugin repository URL of eclipse update site.
+#
+# - PLUGINS: Plugins to be installed.
+#------------------------------
+
+
+# Eclipse plugins information
+true ${REPOSITORY:="http://download.eclipse.org/releases/juno/"}
+true ${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"}
+
+#------------------------------
+# functions
+#------------------------------
+
+#------------------------------------------------------------
+# 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
+}
+
+
+#------------------------------------------------------------
+# install_plugins
+#------------------------------------------------------------
+install_plugins()
+{
+    cmd="java -jar $EQUINOX_LAUNCHER"
+    app_opt="-application org.eclipse.equinox.p2.director"
+    dest_opt="-destination $ECLIPSE_HOME"
+    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
+}
+
+
+#------------------------------
+# main
+#------------------------------
+export LC_ALL=C
+
+if test $# -ne 1 ; then
+    echo "Target eclipse dir is reuiqred."
+    echo "$0 <target eclipse dir>"
+    exit 1
+fi
+ECLIPSE_HOME=$1
+find_equinox
+install_plugins


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

Modified: trunk/rtmtools/make_packages
===================================================================
--- trunk/rtmtools/make_packages	2013-02-04 01:29:53 UTC (rev 403)
+++ trunk/rtmtools/make_packages	2013-02-04 15:17:06 UTC (rev 404)
@@ -247,9 +247,9 @@
         return 0
     fi
     echo "Downloading $FILE_NAME..."
-    wget -O "$FILE_NAME" "$URL"
+    curl -o "$FILE_NAME" "$URL"
     if test $? -ne 0 ; then
-        echo "wget failed. Aborting..."
+        echo "curl failed. Aborting..."
         exit 1
     fi
     file_info=`ls $FILE_NAME`
@@ -407,7 +407,7 @@
         echo "Invalid URL specified"
     fi
     if test ! -f $NL_FILE_NAME ; then
-        wget -O $WORK_DIR/$NL_FILE_NAME $LANGPACK_URL
+        curl -o $WORK_DIR/$NL_FILE_NAME $LANGPACK_URL
     fi
     if test $? -ne 0 ; then
         echo "Downloading language pack failed. Aborting."
@@ -566,4 +566,7 @@
 #      -source Insert Source URL
 #      -destination <mirror directory>
 #
+# http://wiki.eclipse.org/Equinox_p2_Repository_Mirroring
+# https://github.com/adangel/custom-eclipse/blob/master/create-mirror.sh
+#
 #------------------------------------------------------------

Added: trunk/rtmtools/mirror_site
===================================================================
--- trunk/rtmtools/mirror_site	                        (rev 0)
+++ trunk/rtmtools/mirror_site	2013-02-04 15:17:06 UTC (rev 404)
@@ -0,0 +1,285 @@
+#!/bin/bash
+
+# Eclipse search directories
+ECLIPSE_DIRS="$HOME/eclipse $HOME ../ ../../ ../..//usr/lib/ /usr/share"
+
+true ${DOWNLOAD_DIR:=/tmp/download}
+# Local directory for the old-style update site mirror
+true ${MIRROR_DIR_OLD:=/tmp/mirror-sites/}
+# Local p2 repo
+true ${MIRROR_DIR:=file://tmp/mirror-eclipse-p2/}
+
+
+#------------------------------------------------------------
+# 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
+}
+
+#------------------------------------------------------------
+# mirror_site <site URL> <mirror dir>
+#
+# Mirrors an old-style update site (not a p2 repository)
+# Can mirror multiple sites into one mirror. The sites are merged.
+#
+# $1: Source URL of the update site like you would enter it in Eclipse
+# $2: Target directory to store mirror 
+#------------------------------------------------------------
+function mirror_site()
+{
+java -jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar \
+    -application org.eclipse.update.core.standaloneUpdate \
+    -command mirror -from $1 -to $2
+}
+
+#------------------------------------------------------------
+# convert_site <old mirror dir> <p2 repository dir>
+#
+# Converts are mirror of old-style update sites into a p2 repository.
+# Usually called once for multiple mirror_site() calls.
+# If called for an existing, non-empty local p2 repo, then the additional
+# artifacts are merged into it.
+#------------------------------------------------------------
+function convert_site()
+{
+java -jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar \
+   -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
+   -metadataRepository $MIRROR_DIR \
+   -artifactRepository $MIRROR_DIR \
+   -source $MIRROR_DIR_OLD \
+   -append \
+   -publishArtifacts
+}
+
+#------------------------------------------------------------
+# mirror_p2 <source URL> <mirror dir>
+#
+# Mirrors a p2 repository into a local directory.
+# Can be called multiple times. All repos are merged into the local directory.
+#
+# $1: Source URL of the update site like you would enter it in Eclipse
+# $2: Target directory to store mirror
+#------------------------------------------------------------
+function mirror_p2()
+{
+	app_arti="org.eclipse.equinox.p2.artifact.repository.mirrorApplication"
+	app_meta="org.eclipse.equinox.p2.metadata.repository.mirrorApplication"
+
+	echo -n "Mirroring P2 Repo: $1..."
+	java -jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar \
+		-verbose \
+		-application  $app_arti \
+		-source $1 -destination $2
+	java -jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar \
+		-verbose \
+		-application  $app_meta\
+		-source $1 -destination $2
+	echo "done."
+}
+
+mirror_p2_partial()
+{
+	update_site=$1
+	shift
+	target_dir=$1
+	shift
+	ids=""
+	for id in $* ; do
+		ids="$ids
+      <iu id=\"$id\" />"
+	done
+
+	cat<<EOF > mirror.xml
+<project name="Create Mirror" default="create-mirror" basedir=".">
+  <target name="create-mirror">
+    <p2.mirror source="$update_site">
+      <destination location="$target_dir"  />$ids
+    </p2.mirror>
+  </target>
+</project>
+EOF
+
+	echo "Mirroring the following features."
+	echo "$*"
+	java -jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_* \
+		-application org.eclipse.ant.core.antRunner \
+		-verbose \
+		-buildfile mirror.xml
+	echo "Done"
+}
+
+#------------------------------------------------------------
+# download_convert
+#
+# Downloads a zip file containing a eclipse plugin and adds this
+# plugin to the local p2 repo.  Note: The zip file must contain either
+# a copy of the update site (e.g. site.xml) or at least a plugins/
+# subdirectory so that it is recognized.
+#
+# $1: some unique symbolic name of the plugin. Needed, so that
+#     download_convert() can be called multiple times for different
+#     plugins without interferring each other.
+#
+# $2 - download URL, suitable for wget.
+#------------------------------------------------------------
+function download_convert()
+{
+	if [ ! -e $DOWNLOAD_DIR ]; then
+		mkdir $DOWNLOAD_DIR
+	fi
+	
+	mkdir $DOWNLOAD_DIR/$1
+	file="$DOWNLOAD_DIR/"`basename $2`
+	
+	wget -O $file $2
+	unzip -d $DOWNLOAD_DIR/$1 $file
+	
+	java -jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar \
+		-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
+		-metadataRepository $MIRROR_DIR \
+		-artifactRepository $MIRROR_DIR \
+		-source $DOWNLOAD_DIR/$1 \
+		-append \
+		-publishArtifacts
+}
+
+#------------------------------------------------------------
+# download_convert_plugins
+#
+# Downloads a zip file containing a eclipse plugin and adds this
+# plugin to the local p2 repo.  Note: This time, the zip file contains
+# directly the plugin and not a update site structure. Therefore a
+# "plugins/" subdirectory is created.
+#
+# $1: some unique symbolic name of the plugin. Needed, so that
+#     download_convert() can be called multiple times for different
+#     plugins without interferring each other.
+#
+# $2: download URL, suitable for wget
+#------------------------------------------------------------
+function download_convert_plugins()
+{
+	if [ ! -e $DOWNLOAD_DIR ]; then
+		mkdir $DOWNLOAD_DIR
+	fi
+	
+	mkdir -p $DOWNLOAD_DIR/$1/plugins
+	file="$DOWNLOAD_DIR/"`basename $2`
+	
+	wget -O $file $2
+	unzip -d $DOWNLOAD_DIR/$1/plugins $file
+	
+	java -jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar \
+		-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
+		-metadataRepository $MIRROR_DIR \
+		-artifactRepository $MIRROR_DIR \
+		-source $DOWNLOAD_DIR/$1/ \
+		-append \
+		-publishArtifacts
+}
+
+#------------------------------------------------------------
+# svn_site_
+#
+# Does an svn checkout of a subversion repository, which contains a ready to use
+# update site. Then adds this update site to the local p2 repo.
+#
+# $1 - some unique symbolic name of the plugin. Needed, so that svn_site_checkout() can
+#      be called multiple times for different plugins without interferring each other.
+# $2 - the svn repo url
+#
+function svn_site_checkout()
+{
+	if [ ! -e $DOWNLOAD_DIR ]; then
+		mkdir $DOWNLOAD_DIR
+	fi
+	
+	mkdir $DOWNLOAD_DIR/$1
+	svn checkout $2 $DOWNLOAD_DIR/$1
+	
+	java -jar $ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_*.jar \
+		-application \
+		org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
+		-metadataRepository $MIRROR_DIR \
+		-artifactRepository $MIRROR_DIR \
+		-source $DOWNLOAD_DIR/$1 \
+		-append \
+		-publishArtifacts
+
+}
+
+
+#mirror_site "http://findbugs.cs.umd.edu/eclipse/"
+#mirror_site "http://www.soyatec.com/update/juno/"
+#mirror_site "http://www.jutils.com/eclipse-update/"
+#mirror_site "http://andrei.gmxhome.de/eclipse/"
+#mirror_site "http://download.aptana.com/studio3/plugin/install"
+#atlassian doesn't work! This is missing: org.apache.commons.httpclient_3.1.0.v201012070820.jar
+###mirror_site "http://update.atlassian.com/atlassian-eclipse-plugin/e3.6/"
+#mirror_site "http://jautodoc.sourceforge.net/update/"
+#mirror_site "http://www.junginger.biz/eclipse/"
+#mirror_site "http://update.atlassian.com/eclipse/clover/"
+#mirror_site "http://jadclipse.sourceforge.net/update/"
+#mirror_site "http://pydev.org/updates/"
+#convert_site
+
+#mirror_p2 "http://download.eclipse.org/releases/juno"
+#mirror_p2 "http://download.eclipse.org/mylyn/releases/juno"
+#mirror_p2 "http://download.eclipse.org/eclipse/updates/4.2"
+#mirror_p2 "http://download.eclipse.org/webtools/repository/juno"
+#mirror_p2 "http://eclipse-cs.sourceforge.net/update"
+#mirror_p2 "http://dist.springsource.com/release/TOOLS/update/e4.2"
+#mirror_p2 "http://download.eclipse.org/technology/m2e/releases"
+#mirror_p2 "http://update.eclemma.org/"
+#mirror_p2 "http://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/"
+#mirror_p2 "http://download.eclipse.org/egit/updates"
+#mirror_p2 "http://subclipse.tigris.org/update_1.8.x/"
+#mirror_p2 "http://pluginbox.sourceforge.net/"
+#mirror_p2 "http://download.jboss.org/jbosstools/updates/development/juno/"
+
+#download_convert "rbe" "http://sourceforge.net/projects/eclipse-rbe/files/Eclipse%203.x/0.8.0/ResourceBundleEditor_v0.8.0.zip"
+#download_convert_plugins "jutils" "http://sourceforge.net/projects/eclipse-jutils/files/eclipse-jutils/eclipse-jutils%20plugin%20v3.1/org.adarsh.jutils_3.1.0.zip"
+#download_convert "json" "http://sourceforge.net/projects/eclipsejsonedit/files/eclipsejsonedit/Json%20Editor%20Plugin%200.9.4/JsonEditorPlugin-0.9.4.zip"
+
+#svn_site_checkout "jenkins" "http://jenkins-eclipse-plugin.googlecode.com/svn/trunk/jenkins-update/"
+#svn_site_checkout "grinderstone" "http://grinderstone.googlecode.com/svn/update/"
+
+#------------------------------------------------------------
+# main
+#------------------------------------------------------------
+
+find_eclipsehome
+if test $# -eq 2 ; then
+	mirror_p2 $1 $2
+	exit 0
+fi
+if test $# -gt 2 ; then
+	mirror_p2 $*
+fi


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



More information about the openrtm-commit mailing list