Exemplo n.º 1
0
def gdb(args):
    prob = match_get_problem(args.MATCH, auth=args.auth)
    if not isinstance(prob, problem.Ccpp):
        which = 'This'
        if args.MATCH == 'last':
            which = 'Last'

        print('{} problem is not of a C/C++ type. Can\'t run gdb'
              .format(which))
        sys.exit(1)

    prob.chown()

    if args.debuginfo_install:
        di_install(args)

    cmd = config.GDB_CMD.format(di_path=config.DEBUGINFO_PATH)

    with remember_cwd():
        try:
            os.chdir(prob.path)
        except OSError:
            print(_('Permission denied: \'{}\'\n'
                    'If this is a system problem'
                    ' try running this command as root')
                  .format(prob.path))
            sys.exit(1)
        subprocess.call(cmd, shell=True)
Exemplo n.º 2
0
    def run(self, arguments):
        problems = match_get_problems(arguments.patterns,
                                      authenticate=arguments.authenticate,
                                      executables=arguments.executables,
                                      components=arguments.components,
                                      since=arguments.since,
                                      until=arguments.until,
                                      n_latest=arguments.n_latest,
                                      not_reported=arguments.not_reported)
        for problem in problems:
            if not isinstance(problem, Ccpp):
                print(
                    _('The problem is not of a C/C++ type. Can\'t install debuginfo'
                      ))
                sys.exit(1)

            problem.chown()

            with remember_cwd():
                try:
                    os.chdir(problem.path)
                except OSError:
                    print(
                        _('Permission denied: \'{}\'\n'
                          'If this is a system problem'
                          ' try running this command as root').format(
                              problem.path))
                    sys.exit(1)
                subprocess.call(config.DEBUGINFO_INSTALL_CMD, shell=True)
Exemplo n.º 3
0
Arquivo: cli.py Projeto: jfilak/abrt
def di_install(args):
    prob = match_get_problem(args.MATCH, auth=args.auth)
    if not isinstance(prob, problem.Ccpp):
        which = _("This")
        if args.MATCH == "last":
            which = _("Last")

        print(_("{} problem is not of a C/C++ type. Can't install debuginfo").format(which))
        sys.exit(1)

    prob.chown()

    with remember_cwd():
        try:
            os.chdir(prob.path)
        except OSError:
            print(
                _("Permission denied: '{}'\n" "If this is a system problem" " try running this command as root").format(
                    prob.path
                )
            )
            sys.exit(1)
        subprocess.call(config.DEBUGINFO_INSTALL_CMD, shell=True)
Exemplo n.º 4
0
 def test_remember_cwd(self):
     cwd = os.getcwd()
     with remember_cwd():
         os.chdir('/tmp')
     self.assertEqual(os.getcwd(), cwd)
Exemplo n.º 5
0
 def test_remember_cwd(self):
     cwd = os.getcwd()
     with remember_cwd():
         os.chdir('/tmp')
     self.assertEqual(os.getcwd(), cwd)