Add a script for generating an open bug list from exported SourceForge XML data.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 26 May 2003 14:16:08 +0000 (14:16 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 26 May 2003 14:16:08 +0000 (14:16 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@696 fdb21ef1-2011-0410-befe-b5e4ea1792b1

bin/sfsum [new file with mode: 0644]
bin/xml_export [new file with mode: 0644]
bin/xml_export-LICENSE [new file with mode: 0644]
bin/xml_export-README [new file with mode: 0644]

diff --git a/bin/sfsum b/bin/sfsum
new file mode 100644 (file)
index 0000000..a560b7d
--- /dev/null
+++ b/bin/sfsum
@@ -0,0 +1,148 @@
+#!/usr/bin/env python
+#
+# sfsum.py:  A script for parsing XML data exported from
+#            SourceForge projects.
+#
+# Right now, this is hard-coded to generate a summary of open bugs.
+#
+# XML data for SourceForge project is available for download by project
+# administrators.  Because it's intended for backup purposes, you have
+# to slurp the whole set of data, including info about all of the closed
+# items, the feature requests, etc., so it can get big.
+#
+# You can do this by hand (if you're an administrator) with a URL like
+# this (where 30337 is the group_id for SCons):
+#
+#       http://sourceforge.net/export/xml_export.php?group_id=30337
+#
+# They also have a Perl script, called xml_export, available as part
+# of a set of utilities called "adocman" which automate dealing with
+# SourceForge document management from the command line.  "adocman"
+# is available at:
+#
+#       https://sourceforge.net/projects/sitedocs/
+#
+
+import xml.sax
+import xml.sax.saxutils
+import string
+import sys
+
+SFName = {
+    'Unassigned'               : 'nobody',
+    'Chad Austin'              : 'aegis',
+    'Charle Crain'             : 'diewarzau',
+    'Steven Knight'            : 'stevenknight',
+    'Steve Leblanc'            : 'stevenleblanc',
+    'Jeff Petkau'              : 'jpet',
+    'Anthony Roach'            : 'anthonyroach',
+    'Steven Shaw'              : 'steven_shaw',
+    'Terrel Shumway'           : 'terrelshumway',
+    'Greg Spencer'              : 'greg_spencer',
+    'Christoph Wiedemann'       : 'wiedeman',
+}
+
+class Artifact:
+    """Just a place to hold attributes that we find in the XML."""
+    pass
+
+Artifacts = {}
+
+def nws(text):
+    """Normalize white space.  This will become important if/when
+    we enhance this to search for arbitrary fields."""
+    return string.join(string.split(text), ' ')
+
+class ClassifyArtifacts(xml.sax.saxutils.DefaultHandler):
+    """
+    Simple SAX subclass to classify the artifacts in SourceForge
+    XML output.
+
+    This reads up the fields in an XML description and turns the field
+    descriptions into attributes of an Artificat object, on the fly.
+    Artifacts are of the following types:
+
+        Bugs
+        Feature Requests
+        Patches
+        Support Requests
+
+    We could, if we choose to, add additional types in the future
+    by creating additional trackers.
+
+    This class loses some info right now because we don't pay attention
+    to the <messages> tag in the output, which contains a list of items
+    that have <field> tags in them.  Right now, these just overwrite
+    each other in the Arifact object we create.
+
+    We also don't pay attention to any attributes of a <field> tag other
+    than the "name" attribute.  We'll need to extend this class if we
+    ever want to pay attention to those attributes.
+    """
+    def __init__(self):
+        self.artifact = None
+
+    def startElement(self, name, attrs):
+        self.text = ""
+        if name == 'artifact':
+            self.artifact = Artifact()
+        elif not self.artifact is None and name == 'field':
+            self.fname = attrs.get('name', None)
+
+    def characters(self, ch):
+        if not self.artifact is None:
+            self.text = self.text + ch
+
+    def endElement(self, name):
+        global Artifacts
+        if name == 'artifact':
+            type = self.artifact.artifact_type
+            try:
+                list = Artifacts[type]
+            except KeyError:
+                Artifacts[type] = list = []
+            list.append(self.artifact)
+            self.artifact = None
+        elif not self.artifact is None and name == 'field':
+            setattr(self.artifact, self.fname, self.text)
+
+if __name__ == '__main__':
+    # Create a parser.
+    parser = xml.sax.make_parser()
+    # Tell the parser we are not interested in XML namespaces.
+    parser.setFeature(xml.sax.handler.feature_namespaces, 0)
+
+    # Instantiate our handler and tell the parser to use it.
+    parser.setContentHandler(ClassifyArtifacts())
+
+    # Parse the input.
+    parser.parse(sys.argv[1])
+
+    # Hard-coded search for 'Open' bugs.  This should be easily
+    # generalized once we figure out other things for this script to do.
+    bugs = filter(lambda x: x.status == 'Open', Artifacts['Bugs'])
+
+    print Artifacts.keys()
+
+    print "%d open bugs" % len(bugs)
+
+    # Sort them into a separate list for each assignee.
+    Assigned = {}
+    for bug in bugs:
+        a = bug.assigned_to
+        try:
+            list = Assigned[a]
+        except KeyError:
+            Assigned[a] = list = []
+        list.append(bug)
+
+    for a in SFName.keys():
+        try:
+            b = Assigned[SFName[a]]
+        except KeyError:
+            pass
+        else:
+            print "    %s" % a
+            b.sort(lambda x, y: cmp(x.artifact_id, y.artifact_id))
+            for bug in b:
+                print "        %-6s  %s" % (bug.artifact_id, bug.summary)
diff --git a/bin/xml_export b/bin/xml_export
new file mode 100644 (file)
index 0000000..bc9ccbd
--- /dev/null
@@ -0,0 +1,225 @@
+#!/usr/bin/perl -w
+#
+# xml_export - Retrieve data from the SF.net XML export for project data
+#
+# Copyright (C) 2002 Open Source Development Network, Inc. ("OSDN")
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the license details found
+# below in the section marked "$LICENSE_TEXT".
+#
+# SCons: modified the following RCS Id line so it won't expand during
+# our checkins.
+#
+# $_Id: adocman,v 1.51 2002/06/07 18:56:35 moorman Exp _$
+#
+# Written by Nate Oostendorp <oostendo@sourceforge.net>
+# and Jacob Moorman <moorman@sourceforge.net>
+###########################################################################
+
+use strict;
+use Alexandria::Client;
+use HTTP::Request::Common;
+my $client = new Alexandria::Client;
+
+util_verifyvariables("groupid");
+
+my $res = $ua->simple_request(GET "$config{hosturl}/export/xml_export.php?group_id=$config{groupid}");
+
+if (not $res->is_success()) {
+    die "Failed to connect: ".$res->as_string();
+}
+print $res->content;
+
+###########################################################################
+
+__END__
+=head1 NAME
+
+xml_export - Retrieve data for a project via the SF.net XML export facility
+
+=head1 DESCRIPTION
+
+B<This program> provides a simple mechanism to download data from the
+XML data export facility on SourceForge.net.  This utility is needed
+(in place of a downloader like wget or curl) since authentication by
+a project administrator is required to access the XML export facility.
+
+=head1 SYNOPSIS
+
+xml_export [options] > output_file
+
+ OPTIONS
+ --login                Login to the SourceForge.net site
+ --logout               Logout of the SourceForge.net site
+ --groupid=GROUPID      Group ID of the project whose data you wish to export
+
+=head1 ERROR LEVELS
+
+The following error levels are returned upon exit of this program:
+
+ 0 success
+
+ 1 failure: general (requested DocManager operation failed)
+
+ 2 failure: authentication failure
+
+ 3 failure: must --login before performing this operation
+
+ 4 failure: bad command-line option specified or variable setting problem
+
+ 5 failure: error in accessing/creating a file or directory
+
+ 6 failure: failed to enter requested input before timeout expired
+
+=head1 AUTHORITATIVE SOURCE
+
+The original version of B<this program> may be found in the materials
+provided from the SourceForge.net Site Documentation project (sitedocs)
+on the SourceForge.net site.  The latest version of this program
+may be found in the CVS repository for the sitedocs project on
+SourceForge.net.  The sitedocs project pages may be accessed at:
+http://sourceforge.net/projects/sitedocs
+
+=head1 SECURITY
+
+For security-related information for this application, please review
+the documentation provided for the adocman utility.
+
+=head1 EXAMPLES
+
+The following are examples for using this program to export project
+data via the XML data export facility on SourceForge.net.  It is presumed
+that you have a valid SourceForge.net user account, which is listed as
+a project administrator on the project in question.  This tool will
+only work for project administrators.  The group ID for the project
+may be derived from the URL for the Admin page for the project, or by
+viewing the Project Admin page for the project (look for the text
+"Your Group ID is: xxxxxx").
+
+To login to the SourceForge.net site via the command-line:
+
+  adocman --username=myusername --password=mypassword --login \
+          --groupid=8675309
+
+To login to the SourceForge.net site, and be prompted to enter your
+password interactively:
+
+  adocman --username=myusername --interactive --login --groupid=8675309
+
+To perform an export (after logging-in):
+
+  xml_export --groupid=8675309 > output.xml
+
+To logout of SourceForge.net:
+
+  adocman --logout
+
+Additional capabilities (including the use of configuration files to
+specify information that would otherwise be provided interactively
+or on the command-line) are detailed in the documentation provided for
+the adocman utility.
+
+To obtain output for debugging a problem, perform the same command
+as originally tested, but first add the --verbose flag, and determine
+whether you are able to solve the issue on your own.  If the problem
+persists, see the "SUPPORT AND BUGS" section, below.
+
+=head1 SUPPORT AND BUGS
+
+This program was written by a member of the SourceForge.net staff
+team.  This software has been released under an Open Source license,
+for the greater benefit of the SourceForge.net developer community.
+
+The SourceForge.net Site Documentation project is the caretaker of
+this software.  Issues related to the use of this program, or bugs
+found in using this program, may be reported to the SourceForge.net
+Site Documentation project using their Support Request Tracker at:
+https://sourceforge.net/tracker/?func=add&group_id=52614&atid=467457
+
+Any support that is provided for this program is provided as to
+further enhance the stability and functionality of this program
+for SourceForge.net users.  The SourceForge.net Site Documentation
+project makes use of this software for its own internal purposes,
+in managing the Site Documentation collection for the SourceForge.net
+site.
+
+=head1 AUTHOR
+
+Nathan Oostendorp <oostendo@sourceforge.net> and
+Jacob Moorman <moorman@sourceforge.net>
+
+=head1 PREREQUISITES
+
+C<LWP::UserAgent>, C<HTML::TokeParser>, C<Crypt::SSLeay>, C<Digest::MD5>,
+C<Term::ReadKey>
+
+These prerequisites may be installed in an interactive, but automated
+fashion through the use of perl's CPAN module, invoked as:
+
+  perl -MCPAN -e shell;
+
+=head1 LICENSE
+
+Copyright (c) 2002 Open Source Development Network, Inc. ("OSDN")
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+1. The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+2. Neither the names of VA Software Corporation, OSDN, SourceForge.net,
+the SourceForge.net Site Documentation project, nor the names of its
+contributors may be used to endorse or promote products derived from
+the Software without specific prior written permission of OSDN. 
+
+3. The name and trademarks of copyright holders may NOT be used in
+advertising or publicity pertaining to the Software without specific,
+written prior permission. Title to copyright in the Software and
+any associated documentation will at all times remain with copyright
+holders.
+
+4. If any files are modified, you must cause the modified files to carry
+prominent notices stating that you changed the files and the date of
+any change.  We recommend that you provide URLs to the location from which
+the code is derived.
+
+5. Altered versions of the Software must be plainly marked as such, and
+must not be misrepresented as being the original Software.
+
+6. The origin of the Software must not be misrepresented; you must not
+claim that you wrote the original Software. If you use the Software in a
+product, an acknowledgment in the product documentation would be
+appreciated but is not required.
+
+7. The data files supplied as input to, or produced as output from,
+the programs of the Software do not automatically fall under the
+copyright of the Software, but belong to whomever generated them, and may
+be sold commercially, and may be aggregated with the Software.
+
+8. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE OR DOCUMENTATION.
+
+This Software consists of contributions made by OSDN and many individuals
+on behalf of OSDN.  Specific attributions are listed in the accompanying
+credits file.
+
+=head1 HISTORY
+
+B<2002-12-03> Completed version 0.10 - move to classes, added POD
+
+=cut
diff --git a/bin/xml_export-LICENSE b/bin/xml_export-LICENSE
new file mode 100644 (file)
index 0000000..3f06fb7
--- /dev/null
@@ -0,0 +1,52 @@
+Copyright (c) 2002 Open Source Development Network, Inc. ("OSDN")
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+1. The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+2. Neither the names of VA Software Corporation, OSDN, SourceForge.net,
+the SourceForge.net Site Documentation project, nor the names of its
+contributors may be used to endorse or promote products derived from
+the Software without specific prior written permission of OSDN.
+
+3. The name and trademarks of copyright holders may NOT be used in
+advertising or publicity pertaining to the Software without specific,
+written prior permission. Title to copyright in the Software and
+any associated documentation will at all times remain with copyright
+holders.
+
+4. If any files are modified, you must cause the modified files to carry
+prominent notices stating that you changed the files and the date of
+any change.  We recommend that you provide URLs to the location from which
+the code is derived.
+
+5. Altered versions of the Software must be plainly marked as such, and
+must not be misrepresented as being the original Software.
+
+6. The origin of the Software must not be misrepresented; you must not
+claim that you wrote the original Software. If you use the Software in a
+product, an acknowledgment in the product documentation would be
+appreciated but is not required.
+
+7. The data files supplied as input to, or produced as output from,
+the programs of the Software do not automatically fall under the
+copyright of the Software, but belong to whomever generated them, and may
+be sold commercially, and may be aggregated with the Software.
+
+8. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE OR DOCUMENTATION.
+
+This Software consists of contributions made by OSDN and many individuals
+on behalf of OSDN.  Specific attributions are listed in the accompanying
+credits file.
diff --git a/bin/xml_export-README b/bin/xml_export-README
new file mode 100644 (file)
index 0000000..82e3524
--- /dev/null
@@ -0,0 +1,56 @@
+This copy of xml_export was snarfed from adocman-0.10 from SourceForge.
+We're checking in a copy as a convenience for any future SCons project
+administrator who may need to download exported XML data.  The original,
+unmodified contents of the README file for that release of adocman are
+as follows:
+
+
+adocman - Automation tool for SourceForge.net DocManager handling
+Copyright (C) 2002 Open Source Development Network, Inc. ("OSDN")
+
+
+File manifest:
+
+Alexandria     perl-based API for performing operations against the
+               SourceForge.net site, currently including basic Client
+               operations (i.e. login/logout) and DocManager operations
+
+adocman                The adocman program, providing the means to perform
+               DocManager operations from the command-line or scripts
+               (by project developers or admins listed as DocManager Editors)
+
+xml_export     The xml_export program, providing the means to automate
+               downloads of data from the XML data export facility
+               on SourceForge.net (by project administrators)
+
+adocman.html   Manual for adocman, including background information,
+               command-line options detail, etc.
+
+xml_export.html        Manual for xml_export, including basic info about
+               command-line options.  See adocman.html for additional
+               information.
+
+LICENSE                License terms for adocman
+
+README         This file
+
+TODO           List of ongoing work in improving adocman.  NOTE:
+               Please contact the maintainer before starting any effort
+               to improve this code.  We have significantly modified
+               the structure and design of this program for the next
+               release; structure and command-line interface are subject
+               to change without notice.
+
+A list of the prerequisites required to execute 'adocman' may be found
+at in the PREREQUISITES section of the adocman manual (adocman.html).
+Though not listed, a recent installation of 'perl' is also a prerequisite.
+
+Support for this program may be obtained as per the SUPPORT AND BUGS
+section of the adocman.html manual.  Any questions or concerns regarding
+this software should be escalated as per the SUPPORT AND BUGS section
+of the provided manual.
+
+The authoritative source of this software is:
+  https://sourceforge.net/projects/sitedocs
+
+