[OE-core] [PATCHv2 1/4] recipetool: create: disable PREMIRRORS and MIRRORS by default

Chang Rebecca Swee Fun rebecca.swee.fun.chang at intel.com
Thu Jul 20 10:31:57 UTC 2017


When creating new recipes, we are almost certainly fetching a new
source rather that something that has already been fetched. I have
disable PREMIRRORS and MIRRORS settings from datastore while leaving
an option for users to enable them manually if needed.

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang at intel.com>
---
 scripts/lib/recipetool/create.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 8e63580..1015d02 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -422,6 +422,7 @@ def create_recipe(args):
     source = args.source
     srcsubdir = ''
     srcrev = '${AUTOREV}'
+    mirrors = args.mirrors
 
     if os.path.isfile(source):
         source = 'file://%s' % os.path.abspath(source)
@@ -442,6 +443,13 @@ def create_recipe(args):
         tempsrc = tempfile.mkdtemp(prefix='recipetool-')
         srctree = tempsrc
         d = bb.data.createCopy(tinfoil.config_data)
+        if not mirrors:
+            # We do not need PREMIRRORS since we are almost certainly
+            # fetching new source rather than something that has already
+            # been fetched. Hence, we disable them by default.
+            # However, we provide an option for users to enable it.
+            d.setVar('PREMIRRORS', '')
+            d.setVar('MIRRORS', '')
         if fetchuri.startswith('npm://'):
             # Check if npm is available
             npm_bindir = check_npm(tinfoil, args.devtool)
@@ -1180,6 +1188,7 @@ def register_commands(subparsers):
     parser_create.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)')
     parser_create.add_argument('--fetch-dev', action="store_true", help='For npm, also fetch devDependencies')
     parser_create.add_argument('--devtool', action="store_true", help=argparse.SUPPRESS)
+    parser_create.add_argument('--mirrors', action="store_true", help='Enable PREMIRRORS and MIRRORS for source tree fetching (disable by default).')
     # FIXME I really hate having to set parserecipes for this, but given we may need
     # to call into npm (and we don't know in advance if we will or not) and in order
     # to do so we need to know npm's recipe sysroot path, there's not much alternative
-- 
2.7.4




More information about the Openembedded-core mailing list