mirror of
				https://git.launchpad.net/ubuntu-dev-tools
				synced 2025-11-04 07:54:03 +00:00 
			
		
		
		
	Remove hugdaylist script
The last email announcing a 'hug day' appears to have been over 5 years ago, and the hugdaylist script doesn't seem to work right anymore anyway. This also removes ubuntutools/lp/libsupport, which has no functions used by anything else.
This commit is contained in:
		
							parent
							
								
									06038060b0
								
							
						
					
					
						commit
						8fe22fbbb6
					
				
							
								
								
									
										1
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							@ -90,7 +90,6 @@ Description: useful tools for Ubuntu developers
 | 
			
		||||
  - dch-repeat - used to repeat a change log into an older release.
 | 
			
		||||
  - grab-merge - grabs a merge from merges.ubuntu.com easily.
 | 
			
		||||
  - grep-merges - search for pending merges from Debian.
 | 
			
		||||
  - hugdaylist - compile HugDay lists from bug list URLs.
 | 
			
		||||
  - import-bug-from-debian - copy a bug from the Debian BTS to Launchpad
 | 
			
		||||
  - merge-changelog - manually merges two Debian changelogs with the same base
 | 
			
		||||
    version.
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										3
									
								
								debian/copyright
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								debian/copyright
									
									
									
									
										vendored
									
									
								
							@ -72,13 +72,11 @@ License: GPL-2+
 | 
			
		||||
 | 
			
		||||
Files: doc/bitesize.1
 | 
			
		||||
       doc/grab-merge.1
 | 
			
		||||
       doc/hugdaylist.1
 | 
			
		||||
       doc/merge-changelog.1
 | 
			
		||||
       doc/setup-packaging-environment.1
 | 
			
		||||
       doc/syncpackage.1
 | 
			
		||||
       bitesize
 | 
			
		||||
       grab-merge
 | 
			
		||||
       hugdaylist
 | 
			
		||||
       merge-changelog
 | 
			
		||||
       setup-packaging-environment
 | 
			
		||||
       syncpackage
 | 
			
		||||
@ -109,7 +107,6 @@ Files: dch-repeat
 | 
			
		||||
       grep-merges
 | 
			
		||||
       mk-sbuild
 | 
			
		||||
       ubuntu-build
 | 
			
		||||
       ubuntutools/lp/libsupport.py
 | 
			
		||||
       ubuntutools/lp/lpapicache.py
 | 
			
		||||
       ubuntutools/misc.py
 | 
			
		||||
Copyright: 2007-2010, Canonical Ltd.
 | 
			
		||||
 | 
			
		||||
@ -1,26 +0,0 @@
 | 
			
		||||
.TH HUGDAYLIST "1" "August 27, 2008" "ubuntu-dev-tools"
 | 
			
		||||
 | 
			
		||||
.SH NAME
 | 
			
		||||
hugdaylist \- produce MoinMoin wiki formatted tables based on a Launchpad bug list
 | 
			
		||||
 | 
			
		||||
.SH SYNOPSIS
 | 
			
		||||
.B hugdaylist [\fB\-n\fP|\fB\-\-number <NUMBER>\fP] \fBlaunchpad-buglist-url\fP
 | 
			
		||||
 | 
			
		||||
.SH DESCRIPTION
 | 
			
		||||
\fBhugdaylist\fP produces MoinMoin wiki formatted tables based on a
 | 
			
		||||
Launchpad bug list
 | 
			
		||||
 | 
			
		||||
.SH OPTIONS
 | 
			
		||||
.TP
 | 
			
		||||
\fB\-\-number=<NUMBER>\fP
 | 
			
		||||
This option allows you to specify the number of entries to output.
 | 
			
		||||
.TP
 | 
			
		||||
\fBlaunchpad-buglist-url\fP
 | 
			
		||||
Required, this option is a URL pointing to a launchpad bug list.
 | 
			
		||||
 | 
			
		||||
.SH AUTHOR
 | 
			
		||||
\fBhugdaylist\fP has been written by Canonical Ltd., Daniel Holbach
 | 
			
		||||
<daniel.holbach@canonical.com> and Jonathan Patrick Davies <jpds@ubuntu.com>.
 | 
			
		||||
This manual page was written by Ryan Kavanagh <ryanakca@kubuntu.org>.
 | 
			
		||||
.PP
 | 
			
		||||
Both are released under the GNU General Public License, version 3.
 | 
			
		||||
							
								
								
									
										141
									
								
								hugdaylist
									
									
									
									
									
								
							
							
						
						
									
										141
									
								
								hugdaylist
									
									
									
									
									
								
							@ -1,141 +0,0 @@
 | 
			
		||||
#!/usr/bin/python3
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2007 Canonical Ltd., Daniel Holbach
 | 
			
		||||
