Пример #1
0
    def _run(self, config, cmd_options, cmd_args):
        require_box(config)
        box = config.box

        regexps = [re.compile(pattern + '$', re.IGNORECASE) for pattern in cmd_options.exclude]

        to_remove = []
        for pkg in box.packages():
            if pkg.enabled: 
                continue
            for regexp in regexps:
                if regexp.match(pkg.name):
                    break
            else: # no exclude regexp matched
                to_remove.append(pkg)

        if not to_remove:
            log.info('No packages to remove')
            return 0

        print 'The following packages will be removed:'
        for pkg in to_remove:
            print '\t%s' % pkg.name
        answer = raw_input('Are you sure [y/N]? ')
        if answer.lower() != 'y':
            return 0
        for pkg in to_remove:
            box.disable_package(pkg, remove=True)
Пример #2
0
    def _run(self, config, cmd_options, cmd_args):
        require_box(config)
        box = config.box

        regexps = [re.compile(pattern + '$', re.IGNORECASE) for pattern in cmd_options.exclude]

        to_remove = []
        for pkg in box.packages():
            if pkg.enabled: 
                continue
            for regexp in regexps:
                if regexp.match(pkg.name):
                    break
            else: # no exclude regexp matched
                to_remove.append(pkg)

        if not to_remove:
            log.info('No packages to remove')
            return 0

        print 'The following packages will be removed:'
        for pkg in to_remove:
            print '\t%s' % pkg.name
        answer = raw_input('Are you sure [y/N]? ')
        if answer.lower() != 'y':
            return 0
        for pkg in to_remove:
            box.disable_package(pkg, remove=True)
                
Пример #3
0
    def _run(self, config, cmd_options, cmd_args):
        self._require_args(cmd_args, 1)
        require_box(config)

        patterns = cmd_args

        for package in config.box.packages(matching=patterns):
            config.box.enable_package(package)
Пример #4
0
    def _run(self, config, cmd_options, cmd_args):
        self._require_args(cmd_args, 1)
        require_box(config)

        patterns = cmd_args

        for package in config.box.packages(matching=patterns):
            config.box.enable_package(package)
Пример #5
0
    def _run(self, config, cmd_options, cmd_args):
        self._require_args(cmd_args, 1)
        require_box(config)

        try:
            for tarball in cmd_args:
                autobuild_(config.box, tarball, cmd_options.configure_options, cmd_options.keep)
        except UnsupportedPath, exc:
            raise UserError(str(exc))
Пример #6
0
    def _run(self, config, cmd_options, cmd_args):
        self._require_args(cmd_args, 1)
        require_box(config)

        for sourcedir in cmd_args:
            sd = SourceDir(sourcedir)
            if cmd_options.clean_before:
                sd.clean()
            sd.build(config.box, cmd_options.suffix)
            if cmd_options.test:
                sd.unittest()
Пример #7
0
    def _run(self, config, cmd_options, cmd_args):
        self._require_args(cmd_args, 1)
        require_box(config)

        for sourcedir in cmd_args:
            sd = SourceDir(sourcedir)
            if cmd_options.clean_before:
                sd.clean()
            sd.build(config.box, cmd_options.suffix)
            if cmd_options.test:
                sd.unittest()
Пример #8
0
    def _run(self, config, cmd_options, cmd_args):
        self._require_args(cmd_args, 0, 0)
        require_box(config)

        box_name = '(%s)' % config.box.name
        shell_prompt = r'\[\033[01;31m\]%(box_name)s\[\033[01;32m\] \u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' % locals()

        cur_box = get_current_box()
        if cur_box and cur_box == config.box:
            # Already inside the box env, just execute a shell with the new prompt
            new_env = dict(os.environ)
            new_env['PS1'] = shell_prompt
            call(['bash', '-norc', '-noprofile'], env=new_env)
        else:
            # Have to set the correct environment, so execute a shell using the env script
            # XXX(ot): does this spawn two bashs?
            call(['bash', config.box.env_script, 'PS1="%s"' % shell_prompt, 'bash', '-norc', '-noprofile'])
Пример #9
0
    def _run(self, config, cmd_options, cmd_args):
        self._require_args(cmd_args, 0, 0)
        require_box(config)

        box_name = '(%s)' % config.box.name
        shell_prompt = r'\[\033[01;31m\]%(box_name)s\[\033[01;32m\] \u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' % locals(
        )

        cur_box = get_current_box()
        if cur_box and cur_box == config.box:
            # Already inside the box env, just execute a shell with the new prompt
            new_env = dict(os.environ)
            new_env['PS1'] = shell_prompt
            call(['bash', '-norc', '-noprofile'], env=new_env)
        else:
            # Have to set the correct environment, so execute a shell using the env script
            # XXX(ot): does this spawn two bashs?
            call([
                'bash', config.box.env_script,
                'PS1="%s"' % shell_prompt, 'bash', '-norc', '-noprofile'
            ])
Пример #10
0
    def _run(self, config, cmd_options, cmd_args):
        require_box(config)

        fmt = '%-30s| %-20s| %-10s| %-10s|'

        print
        print fmt % ('PACKAGE', 'NAME', 'VERSION', 'STATUS')
        print

        if len(cmd_args) == 0:
            patterns = None
        else:
            patterns = cmd_args

        for package in config.box.packages(matching=patterns):
            if package.enabled:
                pkg_status = 'enabled'
            else:
                pkg_status = 'disabled'
            print fmt % (package.name, package.app_name, package.app_version,
                         pkg_status)
        print
Пример #11
0
    def _run(self, config, cmd_options, cmd_args):
        require_box(config)
        
        fmt = '%-30s| %-20s| %-10s| %-10s|'

        print
        print fmt % ('PACKAGE', 'NAME', 'VERSION', 'STATUS')
        print 

        if len(cmd_args) == 0:
            patterns = None
        else:
            patterns = cmd_args 

        for package in config.box.packages(matching=patterns):
            if package.enabled:
                pkg_status = 'enabled'
            else:
                pkg_status = 'disabled'
            print fmt % (package.name,
                         package.app_name,
                         package.app_version,
                         pkg_status)
        print
Пример #12
0
    def _run(self, config, cmd_options, cmd_args):
        self._require_args(cmd_args, 0, 0)

        require_box(config)
        config.box.sync()
Пример #13
0
    def _run(self, config, cmd_options, cmd_args):
        self._require_args(cmd_args, 0, 0)

        require_box(config)
        config.box.sync()