Esempio n. 1
0
def handle_wnpp(package, bts, ui, fromaddr, timeout, online=True, http_proxy=None):
    short_desc = body = ''
    headers = []
    pseudos = []
    query = True

    tag = ui.menu('What sort of request is this?  (If none of these '
                  'things mean anything to you, or you are trying to report '
                  'a bug in an existing package, please press Enter to '
                  'exit reportbug.)', {
        'O' :
        "The package has been `Orphaned'. It needs a new maintainer as soon as possible.",
        'RFA' :
        "This is a `Request for Adoption'. Due to lack of time, resources, interest or something similar, the current maintainer is asking for someone else to maintain this package. They will maintain it in the meantime, but perhaps not in the best possible way. In short: the package needs a new maintainer.",
        'RFH' :
        "This is a `Request For Help'. The current maintainer wants to continue to maintain this package, but they needs some help to do this, because their time is limited or the package is quite big and needs several maintainers.",
        'ITP' :
        "This is an `Intent To Package'. Please submit a package description along with copyright and URL in such a report.",
        'RFP' :
        "This is a `Request For Package'. You have found an interesting piece of software and would like someone else to maintain it for Debian. Please submit a package description along with copyright and URL in such a report.",
        }, 'Choose the request type: ', empty_ok=True)
    if not tag:
        ui.long_message('To report a bug in a package, use the name of the package, not wnpp.\n')
        raise SystemExit

    # keep asking for package name until one is entered
    package = ""

    while not package:
        if tag in ('RFP', 'ITP'):
            prompt = 'Please enter the proposed package name: '
        else:
            prompt = 'Please enter the package name: '
        package = ui.get_string(prompt)

    ui.log_message('Checking status database...\n')
    info = utils.get_package_status(package, avail=True)
    available = info[1]

    severity = 'normal'
    if tag in ('ITP', 'RFP'):
        if available and (not online or checkversions.check_available(
            package, '0', timeout, http_proxy=http_proxy)):
            if not ui.yes_no(
                ('A package called %s already appears to exist (at least on '
                 'your system); continue?' % package),
                'Ignore this problem and continue.  If you have '
                'already locally created a package with this name, this '
                'warning message may have been produced in error.',
                'Exit without filing a report.', default=0):
                sys.exit(1)

        severity = 'wishlist'

        # keep asking for short description until one is entered
        short_desc = ""

        while not short_desc:
            short_desc = ui.get_string(
                'Please briefly describe this package; this should be an '
                'appropriate short description for the eventual package: ')

        if tag == 'ITP':
            headers.append('X-Debbugs-CC: [email protected]')
            pseudos.append(u'Owner: %s' % fromaddr.decode('utf-8', 'replace'))
            ui.log_message('Your report will be carbon-copied to debian-devel, '
                           'per Debian policy.\n')

        body = itp_template % vars()
    elif tag in ('O', 'RFA', 'RFH'):
        severity = 'normal'
        query = False
        if not available:
            info = utils.get_source_package(package)
            if info:
                info = utils.get_package_status(info[0][0])

        if not info:
            cont = ui.select_options(
                "This package doesn't appear to exist; continue?",
                'yN', {'y': 'Ignore this problem and continue.',
                       'n': 'Exit without filing a report.' })
            if cont == 'n':
                sys.exit(1)
            short_desc = long_desc = ''
        else:
            short_desc = info[11] or ''
            package = info[12] or package
            long_desc = info[13]

        if tag == 'O' and info and info[9] in \
               ('required', 'important', 'standard'):
            severity = 'important'

        if tag == 'RFH':
            headers.append('X-Debbugs-CC: [email protected]')
            ui.log_message('Your request will be carbon-copied to debian-devel, '
                           'per Debian policy.\n')

        if long_desc:
            orphstr = 'intend to orphan'
            if tag == 'RFA':
                orphstr = 'request an adopter for'
            elif tag == 'RFH':
                orphstr = 'request assistance with maintaining'

            body = ('I %s the %s package.\n\n'
                    'The package description is:\n') % (orphstr, package)
            body = body + long_desc + '\n'

    if short_desc:
        subject = '%s: %s -- %s' % (tag, package, short_desc)
    else:
        subject = '%s: %s' % (tag, package)

    return (subject, severity, headers, pseudos, body, query)
