[eclipse-yocto] [oxygen][PATCH 2/2] setup.sh: allow disabling P2 mirrors

Chin Huat Ang chin.huat.ang at intel.com
Thu Dec 13 10:57:45 PST 2018


Add new option for disabling P2 mirrors when downloading IUs. Note that
setting "-vmargs -Declipse.p2.mirrors=false" at the end of the command
line doesn't seem to work, so instead we set them by modifying the
config.ini file from the eclipse archive that's being extracted.

To run setup.sh with P2 mirrors disabled:

  P2_MIRRORS=0 ./setup.sh

[YOCTO #13050]

Signed-off-by: Chin Huat Ang <chin.huat.ang at intel.com>
---
 scripts/setup.sh | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/scripts/setup.sh b/scripts/setup.sh
index 1010235..cd029b9 100755
--- a/scripts/setup.sh
+++ b/scripts/setup.sh
@@ -97,6 +97,11 @@ ep_date="-201803300640"
 P2_disabled=false
 P2_no_dropins=false
 
+# Always use P2 mirrors by default unless we're troubleshooting build
+# related issues.
+P2_MIRRORS=${P2_MIRRORS:=1}
+
+
 if [ ! -f eclipse/plugins/org.eclipse.swt_3.106.3.v20180329-0507.jar ]; then
 
   pushd .
@@ -135,6 +140,22 @@ if [ ! -f eclipse/plugins/org.eclipse.swt_3.106.3.v20180329-0507.jar ]; then
     fi
     ln -s eclipse-${ep_ver}-${ep_arch}/eclipse eclipse
   fi
+
+  # Disable P2 mirrors as needed, the following Eclipse wiki page
+  # suggests adding -vmargs -Declipse.p2.mirrors=false at the end of
+  # the Java command line, in our case this means when the P2 director
+  # being invoked for feature installation:
+  #
+  #   https://wiki.eclipse.org/Equinox/p2/p2.mirrorsURL#Avoiding_mirrors.2C_even_when_using_p2.mirrorsURL
+  #
+  # Unfortunate this doesn't seem to work, so instead we modify the
+  # generated config.ini to force P2 to not use mirrors. This should be
+  # fine for as long as the eclipse installation directory which
+  # contains the modified config.ini is only used for building the
+  # plugins.
+
+  [ "$P2_MIRRORS" == "1" ] || echo "eclipse.p2.mirrors=false" >> eclipse/configuration/config.ini
+
 fi
 
 if [ ! -f eclipse/startup.jar ]; then
-- 
2.7.4



More information about the eclipse-yocto mailing list