summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Cakebread <pythonhead@gentoo.org>2010-03-22 20:35:27 +0100
committerSebastian Pipping <sebastian@pipping.org>2010-03-22 20:46:10 +0100
commitdc3b6330593441080d4f9ab715ea721eccfa8441 (patch)
tree272cbe99c33d3292b90d57e808fcef4e9d7bafcb
parentIntroduce .gitignore (diff)
downloadmetagen-dc3b6330593441080d4f9ab715ea721eccfa8441.tar.gz
metagen-dc3b6330593441080d4f9ab715ea721eccfa8441.tar.bz2
metagen-dc3b6330593441080d4f9ab715ea721eccfa8441.zip
Add content from metagen-0.1.tar.bz2v0.2v0.1
-rwxr-xr-xmetagen108
-rw-r--r--metagen.166
2 files changed, 174 insertions, 0 deletions
diff --git a/metagen b/metagen
new file mode 100755
index 0000000..5dd8e67
--- /dev/null
+++ b/metagen
@@ -0,0 +1,108 @@
+#!/usr/bin/python
+
+"""
+
+NAME - metagen
+
+SYNOPSIS - Adds metadata.xml to current directory
+
+AUTHOR - Rob Cakebread <pythonhead@gentoo.org>
+
+USE - metagen --help
+
+NOTE - Any tags that can have multiples can be separated by a comma
+
+EXAMPLES -
+
+ metagen -H python
+ (creates barebones metadata.xml with python as the herd)
+
+ metagen -H python,wxwidgets \
+ -l "This package does yada yada yada."
+ (Two herds and long description)
+
+ metagen -e pythonhead@gentoo.org \
+ -n "Joe Blow" \
+ -d "The voices in my head told me to maintain this package"
+ (No herd, maintainer email, maintainer name, description of maintainership)
+
+"""
+
+
+import jaxml
+import sys
+from optparse import *
+import os
+
+def cleanup_indent():
+ """Strip tabs to match Gentoo's metadata.xml file"""
+ #TODO This may be doable with _push() and _pop()
+ lines = open("metadata.xml", "r").readlines()
+ newfile = []
+ for l in lines:
+ if l[0] == "\t":
+ l = l[1:]
+ newfile.append(l)
+ f = open("metadata.xml", "w")
+ f.writelines(newfile)
+
+def generate_xml(options):
+ """Write XML file"""
+ doc = jaxml.XML_document("1.0", "UTF-8")
+ doc._indentstring("\t")
+ doc._text('<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">')
+ doc.pkgmetadata()
+ if options.herd:
+ for o in options.herd.split(","):
+ doc.herd(o)
+ i = 0
+ if options.email:
+ for o in options.email.split(","):
+ doc._push("maintainer_level")
+ doc.maintainer().email(o)
+ if options.name:
+ names = options.name.split(",")
+ if i <= len(names)-1:
+ doc.name(names[i])
+ if options.desc:
+ descs = options.desc.split(",")
+ if i <= len(descs)-1:
+ doc.description(descs[i])
+ doc._pop("maintainer_level")
+ i += 1
+ if options.long:
+ doc.longdescription(options.long)
+ doc._output("metadata.xml")
+ cleanup_indent()
+
+if __name__ == '__main__':
+ optParser = OptionParser()
+ optParser.add_option( "-H", action="store", dest="herd", type="string",
+ help="Name of herd")
+
+ optParser.add_option( "-e", action="store", dest="email", type="string",
+ help="Maintainer's email address")
+
+ optParser.add_option( "-n", action="store", dest="name", type="string",
+ help="Maintainer's name")
+
+ optParser.add_option( "-d", action="store", dest="desc", type="string",
+ help="Description of maintainership")
+
+ optParser.add_option( "-l", action="store", dest="long", type="string",
+ help="Long description of package.")
+
+ (options, remainingArgs) = optParser.parse_args()
+
+ if len(sys.argv) == 1:
+ print "usage: %s [options]\n" % os.path.basename(sys.argv[0])
+ print "For help:"
+ print "%s --help" % os.path.basename(sys.argv[0])
+ sys.exit(1)
+
+ if not options.herd and not options.email:
+ print "You must specify at least a herd (-H) or maintainer's email address (-e)"
+ sys.exit(1)
+
+ generate_xml(options)
+
diff --git a/metagen.1 b/metagen.1
new file mode 100644
index 0000000..242fe4b
--- /dev/null
+++ b/metagen.1
@@ -0,0 +1,66 @@
+.\" Contact pythonhead@gentoo.org to correct errors or omissions.
+.TH man 1 "22 August 2004" "1.0" "metagen man page"
+.SH NAME
+metagen \- generate metadata.xml for ebuilds
+.SH SYNOPSIS
+metagen [-H herd] [-e email] [-d desc] [-l long desc] ...
+.SH DESCRIPTION
+metagen will create a valid metadata.xml file in the current directory.
+At a miminumum you must speficy either a herd (-H) or a package
+maintainer's email address (-e).
+.SH OPTIONS
+.\" metagen [OPTIONS]
+ -H herd
+ Name of herd.
+
+ -e email-address
+ Package maintainer's email address
+
+ -n maintainer-name
+ Package maintainer's name (used with -e option)
+
+ -d description
+ Description of maintainership (used with -e option)
+
+ -l long-description
+ Long description of package.
+
+ -h, --help show this help message and exit
+.SH NOTES
+If you need multiple elements, such as two herds, use a comma to
+separate them. See EXAMPLES
+.SH EXAMPLES
+.B metagen -H python
+
+Creates barebones metadata.xml with python as the herd
+
+
+.B metagen -H python,wxwidgets -l "This package does yada yada yada."
+
+Two herds and long description
+
+
+.B metagen -e pythonhead@gentoo.org -n "Joe Blow" -d "The voices in my head told me to maintain this package"
+
+No herd, maintainer email, maintainer name, description of maintainership
+
+
+.B metagen -H net-p2p,python -e jo@gentoo.org,flo@gentoo.org \
+ -n "Jo Blo","Flo Blo" \
+ -d "I'm maintaining this because foo","I'm maintaining this because bar" \
+ -l "This package is yadda yadda yadda, spam and eggs"
+
+2 herds, 2 maintainers with names and maintainer descriptions for each maintainer
+
+.SH FILES
+.P
+.I /usr/bin/metagen
+.I /usr/share/man/man1/metagen.1.gz
+.SH BUGS
+No known bugs at this time.
+.SH AUTHOR
+.nf
+Rob "pythonhead" Cakebread (pythonhead@gentoo.org)
+.fi
+.SH HISTORY
+2004 \- Initial revision