Esempio n. 2
0
def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http_proxy=None):
    body = ''
    headers = []
    pseudos = []
    query = True
    archs = None
    version = None

    tag = ui.menu('What sort of request is this?  (If none of these '
                  'things mean anything to you, or you are trying to report '
                  'a bug in an existing package, please press Enter to '
                  'exit reportbug.)', {
        'binnmu':           "binNMU requests",
        'britney':          "testing migration script bugs",
        'transition':       "transition tracking",
        'unblock':          "unblock requests",
        'freeze-exception': "Freeze exceptions",
        'opu':              "oldstable proposed updates requests",
        'pu':               "stable proposed updates requests",
        'rm':               "Stable/Testing removal requests",
        'other' :           "None of the above",
        }, 'Choose the request type: ', empty_ok=True)
    if not tag:
        ui.long_message('To report a bug in a package, use the name of the package, not release.debian.org.\n')
        raise SystemExit

    severity = 'normal'
    if tag == 'other':
        return

    if tag == 'britney':
        subject_britney = ui.get_string('Please enter the subject of the bug report: ')
        if not subject_britney:
            ui.long_message('No subject specified, exiting')
            sys.exit(1)
    else:
        # package checks code
        prompt  = 'Please enter the name of the package: '
        package = ui.get_string(prompt)
        if not package:
            ui.log_message('You seem to want to report a generic bug.\n')
            return

        ui.log_message('Checking status database...\n')
        info = utils.get_package_status(package)
        available = info[1]

        query = False
        if not available:
            info = utils.get_source_package(package)
            if info:
                info = utils.get_package_status(info[0][0])

        if not info:
            cont = ui.select_options(
                "This package doesn't appear to exist; continue?",
                'yN', {'y': 'Ignore this problem and continue.',
                       'n': 'Exit without filing a report.' })
            if cont == 'n':
                sys.exit(1)
        else:
            package = info[12] or package

    if tag in ('binnmu', 'unblock', 'freeze-exception', 'opu', 'pu', 'rm'):
        # FIXME: opu/pu/rm should lookup the version elsewhere
        version = info and info[0]
        if version:
            cont = ui.select_options(
                "Latest version seems to be %s, is this the proper one ?" % (version),
                "Yn", {'y': "This is the correct version",
                       'n': "Enter the proper vesion"})
            if cont == 'n':
                version = None
        if not version:
            version = ui.get_string('Please enter the version of the package: ')
            if not version:
                ui.log_message("A version is required for action %s, not sending bug\n" % (tag))
                return

    if tag in ('binnmu', 'rm'):
        partial = ui.select_options(
            "Is this request for specific architectures?",
            'yN', {'y': 'This is a partial (specific architectures) removal.',
                   'n': 'This removal is for all architectures.' })
        if partial == 'y':
            if tag == 'rm':
                ui.long_message('The proper way to request a partial removal '
                   'from testing is to file a partial removal from unstable: '
                   'this way the package for the specified architectures will '
                   'be automatically removed from testing too. Please re-run '
                   'reportbug against ftp.debian.org package.')
                raise SystemExit
            prompt = 'Please enter the arch list separated by a space: '
            archs = ui.get_string(prompt)
            if not archs:
                ui.long_message('No architecture specified, skipping...')

    pseudos.append("User: [email protected]")
    pseudos.append("Usertags: %s" % (tag))

    if tag == 'binnmu':
        reason  = ui.get_string("binNMU changelog entry: ")
        subject = "nmu: %s_%s" % (package, version)
        body    = "nmu %s_%s . %s . -m \"%s\"\n" % (package, version, archs or "ALL", reason)
    elif tag == 'transition':
        subject = 'transition: %s' % (package)
        body    = '(please explain about the transition: impacted packages, reason, ...)\n'
    elif tag == 'britney':
        subject = subject_britney
        body = ''
    elif tag == 'unblock' or tag == 'freeze-exception':
        subject = 'unblock: %s/%s' % (package, version)
        body    = textwrap.dedent(u"""\
                Please unblock package %s

                (explain the reason for the unblock here)

                unblock %s/%s
                """ % (package, package, version))
    elif tag == 'pu' or tag == 'opu':
        subject = '%s: package %s/%s' % (tag, package, version)
        body    = '(please explain the reason for this update here)\n'
    elif tag == 'rm':
        subject = 'RM: %s/%s' % (package, version)
        body = '(explain the reason for the removal here)\n'

    return (subject, severity, headers, pseudos, body, query)
