Exemple #1
0
def main():
    # Script options
    (options, args) = parseOpts()

    # Get the API root, default to bugzilla.mozilla.org
    API_ROOT = os.environ.get('BZ_API_ROOT',
                              'https://bugzilla.mozilla.org/bzapi/')

    # Authenticate
    username, password = get_credentials()

    # Sample run
    bugmon = BugMonitor(API_ROOT, username, password, options.repobase, options)

    for bug_id in args:
      print "====== Analyzing bug " + str(bug_id) + " ======"
      try:
        if options.verifyfixed:
          bugmon.verifyFixedBug(bug_id, options.updatebug)
        elif options.confirm:
          bugmon.confirmOpenBug(bug_id, options.updatebug, options.updatebugpositive)
        elif options.process:
          bugmon.processCommand(bug_id)
        else:
          raise "Unsupported action requested"
          #result = bugmon.reproduceBug(bug_id)
      except BugException as b:
        print "Cannot process bug: " + str(b)
        print traceback.format_exc()
      except Exception as e:
        print "Caught exception: " + str(e)
        print traceback.format_exc()
Exemple #2
0
def main():
    # Script options
    (options, args) = parseOpts()

    # Get the API root, default to bugzilla.mozilla.org
    API_ROOT = os.environ.get('BZ_API_ROOT',
                              'https://api-dev.bugzilla.mozilla.org/latest/')

    # Authenticate
    username, password = get_credentials()

    # Sample run
    bugmon = BugMonitor(API_ROOT, username, password, options.repobase, options)

    for bug_id in args:
      print "====== Analyzing bug " + str(bug_id) + " ======"
      try:
        if options.verifyfixed:
          bugmon.verifyFixedBug(bug_id, options.updatebug)
        elif options.confirm:
          bugmon.confirmOpenBug(bug_id, options.updatebug, options.updatebugpositive)
        elif options.process:
          bugmon.processCommand(bug_id)
        else:
          raise "Unsupported action requested"
          #result = bugmon.reproduceBug(bug_id)
      except BugException as b:
        print "Cannot process bug: " + str(b)
      except Exception as e:
        print "Caught exception: " + str(e)
        print traceback.format_exc()
Exemple #3
0
 def __init__(self):
     if API_ROOT is None:
         raise "Please set the API_ROOT environment variable"
     if BZ_USERNAME && BZ_PASSWORD:
         self.username, self.password = BZ_USERNAME, BZ_PASSWORD
     else:
         username, password = get_credentials()
         self.username, self.password = username, password
Exemple #4
0
def main():

    # Script options
    parser = argparse.ArgumentParser(description='Submit Bugzilla attachments')

    parser.add_argument('bug_id',
                        type=int,
                        metavar='BUG',
                        help='Bug number')

    parser.add_argument('filename',
                        metavar='FILE',
                        help='File to upload')

    parser.add_argument('--description',
                        help='Attachment description',
                        required=True)

    parser.add_argument('--patch',
                        action='store_true',
                        help='Is this a patch?')

    parser.add_argument('--reviewer',
                        help='Bugzilla name of someone to r?')

    parser.add_argument('--comment',
                        help='Comment for the attachment')

    parser.add_argument('--content_type',
                        choices=FILE_TYPES,
                        help="File's content_type")

    args = parser.parse_args()

    if args.content_type:
        args.content_type = FILE_TYPES[args.content_type]

    # Get the API root, default to bugzilla.mozilla.org
    API_ROOT = os.environ.get('BZ_API_ROOT',
                              'https://api-dev.bugzilla.mozilla.org/latest/')

    # Authenticate
    username, password = get_credentials()

    # Load the agent
    bz = AttachmentAgent(API_ROOT, username, password)

    # Attach the file
    bz.attach(**dict(args._get_kwargs()))
Exemple #5
0
def main():

    parser = argparse.ArgumentParser(description='Submit Bugzilla attachments')
    parser.add_argument('bug_id', type=int, metavar='BUG', help='Bug number')
    parser.add_argument('filename', metavar='FILE', help='File to upload')

    parser.add_argument('--description', help='Attachment description',
                        required=True)
    parser.add_argument('--patch', action='store_true',
                        help='Is this a patch?')
    parser.add_argument('--reviewer', help='Bugzilla name of someone to r?')
    parser.add_argument('--comment', help='Comment for the attachment')

    parser.add_argument('--content_type', choices=FILE_TYPES,
                        help="File's content_type")

    args = parser.parse_args()

    if args.content_type:
        args.content_type = FILE_TYPES[args.content_type]

    username, password = get_credentials()

    Agent(username, password).attach(**dict(args._get_kwargs()))
Exemple #6
0
        (key,val) = pair.split("=")
        if key != "list_id":
            d[key]=urllib.unquote(val)
    
    d["include_fields"] = "_default, attachments, history"

    return d

if __name__ == '__main__':

    query = sys.argv[1]
    
    if query == None:
        sys.exit("Please specify a query")
    
    username, password = get_credentials()
    
    # Load our agent for BMO
    bmo = BMOAgent(username, password)
    
    # Get the buglist(s)
    # import the query
    buglist = []

    if os.path.exists(query):
        info = {}
        execfile(query, info)
        query_name = info['query_name']
        if info.has_key('query_url'):
            buglist = bmo.get_bug_list(query_url_to_dict(info['query_url'])) 
        else:
#   CC list

# Create mapping data structures.
bugIdMap = {}
attachmentIdMap = {}


def mapIds(text):
    #bugPattern = /(bug\s#?|show_bug\.cgi\?id=)(\d+)/gi;
    #attachmentPattern = /(attachment\s#?)(\d+)/gi;
    #sourceUrlPattern = /bugzilla\.instantbird\.(?:org|com)/gi;
    return text


# We can use "None" for both instead to not authenticate
username, password = get_credentials()
username2, password2 = get_credentials("bmo")

# If you're stupid and type in the wrong password...
#import keyring
#keyring.set_password("bugzilla", username, "")

# Load our agent for BMO
bio = BugzillaAgent("https://api-dev.bugzilla.mozilla.org/instantbird/",
                    username, password)
bioUrl = "https://bugzilla.instantbird.org"
#bmo = BMOAgent(username, password)
bmo = CommentAgent("https://api-dev.bugzilla.mozilla.org/test/latest/",
                   username2, password2)

# Set whatever REST API options we want
    parser.add_argument("--days-since-comment", dest="days_since_comment",
            help="threshold to check comments against to take action based on days since comment")
    parser.add_argument("--verbose", dest="verbose", action="store_true",
            help="turn on verbose output")

    options, args = parser.parse_known_args()
    
    if options.queries == []:
        parser.error("Need to provide at least one query to run")
    
    if options.show_summary:
        print "\n *****ATTN***** Bug Summaries will be shown in output, be careful when sending emails.\n"

    if not options.username:
        # We can use "None" for both instead to not authenticate
        username, password = get_credentials()
    else:
        username, password = get_credentials(options.username)
    try:
        int(options.days_since_comment)
    except:
        if options.days_since_comment != None:
            parser.error("Need to provide a number for days since last comment value")

    # Load our agent for BMO
    bmo = BMOAgent(username, password)
    
    # Get the buglist(s)
    collected_queries = {}
    for query in options.queries:
        # import the query