[Pkg-ruby-extras-maintainers] r316 - in tools/ruby-pkg-tools/trunk: . bin debian

Thierry Reding beatle-guest at costa.debian.org
Thu Jan 26 08:46:52 UTC 2006


Author: beatle-guest
Date: 2006-01-26 08:46:50 +0000 (Thu, 26 Jan 2006)
New Revision: 316

Modified:
   tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources
   tools/ruby-pkg-tools/trunk/debian/changelog
   tools/ruby-pkg-tools/trunk/pkg-ruby-extras.sources
Log:
* Added upstream tarball for the liblog4r-ruby package.
* Added support for HTTP redirections.


Modified: tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources
===================================================================
--- tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources	2006-01-26 00:23:56 UTC (rev 315)
+++ tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources	2006-01-26 08:46:50 UTC (rev 316)
@@ -138,10 +138,47 @@
   }
 end
 
+# follows redirections up to <limit> levels deep
+def follow(uri, limit = 10)
+  # anyone know what the second parameter is supposed to do? HTTP status code?
+  raise Net::HTTPFatalError.new('Too many redirections', 0) if limit == 0
+
+  begin
+    response = Net::HTTP.get_response(URI.parse(uri))
+  rescue SocketError => error
+    puts "E: #{error}"
+    return false
+  end
+
+  case response
+    when Net::HTTPSuccess then
+      return uri
+    when Net::HTTPRedirection then
+      puts "I: Redirecting: #{response['location']}" if $verbose
+      return follow(response['location'], limit-1)
+    else
+      raise Net::HTTPFatalError.new(response.message, response.code)
+  end
+end
+
 # downloads a given package from a specified URL
 def download(package,version,tarball_url)
-  uri = URI.parse(tarball_url)
+  # follow redirection
+  begin
+    tarball_url = follow(tarball_url)
+  rescue Net::HTTPFatalError => error
+    puts "E: HTTP Error: #{error}"
+    return false
+  end
 
+  if tarball_url then
+    uri = URI.parse(tarball_url)
+  else
+    return false;
+  end
+
+  puts "I: URL: #{tarball_url}" if $verbose
+  
   source = uri.path.split('/').pop
   ext = nil
 

Modified: tools/ruby-pkg-tools/trunk/debian/changelog
===================================================================
--- tools/ruby-pkg-tools/trunk/debian/changelog	2006-01-26 00:23:56 UTC (rev 315)
+++ tools/ruby-pkg-tools/trunk/debian/changelog	2006-01-26 08:46:50 UTC (rev 316)
@@ -9,13 +9,15 @@
 
   [ Thierry Reding ]
   * pkg-ruby-get-sources:
-     + now also supports tgz and bzipped archives
+     + Now also supports tgz and bzipped archives:
         - tgz archives are automatically renamed to tar.gz
         - bzipped archives are converted to gzipped archives
-     + no longer displays the verbose message `I: Found source tarball...'
+     + No longer displays the verbose message `I: Found source tarball...'
        when not in verbose mode.
+     + Added support for HTTP redirections.
+  * Added upstream tarball for the liblog4r-ruby package.
 
- -- Lucas Nussbaum <lucas at lucas-nussbaum.net>  Wed, 25 Jan 2006 20:06:31 +0100
+ -- Thierry Reding <thierry at doppeltgemoppelt.de>  Thu, 26 Jan 2006 09:44:26 +0100
 
 ruby-pkg-tools (0.6) unstable; urgency=low
 

Modified: tools/ruby-pkg-tools/trunk/pkg-ruby-extras.sources
===================================================================
--- tools/ruby-pkg-tools/trunk/pkg-ruby-extras.sources	2006-01-26 00:23:56 UTC (rev 315)
+++ tools/ruby-pkg-tools/trunk/pkg-ruby-extras.sources	2006-01-26 08:46:50 UTC (rev 316)
@@ -31,3 +31,5 @@
   "2.2":    http://rubyforge.org/frs/download.php/7093/rgplot-2.2.tar.bz2
 librmagick-ruby:
   "1.10.0": http://rubyforge.org/frs/download.php/8173/RMagick-1.10.0.tar.gz
+liblog4r-ruby:
+  "1.0.5":  http://easynews.dl.sourceforge.net/sourceforge/log4r/log4r-1.0.5.tgz




More information about the pkg-ruby-extras-maintainers mailing list