[kde-services-devel] r537 - in trunk/hotstuff: . ocs
josef at new.kstuff.org
josef at new.kstuff.org
Sun Oct 4 15:38:00 CEST 2009
Author: josef
Date: 2009-10-04 15:37:59 +0200 (Sun, 04 Oct 2009)
New Revision: 537
Added:
trunk/hotstuff/ocs/
trunk/hotstuff/ocs/HotstuffOCS.pm
trunk/hotstuff/ocs/hotstuff-ocs
Removed:
trunk/hotstuff/THOUGHTS
Modified:
trunk/hotstuff/ChangeLog
trunk/hotstuff/Makefile
trunk/hotstuff/NEWS
trunk/hotstuff/README
trunk/hotstuff/TODO
Log:
- initial code for eventual implementation of the content part of the OCS API
- cleanup of old TODO lists
- update of changelog in anticipation of a new release
Modified: trunk/hotstuff/ChangeLog
===================================================================
--- trunk/hotstuff/ChangeLog 2009-10-03 17:40:16 UTC (rev 536)
+++ trunk/hotstuff/ChangeLog 2009-10-04 13:37:59 UTC (rev 537)
@@ -1,3 +1,159 @@
+2009-10-03 16:32 josef
+
+ * man/hotstuff-search.1, man/hotstuff-stuff.1: - adapt manual pages
+ including CGI parameters to merged hotstuff-search script
+
+2009-10-03 16:25 josef
+
+ * src/hotstuff-stuff: - very simple offset mechanism
+
+2009-10-03 16:21 josef
+
+ * src/hotstuff-search, src/hotstuff-stuff: - merge hotstuff-search
+ functionality into hotstuff-stuff
+ - this includes both an (improved) RSS feed and restriction of
+ items based on name/summary search phrases
+
+2009-10-03 15:41 josef
+
+ * src/hotstuff-stuff: - for WebDAV uploads which are stored
+ according to their category, honour the payload and preview paths
+ when producing the download feed (bug showed up with Cantor repo)
+
+2009-10-03 13:51 josef
+
+ * TODO: - another wanted feature
+
+2009-10-03 13:10 josef
+
+ * TODO: - idea worth a try: RSS feed import/export
+
+2009-08-17 06:09 josef
+
+ * src/hotstuff-versioning: - suppress error messages
+
+2009-08-14 20:33 josef
+
+ * scripts/maintenance.sh: - automate scanning process for
+ non-SVN-backed repos as well
+
+2009-08-14 20:20 josef
+
+ * src/hotstuff-provider: - force upload URL to contain webdav:// as
+ otherwise konqueror will not switch into webdav mode
+
+2009-08-14 19:39 josef
+
+ * src/hotstuff-stuff: - enforce correct database encoding, Perl's
+ DBI doesn't get this automatically
+ - now umlauts show up correctly in the feeds
+
+2009-08-12 09:19 josef
+
+ * src/hotstuff-versioning: - partially revert r517 to get the logic
+ right... sorry for the noise
+
+2009-08-12 09:03 josef
+
+ * src/hotstuff-scan: - show update path for dismissed updates
+
+2009-08-12 09:01 josef
+
+ * src/hotstuff-versioning: - improved handling of commit-by-commit
+ subversion updates
+
+2009-08-03 09:06 josef
+
+ * TODO: - bug report about feed count of not approved items
+
+2009-07-02 00:08 josef
+
+ * src/hotstuff-stuff: - experimental support for unique identifiers
+ per entry
+
+2009-04-14 16:58 josef
+
+ * src/hotstuff-access: - do not break file contents by assuming any
+ encoding for binary downloads
+
+2009-03-22 20:42 josef
+
+ * src/hotstuff-stuff: - this Perl typo caused an HTTP error 500
+
+2009-03-22 20:09 josef
+
+ * TODO, src/hotstuff-scan: - this problem should be solved now
+
+2009-03-22 19:49 josef
+
+ * TODO, src/hotstuff-access, src/hotstuff-downloads,
+ src/hotstuff-http, src/hotstuff-provider, src/hotstuff-scan,
+ src/hotstuff-search, src/hotstuff-siteadmin, src/hotstuff-stuff,
+ src/hotstuff-versioning: - replace perl -C invocation with weird
+ :encoding(utf-8) binmode statement, required by perl 5.10
+ - extend database port configurability to hotstuff-versioning
+ script
+ - propagate --dry-run option from hotstuff-versioning to
+ hotstuff-scan
+ - do not skip 'preview' and 'summary' tags anymore since the new
+ special handling for meta_ref covers this skip implicitly
+ - copyright updates to cover 2009
+ - kde-look fix: discard 'id' tag as it clashes with what we use
+ internally in our database, and it's definitely not part of the
+ GHNS spec
+ - upped priority for Kalzium subdirs issue, this really needs to
+ be solved soon
+
+2008-11-23 15:56 josef
+
+ * svn-repos.txt: - how to create meta files
+
+2008-11-23 15:30 josef
+
+ * scripts/ghnsmetatemplate: - updated for current GHNS spec
+
+2008-11-23 09:47 josef
+
+ * svn-repos.txt: - documentation on SVN-backed repositories
+
+2008-11-23 09:37 josef
+
+ * TODO, src/hotstuff-scan, src/hotstuff-versioning: - experimental
+ code found uncommitted as of yet: read revision and changelog
+ from SVN information
+
+2008-11-07 13:04 josef
+
+ * schemas/ghns.xsd: - preview is actually an optional field
+ (detected by smajewsky)
+
+2008-07-31 20:29 josef
+
+ * README, TODO: - start working towards next version, 0.9.4
+ - one TODO item is mostly solved, another one got a suggestion
+
+2008-07-31 19:49 josef
+
+ * scripts/maintenance.sh, scripts/post-commit: - while running
+ Hotstuff directly on commit comes with a performance issue, we
+ can at least let the cronjob idle until something happens in the
+ repository
+
+2008-07-31 17:38 josef
+
+ * ChangeLog, NEWS: - update changelog right until today to finish
+ with the hacking-less period of several months
+
+2008-05-17 12:09 josef
+
+ * src/hotstuff-scan, src/hotstuff-stuff: - support for the
+ <webpage> tag when sending out the feeds as long as it's not
+ empty
+
+2008-05-17 12:01 josef
+
+ * schemas/hotstuff.sql: - addition of SQL column for <webpage> tags
+
2008-05-11 18:52 josef
* TODO: - changelog entries are currently not used for SVN-backed
Modified: trunk/hotstuff/Makefile
===================================================================
--- trunk/hotstuff/Makefile 2009-10-03 17:40:16 UTC (rev 536)
+++ trunk/hotstuff/Makefile 2009-10-04 13:37:59 UTC (rev 537)
@@ -1,4 +1,4 @@
-version = 0.9.3
+version = 0.9.4
prefix = /usr/local
webprefix = $(prefix)/share
@@ -15,6 +15,7 @@
$(MAKE) install-common
$(MAKE) install-scripts
$(MAKE) install-dxs
+ $(MAKE) install-ocs
$(MAKE) install-admin
#$(MAKE) install-doc
@@ -41,13 +42,11 @@
cp scripts/ghnsmetatemplate $(dprefix)/bin
cp scripts/ghnssignature $(dprefix)/bin
mkdir -p $(dprefix)/lib/cgi-bin
- cp src/hotstuff-search $(dprefix)/lib/cgi-bin
cp src/hotstuff-stuff $(dprefix)/lib/cgi-bin
cp src/hotstuff-access $(dprefix)/lib/cgi-bin
cp src/hotstuff-provider $(dprefix)/lib/cgi-bin
mkdir -p $(dprefix)/share/man/man1
cp man/hotstuff-scan.1 $(dprefix)/share/man/man1
- cp man/hotstuff-search.1 $(dprefix)/share/man/man1
cp man/hotstuff-stuff.1 $(dprefix)/share/man/man1
cp man/hotstuff-versioning.1 $(dprefix)/share/man/man1
cp man/hotstuff-http.1 $(dprefix)/share/man/man1
@@ -67,6 +66,11 @@
cp dxs/DXS.pm $(dprefix)/lib/cgi-bin
cp dxs/hotstuff-dxs $(dprefix)/lib/cgi-bin
+install-ocs:
+ mkdir -p $(dprefix)/lib/cgi-bin
+ cp dxs/HotstuffOCS.pm $(dprefix)/lib/cgi-bin
+ cp dxs/hotstuff-ocs $(dprefix)/lib/cgi-bin
+
install-admin:
mkdir -p $(dwebprefix)/hotstuff-admin
cp -r admin/*.* $(dwebprefix)/hotstuff-admin
Modified: trunk/hotstuff/NEWS
===================================================================
--- trunk/hotstuff/NEWS 2009-10-03 17:40:16 UTC (rev 536)
+++ trunk/hotstuff/NEWS 2009-10-04 13:37:59 UTC (rev 537)
@@ -1,10 +1,11 @@
-??.??.2008: Version 0.9.4
+04.10.2009: Version 0.9.4
-------------------------
* Licence upgraded to AGPLv3
* Hook script to maintain repository configuration files and database
creation in SVN.
* Better integration of Hotstuff-DXS through configuration options.
-* Countless Perl fixes.
+* Merge of search and RSS/OpenSearch output into hotstuff-stuff.
+* Countless Perl fixes, especially encoding related ones.
15.03.2008: Version 0.9.3
-------------------------
Modified: trunk/hotstuff/README
===================================================================
--- trunk/hotstuff/README 2009-10-03 17:40:16 UTC (rev 536)
+++ trunk/hotstuff/README 2009-10-04 13:37:59 UTC (rev 537)
@@ -13,7 +13,7 @@
direct interaction with GHNS repositories, whereas normal upload and download
are handled by traditional FTP, HTTP, WebDAV and SVN software.
-This is the fourth release of Hotstuff in tarball format, and as such still
+This is the fifth release of Hotstuff in tarball format, and as such still
subject to heavy instability. Use with care! This package is mainly provided
for those who want to test the corresponding client development, for example
the KNewStuff2 library from KDE 4.
@@ -27,7 +27,7 @@
Have a look at http://newstuff.kde.org/ to see how a Hotstuff-powered site
can be run.
-Last update: 31.07.2008
+Last update: 04.10.2009
Josef Spillner <josef at kstuff.org>
Deleted: trunk/hotstuff/THOUGHTS
===================================================================
--- trunk/hotstuff/THOUGHTS 2009-10-03 17:40:16 UTC (rev 536)
+++ trunk/hotstuff/THOUGHTS 2009-10-04 13:37:59 UTC (rev 537)
@@ -1,11 +0,0 @@
-TODO:
-
-- read in all translations from meta file
-- better resistance against broken feeds (like kde-look.org ;)
-(done) - use of config file in hotstuff-http.pl and hotstuff-downloads.pl
-
-Old thoughts:
-
-- distribute load from main download server (mirrors)
-- webdav
-
Modified: trunk/hotstuff/TODO
===================================================================
--- trunk/hotstuff/TODO 2009-10-03 17:40:16 UTC (rev 536)
+++ trunk/hotstuff/TODO 2009-10-04 13:37:59 UTC (rev 537)
@@ -1,5 +1,3 @@
-* recursive scanning in hotstuff-scan (e.g. for 'kalzium' repository)
- - is implemented, but issue with database remains
* less strict schema to allow for reordered lines
- see schemas/SchemaLimitation; this will affect SVN pre-commit hook script
* SVN-backed repos: option to only generate new entry when tag gets applied
@@ -8,41 +6,11 @@
* get rid of LWP::Simple, for it doesn't really mirror(), i.e. it always downloads everything again
* strip \r from any imported texts?
-* complete provider management (i.e. hotstuff-siteadmin) through SVN
- - partially implemented already
* replace hotstuff-scan cronjob with hooks for SVN-backed repos
- partially implemented with an idle-noop cronjob
-* populate changelog entries automatically when using SVN
- - implement by adding changelog entries in hotstuff-versioning before calling hotstuff-scan
-* bug report by JohnFlux: SVN-backed subdirectories are stripped in the database
- + confirmed by Karl-Ulrich Bamberg, see Kalzium: ?file=./heptan-2-one.cml&site=kalzium
- - solved by considering relative directories and general path beautification
-
* bug report by Sebastien Martel: notapproved=1 appears for approved but replaced (hidden) item
* XSL script for RSS<->GHNS feed transformation
* Support for paging by introducing offset parameter at least for DXS (OCS has offset + size <= sizelimit)
-------------------------------------------------------
-
-* stuff.xml.php, providers.xml:
- check for compliance with new GHNS format!
-* hotstuff.conf DXS changes to hotstuff.conf-dist
-* renaming of kstuff-ws.pl to hotstuff-dxs
- renaming of GHNS.pm to DXS.pm, and creation of a general
- GHNS.pm/Hotstuff.pm?
- (both after cvs->svn migration maybe...)
-
-################## new for 0.9.1:
-
-* manpage cleanup needed
-* hotstuff-siteadmin needs a manpage
-
---- DONE ---
-
-* install kpresenter (for docs-src/*.kpr)
-* CVS additions:
- hotstuff/src/htaccess-dist
- hotstuff/src/README.files
- kdxs/src/kdxsrc
Added: trunk/hotstuff/ocs/HotstuffOCS.pm
===================================================================
--- trunk/hotstuff/ocs/HotstuffOCS.pm (rev 0)
+++ trunk/hotstuff/ocs/HotstuffOCS.pm 2009-10-04 13:37:59 UTC (rev 537)
@@ -0,0 +1,165 @@
+#!/usr/bin/env perl
+#
+# Open Collaboration Services interface to the Hotstuff database
+# Copyright (C) 2009 Josef Spillner <josef at kstuff.org>
+# Published under 'GNU AGPLv3 or later' conditions
+
+package HotstuffOCS;
+
+use base qw/CGI::Application/;
+
+use strict;
+use warnings;
+
+use CGI::Application::Plugin::Routes;
+use XML::Writer;
+
+sub setup {
+ my $self = shift;
+ $self->routes_root('/:site/v1/content');
+ $self->routes([
+ '' => 'home' ,
+ '/categories' => 'categories',
+ '/data' => 'list'
+ ]);
+ $self->start_mode('home');
+}
+
+sub database {
+ # FIXME: encapsulate and share with hotstuff-stuff
+ my $site = shift;
+
+ my $opt_config = "/etc/hotstuff.d/$site.conf";
+
+ use vars qw($dbhost $dbport $dbname $dbuser $dbpass);
+ eval{require $opt_config};
+ if($@){
+ return 0;
+ }
+ if(!$dbport){
+ $dbport = 5432;
+ }
+
+ my $conn = DBI->connect("DBI:Pg:host=$dbhost;port=$dbport;dbname=$dbname;user=$dbuser;password=$dbpass");
+ # FIXME: Bareword "DBI::errstr" not allowed while "strict subs" in use at HotstuffOCS.pm
+ #$conn || die DBI::errstr;
+ $conn->{pg_enable_utf8} = 1;
+ return $conn;
+}
+
+sub list {
+ my $self = shift;
+ $self->header_add(-content_type => "text/xml");
+
+ # FIXME: categories := 'XxYxZ'
+ # FIXME: sortmode := (new|alpha|high|down)
+
+ my $q = $self->query();
+ my $site = $q->param('site');
+ my $categories = $q->param('categories');
+ my $search = $q->param('search');
+ my $user = $q->param('user');
+ my $sortmode = $q->param('sortmode');
+ my $page = $q->param('page');
+ my $pagesize = $q->param('pagesize');
+
+ my $conn = database($site);
+
+ my $out;
+ my $writer = new XML::Writer(DATA_MODE => 1, OUTPUT => \$out);
+ $writer->xmlDecl("UTF-8");
+ $writer->startTag("ocs");
+ $writer->startTag("meta");
+ $writer->dataElement("status", "ok");
+ $writer->dataElement("statuscode", "100");
+ $writer->dataElement("message", "");
+ $writer->dataElement("totalitems", "???");
+ $writer->dataElement("itemsperpage", "???");
+ $writer->endTag("meta");
+ $writer->startTag("data");
+ $writer->startTag("content", "details" => "summary");
+ $writer->dataElement("id", "???");
+ $writer->dataElement("name", "???");
+ $writer->dataElement("version", "???");
+ $writer->dataElement("changed", "???");
+ $writer->dataElement("created", "???");
+ $writer->dataElement("typeid", "???");
+ $writer->dataElement("typename", "???");
+ $writer->dataElement("language", "???");
+ $writer->dataElement("personid", "???");
+ $writer->dataElement("downloads", "???");
+ $writer->dataElement("score", "???");
+ $writer->dataElement("comments", "???");
+ $writer->dataElement("detailpage", "???");
+ $writer->dataElement("preview1", "???");
+ $writer->dataElement("previewpic1", "???");
+ $writer->endTag("content");
+ $writer->endTag("data");
+ $writer->endTag("ocs");
+
+ # FIXME: download-type/price/link/name/size
+
+ return $out;
+}
+
+sub categories {
+ my $self = shift;
+ $self->header_add(-content_type => "text/xml");
+
+ my $q = $self->query();
+ my $site = $q->param('site');
+
+ my $conn = database($site);
+
+ my $category;
+ my @categories = ();
+
+ # FIXME: available repositories could be maintained in a database as well
+ my $query = "SELECT DISTINCT category FROM directory";
+ my $res = $conn->prepare($query);
+ $res->execute();
+ $res->bind_columns(\$category);
+ while($res->fetch()){
+ push @categories, $category;
+ }
+ $res->finish();
+
+ my $out;
+ my $writer = new XML::Writer(DATA_MODE => 1, OUTPUT => \$out);
+ $writer->xmlDecl("UTF-8");
+ $writer->startTag("ocs");
+ $writer->startTag("meta");
+ $writer->dataElement("status", "ok");
+ $writer->dataElement("statuscode", "100");
+ $writer->dataElement("message", "");
+ $writer->dataElement("totalitems", "???");
+ $writer->endTag("meta");
+ $writer->startTag("data");
+ foreach my $category(@categories){
+ # FIXME: unique ids
+ my $id = 0;
+ $writer->startTag("category");
+ $writer->dataElement("id", $id);
+ $writer->dataElement("name", $category);
+ $writer->endTag("category");
+ }
+ $writer->endTag("data");
+ $writer->endTag("ocs");
+
+ return $out;
+}
+
+sub home {
+ my $self = shift;
+ $self->header_add(-content_type => "text/plain");
+
+ my $s = "Hotstuff OCS Implementation\n\n";
+ $s .= "This script implements the Content part of the Open Collaboration Services (OCS).\n";
+ # FIXME: here or rather in hotstuff-provider?
+ #$s .= "It also creates the provider meta-information on request.\n";
+ $s .= "Please refer to the specification to find out about its methods.\n";
+
+ return $s;
+}
+
+1;
Added: trunk/hotstuff/ocs/hotstuff-ocs
===================================================================
--- trunk/hotstuff/ocs/hotstuff-ocs (rev 0)
+++ trunk/hotstuff/ocs/hotstuff-ocs 2009-10-04 13:37:59 UTC (rev 537)
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+#
+# Web service handler for the OCS backend service
+# Copyright (C) 2009 Josef Spillner <josef at kstuff.org>
+# Published under 'GNU AGPLv3 or later' conditions
+
+use HotstuffOCS;
+my $ocs= HotstuffOCS->new();
+$ocs->run();
+
Property changes on: trunk/hotstuff/ocs/hotstuff-ocs
___________________________________________________________________
Name: svn:executable
+ *
More information about the kde-services-devel
mailing list