[Pkg-ruby-extras-maintainers] r285 - in tools/ruby-pkg-tools/trunk:
bin debian
Thierry Reding
beatle-guest at costa.debian.org
Tue Jan 17 01:05:40 UTC 2006
Author: beatle-guest
Date: 2006-01-17 01:05:40 +0000 (Tue, 17 Jan 2006)
New Revision: 285
Modified:
tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources
tools/ruby-pkg-tools/trunk/debian/changelog
Log:
* pkg-ruby-get-sources now also supports `.tgz' and `.tar.bz2' archives.
`.tgz' archives are automatically renamed to `.tar.gz'.
Modified: tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources
===================================================================
--- tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources 2006-01-17 00:17:47 UTC (rev 284)
+++ tools/ruby-pkg-tools/trunk/bin/pkg-ruby-get-sources 2006-01-17 01:05:40 UTC (rev 285)
@@ -18,7 +18,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# TODO: check for already downloaded files (and their size, maybe)
-# TODO: check for formats other than .tar.gz
require 'uri'
require 'net/http'
@@ -50,6 +49,16 @@
"--version" => "shows version information and exit"
}
+# maps extensions of upstream tarballs to extensions of the downloaded
+# archives
+$extensions = {
+ # rename .tgz to .tar.gz; dpkg-source likes it that way
+ 'tgz' => 'tar.gz',
+ # do not rename these archive types
+ 'tar.gz' => nil,
+ 'tar.bz2' => nil
+}
+
begin
opts.each { |opt,val|
case opt
@@ -131,11 +140,27 @@
# downloads a given package from a specified URL
def download(package,version,tarball_url)
uri = URI.parse(tarball_url)
+
+ source = uri.path.split('/').pop
+ ext = nil
+
+ $extensions.each { |key, val|
+ if source.index(key) then
+ ext = val ? 'orig.' + val : 'orig.' + key
+ puts "I: Known archive format: #{source}" if $verbose
+ end
+ }
+
+ if not ext then
+ puts "E: Unknown archive type: #{uri.path}"
+ return false
+ end
+
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 + '.orig.tar.gz'
+ tarball_name = "#{package}_#{version}.#{ext}"
filename = File.join($target_directory,tarball_name)
File.open(filename,'w') { |file|
res.read_body { |part|
Modified: tools/ruby-pkg-tools/trunk/debian/changelog
===================================================================
--- tools/ruby-pkg-tools/trunk/debian/changelog 2006-01-17 00:17:47 UTC (rev 284)
+++ tools/ruby-pkg-tools/trunk/debian/changelog 2006-01-17 01:05:40 UTC (rev 285)
@@ -6,8 +6,12 @@
[ Lucas Nussbaum ]
* Added source for libgnuplot-ruby.
- -- Lucas Nussbaum <lucas at lucas-nussbaum.net> Tue, 17 Jan 2006 00:29:14 +0100
+ [ Thierry Reding ]
+ * pkg-ruby-get-sources now also supports `.tgz' and `.tar.bz2' archives.
+ `.tgz' archives are automatically renamed to `.tar.gz'.
+ -- Thierry Reding <thierry at doppeltgemoppelt.de> Tue, 17 Jan 2006 01:45:06 +0100
+
ruby-pkg-tools (0.6) unstable; urgency=low
[ Lucas Nussbaum ]
More information about the pkg-ruby-extras-maintainers
mailing list