Changeset 467cace in rtems-source-builder


Ignore:
Timestamp:
May 20, 2014, 11:55:51 AM (5 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, 4.9, master
Children:
4a315d3
Parents:
b09fde0
Message:

sb: Clean up the bootstrap error handling.

File:
1 edited

Legend:

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

    rb09fde0 r467cace  
    4848        f.close()
    4949    except IOError, err:
    50         raise error.general('error reading: %s' % (file))
     50        raise error.general('reading: %s' % (file))
    5151    return True in matches
    5252
     
    5959        self.cmd = cmd
    6060        self.cwd = cwd
     61        self.result = None
    6162
    6263    def runner(self):
     
    8586        self.exit_code = 0
    8687        try:
    87             self.output = subprocess.check_output(self.cmd, cwd = self.cwd)
    88         except subprocess.CalledProcessError, cpe:
    89             self.exit_code = cpe.returncode
    90             self.output = cpe.output
    91         except OSError, ose:
    92             raise error.general('bootstrap failed: %s in %s: %s' % \
    93                                 (' '.join(self.cmd), self.cwd, (str(ose))))
     88            try:
     89                self.output = subprocess.check_output(self.cmd, cwd = self.cwd)
     90            except subprocess.CalledProcessError, cpe:
     91                self.exit_code = cpe.returncode
     92                self.output = cpe.output
     93            except OSError, ose:
     94                raise error.general('bootstrap failed: %s in %s: %s' % \
     95                                        (' '.join(self.cmd), self.cwd, (str(ose))))
     96            except KeyboardInterrupt:
     97                pass
     98            except:
     99                raise
     100        except:
     101            self.result = sys.exc_info()
    94102        self.end_time = datetime.datetime.now()
    95103
     
    100108    def is_alive(self):
    101109        return self.thread and self.thread.is_alive()
     110
     111    def reraise(self):
     112        if self.result is not None:
     113            raise self.result[0], self.result[1], self.result[2]
    102114
    103115class autoreconf:
     
    131143                b.close()
    132144            except IOError, err:
    133                 raise error.general('error writing: %s' % (acinclude))
     145                raise error.general('writing: %s' % (acinclude))
    134146
    135147    def is_alive(self):
     
    138150    def post_process(self):
    139151        if self.command is not None:
     152            self.command.reraise()
    140153            if self.command.exit_code != 0:
    141154                raise error.general('error: autoreconf: %s' % (' '.join(self.command.cmd)))
     
    149162                        t.close()
    150163                    except IOError, err:
    151                         raise error.general('error writing: %s' % (stamp_h))
     164                        raise error.general('writing: %s' % (stamp_h))
    152165
    153166def generate(topdir, jobs):
     
    197210                p.close()
    198211            except IOError, err:
    199                 raise error.general('error writing: %s' % (self.preinstall))
     212                raise error.general('writing: %s' % (self.preinstall))
    200213
    201214def preinstall(topdir, jobs):
Note: See TracChangeset for help on using the changeset viewer.