Esempio n. 3
0
def handle_debian_ftp(package, bts, ui, fromaddr, timeout, online=True, http_proxy=None):
    body = reason = archs = ''
    suite = 'unstable'
    headers = []
    pseudos = []
    query = True

    tag = ui.menu('What sort of request is this?  (If none of these '
                  'things mean anything to you, or you are trying to report '
                  'a bug in an existing package, please press Enter to '
                  'exit reportbug.)', {
        'ROM' :
        "Package removal - Request Of Maintainer.",
        'RoQA' :
        "Package removal - Requested by the QA team.",
        'ROP' :
        "Package removal - Request of Porter.",
        'ROSRM' :
        "Package removal - Request of Stable Release Manager.",
        'NBS' :
        "Package removal - Not Built [by] Source.",
        'NPOASR' :
        "Package removal - Never Part Of A Stable Release.",
        'NVIU' :
        "Package removal - Newer Version In Unstable.",
        'ANAIS' :
        "Package removal - Architecture Not Allowed In Source.",
        'ICE' :
        "Package removal - Internal Compiler Error.",
        'override' :
        "Change override request.",
        'other' :
        "Not a package removal request, report other problems.",
        }, 'Choose the request type: ', empty_ok=True)
    if not tag:
        ui.long_message('To report a bug in a package, use the name of the package, not ftp.debian.org.\n')
        raise SystemExit

    severity = 'normal'
    if tag == 'other':
        return
    else:
        prompt = 'Please enter the name of the package: '
        package = ui.get_string(prompt)
        if not package:
            ui.log_message('You seem to want to report a generic bug, not request a removal\n')
            return

        ui.log_message('Checking status database...\n')
        info = utils.get_package_status(package)
        available = info[1]

        query = False
        if not available:
            info = utils.get_source_package(package)
            if info:
                info = utils.get_package_status(info[0][0])

        if not info:
            cont = ui.select_options(
                "This package doesn't appear to exist; continue?",
                'yN', {'y': 'Ignore this problem and continue.',
                       'n': 'Exit without filing a report.' })
            if cont == 'n':
                sys.exit(1)
        else:
            package = info[12] or package
            # get package section and priority, for override
            section, priority = info[16], info[10]

    if tag == 'override':
        # we handle here the override change request
        new_section = ui.menu('Select the new section', {
                'admin': "", 'cli-mono': "", 'comm': "", 'database': "",
                'debian-installer': "", 'debug': "", 'devel': "", 'doc': "",
                'editors': "", 'electronics': "", 'embedded': "", 'fonts': "",
                'games': "", 'gnome': "", 'gnu-r': "", 'gnustep': "",
                'graphics': "", 'hamradio': "", 'haskell': "", 'httpd': "",
                'interpreters': "", 'java': "", 'kde': "", 'kernel': "",
                'libdevel': "", 'libs': "", 'lisp': "", 'localization': "",
                'mail': "", 'math': "", 'misc': "", 'net': "",
                'news': "", 'ocaml': "", 'oldlibs': "", 'otherosfs': "",
                'perl': "", 'php': "", 'python': "", 'ruby': "",
                'science': "", 'shells': "", 'sound': "", 'tex': "",
                'text': "", 'utils': "", 'vcs': "", 'video': "",
                'web': "", 'x11': "", 'xfce': "", 'zope': "",
        }, 'Choose the section: ', default=section, empty_ok=True)
        if not new_section:
            new_section = section

        new_priority = ui.menu('Select the new priority', {
                'required': "",
                'important': "",
                'standard': "",
                'optional': "",
                'extra': "",
        }, 'Choose the priority: ', default=priority, empty_ok=True)
        if not new_priority:
            new_priority = priority

        if new_section == section and new_priority == priority:
            ui.long_message("You didn't change section nor priority, exiting...")
            sys.exit(1)

        arch_section = ui.menu('Is this request for an archive section other than "main"?', {
            'main' : "",
            'contrib' : "",
            'non-free' : "",
        }, 'Choose the archive section: ', default='main', empty_ok=True)
        if not arch_section:
           arch_section = 'main'

        if arch_section != 'main':
            subject = "override: %s:%s/%s %s" % (package, arch_section, new_section, new_priority)
        else:
            subject = "override: %s:%s/%s" % (package, new_section, new_priority)
        body = "(Describe here the reason for this change)"
    else:
        # we handle here the removal requests
        suite = ui.menu('Is the removal to be done in a suite other than'
                        ' "unstable"?  Please press Enter for "unstable"', {
            'oldstable' : "Old stable.",
            'oldstable-proposed-updates' : "Old stable proposed updates.",
            'stable' : "Stable.",
            'stable-proposed-updates' : "Stable proposed updates.",
            'testing' : "Testing only (NOT unstable)",
	    'testing-proposed-updates' : "Testing proposed updates",
            'experimental' : "Experimental.",
        }, 'Choose the suite: ', empty_ok=True)
        if not suite:
            suite = 'unstable'

        if suite not in ('testing', 'unstable', 'experimental'):
            headers.append('X-Debbugs-CC: [email protected]')
            ui.log_message('Your report will be carbon-copied to debian-release.\n')

        why = 'Please enter the reason for removal: '
        reason = ui.get_string(why)
        if not reason: return

        partial = ui.select_options(
            "Is this removal request for specific architectures?",
            'yN', {'y': 'This is a partial (specific architectures) removal.',
                   'n': 'This removal is for all architectures.' })
        if partial == 'y':
            prompt = 'Please enter the arch list separated by a space: '
            archs = ui.get_string(prompt)
            if not archs:
                ui.long_message('Partial removal requests must have a list of architectures.\n')
                raise SystemExit


        if suite == 'testing' and archs:
            ui.long_message('Partial removal for testing; forcing suite to '
                            '\'unstable\', since it\'s the proper way to do that.')
            suite = 'unstable'
            body = '(please explain the reason for the removal here)\n\n' +\
                'Note: this was a request for a partial removal from testing, ' +\
                'converted in one for unstable'

        if archs:
            if suite != 'unstable':
                subject = 'RM: %s/%s [%s] -- %s; %s' % (package, suite, archs, tag, reason)
            else:
                subject = 'RM: %s [%s] -- %s; %s' % (package, archs, tag, reason)
        else:
            if suite != 'unstable':
                subject = 'RM: %s/%s -- %s; %s' % (package, suite, tag, reason)
            else:
                subject = 'RM: %s -- %s; %s' % (package, tag, reason)

        if suite == 'testing':
            ui.long_message('Please use release.debian.org pseudo-package and '
                            'report a bug there.')
            sys.exit(1)

    return (subject, severity, headers, pseudos, body, query)
