[SCM] ci-tooling packaging branch, master, updated. 5351e20cb881d848c51f47b5fe1c300a501169fc
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Tue Jun 30 07:14:34 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=5351e20
The following commit has been merged in the master branch:
commit 5351e20cb881d848c51f47b5fe1c300a501169fc
Author: Harald Sitter <sitter at kde.org>
Date: Tue Jun 30 09:14:25 2015 +0200
make source publisher handle HTTP301 correctly by using open()
open() unlike manual Net::HTTP is able to handle 301 automatically by
following the redirect, it also has retry nonesense and timeouts and so
forth making it all the more awesome.
instead of using HTTP manually use open, open returns a tmpfile, make sure
it is one and if so rename to the target
---
kci/source_publisher.rb | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/kci/source_publisher.rb b/kci/source_publisher.rb
index 61e53d6..b1d7850 100755
--- a/kci/source_publisher.rb
+++ b/kci/source_publisher.rb
@@ -1,6 +1,8 @@
#!/usr/bin/env ruby
require 'fileutils'
+require 'open-uri'
+require 'tmpfile'
require_relative 'lib/debian/changelog'
require_relative 'lib/lp'
@@ -147,37 +149,30 @@ class SourcePublisher
end
def get_logs(source)
- puts("getting logs...")
+ puts('getting logs...')
log_dir = 'logs'
FileUtils.rm_rf(log_dir)
Dir.mkdir(log_dir)
source.getBuilds.each do |build|
- uri = URI(build.build_log_url)
- begin
- Net::HTTP.start(uri.host) do |http|
- response = http.get(uri.path)
- File.open("#{log_dir}/#{build.arch_tag}.log", 'w') do |file|
- file.write(response.body)
- end
- end
- rescue => e
- p e
- retry
+ tmpfile = open(build.build_log_url)
+ unless tmpfile.is_a?(Tempfile)
+ fail IOError, 'open() did not return a Tempfile'
end
+ File.rename(tmpfile, "#{log_dir}/#{build.arch_tag}.log")
+ tmpfile.close
archindep = source.distro_series.nominatedarchindep.architecture_tag
File.write('archindep', archindep) if archindep
-
- puts "logs done."
end
+
+ puts 'logs done.'
end
def source
return @source if defined?(@source)
sources = @ppa.getPublishedSources(source_name: @source_name, version: @source_version, exact_match: true)
- # TODO: handle too many matches, handle too few matches, handle raise
return nil if sources.size < 1
fail "Unexpectedly too many matching sources #{sources}" if sources.size > 1
puts "source: #{sources[0]}"
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list