+def print_wnpp(pkgs, config, wnpp_type="ITP"):
+ """Little helper to spit out formatted entry for WNPP bugreport
+
+ TODO: It would puke atm if any field is missing
+ """
+
+ pkg = pkgs[0] # everything is based on the 1st one
+ opts = dict(pkg.items())
+ opts['WNPP-Type'] = wnpp_type.upper()
+ opts['Pkg-Description-Short'] = re.sub('\n.*', '', pkg['Pkg-Description'])
+
+ subject = "%(WNPP-Type)s: %(Pkg-Name)s -- %(Pkg-Description-Short)s" % opts
+ body = """*** Please type your report below this line ***
+
+* Package name : %(Pkg-Name)s
+ Version : %(Version)s
+ Upstream Author : %(Author)s
+* URL : %(Homepage)s
+* License : %(License)s
+ Programming Lang: %(Language)s
+ Description : %(Pkg-Description)s
+
+""" % opts
+
+ # Unfortunately could not figure out how to set the owner, so I will just print it out
+ if False:
+ tmpfile = tempfile.NamedTemporaryFile()
+ tmpfile.write(body)
+ tmpfile.flush()
+ cmd = "reportbug -b --paranoid --subject='%s' --severity=wishlist --body-file='%s' -o /tmp/o.txt wnpp" \
+ % (subject, tmpfile.name)
+ verbose(2, "Running %s" %cmd)
+ os.system(cmd)
+ else:
+ print "Subject: %s\n\n%s" % (subject, body)
+
+