Changeset 9994530 in rtems-source-builder


Ignore:
Timestamp:
Apr 15, 2013, 12:05:23 AM (6 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, 4.9, master
Children:
c95c245
Parents:
8508944
Message:

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.

Location:
source-builder/sb
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • source-builder/sb/options.py

    r8508944 r9994530  
    6565            '--keep-going'     : ('_keep_going',       self._lo_bool,     False, '0',   True),
    6666            '--always-clean'   : ('_always_clean',     self._lo_bool,     False, '0',   True),
     67            '--no-install'     : ('_no_install',       self._lo_bool,     False, '0',   True),
    6768            '--host'           : ('_host',             self._lo_triplets, True,  None,  False),
    6869            '--build'          : ('_build',            self._lo_triplets, True,  None,  False),
     
    203204        print '--url url[,url]        : URL to look for source'
    204205        print '--no-download          : Disable the source downloader'
     206        print '--no-install           : Do not install the packages to the prefix'
    205207        print '--targetcflags flags   : List of C flags for the target code'
    206208        print '--targetcxxflags flags : List of C++ flags for the target code'
     
    240242
    241243    def post_process(self):
     244        # Must have a host
    242245        if self.defaults['_host'] == self.defaults['nil']:
    243246            raise error.general('host not set')
     247        # Handle the jobs for make
    244248        if '_ncpus' not in self.defaults:
    245249            raise error.general('host number of CPUs not set')
     
    249253        else:
    250254            self.defaults['_smp_mflags'] = self.defaults['nil']
     255        # Load user macro files
    251256        um = self.user_macros()
    252257        if um:
     
    256261            for m in um:
    257262                self.defaults.load(m)
     263        # Check the prefix permission
     264        if not self.no_install() and not path.iswritable(self.defaults['_prefix']):
     265            raise error.general('prefix is not writable: %s' % (path.host(self.defaults['_prefix'])))
    258266
    259267    def command(self):
     
    286294    def always_clean(self):
    287295        return self.opts['always-clean'] != '0'
     296
     297    def no_install(self):
     298        return self.opts['no-install'] != '0'
    288299
    289300    def user_macros(self):
  • source-builder/sb/path.py

    r8508944 r9994530  
    9090    return path[0] == '/'
    9191
     92def iswritable(path):
     93    return os.access(host(path), os.W_OK)
     94
    9295def mkdir(path):
    9396    path = host(path)
  • source-builder/sb/setbuilder.py

    r8508944 r9994530  
    311311                    else:
    312312                        raise
    313             if deps is None and not self.opts.get_arg('--no-install'):
     313            if deps is None and not self.opts.no_install():
    314314                for b in builds:
    315315                    self.install(b.name(),
     
    353353                    '--list-bsets':    'List available build sets',
    354354                    '--list-deps':     'List the dependent files.',
    355                     '--no-install':    'Do not install the packages to the prefix.',
    356355                    '--no-report':     'Do not create a package report.',
    357356                    '--report-format': 'The report format (text, html, asciidoc).',
Note: See TracChangeset for help on using the changeset viewer.