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

Chang Rebecca Swee Fun rebecca.swee.fun.chang at intel.com
Mon Jul 24 08:25:01 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 tinfoil 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 | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 359eb9a..3885017 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)
@@ -440,6 +441,14 @@ def create_recipe(args):
             srcrev = res.group(1)
             srcuri = rev_re.sub('', srcuri)
 
+        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.
+            tinfoil.config_data.setVar('PREMIRRORS', '')
+            tinfoil.config_data.setVar('MIRRORS', '')
+
         tmpparent = tinfoil.config_data.getVar('BASE_WORKDIR')
         bb.utils.mkdirhier(tmpparent)
         tempsrc = tempfile.mkdtemp(prefix='recipetool-', dir=tmpparent)
@@ -1169,5 +1178,6 @@ 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).')
     parser_create.set_defaults(func=create_recipe)
 
-- 
2.7.4




More information about the Openembedded-core mailing list