From: Eric S. Raymond Date: Sun, 17 Oct 2010 20:37:25 +0000 (-0400) Subject: Remove support for cracking RPMs. X-Git-Tag: 2.0~7 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=65262f5ce2852a58737bd3b704909721bad100be;p=freecode-submit.git Remove support for cracking RPMs. --- diff --git a/freshmeat-submit b/freshmeat-submit index f937e38..079c590 100755 --- a/freshmeat-submit +++ b/freshmeat-submit @@ -28,11 +28,14 @@ class Update: class RequestWithMethod(urllib2.Request): "Hack for forcing the method in a request - allows PUT and DELETE" def __init__(self, method, *args, **kwargs): - self.method = method + # This assignment works directly in older Python versions + self._method = method urllib2.Request.__init__(self, *args, **kwargs) def get_method(self): - if self.method: - return self.method + "Deduce the HTTP method to use." + # This method works in newer Pythons (2.6.5, possibly earlier). + if self._method: + return self._method elif self.has_data(): return "POST" else: @@ -155,46 +158,6 @@ class FreshmeatSession: "POST", {"url" : {"label": label, "location" : url}}) -def crack_rpm(rpm, meta, urls): - "Extract freshmeat metadata from an RPM." - try: - def get_rpm_field(fld, rpm): - cmd = "rpm --queryformat='%%{%s}' -qp %s" % (fld, rpm) - (status, output) = commands.getstatusoutput(cmd) - if status != 0: - raise ValueError - return output - # Some fields can be copied literally if present. - if not "name" in meta: - meta["name"] = get_rpm_field("name", rpm) - if not "description" in meta: - meta["description"] = get_rpm_field("description", rpm) - if not "version" in meta: - meta["version"] = get_rpm_field("version", rpm) - # This doesn't work. The values don't map over. - #if not "license" in meta: - # meta["license"] = get_rpm_field("license", rpm) - if not "url_homepage" in meta: - meta["url_homepage"] = get_rpm_field("url", rpm) - if not "changelog" in meta: - # Querying gets you the first entry, apparently - # blank-line-delimited. - changes = get_rpm_field("changelogtext", rpm) - # Canonicalize, stripping leading spaces. - changes = map(lambda x: x.strip(), changes.split('\n')) - changes = "\n".join(changes) + "\n" - meta["changelog"] = changes - # RPMs have a source field; figure out which Freshmeat field it maps to - source = get_rpm_field("source", rpm) - if source.endswith(".tar.gz") or source.endswith(".tgz"): - if "Tar/GZ" not in urls: - urls["Tar/GZ"] = source - if source.endswith(".tar.bz2"): - if "Tar/BZ" not in urls: - urls["Tar/BZ"] = source - except ValueError: - pass - class FreshmeatMetadataFactory: "Factory class for producing Freshmeat records in JSON." freshmeat_field_map = ( @@ -255,7 +218,7 @@ class FreshmeatMetadataFactory: def header_to_field(self, hdr): lhdr = hdr.lower().replace("-", "_") for (alias, shortopt, field) in FreshmeatMetadataFactory.freshmeat_field_map: - if lhdr == alias.lower().replace("-", "_"): + if lhdr == alias.lower().replace("-", "_").replace("/", "_"): return field raise FreshmeatSessionException("Illegal field name %s" % hdr) @@ -264,11 +227,7 @@ class FreshmeatMetadataFactory: data = {} urls = {} (options, args) = self.argument_parser.parse_args() - # First stuff from RPMs if present. - for file in args: - if file.endswith(".rpm"): - crack_rpm(file, data, urls) - # Second, stuff from stdin if present + # Stuff from stdin if present prior_version = data.get("version") if options.read: message = self.message_parser.parse(stream) diff --git a/freshmeat-submit.xml b/freshmeat-submit.xml index b5e10c6..9ba51fc 100644 --- a/freshmeat-submit.xml +++ b/freshmeat-submit.xml @@ -6,7 +6,7 @@ freshmeat-submit 1 -Oct 15 2010 +Oct 17 2010 freshmeat-submit @@ -34,12 +34,11 @@ for batch-mode operation in project release scripts, and designed so that its input format can easily be generated by scripts. freshmeat-submit accepts release -information from binary packages named in the command line, or from an -email-message-like data block on standard input, or from command-line -flags. Values set with command-line flags override those collected -from standard input, which in turn override those collected from -binary package files. The accumulated data is entered into the -freshmeat database via its API. +information from a job card (an email-message-like data block on +standard input) or from command-line flags. Values set with +command-line flags override those collected from the job card. The +accumulated data is entered into the freshmeat database via its +API. A few flags control the operation of freshmeat-submit itself. @@ -80,22 +79,16 @@ option is mainly for developers. -Release information is accepted from three sources in the +Release information is accepted from sources in the following order: - -Binary package files named on the command line. Presently -the only supported format is RPM. The data from certain RPM tags -is mined out of the RPM and merged into the release information. - - An RFC-2822-format message, strongly resembling an ordinary email message, on standard input. The message header fields each specify a particular item of release information; the body (if present) becomes the change announcement text. Within URL fields, the -string ${version} will be replaced with the contends of the Version +string ${version} will be replaced with the contents of the Version field. @@ -108,12 +101,11 @@ field. corresponding command-line switches: - + Message field Scope - RPM tag Short switch Long switch Explanation @@ -122,7 +114,7 @@ corresponding command-line switches: -Project: Project NAME +Project: Project -p--project Name of the project (freshmeat shortname) to operate on. You cannot @@ -132,7 +124,7 @@ need to use the Freshmeat web interface. -Summary: Project - +Summary: Project -S--summary One-line summary of the project. @@ -140,25 +132,25 @@ need to use the Freshmeat web interface. -Description: Project DESCRIPTION +Description: Project -D--description -Multiline description of the project. +Multiline description of the project. (Use RFC-822-style continuation +lines) -License-List: Project - +License-List: Project -L--license-list -Specify the licenses under which the release is issued. This -may be a comma-separated list. Note that this is not copied from the -RPM License field, because the values don't map. +Specify the licenses under which the project is issued. This +may be a comma-separated list. -Project-Tag-List:Release - +Project-Tag-List:Release -T--project-tag-list Tags to attach to this project. May be a comma-separated list. @@ -166,27 +158,25 @@ RPM License field, because the values don't map. -Version: Release VERSION +Version: Release -v--version -Version string to be associated with the release. -Conventionally this will look like n.n or n.n.n, where each n -is decimal digits. +Version string to be associated with the release. -Changes: Release CHANGELOGTEXT +Changes: Release -c--changes -The Changes field. Plain text, no more than 600 characters. -If no Changes field or option is already present, the changes text is taken -from the body of the RFC-822 message on standard input. +The Changes field. If no Changes field or option is already +present, the changes text is taken from the body of the RFC-822 +message on standard input. -Release-Focus:Release - +Release-Focus:Release -r--release-focus Purpose of this release. See the table of release-focus types @@ -195,7 +185,7 @@ below. -Release-Tag-List: Release - +Release-Tag-List: Release -t--tag-list Tags to attach to this release. May be a comma-separated list. @@ -203,7 +193,7 @@ below. -Hide: Release - +Hide: Release -x--hide If this field is present and has the value “Y”, this @@ -212,15 +202,22 @@ release will not be visible on the project page. -Website-URL: Project URL --H--home-page-url +Website-URL: Project +-H--website-url Specify the project home page. -Tar/GZ-URL: Project SOURCE --G--gzipped-tar-url +Tar/GZ-URL: Project +-G--tar-gz-url + +Specify the URL where a gzipped tarball of source can be found. + + + +Changelog-URL: Project +-G--changelog-url Specify the URL where a gzipped tarball of source can be found. @@ -278,12 +275,6 @@ now parse K&R style function prototypes as well as ANSI ones. This version lifts 96% of 9829 manual pages in a full Red Hat 9 installation with Fedora updates to *validated* XML-DocBook. - -You may run this program in a directory where you have already -made an RPM, giving it the RPM as a file argument. In that case, all -you will normally need to supply is the Release-Focus field; the other -required fields (including, most notably, the Changes field) will be -mined out of the RPM. WARNING @@ -296,12 +287,12 @@ compatibility, the data model has changed in significant ways. There is no longer a Branch attribute. The old Release-Focus field is gone. As a special case, this -pragram will validate it and use it to fill in the tags list. +pragram will validate it and use it to fill in the project tags list. The old License field is now License-List and can take a comma-separated list of licenses. -The old Home-Page-URL is noe Website-URL to match the convention +The old Home-Page-URL is now Website-URL to match the convention used by the new API. The old Gzipped-Tar-URL is now Tar/GZ-URL to match the convention @@ -309,6 +300,10 @@ used by the new API. All the other special-case URL fields are gone. They're replaced by the general mechanism for pairing URLs with labels. + +Earlier versions parsed RPM specfiles. This was poor +separation of function and has been removed. That responsibility +belong to the human or program generating the job card. FILES