Esempio n. 4
0
def handle_wnpp(package, bts, ui, fromaddr, timeout, online=True, http_proxy=None):
    short_desc = body = ''
    headers = []
    pseudos = []
    query = True

    tag = ui.menu('What sort of request is this?  (If none of these '
                  'things mean anything to you, or you are trying to report '
                  'a bug in an existing package, please press Enter to '
                  'exit reportbug.)', {
        'O' :
        "The package has been `Orphaned'. It needs a new maintainer as soon as possible.",
        'RFA' :
        "This is a `Request for Adoption'. Due to lack of time, resources, interest or something similar, the current maintainer is asking for someone else to maintain this package. They will maintain it in the meantime, but perhaps not in the best possible way. In short: the package needs a new maintainer.",
        'RFH' :
        "This is a `Request For Help'. The current maintainer wants to continue to maintain this package, but they needs some help to do this, because their time is limited or the package is quite big and needs several maintainers.",
        'ITP' :
        "This is an `Intent To Package'. Please submit a package description along with copyright and URL in such a report.",
        'RFP' :
        "This is a `Request For Package'. You have found an interesting piece of software and would like someone else to maintain it for Debian. Please submit a package description along with copyright and URL in such a report.",
        }, 'Choose the request type: ', empty_ok=True)
    if not tag:
        ui.long_message('To report a bug in a package, use the name of the package, not wnpp.\n')
        raise SystemExit

    # keep asking for package name until one is entered
    package = ""

    while not package:
        if tag in ('RFP', 'ITP'):
            prompt = 'Please enter the proposed package name: '
        else:
            prompt = 'Please enter the package name: '
        package = ui.get_string(prompt)

    ui.log_message('Checking status database...\n')
    info = utils.get_package_status(package, avail=True)
    available = info[1]

    severity = 'normal'
    if tag in ('ITP', 'RFP'):
        if available and (not online or checkversions.check_available(
            package, '0', timeout, http_proxy=http_proxy)):
            if not ui.yes_no(
                ('A package called %s already appears to exist (at least on '
                 'your system); continue?' % package),
                'Ignore this problem and continue.  If you have '
                'already locally created a package with this name, this '
                'warning message may have been produced in error.',
                'Exit without filing a report.', default=0):
                sys.exit(1)

        severity = 'wishlist'

        # keep asking for short description until one is entered
        short_desc = ""

        while not short_desc:
            short_desc = ui.get_string(
                'Please briefly describe this package; this should be an '
                'appropriate short description for the eventual package: ')

        if tag == 'ITP':
            headers.append('X-Debbugs-CC: [email protected]')
            pseudos.append(u'Owner: %s' % fromaddr.decode('utf-8', 'replace'))
            ui.log_message('Your report will be carbon-copied to debian-devel, '
                           'per Debian policy.\n')

        body = itp_template % vars()
    elif tag in ('O', 'RFA', 'RFH'):
        severity = 'normal'
        query = False
        if not available:
            info = utils.get_source_package(package)
            if info:
                info = utils.get_package_status(info[0][0])

        if not info:
            cont = ui.select_options(
                "This package doesn't appear to exist; continue?",
                'yN', {'y': 'Ignore this problem and continue.',
                       'n': 'Exit without filing a report.' })
            if cont == 'n':
                sys.exit(1)
            short_desc = long_desc = ''
        else:
            short_desc = info[11] or ''
            package = info[12] or package
            long_desc = info[13]

        if tag == 'O' and info and info[9] in \
               ('required', 'important', 'standard'):
            severity = 'important'

        if tag == 'RFH':
            headers.append('X-Debbugs-CC: [email protected]')
            ui.log_message('Your request will be carbon-copied to debian-devel, '
                           'per Debian policy.\n')

        if long_desc:
            orphstr = 'intend to orphan'
            if tag == 'RFA':
                orphstr = 'request an adopter for'
            elif tag == 'RFH':
                orphstr = 'request assistance with maintaining'

            body = ('I %s the %s package.\n\n'
                    'The package description is:\n') % (orphstr, package)
            body = body + long_desc + '\n'

    if short_desc:
        subject = '%s: %s -- %s' % (tag, package, short_desc)
    else:
        subject = '%s: %s' % (tag, package)

    return (subject, severity, headers, pseudos, body, query)
