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

Chin Huat Ang chin.huat.ang at intel.com
Fri Jan 11 01:37:07 PST 2019


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.

[YOCTO #13050 v1]

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 b13ecc7..7e05d25 100755
--- a/scripts/setup.sh
+++ b/scripts/setup.sh
@@ -97,6 +97,11 @@ ep_date="-201806110500"
 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.107.0.v20180611-0422.jar ]; then
 
   pushd .
@@ -135,6 +140,22 @@ if [ ! -f eclipse/plugins/org.eclipse.swt_3.107.0.v20180611-0422.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