Add --no-download to disable the downloader.

This commit is contained in:
Chris Johns 2013-04-15 09:18:31 +10:00
parent cc2c48ba88
commit 5e02e80d5a
3 changed files with 43 additions and 30 deletions

View File

@ -371,9 +371,9 @@ remove the parts you do not have write access too or you may need to unpack the
tar file somewhere and copy the file tree from the level you have write access tar file somewhere and copy the file tree from the level you have write access
from. Embedding the full prefix path in the tar files lets you know what the from. Embedding the full prefix path in the tar files lets you know what the
prefix is and is recommended. For example if prefix is and is recommended. For example if
`/home/chris/development/rtems/4.11` is the prefix used you cannot `/home/chris/development/rtems/4.11` is the prefix used you cannot change
change directory to the root (`/`) and install because the `/home` is root directory to the root (`/`) and install because the `/home` is root access
access only. To install you would: only. To install you would:
------------------------------------------------------------- -------------------------------------------------------------
$ cd $ cd
@ -1541,6 +1541,7 @@ Options and arguments:
--macros file[,[file] : Macro format files to load after the defaults --macros file[,[file] : Macro format files to load after the defaults
--log file : Log file where all build out is written too --log file : Log file where all build out is written too
--url url[,url] : URL to look for source --url url[,url] : URL to look for source
--no-download : Disable the source downloader
--targetcflags flags : List of C flags for the target code --targetcflags flags : List of C flags for the target code
--targetcxxflags flags : List of C++ flags for the target code --targetcxxflags flags : List of C++ flags for the target code
--libstdcxxflags flags : List of C++ flags to build the target libstdc++ code --libstdcxxflags flags : List of C++ flags to build the target libstdc++ code
@ -1582,6 +1583,7 @@ Options and arguments:
--macros file[,[file] : Macro format files to load after the defaults --macros file[,[file] : Macro format files to load after the defaults
--log file : Log file where all build out is written too --log file : Log file where all build out is written too
--url url[,url] : URL to look for source --url url[,url] : URL to look for source
--no-download : Disable the source downloader
--targetcflags flags : List of C flags for the target code --targetcflags flags : List of C flags for the target code
--targetcxxflags flags : List of C++ flags for the target code --targetcxxflags flags : List of C++ flags for the target code
--libstdcxxflags flags : List of C++ flags to build the target libstdc++ code --libstdcxxflags flags : List of C++ flags to build the target libstdc++ code
@ -1618,6 +1620,7 @@ Options and arguments:
--macros file[,[file] : Macro format files to load after the defaults --macros file[,[file] : Macro format files to load after the defaults
--log file : Log file where all build out is written too --log file : Log file where all build out is written too
--url url[,url] : URL to look for source --url url[,url] : URL to look for source
--no-download : Disable the source downloader
--targetcflags flags : List of C flags for the target code --targetcflags flags : List of C flags for the target code
--targetcxxflags flags : List of C++ flags for the target code --targetcxxflags flags : List of C++ flags for the target code
--libstdcxxflags flags : List of C++ flags to build the target libstdc++ code --libstdcxxflags flags : List of C++ flags to build the target libstdc++ code
@ -1690,6 +1693,9 @@ Log all the output from the build process. The output is directed to +stdout+
if no log file is provided. if no log file is provided.
+--url url+;; +--url url+;;
URL to look for source when downloading. This is can be comma separate list. URL to look for source when downloading. This is can be comma separate list.
+--no-download+;;
Disable downloading of source and patches. If the source is not found an error
is raised.
+--targetcflags flags+;; +--targetcflags flags+;;
List of C flags for the target code. This allows for specific local List of C flags for the target code. This allows for specific local
customisation when testing new variations. customisation when testing new variations.

View File

@ -128,11 +128,13 @@ class build:
def get_file(self, url, local): def get_file(self, url, local):
if local is None: if local is None:
raise error.general('source/patch path invalid') raise error.general('source/patch path invalid')
if not path.isdir(path.dirname(local)): if not path.isdir(path.dirname(local)) and not self.opts.download_disabled():
_notice(self.opts, _notice(self.opts,
'Creating source directory: %s' % (os.path.relpath(path.host(path.dirname(local))))) 'Creating source directory: %s' % (os.path.relpath(path.host(path.dirname(local)))))
self.mkdir(path.host(path.dirname(local))) self.mkdir(path.host(path.dirname(local)))
if not path.exists(local): if not path.exists(local):
if self.opts.download_disabled():
raise error.general('source not found: %s' % (path.host(local)))
# #
# Not localy found so we need to download it. Check if a URL has # Not localy found so we need to download it. Check if a URL has
# been provided on the command line. # been provided on the command line.

View File

@ -41,32 +41,33 @@ class command_line:
def __init__(self, argv, optargs, _defaults, command_path): def __init__(self, argv, optargs, _defaults, command_path):
self._long_opts = { self._long_opts = {
# key macro handler param defs init # key macro handler param defs init
'--prefix' : ('_prefix', self._lo_path, True, None, False), '--prefix' : ('_prefix', self._lo_path, True, None, False),
'--topdir' : ('_topdir', self._lo_path, True, None, False), '--topdir' : ('_topdir', self._lo_path, True, None, False),
'--configdir' : ('_configdir', self._lo_path, True, None, False), '--configdir' : ('_configdir', self._lo_path, True, None, False),
'--builddir' : ('_builddir', self._lo_path, True, None, False), '--builddir' : ('_builddir', self._lo_path, True, None, False),
'--sourcedir' : ('_sourcedir', self._lo_path, True, None, False), '--sourcedir' : ('_sourcedir', self._lo_path, True, None, False),
'--tmppath' : ('_tmppath', self._lo_path, True, None, False), '--tmppath' : ('_tmppath', self._lo_path, True, None, False),
'--jobs' : ('_jobs', self._lo_jobs, True, 'max', True), '--jobs' : ('_jobs', self._lo_jobs, True, 'max', True),
'--log' : ('_logfile', self._lo_string, True, None, False), '--log' : ('_logfile', self._lo_string, True, None, False),
'--url' : ('_url_base', self._lo_string, True, None, False), '--url' : ('_url_base', self._lo_string, True, None, False),
'--macros' : ('_macros', self._lo_string, True, None, False), '--no-download' : ('_disable_download', self._lo_bool, False, '0', True),
'--targetcflags' : ('_targetcflags', self._lo_string, True, None, False), '--macros' : ('_macros', self._lo_string, True, None, False),
'--targetcxxflags' : ('_targetcxxflags', self._lo_string, True, None, False), '--targetcflags' : ('_targetcflags', self._lo_string, True, None, False),
'--libstdcxxflags' : ('_libstdcxxflags', self._lo_string, True, None, False), '--targetcxxflags' : ('_targetcxxflags', self._lo_string, True, None, False),
'--force' : ('_force', self._lo_bool, False, '0', True), '--libstdcxxflags' : ('_libstdcxxflags', self._lo_string, True, None, False),
'--quiet' : ('_quiet', self._lo_bool, False, '0', True), '--force' : ('_force', self._lo_bool, False, '0', True),
'--trace' : ('_trace', self._lo_bool, False, '0', True), '--quiet' : ('_quiet', self._lo_bool, False, '0', True),
'--dry-run' : ('_dry_run', self._lo_bool, False, '0', True), '--trace' : ('_trace', self._lo_bool, False, '0', True),
'--warn-all' : ('_warn_all', self._lo_bool, False, '0', True), '--dry-run' : ('_dry_run', self._lo_bool, False, '0', True),
'--no-clean' : ('_no_clean', self._lo_bool, False, '0', True), '--warn-all' : ('_warn_all', self._lo_bool, False, '0', True),
'--keep-going' : ('_keep_going', self._lo_bool, False, '0', True), '--no-clean' : ('_no_clean', self._lo_bool, False, '0', True),
'--always-clean' : ('_always_clean', self._lo_bool, False, '0', True), '--keep-going' : ('_keep_going', self._lo_bool, False, '0', True),
'--host' : ('_host', self._lo_triplets, True, None, False), '--always-clean' : ('_always_clean', self._lo_bool, False, '0', True),
'--build' : ('_build', self._lo_triplets, True, None, False), '--host' : ('_host', self._lo_triplets, True, None, False),
'--target' : ('_target', self._lo_triplets, True, None, False), '--build' : ('_build', self._lo_triplets, True, None, False),
'--help' : (None, self._lo_help, False, None, False) '--target' : ('_target', self._lo_triplets, True, None, False),
'--help' : (None, self._lo_help, False, None, False)
} }
self.command_path = command_path self.command_path = command_path
@ -200,6 +201,7 @@ class command_line:
print '--macros file[,[file] : Macro format files to load after the defaults' print '--macros file[,[file] : Macro format files to load after the defaults'
print '--log file : Log file where all build out is written too' print '--log file : Log file where all build out is written too'
print '--url url[,url] : URL to look for source' print '--url url[,url] : URL to look for source'
print '--no-download : Disable the source downloader'
print '--targetcflags flags : List of C flags for the target code' print '--targetcflags flags : List of C flags for the target code'
print '--targetcxxflags flags : List of C++ flags for the target code' print '--targetcxxflags flags : List of C++ flags for the target code'
print '--libstdcxxflags flags : List of C++ flags to build the target libstdc++ code' print '--libstdcxxflags flags : List of C++ flags to build the target libstdc++ code'
@ -390,6 +392,9 @@ class command_line:
return self.opts['url'].split(',') return self.opts['url'].split(',')
return None return None
def download_disabled(self):
return self.opts['no-download'] != '0'
def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc'): def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc'):
""" """
Copy the defaults, get the host specific values and merge them overriding Copy the defaults, get the host specific values and merge them overriding