# Copyright (C) 2008 Jonathan Patrick Davies <jpds@ubuntu.com>
 | 
			
		||||
#
 | 
			
		||||
# ##################################################################
 | 
			
		||||
#
 | 
			
		||||
# 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.
 | 
			
		||||
#
 | 
			
		||||
# ##################################################################
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
# hugdaylist - produces MoinMoin wiki formatted tables based on a Launchpad bug
 | 
			
		||||
#              list.
 | 
			
		||||
#
 | 
			
		||||
# hugdaylist <url>
 | 
			
		||||
# - produces lists like https://wiki.ubuntu.com/UbuntuBugDay/20070912?action=raw
 | 
			
		||||
#
 | 
			
		||||
# hugdaylist -n <howmany> <url>
 | 
			
		||||
# - will only list <howmany> URLs.
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
from optparse import OptionParser
 | 
			
		||||
 | 
			
		||||
from launchpadlib.launchpad import Launchpad
 | 
			
		||||
 | 
			
		||||
from ubuntutools.lp.libsupport import translate_web_api
 | 
			
		||||
 | 
			
		||||
from ubuntutools import getLogger
 | 
			
		||||
Logger = getLogger()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def check_args():
 | 
			
		||||
    howmany = -1
 | 
			
		||||
    url = ""
 | 
			
		||||
 | 
			
		||||
    # Our usage options.
 | 
			
		||||
    usage = "usage: %prog [-n <number>] launchpad-buglist-url"
 | 
			
		||||
    opt_parser = OptionParser(usage)
 | 
			
		||||
 | 
			
		||||
    # Options - namely just the number of bugs to output.
 | 
			
		||||
    opt_parser.add_option("-n", "--number", type="int",
 | 
			
		||||
                          dest="number", help="Number of entries to output.")
 | 
			
		||||
 | 
			
		||||
    # Parse arguments.
 | 
			
		||||
    (options, args) = opt_parser.parse_args()
 | 
			
		||||
 | 
			
		||||
    # Check if we want a number other than the default.
 | 
			
		||||
    howmany = options.number
 | 
			
		||||
 | 
			
		||||
    # Check that we have an URL.
 | 
			
		||||
    if not args:
 | 
			
		||||
        Logger.error("An URL pointing to a Launchpad bug list is required.")
 | 
			
		||||
        opt_parser.print_help()
 | 
			
		||||
        sys.exit(1)
 | 
			
		||||
    else:
 | 
			
		||||
        url = args[0]
 | 
			
		||||
 | 
			
		||||
    return (howmany, url)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def filter_unsolved(task):
 | 
			
		||||
    # TODO: don't use this filter here, only check status and assignee of
 | 
			
		||||
    #   the given task
 | 
			
		||||
    # Filter out special types of bugs:
 | 
			
		||||
    # - https://wiki.ubuntu.com/Bugs/HowToTriage#Special%20types%20of%20bugs
 | 
			
		||||
    # this is expensive, parse name out of self_link instead?
 | 
			
		||||
    subscriptions = set(s.person.name for s in task.bug.subscriptions)
 | 
			
		||||
    if (task.status != "Fix Committed" and
 | 
			
		||||
            (not task.assignee or task.assignee.name in ['motu', 'desktop-bugs']) and
 | 
			
		||||
            'ubuntu-sponsors' not in subscriptions and
 | 
			
		||||
            'ubuntu-archive' not in subscriptions):
 | 
			
		||||
        return True
 | 
			
		||||
    return False
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    (howmany, url) = check_args()
 | 
			
		||||
    if len(url.split("?", 1)) == 2:
 | 
			
		||||
        # search options not supported, because there is no mapping web ui
 | 
			
		||||
        # options <-> API options
 | 
			
		||||
        Logger.error("Options in url are not supported, url: %s" % url)
 | 
			
		||||
        sys.exit(1)
 | 
			
		||||
 | 
			
		||||
    launchpad = None
 | 
			
		||||
    try:
 | 
			
		||||
        launchpad = Launchpad.login_with("ubuntu-dev-tools", 'production')
 | 
			
		||||
    except IOError as error:
 | 
			
		||||
        Logger.exception(error)
 | 
			
		||||
        sys.exit(1)
 | 
			
		||||
 | 
			
		||||
    api_url = translate_web_api(url, launchpad)
 | 
			
		||||
    try:
 | 
			
		||||
        product = launchpad.load(api_url)
 | 
			
		||||
    except Exception as error:
 | 
			
		||||
        response = getattr(error, "response", {})
 | 
			
		||||
        if response.get("status", None) == "404":
 | 
			
		||||
            Logger.error("The URL at '%s' does not appear to be a "
 | 
			
		||||
                         "valid url to a product" % url)
 | 
			
		||||
            sys.exit(1)
 | 
			
		||||
        else:
 | 
			
		||||
            raise
 | 
			
		||||
 | 
			
		||||
    bug_list = [b for b in product.searchTasks() if filter_unsolved(b)]
 | 
			
		||||
 | 
			
		||||
    if not bug_list:
 | 
			
		||||
        Logger.info("Bug list of %s is empty." % url)
 | 
			
		||||
        sys.exit(0)
 | 
			
		||||
    if howmany == -1:
 | 
			
		||||
        howmany = len(bug_list)
 | 
			
		||||
 | 
			
		||||
    Logger.info("""
 | 
			
		||||
## ||<rowbgcolor="#CCFFCC"> This task is done || somebody || ||
 | 
			
		||||
## ||<rowbgcolor="#FFFFCC"> This task is assigned || somebody || <status> ||
 | 
			
		||||
## ||<rowbgcolor="#FFEBBB"> This task isn't || ... || ||
 | 
			
		||||
## ||<rowbgcolor="#FFCCCC"> This task is blocked on something || somebody || <explanation> ||
 | 
			
		||||
 | 
			
		||||
|| Bug || Subject || Triager ||""")
 | 
			
		||||
 | 
			
		||||
    for i in list(bug_list)[:howmany]:
 | 
			
		||||
        bug = i.bug
 | 
			
		||||
        Logger.info('||<rowbgcolor="#FFEBBB"> [%s %s] || %s || ||' %
 | 
			
		||||
                    (bug.web_link, bug.id, bug.title))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    try:
 | 
			
		||||
        main()
 | 
			
		||||
    except KeyboardInterrupt:
 | 
			
		||||
        Logger.error("Aborted.")
 | 
			
		||||
        sys.exit(1)
 | 
			
		||||
							
								
								
									
										1
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								setup.py
									
									
									
									
									
								
							@ -21,7 +21,6 @@ scripts = [
 | 
			
		||||
    'dch-repeat',
 | 
			
		||||
    'grab-merge',
 | 
			
		||||
    'grep-merges',
 | 
			
		||||
    'hugdaylist',
 | 
			
		||||
    'import-bug-from-debian',
 | 
			
		||||
    'merge-changelog',
 | 
			
		||||
    'mk-sbuild',
 | 
			
		||||
 | 
			
		||||
@ -1,50 +0,0 @@
 | 
			
		||||
#
 | 
			
		||||
#   libsupport.py - functions which add launchpadlib support to the Ubuntu
 | 
			
		||||
#                     Developer Tools package.
 | 
			
		||||
#
 | 
			
		||||
#   Copyright (C) 2009 Markus Korn <thekorn@gmx.de>
 | 
			
		||||
#
 | 
			
		||||
#   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; either version 3
 | 
			
		||||
#   of the License, or (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
#   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.
 | 
			
		||||
#
 | 
			
		||||
#   Please see the /usr/share/common-licenses/GPL file for the full text of
 | 
			
		||||
#   the GNU General Public License license.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
from urllib.parse import urlsplit, urlencode, urlunsplit
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def query_to_dict(query_string):
 | 
			
		||||
    result = dict()
 | 
			
		||||
    options = filter(None, query_string.split("&"))
 | 
			
		||||
    for opt in options:
 | 
			
		||||
        key, value = opt.split("=")
 | 
			
		||||
        result.setdefault(key, set()).add(value)
 | 
			
		||||
    return result
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def translate_web_api(url, launchpad):
 | 
			
		||||
    scheme, netloc, path, query, fragment = urlsplit(url)
 | 
			
		||||
    query = query_to_dict(query)
 | 
			
		||||
 | 
			
		||||
    differences = set(netloc.split('.')).symmetric_difference(
 | 
			
		||||
            set(launchpad._root_uri.host.split('.')))
 | 
			
		||||
    if ('staging' in differences or 'edge' in differences):
 | 
			
		||||
        raise ValueError("url conflict (url: %s, root: %s" %
 | 
			
		||||
                         (url, launchpad._root_uri))
 | 
			
		||||
    if path.endswith("/+bugs"):
 | 
			
		||||
        path = path[:-6]
 | 
			
		||||
        if "ws.op" in query:
 | 
			
		||||
            raise ValueError("Invalid web url, url: %s" % url)
 | 
			
		||||
        query["ws.op"] = "searchTasks"
 | 
			
		||||
    scheme, netloc, api_path, _, _ = urlsplit(str(launchpad._root_uri))
 | 
			
		||||
    query = urlencode(query)
 | 
			
		||||
    url = urlunsplit((scheme, netloc, api_path + path.lstrip("/"), query, fragment))
 | 
			
		||||
    return url
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user