summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>2017-08-21 17:39:40 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-23 08:47:02 +0100
commite09b9d4543c6f0cba9215a0ed3cfb97fc7153471 (patch)
treec34bcf1285b9ee277011305f3a50bd29f86ba482
parentae874ef55373160e0fc910273915e885f9236ed2 (diff)
downloadpoky-e09b9d4543c6f0cba9215a0ed3cfb97fc7153471.tar.gz
recipetool: create: disable PREMIRRORS and MIRRORS by default
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 in the recipe that created by devtool while leaving an option for users to enable them manually if needed. Since devtool already has this options, we need to ensure that recipetool is able to handle the options passed from devtool. (From OE-Core rev: 091cee2bdc2378a3425a4ef8558d03e6f9c021ff) Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/recipetool/create.py1
-rw-r--r--scripts/lib/scriptutils.py9
2 files changed, 9 insertions, 1 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index e21e2bf298..2c3a58a143 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -1169,5 +1169,6 @@ def register_commands(subparsers):
1169 parser_create.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') 1169 parser_create.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)')
1170 parser_create.add_argument('--fetch-dev', action="store_true", help='For npm, also fetch devDependencies') 1170 parser_create.add_argument('--fetch-dev', action="store_true", help='For npm, also fetch devDependencies')
1171 parser_create.add_argument('--devtool', action="store_true", help=argparse.SUPPRESS) 1171 parser_create.add_argument('--devtool', action="store_true", help=argparse.SUPPRESS)
1172 parser_create.add_argument('--mirrors', action="store_true", help='Enable PREMIRRORS and MIRRORS for source tree fetching (disabled by default).')
1172 parser_create.set_defaults(func=create_recipe) 1173 parser_create.set_defaults(func=create_recipe)
1173 1174
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py
index 97854385d5..11f1a78e97 100644
--- a/scripts/lib/scriptutils.py
+++ b/scripts/lib/scriptutils.py
@@ -102,7 +102,7 @@ class FetchUrlFailure(Exception):
102 def __str__(self): 102 def __str__(self):
103 return "Failed to fetch URL %s" % self.url 103 return "Failed to fetch URL %s" % self.url
104 104
105def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False): 105def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False, mirrors=False):
106 """ 106 """
107 Fetch the specified URL using normal do_fetch and do_unpack tasks, i.e. 107 Fetch the specified URL using normal do_fetch and do_unpack tasks, i.e.
108 any dependencies that need to be satisfied in order to support the fetch 108 any dependencies that need to be satisfied in order to support the fetch
@@ -150,6 +150,13 @@ def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False):
150 f.write('WORKDIR = "%s"\n' % tmpworkdir) 150 f.write('WORKDIR = "%s"\n' % tmpworkdir)
151 # Set S out of the way so it doesn't get created under the workdir 151 # Set S out of the way so it doesn't get created under the workdir
152 f.write('S = "%s"\n' % os.path.join(tmpdir, 'emptysrc')) 152 f.write('S = "%s"\n' % os.path.join(tmpdir, 'emptysrc'))
153 if not mirrors:
154 # We do not need PREMIRRORS since we are almost certainly
155 # fetching new source rather than something that has already
156 # been fetched. Hence, we disable them by default.
157 # However, we provide an option for users to enable it.
158 f.write('PREMIRRORS = ""\n')
159 f.write('MIRRORS = ""\n')
153 160
154 logger.info('Fetching %s...' % srcuri) 161 logger.info('Fetching %s...' % srcuri)
155 162