Esempio n. 5
0
def handle_debian_release(package, bts, ui, fromaddr, timeout, online=True, http_proxy=None):
    body = ''
    headers = []
    pseudos = []
    query = True
    archs = None
    version = None

    tag = ui.menu('What sort of request is this?  (If none of these '
                  'things mean anything to you, or you are trying to report '
                  'a bug in an existing package, please press Enter to '
                  'exit reportbug.)', {
        'binnmu':           "binNMU requests",
        'britney':          "testing migration script bugs",
        'transition':       "transition tracking",
        'unblock':          "unblock requests",
        'opu':              "oldstable proposed updates requests",
        'pu':               "stable proposed updates requests",
        'rm':               "Stable/Testing removal requests",
        'other' :           "None of the other options",
        }, 'Choose the request type: ', empty_ok=True)
    if not tag:
        ui.long_message('To report a bug in a package, use the name of the package, not release.debian.org.\n')
        raise SystemExit

    severity = 'normal'
    if tag == 'other':
        return

    if tag == 'britney':
        subject_britney = ui.get_string('Please enter the subject of the bug report: ')
        if not subject_britney:
            ui.long_message('No subject specified, exiting')
            sys.exit(1)
    else:
        # package checks code
        prompt  = 'Please enter the name of the package: '
        package = ui.get_string(prompt)
        if not package:
            ui.log_message('You seem to want to report a generic bug.\n')
            return

        ui.log_message('Checking status database...\n')
        info = utils.get_package_status(package)
        available = info[1]

        query = False
        if not available:
            info = utils.get_source_package(package)
            if info:
                info = utils.get_package_status(info[0][0])

        if not info:
            cont = ui.select_options(
                "This package doesn't appear to exist; continue?",
                'yN', {'y': 'Ignore this problem and continue.',
                       'n': 'Exit without filing a report.' })
            if cont == 'n':
                sys.exit(1)
        else:
            package = info[12] or package

    if tag in ('binnmu', 'unblock', 'opu', 'pu', 'rm'):
        # FIXME: opu/pu/rm should lookup the version elsewhere
        version = info and info[0]
        if online:
            if tag == 'pu':
                version = checkversions.get_versions_available(package, timeout).get('stable', '')
            elif tag == 'opu':
                version = checkversions.get_versions_available(package, timeout).get('oldstable', '')
        if version:
            cont = ui.select_options(
                "Latest version seems to be %s, is this the proper one ?" % (version),
                "Yn", {'y': "This is the correct version",
                       'n': "Enter the proper vesion"})
            if cont == 'n':
                version = None
        if not version:
            version = ui.get_string('Please enter the version of the package: ')
            if not version:
                ui.log_message("A version is required for action %s, not sending bug\n" % (tag))
                return

    if tag in ('binnmu', 'rm'):
        partial = ui.select_options(
            "Is this request for specific architectures?",
            'yN', {'y': 'This is a partial (specific architectures) removal.',
                   'n': 'This removal is for all architectures.' })
        if partial == 'y':
            if tag == 'rm':
                ui.long_message('The proper way to request a partial removal '
                   'from testing is to file a partial removal from unstable: '
                   'this way the package for the specified architectures will '
                   'be automatically removed from testing too. Please re-run '
                   'reportbug against ftp.debian.org package.')
                raise SystemExit
            prompt = 'Please enter the arch list separated by a space: '
            archs = ui.get_string(prompt)
            if not archs:
                ui.long_message('No architecture specified, skipping...')

    pseudos.append("User: [email protected]")
    pseudos.append("Usertags: %s" % (tag))

    if tag == 'binnmu':
        reason  = ui.get_string("binNMU changelog entry: ")
        subject = "nmu: %s_%s" % (package, version)
        body    = "nmu %s_%s . %s . -m \"%s\"\n" % (package, version, archs or "ALL", reason)
    elif tag == 'transition':
        subject = 'transition: %s' % (package)
        body    = '(please explain about the transition: impacted packages, reason, ...\n' \
                  ' for more info see: https://wiki.debian.org/Teams/ReleaseTeam/Transitions)\n'
        affected = '<Fill out>'
        good = '<Fill out>'
        bad = '<Fill out>'

        ui.long_message('To assist the release team, please fill in the following information. '
                        'You will be asked to provide package names of the library package(s) '
                        'that are the source of the transition.  If more than one library is '
                        'changing the name, please use a space separated list.  Alternatively '
                        'you can use a regex by enclosing the regex in slashes ("/").  Please '
                        'ensure that the "old" regex does not match the "new" packages.  '
                        'Example: old="/libapt-pkg4.10|libapt-inst1.2/ libept1" '
                        'new="/libapt-pkg4.12|libapt-inst1.5|libept1.4.12/". For futher '
                        'reference, please refer to http://ben.debian.net/ .')

        prompt = 'Please enter old binary package name of the library (or a regex matching it):'
        tfrom = ui.get_string(prompt)
        if tfrom:
            prompt = 'Please enter new binary package name of the library (or a regex matching it):'
            tto = ui.get_string(prompt)
        else:
            tto = None
        if tfrom and tto:
            # Compute a ben file from this.

            # (quote if x does not start with a "/")
            quote=lambda x: (x[0] == '/' and x) or '"%s"' % x

            listbad = [quote(x) for x in tfrom.strip().split()]
            listgood = [quote(x) for x in tto.strip().split()]

            j = " | .depends ~ ".join
            affected = ".depends ~ " + j(listbad + listgood)
            good = ".depends ~ " + j(listgood)
            bad = ".depends ~ " + j(listbad)


        body += textwrap.dedent(u"""\

               Ben file:

               title = "%s";
               is_affected = %s;
               is_good = %s;
               is_bad = %s;

               """ % (package, affected, good, bad))

    elif tag == 'britney':
        subject = subject_britney
        body = ''
    elif tag == 'unblock':
        subject = 'unblock: %s/%s' % (package, version)
        body    = textwrap.dedent(u"""\
                Please unblock package %s

                (explain the reason for the unblock here)

                (include/attach the debdiff against the package in testing)

                unblock %s/%s
                """ % (package, package, version))
    elif tag == 'pu' or tag == 'opu':
        subject = '%s: package %s/%s' % (tag, package, version)
        body    = '(please explain the reason for this update here)\n'
    elif tag == 'rm':
        subject = 'RM: %s/%s' % (package, version)
        body = '(explain the reason for the removal here)\n'

    return (subject, severity, headers, pseudos, body, query)
