mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
PR 2115 - Check prefix path write access before starting to build.
Added a check in the options post processing to check is the prefix path allows writes. No actual write check is made. just the permissions are checked. If the --no-install options is used the check is not made. Moved the --no-install option from the set builder to the options module.
This commit is contained in:
parent
8508944647
commit
9994530920
@ -64,6 +64,7 @@ class command_line:
|
|||||||
'--no-clean' : ('_no_clean', self._lo_bool, False, '0', True),
|
'--no-clean' : ('_no_clean', self._lo_bool, False, '0', True),
|
||||||
'--keep-going' : ('_keep_going', self._lo_bool, False, '0', True),
|
'--keep-going' : ('_keep_going', self._lo_bool, False, '0', True),
|
||||||
'--always-clean' : ('_always_clean', self._lo_bool, False, '0', True),
|
'--always-clean' : ('_always_clean', self._lo_bool, False, '0', True),
|
||||||
|
'--no-install' : ('_no_install', self._lo_bool, False, '0', True),
|
||||||
'--host' : ('_host', self._lo_triplets, True, None, False),
|
'--host' : ('_host', self._lo_triplets, True, None, False),
|
||||||
'--build' : ('_build', self._lo_triplets, True, None, False),
|
'--build' : ('_build', self._lo_triplets, True, None, False),
|
||||||
'--target' : ('_target', self._lo_triplets, True, None, False),
|
'--target' : ('_target', self._lo_triplets, True, None, False),
|
||||||
@ -202,6 +203,7 @@ class command_line:
|
|||||||
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 '--no-download : Disable the source downloader'
|
||||||
|
print '--no-install : Do not install the packages to the prefix'
|
||||||
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'
|
||||||
@ -239,8 +241,10 @@ class command_line:
|
|||||||
arg += 1
|
arg += 1
|
||||||
|
|
||||||
def post_process(self):
|
def post_process(self):
|
||||||
|
# Must have a host
|
||||||
if self.defaults['_host'] == self.defaults['nil']:
|
if self.defaults['_host'] == self.defaults['nil']:
|
||||||
raise error.general('host not set')
|
raise error.general('host not set')
|
||||||
|
# Handle the jobs for make
|
||||||
if '_ncpus' not in self.defaults:
|
if '_ncpus' not in self.defaults:
|
||||||
raise error.general('host number of CPUs not set')
|
raise error.general('host number of CPUs not set')
|
||||||
ncpus = self.jobs(self.defaults['_ncpus'])
|
ncpus = self.jobs(self.defaults['_ncpus'])
|
||||||
@ -248,6 +252,7 @@ class command_line:
|
|||||||
self.defaults['_smp_mflags'] = '-j %d' % (ncpus)
|
self.defaults['_smp_mflags'] = '-j %d' % (ncpus)
|
||||||
else:
|
else:
|
||||||
self.defaults['_smp_mflags'] = self.defaults['nil']
|
self.defaults['_smp_mflags'] = self.defaults['nil']
|
||||||
|
# Load user macro files
|
||||||
um = self.user_macros()
|
um = self.user_macros()
|
||||||
if um:
|
if um:
|
||||||
checked = path.exists(um)
|
checked = path.exists(um)
|
||||||
@ -255,6 +260,9 @@ class command_line:
|
|||||||
raise error.general('macro file not found: %s' % (um[checked.index(False)]))
|
raise error.general('macro file not found: %s' % (um[checked.index(False)]))
|
||||||
for m in um:
|
for m in um:
|
||||||
self.defaults.load(m)
|
self.defaults.load(m)
|
||||||
|
# Check the prefix permission
|
||||||
|
if not self.no_install() and not path.iswritable(self.defaults['_prefix']):
|
||||||
|
raise error.general('prefix is not writable: %s' % (path.host(self.defaults['_prefix'])))
|
||||||
|
|
||||||
def command(self):
|
def command(self):
|
||||||
return path.join(self.command_path, self.command_name)
|
return path.join(self.command_path, self.command_name)
|
||||||
@ -286,6 +294,9 @@ class command_line:
|
|||||||
def always_clean(self):
|
def always_clean(self):
|
||||||
return self.opts['always-clean'] != '0'
|
return self.opts['always-clean'] != '0'
|
||||||
|
|
||||||
|
def no_install(self):
|
||||||
|
return self.opts['no-install'] != '0'
|
||||||
|
|
||||||
def user_macros(self):
|
def user_macros(self):
|
||||||
#
|
#
|
||||||
# Return something even if it does not exist.
|
# Return something even if it does not exist.
|
||||||
|
@ -89,6 +89,9 @@ def isfile(path):
|
|||||||
def isabspath(path):
|
def isabspath(path):
|
||||||
return path[0] == '/'
|
return path[0] == '/'
|
||||||
|
|
||||||
|
def iswritable(path):
|
||||||
|
return os.access(host(path), os.W_OK)
|
||||||
|
|
||||||
def mkdir(path):
|
def mkdir(path):
|
||||||
path = host(path)
|
path = host(path)
|
||||||
if exists(path):
|
if exists(path):
|
||||||
|
@ -310,7 +310,7 @@ class buildset:
|
|||||||
builds += [b]
|
builds += [b]
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
if deps is None and not self.opts.get_arg('--no-install'):
|
if deps is None and not self.opts.no_install():
|
||||||
for b in builds:
|
for b in builds:
|
||||||
self.install(b.name(),
|
self.install(b.name(),
|
||||||
b.config.expand('%{buildroot}'),
|
b.config.expand('%{buildroot}'),
|
||||||
@ -352,7 +352,6 @@ def run():
|
|||||||
optargs = { '--list-configs': 'List available configurations',
|
optargs = { '--list-configs': 'List available configurations',
|
||||||
'--list-bsets': 'List available build sets',
|
'--list-bsets': 'List available build sets',
|
||||||
'--list-deps': 'List the dependent files.',
|
'--list-deps': 'List the dependent files.',
|
||||||
'--no-install': 'Do not install the packages to the prefix.',
|
|
||||||
'--no-report': 'Do not create a package report.',
|
'--no-report': 'Do not create a package report.',
|
||||||
'--report-format': 'The report format (text, html, asciidoc).',
|
'--report-format': 'The report format (text, html, asciidoc).',
|
||||||
'--bset-tar-file': 'Create a build set tar file',
|
'--bset-tar-file': 'Create a build set tar file',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user