Ejemplo n.º 1
0
def main(filename):
    title, description = readFile(filename)

    c = BugspyConfig()
    bugzilla = Bugzilla(c.bugzillaurl, c.username, c.password)

    new_bug = {}
    new_bug["title"] = title
    new_bug["description"] = description
    new_bug["product"] = "Güvenlik / Security"

    print "Proessing bug: %s" % title
    print description

    component = "guvenlik/security"
    new_bug["component"] = component
    new_bug["version"]="---"
    print ''
    print "Which Pardus versions are affected?"
    print "1- Pardus 2009"
    print "2- Pardus Corporate2"
    print "3- Pardus 2011\n"

    affected_pardus_versions = []
    while 1:
        print "Append Pardus version [r=Revert, q=Quit]: ",
        answer = sys.stdin.readline()
        answer = answer[0]
        if answer == "q":
            if len(affected_pardus_versions) > 0:
                break
            else:
                print "You need to specify at least 1 version"
                continue

        if answer == "r":
            affected_pardus_versions = []
            continue

        if answer == "\n":
            print affected_pardus_versions
            continue

        if not answer in PARDUS_RELEASES.keys():
            print "Invalid entry"
        else:
            if PARDUS_RELEASES.get(answer) in affected_pardus_versions:
                print "This is already selected"
            else:
                affected_pardus_versions.append(PARDUS_RELEASES.get(answer))
                print affected_pardus_versions

    print ''
    print "Assign this bug to [Enter=default]: ",
    answer = sys.stdin.readline()
    if answer[0] != "\n":
        assigned_to = answer.replace("\n", "")
        print "Bug is assigned and CCed to: %s" % assigned_to
        new_bug["cc"] = assigned_to
    else:
        assigned_to = None
        print "Not assigning. Assignee is default."

    print ''
    print "Add CC [Enter=none]: ",
    answer = sys.stdin.readline()
    if answer[0] != "\n":
        cc_address = answer.replace("\n", "")
        print "Address CCed: %s" % cc_address
    else:
        cc_address = None

    print ''
    print "Make his bug private? [Y/n]: ",
    answer = sys.stdin.readline()
    if answer[0] == "y" or answer[0] == "\n":
        new_bug["security"] = 1
    elif answer[0] == "n":
        new_bug["security"] = 0

    print '\n!!!!!!!!!!!!!!!!!!!!!!!!!!!'
    print '!!!!!!!!!!!!!!!!!!!!!!!!!!!'
    print "Title     : %s" % title
    print "Component : %s" % component
    print "Affected  : %s" % ', '.join(affected_pardus_versions)
    print "Private?  : %s" % new_bug["security"]
    print "Assigned  : %s" % assigned_to
    print "CCed      : %s" % cc_address
    print description + "\n"

    print "\nWill file this bug [Y/n]: ",

    answer = sys.stdin.readline()
    if answer[0] == "y" or answer[0] == "Y" or answer[0] == "\n":
        print "Filing the bug..."

        bugzilla.login()
        bugno = bugzilla.new(**new_bug)

        if bugno:
            print "Success! http://bugs.pardus.org.tr/%s" % (bugno)
            print "   %s" % title

            # add each entry to files and file a bug
            for affected_version in affected_pardus_versions:
                bug_title = "%s - Pardus %s" % (title.replace("\n",""), affected_version)
                bug_desc = "Pardus %s is affected from bug #%s" % (affected_version, bugno)

                no = bugzilla.new(title=bug_title,
                                  description=bug_desc,
                                  security=1,
                                  component=component,
                                  status="ASSIGNED",
                                  assigned_to=assigned_to,
                                  cc=cc_address,
                                  version=affected_version,
                                  product="Güvenlik / Security",
                                  blocks=bugno)

                print "Success! http://bugs.pardus.org.tr/%s" % no
                print "   %s" % bug_title

                # FIXME: Add them to tracker file when we move to new tracker system
                #file = TRACKER_MAP.get(affected_version)
                #ini = SecurityINI(file)

                #Write the bug number to tracker
                package_name = bug_title.split(":")[0]
                enter_bug_to_tracker(str(affected_version), package_name, no)