Esempio n. 6
0
def handle_debian_ftp(package, bts, ui, fromaddr, timeout, online=True, http_proxy=None):
    body = reason = archs = section = priority = ''
    suite = 'unstable'
    headers = []
    pseudos = []
    query = True

    tag = ui.menu('What sort of request is this?  (If none of these '
                  'things mean anything to you, or you are trying to report '
                  'a bug in an existing package, please press Enter to '
                  'exit reportbug.)', {
        'ROM' :
        "Package removal - Request Of Maintainer.",
        'RoQA' :
        "Package removal - Requested by the QA team.",
        'ROP' :
        "Package removal - Request of Porter.",
        'ROSRM' :
        "Package removal - Request of Stable Release Manager.",
        'NBS' :
        "Package removal - Not Built [by] Source.",
        'NPOASR' :
        "Package removal - Never Part Of A Stable Release.",
        'NVIU' :
        "Package removal - Newer Version In Unstable.",
        'ANAIS' :
        "Package removal - Architecture Not Allowed In Source.",
        'ICE' :
        "Package removal - Internal Compiler Error.",
        'override' :
        "Change override request.",
        'other' :
        "Not a package removal request, report other problems.",
        }, 'Choose the request type: ', empty_ok=True)
    if not tag:
        ui.long_message('To report a bug in a package, use the name of the package, not ftp.debian.org.\n')
        raise SystemExit

    severity = 'normal'
    if tag == 'other':
        return
    else:
        prompt = 'Please enter the name of the package: '
        package = ui.get_string(prompt)
        if not package:
            ui.log_message('You seem to want to report a generic bug, not request a removal\n')
            return

        ui.log_message('Checking status database...\n')
        info = utils.get_package_status(package)
        available = info[1]

        query = False
        if not available:
            info = utils.get_source_package(package)
            if info:
                info = utils.get_package_status(info[0][0])

        if not info:
            cont = ui.select_options(
                "This package doesn't appear to exist; continue?",
                'yN', {'y': 'Ignore this problem and continue.',
                       'n': 'Exit without filing a report.' })
            if cont == 'n':
                sys.exit(1)
        else:
            # don't try to convert it to source if it's an 'override'
            if tag != 'override':
                package = info[12] or package
            # get package section and priority, for override
            section, priority = info[16], info[10]

    if tag == 'override':
        # we handle here the override change request
        new_section = ui.menu('Select the new section', {
                'admin': "", 'cli-mono': "", 'comm': "", 'database': "",
                'debian-installer': "", 'debug': "", 'devel': "", 'doc': "",
                'editors': "", 'education': "", 'electronics': "",
                'embedded': "", 'fonts': "", 'games': "", 'gnome': "",
                'gnu-r': "", 'gnustep': "", 'graphics': "", 'hamradio': "",
                'haskell': "", 'httpd': "", 'interpreters': "",
                'introspection': "", 'java': "", 'kde': "", 'kernel': "",
                'libdevel': "", 'libs': "", 'lisp': "", 'localization': "",
                'mail': "", 'math': "", 'metapackages': "", 'misc': "",
                'net': "", 'news': "", 'ocaml': "", 'oldlibs': "",
                'otherosfs': "", 'perl': "", 'php': "", 'python': "",
                'ruby': "", 'science': "", 'shells': "", 'sound': "", 'tex': "",
                'text': "", 'utils': "", 'vcs': "", 'video': "", 'web': "",
                'x11': "", 'xfce': "", 'zope': "",
        }, 'Choose the section: ', default=section, empty_ok=True)
        if not new_section:
            new_section = section

        new_priority = ui.menu('Select the new priority', {
                'required': "",
                'important': "",
                'standard': "",
                'optional': "",
                'extra': "",
        }, 'Choose the priority: ', default=priority, empty_ok=True)
        if not new_priority:
            new_priority = priority

        if new_section == section and new_priority == priority:
            cont = ui.select_options(
                "You didn't change section nor priority: is this because it's "
                "ftp.debian.org override file that needs updating?",
                'Yn', {'y': 'ftp.debian.org override file needs updating',
                       'n': 'No, it\'s not the override file' })
            if cont == 'n':
                ui.long_message("There's nothing we can do for you, then; "
                                "exiting...")
                sys.exit(1)

        arch_section = ui.menu('Is this request for an archive section other than "main"?', {
            'main' : "",
            'contrib' : "",
            'non-free' : "",
        }, 'Choose the archive section: ', default='main', empty_ok=True)
        if not arch_section:
           arch_section = 'main'

        if arch_section != 'main':
            subject = "override: %s:%s/%s %s" % (package, arch_section, new_section, new_priority)
        else:
            subject = "override: %s:%s/%s" % (package, new_section, new_priority)
        body = "(Describe here the reason for this change)"
    else:
        # we handle here the removal requests
        suite = ui.menu('Is the removal to be done in a suite other than'
                        ' "unstable"?  Please press Enter for "unstable"', {
            'oldstable' : "Old stable.",
            'oldstable-proposed-updates' : "Old stable proposed updates.",
            'stable' : "Stable.",
            'stable-proposed-updates' : "Stable proposed updates.",
            'testing' : "Testing only (NOT unstable)",
	    'testing-proposed-updates' : "Testing proposed updates",
            'experimental' : "Experimental.",
        }, 'Choose the suite: ', empty_ok=True)
        if not suite:
            suite = 'unstable'

        if suite not in ('testing', 'unstable', 'experimental'):
            headers.append('X-Debbugs-CC: [email protected]')
            ui.log_message('Your report will be carbon-copied to debian-release.\n')

        why = 'Please enter the reason for removal: '
        reason = ui.get_string(why)
        if not reason: return

        partial = ui.select_options(
            "Is this removal request for specific architectures?",
            'yN', {'y': 'This is a partial (specific architectures) removal.',
                   'n': 'This removal is for all architectures.' })
        if partial == 'y':
            prompt = 'Please enter the arch list separated by a space: '
            archs = ui.get_string(prompt)
            if not archs:
                ui.long_message('Partial removal requests must have a list of architectures.\n')
                raise SystemExit


        if suite == 'testing' and archs:
            ui.long_message('Partial removal for testing; forcing suite to '
                            '\'unstable\', since it\'s the proper way to do that.')
            suite = 'unstable'
            body = '(please explain the reason for the removal here)\n\n' +\
                'Note: this was a request for a partial removal from testing, ' +\
                'converted in one for unstable'

        if archs:
            if suite != 'unstable':
                subject = 'RM: %s/%s [%s] -- %s; %s' % (package, suite, archs, tag, reason)
            else:
                subject = 'RM: %s [%s] -- %s; %s' % (package, archs, tag, reason)
        else:
            if suite != 'unstable':
                subject = 'RM: %s/%s -- %s; %s' % (package, suite, tag, reason)
            else:
                subject = 'RM: %s -- %s; %s' % (package, tag, reason)

        if suite == 'testing':
            ui.long_message('Please use release.debian.org pseudo-package and '
                            'report a bug there.')
            sys.exit(1)

    return (subject, severity, headers, pseudos, body, query)