From 8a701f499a46960c5e09f3cd9f9897f3dc601a75 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 3 Nov 2011 06:22:36 -0400 Subject: [PATCH] Deal with the name change to freecode.net. --- Makefile | 50 ++++++------- NEWS | 10 ++- README | 10 ++- control | 12 ++-- freshmeat-submit => freecode-submit | 78 ++++++++++----------- freshmeat-submit.xml => freecode-submit.xml | 52 +++++++------- 6 files changed, 110 insertions(+), 102 deletions(-) rename freshmeat-submit => freecode-submit (86%) rename freshmeat-submit.xml => freecode-submit.xml (87%) diff --git a/Makefile b/Makefile index 4adc57e..bddcfd2 100644 --- a/Makefile +++ b/Makefile @@ -1,44 +1,44 @@ -# Makefile for the freshmeat-submit tool +# Makefile for the freecode-submit tool -VERS=$(shell sed MANIFEST - (cd ..; ln -s freshmeat-submit freshmeat-submit-$(VERS)) - (cd ..; tar -czf freshmeat-submit/freshmeat-submit-$(VERS).tar.gz `cat freshmeat-submit/MANIFEST`) - (cd ..; rm freshmeat-submit-$(VERS)) +freecode-submit-$(VERS).tar.gz: $(SOURCES) freecode-submit.1 + find $(SOURCES) freecode-submit.1 -type f | sed "s:^:freecode-submit-$(VERS)/:" >MANIFEST + (cd ..; ln -s freecode-submit freecode-submit-$(VERS)) + (cd ..; tar -czf freecode-submit/freecode-submit-$(VERS).tar.gz `cat freecode-submit/MANIFEST`) + (cd ..; rm freecode-submit-$(VERS)) pychecker: @echo "Expect: Object (data) has no attribute (update)" - @ln -f freshmeat-submit freshmeat-submit.py - @-pychecker --only --limit 50 freshmeat-submit.py - @rm -f freshmeat-submit.py + @ln -f freecode-submit freecode-submit.py + @-pychecker --only --limit 50 freecode-submit.py + @rm -f freecode-submit.py clean: - rm -f *.pyc *.html freshmeat-submit.1 MANIFEST ChangeLog SHIPPER.* *~ + rm -f *.pyc *.html freecode-submit.1 MANIFEST ChangeLog SHIPPER.* *~ -dist: freshmeat-submit-$(VERS).tar.gz +dist: freecode-submit-$(VERS).tar.gz -release: freshmeat-submit-$(VERS).tar.gz freshmeat-submit.html +release: freecode-submit-$(VERS).tar.gz freecode-submit.html shipper -u -m -t; make clean diff --git a/NEWS b/NEWS index 2d5d817..808fae4 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,12 @@ - freshmeat-submit project release news + freecode-submit project release news + +Thu Nov 03 2011 Eric S. Raymond - 2.3 + Deal with the Freshmeat to Freecode name change. + Means the name of this tool has to change. Thu Nov 24 2010 Eric S. Raymond - 2.2 Release withdrawal, previously broken, now works. - (This required a Freshmeat API change.) + (This required a site API change.) Thu Oct 21 2010 Eric S. Raymond - 2.1 Now has a query mode that can retrieve project metadata in editable form. @@ -11,7 +15,7 @@ Thu Oct 21 2010 Eric S. Raymond - 2.1 License changed to BSD. Mon Oct 17 2010 Eric S. Raymond - 2.0 - Updated to work with the JSON-based 3.0 freshmeat.net API. + Updated to work with the JSON-based 3.0 API. Major rewrite and simplification of the code. Mon Aug 2 2004 Eric S. Raymond - 1.6 diff --git a/README b/README index 0d99ce1..419d5f4 100644 --- a/README +++ b/README @@ -1,7 +1,11 @@ - freshmeat-submit + freecode-submit -freshmeat-submit is a script that supports remote submitssion of release -updates to Freshmeat via its XML-RPC interface. It is intended for use +freecode-submit is a script that supports remote submitssion of release +updates to Freecode via its XML-RPC interface. It is intended for use in project release scripts. + +(This project was formerly called freshmeat-submit. It changed its name +in 2011 when Freecode did.) + Eric S, Raymond December 2003 diff --git a/control b/control index 5bf409d..01c17ab 100644 --- a/control +++ b/control @@ -1,18 +1,18 @@ # This is not a real Debian control file, but the syntax is upward-compatible. # It's project metadata for the shipper tool -Package: freshmeat-submit +Package: freecode-submit -Description: submit release information to freshmeat.net - freshmeat-submit is a script that supports remote submission of - release updates to Freshmeat via its JSON API. It is intended for use +Description: submit release information to freecode.net + freecode-submit is a script that supports remote submission of + release updates to Freecode via its JSON API. It is intended for use in project release scripts. It reads the metadata from an RFC-2822-like message on standard input, possibly with overrides by command-line switches. -XBS-Destinations: freshmeat +XBS-Destinations: freecode -Homepage: http://www.catb.org/~esr/freshmeat-submit +Homepage: http://www.catb.org/~esr/freecode-submit XBS-Logo: gold-mega.png diff --git a/freshmeat-submit b/freecode-submit similarity index 86% rename from freshmeat-submit rename to freecode-submit index 52ac4d0..f473ed7 100755 --- a/freshmeat-submit +++ b/freecode-submit @@ -1,10 +1,10 @@ #!/usr/bin/env python # -# freshmeat-submit -- script transactions with the Freshmeat server +# freecode-submit -- script transactions with the Freecode server import sys, re, urllib2, json, netrc, email.Parser, optparse -version="2.2" +version="2.3" class Update: "Encapsulate dictionaries describing a project metadata update." @@ -16,7 +16,7 @@ class Update: def __repr__(self): return "Update(" + repr(self.__dict__) + ")" -# The Freshmeat API implementation is sensitive to the kind of HTTP request +# The Freecode API implementation is sensitive to the kind of HTTP request # method you use. The general rule is: # # Reading records: GET @@ -24,7 +24,7 @@ class Update: # Updating existing records: PUT # Deleting existing records: DELETE # -# From http://help.freshmeat.net/faqs/api-7/data-api-intro: +# From http://help.freecode.net/faqs/api-7/data-api-intro: # 200 OK - Request was successful, the requested content is included # 201 Created - Creation of a new resource was successful # 401 Unauthorized - You need to provide an authentication code with this @@ -53,16 +53,16 @@ class RequestWithMethod(urllib2.Request): else: return "GET" -class FreshmeatSessionException(Exception): +class FreecodeSessionException(Exception): def __init__(self, msg): self.msg = msg -class FreshmeatSession: - "Encapsulate the state of a Freshmeat API session." - server = "http://freshmeat.net/" +class FreecodeSession: + "Encapsulate the state of a Freecode API session." + server = "http://freecode.net/" def __init__(self, auth=None, verbose=0, emit_enable=True): - "Initialize Freshmeat session credentials." + "Initialize Freecode session credentials." self.auth = auth self.verbose = verbose self.emit_enable = emit_enable @@ -72,22 +72,22 @@ class FreshmeatSession: try: credentials = netrc.netrc() except netrc.NetrcParseError, e: - raise FreshmeatSessionException("ill-formed .netrc: %s:%s %s" \ + raise FreecodeSessionException("ill-formed .netrc: %s:%s %s" \ % (e.filename, e.lineno, e.msg)) except IOError, e: - raise FreshmeatSessionException(("missing .netrc file %s" % \ + raise FreecodeSessionException(("missing .netrc file %s" % \ str(e).split()[-1])) - ret = credentials.authenticators("freshmeat") + ret = credentials.authenticators("freecode") if not ret: - raise FreshmeatSessionException("no credentials for Freshmeat") + raise FreecodeSessionException("no credentials for Freecode") login, self.auth, password = ret def on_project(self, name): - "Select project by Freshmeat shortname." + "Select project by Freecode shortname." if self.verbose: print "Selecting project: %s" % name self.project = name - query = FreshmeatSession.server + "projects/%s.json?auth_code=%s" \ + query = FreecodeSession.server + "projects/%s.json?auth_code=%s" \ % (self.project, self.auth) handle = urllib2.urlopen(query) content = json.loads(handle.read()) @@ -99,7 +99,7 @@ class FreshmeatSession: def edit_request(self, url, method="GET", request={}, force=False): "Wrap a JSON object with the auth code and ship it as a request" - url = FreshmeatSession.server + url + url = FreecodeSession.server + url data = {"auth_code" : self.auth} data.update(request) data = json.dumps(data) @@ -145,7 +145,7 @@ class FreshmeatSession: print "I see", properties break else: - raise FreshmeatSessionException("couldn't find release %s"%version) + raise FreecodeSessionException("couldn't find release %s"%version) deletelink = "projects/%s/releases/%s.json" % (self.permalink, vid) self.edit_request(deletelink, "DELETE", {}) @@ -162,7 +162,7 @@ class FreshmeatSession: if self.verbose: print "URL list update for %s is: %s" % (self.project, urlassoc) # First, get permalinks for all existing URLs - query = FreshmeatSession.server + "projects/%s/urls.json?auth_code=%s" \ + query = FreecodeSession.server + "projects/%s/urls.json?auth_code=%s" \ % (self.permalink, self.auth) handle = urllib2.urlopen(query) content = json.loads(handle.read()) @@ -190,9 +190,9 @@ class FreshmeatSession: self.edit_request("projects/%s/urls/%s.json?auth_code=%s" % (self.permalink, permadict[label], self.auth), "DELETE", {}) -class FreshmeatMetadataFactory: - "Factory class for producing Freshmeat records in JSON." - freshmeat_field_map = ( +class FreecodeMetadataFactory: + "Factory class for producing Freecode records in JSON." + freecode_field_map = ( ("Project", "P", "name"), # Project ("Summary", "S", "oneliner"), # Project ("Description", "D", "description"), # Project @@ -202,13 +202,13 @@ class FreshmeatMetadataFactory: ("Changes", "c", "changelog"), # Release ("Hide", "x", "hidden_from_frontpage"), # Release ("Release-Tag-List", "t", "tag_list"), # Release - # Note: Release Focus is no longer a real Freshmeat field. + # Note: Release Focus is no longer a real Freecode field. # We remap it below. ("Release-Focus", "r", "release_focus"), # Release ) # Conventional values for release focus focus_values = ( - "Initial freshmeat announcement", + "Initial freecode announcement", "Documentation", "Code cleanup", "Minor feature enhancements", @@ -229,7 +229,7 @@ class FreshmeatMetadataFactory: self.message_parser = email.Parser.Parser() self.argument_parser = optparse.OptionParser( \ usage="usage: %prog [options]") - for (msg_field, shortopt, rpc_field) in FreshmeatMetadataFactory.freshmeat_field_map: + for (msg_field, shortopt, rpc_field) in FreecodeMetadataFactory.freecode_field_map: self.argument_parser.add_option("-" + shortopt, "--" + msg_field.lower(), dest=rpc_field, @@ -254,10 +254,10 @@ class FreshmeatMetadataFactory: def header_to_field(self, hdr): lhdr = hdr.lower().replace("-", "_") - for (alias, shortopt, field) in FreshmeatMetadataFactory.freshmeat_field_map: + for (alias, shortopt, field) in FreecodeMetadataFactory.freecode_field_map: if lhdr == alias.lower().replace("-", "_").replace("/", "_"): return field - raise FreshmeatSessionException("Illegal field name %s" % hdr) + raise FreecodeSessionException("Illegal field name %s" % hdr) def getMetadata(self, stream): "Return an Update object describing project and release attributes." @@ -282,7 +282,7 @@ class FreshmeatMetadataFactory: if payload: data['changelog'] = payload + "\n" if prior_version and data.get("version") != prior_version: - raise FreshmeatSessionException("Version conflict on stdin.") + raise FreecodeSessionException("Version conflict on stdin.") # Merge in options from the command line; # they override what's on stdin. controls = ('query', 'delete', 'read', 'dryrun', 'verbose', 'showversion') @@ -292,16 +292,16 @@ class FreshmeatMetadataFactory: data[key] = value del options.__dict__[key] if data.get("version") != prior_version and not options.delete: - raise FreshmeatSessionException("Version conflict in options.") + raise FreecodeSessionException("Version conflict in options.") # Hidden flag special handling if "hidden_from_frontpage" in data: data["hidden_from_frontpage"] = data["hidden_from_frontpage"] in ("Y", "y") # Release-Focus field special handling. if "release_focus" in data: if data["release_focus"] in '123456789': - data["release_focus"] = FreshmeatMetadataFactory.focus_values[int(data["release_focus"])-1] - if data["release_focus"] not in FreshmeatMetadataFactory.focus_values: - raise FreshmeatSessionException("Invalid release focus") + data["release_focus"] = FreecodeMetadataFactory.focus_values[int(data["release_focus"])-1] + if data["release_focus"] not in FreecodeMetadataFactory.focus_values: + raise FreecodeSessionException("Invalid release focus") if "tag_list" not in data: data["tag_list"] = data["release_focus" ] else: @@ -324,7 +324,7 @@ class FreshmeatMetadataFactory: update.name = data.pop('name') update.urlassoc = urllist for (k, v) in data.items(): - if k in FreshmeatMetadataFactory.projectwide: + if k in FreecodeMetadataFactory.projectwide: # Hack to get around a namespace collision if k == "project_release_tag": k = "release_tag" @@ -337,7 +337,7 @@ class FreshmeatMetadataFactory: if __name__ == "__main__": try: # First, gather update data from stdin and command-line switches - factory = FreshmeatMetadataFactory() + factory = FreecodeMetadataFactory() (options, update) = factory.getMetadata(sys.stdin) # Some switches shouldn't be passed to the server query = 'query' in options.__dict__ and options.query @@ -346,11 +346,11 @@ if __name__ == "__main__": dryrun = 'dryrun' in options.__dict__ and options.dryrun showversion = 'showversion' in options.__dict__ and options.showversion if showversion: - print "freshmeat-submit", version + print "freecode-submit", version raise SystemExit, 0 # Time to ship the update. # Establish session - session = FreshmeatSession(verbose=int(verbose), emit_enable=not dryrun) + session = FreecodeSession(verbose=int(verbose), emit_enable=not dryrun) session.on_project(update.name) if options.query: print "Project: %s" % session.project_data["name"] @@ -389,15 +389,15 @@ if __name__ == "__main__": session.withdraw_release(update.per_release['version']) elif update.per_release and update.per_release.keys()!=["version"]: session.publish_release(update.per_release) - except FreshmeatSessionException, e: - print >>sys.stderr,"freshmeat-submit:", e.msg + except FreecodeSessionException, e: + print >>sys.stderr,"freecode-submit:", e.msg sys.exit(1) except urllib2.HTTPError, f: - print >>sys.stderr,"freshmeat-submit: HTTPError %s" % (f.code) + print >>sys.stderr,"freecode-submit: HTTPError %s" % (f.code) print >>sys.stderr,f.read() sys.exit(1) except urllib2.URLError, f: - print >>sys.stderr,"freshmeat-submit: URLError %s" % (f.reason,) + print >>sys.stderr,"freecode-submit: URLError %s" % (f.reason,) print >>sys.stderr,f.read() sys.exit(1) diff --git a/freshmeat-submit.xml b/freecode-submit.xml similarity index 87% rename from freshmeat-submit.xml rename to freecode-submit.xml index 2e6cc2d..65b761c 100644 --- a/freshmeat-submit.xml +++ b/freecode-submit.xml @@ -2,22 +2,22 @@ - + -freshmeat-submit +freecode-submit 1 -freshmeat-submit +freecode-submit Development Tools Oct 17 2010 -freshmeat-submit -submit release announcements and project metadata updates to freshmeat.net +freecode-submit +submit release announcements and project metadata updates to freecode.net - freshmeat-submit + freecode-submit -q -V -n @@ -31,20 +31,20 @@ DESCRIPTION -freshmeat-submit is a command-line tool -for submitting release announcements to freshmeat.net. It is intended +freecode-submit is a command-line tool +for submitting release announcements to freecode.net. It is intended 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 +freecode-submit accepts release 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 +accumulated data is entered into the freecode database via its API. A few flags control the operation of -freshmeat-submit itself. +freecode-submit itself. @@ -76,9 +76,9 @@ standard input. -N, --dryrun -Generate JSON, but don't ship any modification requests to Freshmeat. +Generate JSON, but don't ship any modification requests to Freecode. Useful for debugging in combination with -V. Note, this mode may generate -requests which read data from Freshmeat in order to get permalink data. +requests which read data from Freecode in order to get permalink data. @@ -135,9 +135,9 @@ corresponding command-line switches: Project: Project -p--project -Name of the project (freshmeat shortname) to operate on. You cannot +Name of the project (freecode shortname) to operate on. You cannot change the project-name attribute with this program; to do that, you -need to use the Freshmeat web interface. +need to use the Freecode web interface. @@ -224,7 +224,7 @@ release will not be visible on the project page. Additionally, you can specify tagged URL fields for the -Freshmeat project record with header lines ending in "-URL:". The tag +Freecode project record with header lines ending in "-URL:". The tag will be the header with the "-URL:" suffix stripped off. Some examples of how to set frequently-used URL types: @@ -290,7 +290,7 @@ integer is acceptable. Case of the string is significant. -Initial freshmeat announcement1 +Initial freecode announcement1 Documentation2 Code cleanup3 Minor feature enhancements4 @@ -303,7 +303,7 @@ integer is acceptable. Case of the string is significant. -The following elements of Freshmeat project metadata cannot yet +The following elements of Freecode project metadata cannot yet be modified using this tool: name, translation list, programming language list, operating system @@ -317,7 +317,7 @@ and dependency records. USAGE Here is an example of a release-information record that could be -fed to freshmeat-submit on standard input: +fed to freecode-submit on standard input: Project: doclifter @@ -340,7 +340,7 @@ installation with Fedora updates to *validated* XML-DocBook. WARNING -Since this program was first written, Freshmeat has changed its +Since this program was first written, Freecode has changed its data API significantly. While we have attempted to maintain backward compatibility, the data model has changed in significant ways. @@ -366,12 +366,12 @@ belong to the human or program generating the job card. ~/.netrc -freshmeat-submit expects to find your -Freshmeat authorization tag here. The correct form for an entry looks like +freecode-submit expects to find your +Freecode authorization tag here. The correct form for an entry looks like this: -machine freshmeat +machine freecode account <your_api_auth_code> @@ -385,15 +385,15 @@ is not world-readable; we recommend doing chmod 600 BUGS -The URLs returned in a project metadata query are Freshmeat redirectors, +The URLs returned in a project metadata query are Freecode redirectors, not the actual URLS supplied by previous project updates. This is due to -a limitation in the Freshmeat API which may be fixed in future versions +a limitation in the Freecode API which may be fixed in future versions of that API. RETURN VALUES 0 on success, 1 on failure. In case of failure, any error message -passed back by the Freshmeat API is issued to standard error. +passed back by the Freecode API is issued to standard error. AUTHORS -- 2.43.0