Beispiel #1
0
    def test_rebuild_modules(self):
        '''system.rebuild_modules()'''

        self.mock_system_portage_emerge()

        system.rebuild_modules()

        self.mocked_system_portage_emerge.assert_called_once_with(options = [ '-v' ], package = '@module-rebuild')
Beispiel #2
0
def run():
    '''Main execution function for upkern.'''

    p = ARGUMENTS.parse_args()

    logging.basicConfig(level = getattr(logging, p.level.upper()))

    sources = Sources(name = p.name)

    sources.emerge(force = p.force)

    sources.prepare(configuration = p.configuration)
    sources.configure(configurator = p.configurator, accept_defaults = p.yes)

    if p.time:
        start = datetime.datetime.now()

    sources.build()

    if p.time:
        delta = datetime.datetime.now() - start

    if p.module_rebuild:
        rebuild_modules()

    sources.install()

    initramfs = None

    if p.initramfs:
        initramfs = InitialRAMFileSystem(p.initramfs_preparer)
        initramfs.configure(*p.initramfs_options)

        initramfs.build()

        initramfs.install()

    bootloader = Bootloader()
    bootloader.configure(sources = sources, kernel_options = p.kernel_options, initramfs = initramfs)

    bootloader.build()

    bootloader.install()

    logger.info(
            'The kernel, %s, has been successfully installed.  Please, check ' \
            'that all configuration files are installed correctly and the ' \
            'bootloader is configured correctly',
            sources.binary_name
            )

    if p.time:
        logger.info('The kernel\'s build time was %s', str(delta))