[csw-devel] SF.net SVN: opencsw:[485] catalog_signatures

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Thu Jul 21 05:29:43 CEST 2011


Revision: 485
          http://opencsw.svn.sourceforge.net/opencsw/?rev=485&view=rev
Author:   bdwalton
Date:     2011-07-21 03:29:43 +0000 (Thu, 21 Jul 2011)

Log Message:
-----------
move the gpg_daemon library back into the main script...it is small enough for now

Signed-off-by: Ben Walton <bwalton at opencsw.org>

Modified Paths:
--------------
    catalog_signatures/bin/http_gpg_daemon

Removed Paths:
-------------
    catalog_signatures/lib/csw/gpg_daemon.rb

Modified: catalog_signatures/bin/http_gpg_daemon
===================================================================
--- catalog_signatures/bin/http_gpg_daemon	2011-07-21 03:29:16 UTC (rev 484)
+++ catalog_signatures/bin/http_gpg_daemon	2011-07-21 03:29:43 UTC (rev 485)
@@ -8,19 +8,6 @@
 VALID_ARCHES = %w(i386 sparc)
 VALID_RELEASES = %w(5.9 5.10 5.11)
 
-begin
-  retried = nil
-  require 'csw/gpg_daemon'
-rescue LoadError => e
-  if retried.nil?
-    $:.unshift(File.join(File.dirname($0), '..', 'lib'))
-    retried = 1
-    retry
-  else
-    reraise
-  end
-end
-
 opts = OpenStruct.new
 opts.port = 9981
 opts.mirror_path = File.join(File.dirname($0), '..')
@@ -28,6 +15,44 @@
 opts.gpg.home = ENV['APP_GPG']
 opts.gpg.bin = '/opt/csw/bin/gpg'
 
+class GPGDaemon < WEBrick::HTTPServlet::AbstractServlet
+  def initialize(server, mirror_path, catalogpath, gpg)
+    @mirror_path = mirror_path
+    @catalog_path = catalogpath
+    @full_path = File.join(@mirror_path, @catalog_path)
+    @catalog_file = File.join(@full_path, 'catalog')
+    @gpg = "#{gpg.bin} --homedir #{gpg.home} --batch --yes --no-tty -a --output /dev/stdout"
+  end
+
+  def do_GET(request, response)
+    mode, *rest = request.path.split('/')[1..-1]
+    mode = 'detach-sign' if mode.eql?('detachsign')
+    cat_reg = "^/(detachsign|clearsign)/#{@catalog_path}(/catalog)*"
+    cmd = "#{@gpg} --#{mode} '#{@catalog_file}'"
+
+    response['Content-type'] = 'text/plain'
+
+    if request.path.match(cat_reg)
+      if File.exists?(@catalog_file)
+        content = `#{cmd}`
+        if $?.exitstatus.eql?(0)
+          response.status = 200
+          response.body = content
+        else
+          response.status = 500
+          response.body = "500 Problem signing the catalog file."
+        end
+      else
+        response.status = 500
+        response.body = "500 Catalog file not found at valid path."
+      end
+    else
+      response.status = 400
+      response.body = "400 Invalid request."
+    end
+  end
+end
+
 OptionParser.new do |o|
   o.banner = "Usage: #{File.basename($0)} [options]"
   o.separator ''

Deleted: catalog_signatures/lib/csw/gpg_daemon.rb
===================================================================
--- catalog_signatures/lib/csw/gpg_daemon.rb	2011-07-21 03:29:16 UTC (rev 484)
+++ catalog_signatures/lib/csw/gpg_daemon.rb	2011-07-21 03:29:43 UTC (rev 485)
@@ -1,39 +0,0 @@
-require 'webrick'
-
-class GPGDaemon < WEBrick::HTTPServlet::AbstractServlet
-  def initialize(server, mirror_path, catalogpath, gpg)
-    @mirror_path = mirror_path
-    @catalog_path = catalogpath
-    @full_path = File.join(@mirror_path, @catalog_path)
-    @catalog_file = File.join(@full_path, 'catalog')
-    @gpg = "#{gpg.bin} --homedir #{gpg.home} --batch --yes --no-tty -a --output /dev/stdout"
-  end
-
-  def do_GET(request, response)
-    mode, *rest = request.path.split('/')[1..-1]
-    mode = 'detach-sign' if mode.eql?('detachsign')
-    cat_reg = "^/(detachsign|clearsign)/#{@catalog_path}(/catalog)*"
-    cmd = "#{@gpg} --#{mode} '#{@catalog_file}'"
-
-    response['Content-type'] = 'text/plain'
-
-    if request.path.match(cat_reg)
-      if File.exists?(@catalog_file)
-        content = `#{cmd}`
-        if $?.exitstatus.eql?(0)
-          response.status = 200
-          response.body = content
-        else
-          response.status = 500
-          response.body = "500 Problem signing the catalog file."
-        end
-      else
-        response.status = 500
-        response.body = "500 Catalog file not found at valid path."
-      end
-    else
-      response.status = 400
-      response.body = "400 Invalid request."
-    end
-  end
-end


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list