Ejemplo n.º 2
0
def main(filename):
    title, description = readFile(filename)

    c = BugspyConfig()
    bugzilla = Bugzilla(c.bugzillaurl, c.username, c.password)

    new_bug = {}
    new_bug["title"] = title
    new_bug["description"] = description
    new_bug["product"] = "Güvenlik / Security"

    print "Proessing bug: %s" % title
    print description

    component = "guvenlik/security"
    new_bug["component"] = component
    new_bug["version"] = "---"
    print ''
    print "Which Pardus versions are affected?"
    print "1- Pardus 2009"
    print "2- Pardus Corporate2"
    print "3- Pardus 2011\n"

    affected_pardus_versions = []
    while 1:
        print "Append Pardus version [r=Revert, q=Quit]: ",
        answer = sys.stdin.readline()
        answer = answer[0]
        if answer == "q":
            if len(affected_pardus_versions) > 0:
                break
            else:
                print "You need to specify at least 1 version"
                continue

        if answer == "r":
            affected_pardus_versions = []
            continue

        if answer == "\n":
            print affected_pardus_versions
            continue

        if not answer in PARDUS_RELEASES.keys():
            print "Invalid entry"
        else:
            if PARDUS_RELEASES.get(answer) in affected_pardus_versions:
                print "This is already selected"
            else:
                affected_pardus_versions.append(PARDUS_RELEASES.get(answer))
                print affected_pardus_versions

    print ''
    print "Assign this bug to [Enter=default]: ",
    answer = sys.stdin.readline()
    if answer[0] != "\n":
        assigned_to = answer.replace("\n", "")
        print "Bug is assigned and CCed to: %s" % assigned_to
        new_bug["cc"] = assigned_to
    else:
        assigned_to = None
        print "Not assigning. Assignee is default."

    print ''
    print "Add CC [Enter=none]: ",
    answer = sys.stdin.readline()
    if answer[0] != "\n":
        cc_address = answer.replace("\n", "")
        print "Address CCed: %s" % cc_address
    else:
        cc_address = None

    print ''
    print "Make his bug private? [Y/n]: ",
    answer = sys.stdin.readline()
    if answer[0] == "y" or answer[0] == "\n":
        new_bug["security"] = 1
    elif answer[0] == "n":
        new_bug["security"] = 0

    print '\n!!!!!!!!!!!!!!!!!!!!!!!!!!!'
    print '!!!!!!!!!!!!!!!!!!!!!!!!!!!'
    print "Title     : %s" % title
    print "Component : %s" % component
    print "Affected  : %s" % ', '.join(affected_pardus_versions)
    print "Private?  : %s" % new_bug["security"]
    print "Assigned  : %s" % assigned_to
    print "CCed      : %s" % cc_address
    print description + "\n"

    print "\nWill file this bug [Y/n]: ",

    answer = sys.stdin.readline()
    if answer[0] == "y" or answer[0] == "Y" or answer[0] == "\n":
        print "Filing the bug..."

        bugzilla.login()
        bugno = bugzilla.new(**new_bug)

        if bugno:
            print "Success! http://bugs.pardus.org.tr/%s" % (bugno)
            print "   %s" % title

            # add each entry to files and file a bug
            for affected_version in affected_pardus_versions:
                bug_title = "%s - Pardus %s" % (title.replace(
                    "\n", ""), affected_version)
                bug_desc = "Pardus %s is affected from bug #%s" % (
                    affected_version, bugno)

                no = bugzilla.new(title=bug_title,
                                  description=bug_desc,
                                  security=1,
                                  component=component,
                                  status="ASSIGNED",
                                  assigned_to=assigned_to,
                                  cc=cc_address,
                                  version=affected_version,
                                  product="Güvenlik / Security",
                                  blocks=bugno)

                print "Success! http://bugs.pardus.org.tr/%s" % no
                print "   %s" % bug_title

                # FIXME: Add them to tracker file when we move to new tracker system
                #file = TRACKER_MAP.get(affected_version)
                #ini = SecurityINI(file)

                #Write the bug number to tracker
                package_name = bug_title.split(":")[0]
                enter_bug_to_tracker(str(affected_version), package_name, no)