示例#1
0
def _checkForUpdates():
    """
        Check if there are any updates for this package.
    """
    from ToolBOSCore.CIA.PatchSystem import PatchSystem

    logging.debug('checking for updates')

    oldDebugLevel = Any.getDebugLevel()
    Any.setDebugLevel(1)

    patcher = PatchSystem()
    result = patcher.run(dryRun=True)

    Any.setDebugLevel(oldDebugLevel)

    if len(result) > 0:
        logging.info('')
        logging.info('\033[7;37m\033[1;31m' + ' ' * 60 + '\033[0m')
        logging.info(
            '\033[1;31mupdates are available for this package:\033[0m')

        for patch in result:
            logging.info('  - %s', patch[0])

        logging.info('')
        logging.info('')
        logging.info(
            '\033[0;31mYou may apply them using "BST.py --upgrade".\033[0m')
        logging.info('\033[7;37m\033[1;31m' + ' ' * 60 + '\033[0m')
        logging.info('')
    else:
        logging.debug('no need to patch')
class UpdateDialog( QWidget, object ):

    def __init__( self, parent=None ):
        super( UpdateDialog, self ).__init__( parent )

        self._patcher = PatchSystem()
        neededPatches = self._patcher.run( dryRun=True )

        self._listLayout = QVBoxLayout()

        for patch in neededPatches:

            descr     = patch[0]
            self._listLayout.addWidget( QLabel( '* ' + descr ) )

        self._listWidget = QGroupBox( 'Patches available:' )
        self._listWidget.setLayout( self._listLayout )

        self._applyAllButton = QPushButton( '&Apply all' )
        self._applyAllButton.pressed.connect( self._applyAllUpdate )

        self._closeButton    = QPushButton( '&Close' )
        self._closeButton.pressed.connect( self.close )

        self._submitLayout = QHBoxLayout()
        self._submitLayout.setContentsMargins( 0, 0, 0, 0 )
        self._submitLayout.addStretch( 1 )
        self._submitLayout.addWidget( self._applyAllButton )
        self._submitLayout.addWidget( self._closeButton )

        self._submitWidget = QWidget()
        self._submitWidget.setLayout( self._submitLayout )

        self._dialogLayout = QVBoxLayout()
        self._dialogLayout.addWidget( self._listWidget )
        self._dialogLayout.addWidget( self._submitWidget )

        self.setLayout( self._dialogLayout )
        self.setWindowIcon( IconProvider.getIcon( 'software-update-available' ) )
        self.setWindowTitle( 'Package Updates' )
        self.setFixedSize( self.sizeHint() )

        if not neededPatches:
            self._listLayout.addWidget( QLabel( "No need to apply the patches. Already Updated." ))
            self._applyAllButton.setEnabled( False )
            self._applyAllButton.setText( 'Apply' )


    def _applyAllUpdate( self ):

        self._patcher.run()
        logging.info( "Applying all patches" )
        self._applyAllButton.setEnabled( False )
        self._applyAllButton.setText( 'Patch Applied' )
示例#3
0
        def run(self):

            # suppress dry-run patching output
            oldDebugLevel = Any.getDebugLevel()
            Any.setDebugLevel(1)

            try:
                patchesAvailable = PatchSystem().run(dryRun=True)
            except AssertionError as e:
                # e.g. templates not installed, let's gnore this case
                logging.debug(e)
                patchesAvailable = False

            Any.setDebugLevel(oldDebugLevel)

            if patchesAvailable:
                logging.debug('patches available')
                self.updatesAvailable.emit()
示例#4
0
        elif quality:
            _runCheckRoutineDialog()

        else:
            _runZenBuildModeGUI()

        sys.exit(0)

    if setup or noArgs:
        if not bst.configure():
            sys.exit(-2)

    if upgrade:
        from ToolBOSCore.CIA.PatchSystem import PatchSystem

        patcher = PatchSystem()
        patcher.run()

    if build or noArgs:
        if not bst.compile():
            sys.exit(-3)

    if shellfiles:
        bst.makeShellfiles()

    if test:
        if not bst.runUnittest():
            sys.exit(-4)

    if documentation:
        bst.makeDocumentation()
示例#5
0
    def upgrade( self ):
        from ToolBOSCore.CIA.PatchSystem import PatchSystem

        patcher = PatchSystem()
        patcher.run()