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

Thierry Reding beatle-guest at costa.debian.org
Tue Jan 17 21:28:23 UTC 2006


Author: beatle-guest
Date: 2006-01-17 21:28:22 +0000 (Tue, 17 Jan 2006)
New Revision: 289

Modified:
   tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources
   tools/ruby-pkg-tools/trunk/debian/changelog
Log:
* Now converts bzipped archives to gzipped ones after downloading. This uses
  the system() function, which might not be the best way, but it certainly is
  the easiest.


Modified: tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources
===================================================================
--- tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources	2006-01-17 08:32:45 UTC (rev 288)
+++ tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources	2006-01-17 21:28:22 UTC (rev 289)
@@ -18,6 +18,7 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
 # TODO: check for already downloaded files (and their size, maybe)
+# TODO: delete temporary bzipped archives after converting to gzipped
 
 require 'uri'
 require 'net/http'
@@ -146,7 +147,7 @@
 
   $extensions.each { |key, val|
     if source.index(key) then
-      ext = val ? 'orig.' + val : 'orig.' + key
+      ext = val ? val : key
       puts "I: Known archive format: #{source}" if $verbose
     end
   }
@@ -156,12 +157,13 @@
     return false
   end
 
+  tarball_name = "#{package}_#{version}.orig.#{ext}"
+  filename = File.join($target_directory,tarball_name)
+
   Net::HTTP.start(uri.host, uri.port) { |http|
     http.request_get(uri.path) { |res|
       total = res.header.content_length
       current = 0
-      tarball_name = "#{package}_#{version}.#{ext}"
-      filename = File.join($target_directory,tarball_name)
       File.open(filename,'w') { |file|
         res.read_body { |part|
           current += part.length
@@ -174,6 +176,16 @@
       puts "I: Saved #{filename}" if $verbose
     }
   }
+
+  orig_tarball = filename.sub(ext, 'tar.gz')
+
+  case ext
+    when 'tar.bz2'
+      puts "I: Converting #{filename} to #{orig_tarball}" if $verbose
+      system "bzcat '#{filename}' | gzip -c > '#{orig_tarball}'"
+    else
+      puts "I: Nothing to do for archive type: #{ext}" if $verbose
+  end
 end
 
 package, version = guess_package

Modified: tools/ruby-pkg-tools/trunk/debian/changelog
===================================================================
--- tools/ruby-pkg-tools/trunk/debian/changelog	2006-01-17 08:32:45 UTC (rev 288)
+++ tools/ruby-pkg-tools/trunk/debian/changelog	2006-01-17 21:28:22 UTC (rev 289)
@@ -7,12 +7,14 @@
   * Added source for libgnuplot-ruby.
 
   [ Thierry Reding ]
-  * pkg-ruby-get-sources now also supports `.tgz' and `.tar.bz2' archives.
-    `.tgz' archives are automatically renamed to `.tar.gz'.
-  * No longer displays the verbose message `I: Found source tarball...' when
-    not in verbose mode.
+  * pkg-ruby-get-sources:
+     + 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...'
+       when not in verbose mode.
 
- -- Thierry Reding <thierry at doppeltgemoppelt.de>  Tue, 17 Jan 2006 02:14:53 +0100
+ -- Thierry Reding <thierry at doppeltgemoppelt.de>  Tue, 17 Jan 2006 22:00:21 +0100
 
 ruby-pkg-tools (0.6) unstable; urgency=low
 




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