[SCM] ci-tooling packaging branch, master, updated. caa217bc1f04a18467d31e4c12f20800d8c134f1
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Fri Nov 28 13:36:27 UTC 2014
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=1aeb66b
The following commit has been merged in the master branch:
commit 1aeb66b2ab6294671f7ffc330647e019e3333a27
Author: Harald Sitter <sitter at kde.org>
Date: Fri Nov 28 14:35:53 2014 +0100
fix up ppa-wait.rb and implement missing bits
---
ppa-wait.rb | 147 ++++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 99 insertions(+), 48 deletions(-)
diff --git a/ppa-wait.rb b/ppa-wait.rb
index 09be192..90ce1a8 100644
--- a/ppa-wait.rb
+++ b/ppa-wait.rb
@@ -1,27 +1,33 @@
#!/usr/bin/env ruby
+require 'fileutils'
require_relative 'lib/lp'
-Launchpad::authenticate!
+Launchpad::authenticate
-ppa = Launchpad::Rubber::from_url('/devel/~kubuntu-ci/+archive/ubuntu/')
+$ppa = Launchpad::Rubber::from_url('https://api.launchpad.net/devel/~kubuntu-ci/+archive/ubuntu/unstable')
def print_state(source)
- # FIXME: format strings
- puts "#{source.distro_series.name}/#{source.source_package_name} (#{source.source_pakage_version}) #{source.status}"
+ puts "%s/%s (%s) %s" % [source.distro_series.name,
+ source.source_package_name,
+ source.source_package_version,
+ source.status]
build_logs = {}
anchor_file = File.open('_anchor-chain', 'w')
source.getBuilds().each do |build|
- # FIXME: format strings
- puts 'lallllll'
+ puts " %s [%s] (%s) %s :: %s :: %s" % [source.source_package_name,
+ build.arch_tag,
+ source.source_package_version,
+ build.buildstate,
+ build.web_link,
+ build.build_log_url]
build_logs[build.arch_tag] = build.build_log_url
- # FIXME
- anchor_file.write(format_string)
+ anchor_file.write(("%s %s
" % [build.arch_tag, build.build_log_url]))
end
+ anchor_file.close
build_log_marker = 'BUILD -'
- build_logs.each do |arch|
- log = build_logs[arch]
+ build_logs.each_pair do |arch, log|
build_log_marker += " [#{arch}] (#{log})"
end
puts build_log_marker
@@ -31,71 +37,116 @@ def print_state(source)
end
end
+def get_logs(source)
+ 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)
+ basename = File.basename(uri.path)
+ File.open("#{log_dir}/#{basename}", 'w') do |file|
+ file.write(response.body)
+ end
+ end
+ rescue => e
+ p e
+ retry
+ end
+ end
+
+ archindep = source.distro_series.nominatedarchindep.architecture_tag
+ if archindep
+ File.open('archindep','w') do |file|
+ file.write(archindep)
+ end
+ end
+
+ puts "logs done."
+end
+
def get_source
- return ppa.getPublishedSources(:source_name => pkg_name,
- :version => pkg_version)[0]
+ source = $ppa.getPublishedSources(:source_name => ARGV[0],
+ :version => ARGV[1])[0]
+ raise '' if source == nil
+ return source
end
+#################################
+
+puts "------------------------- Waiting for LP Builds -------------------------"
+
+#################################
+
# If it takes 20 minutes for the source to arrive it probably got rejected.
fail_count = 20 # This is ~= minutes
-while true
- source = nil
- begin
- source = get_source()
- rescue
- sleep(60)
- fail_count -= 1
- if fail_count <= 0
- puts 'Upload was likely rejected, we have been waiting for well over 20 minutes!'
- exit 1
- end
- next
+source = nil
+begin
+ source = get_source()
+rescue RuntimeError => e # only rescue our own runtime errors, others are fatal
+ p e
+ sleep(60)
+ fail_count -= 1
+ if fail_count <= 0
+ puts 'Upload was likely rejected, we have been waiting for well over 20 minutes!'
+ exit 1
end
+ retry
+end
+
+#################################
- source.get_builds().each do |build|
+loop do
+ sleep_time = 0
+ needs_wait = false
+ has_failed = false
+
+ source.getBuilds().each do |build|
state = build.buildstate
+
case state
when 'Needs building' || 'Currently building' || 'Uploading build' || 'Cancelling build'
needs_wait = true
- sleep = 60 if sleep < 60
+ sleep_time = 60 if sleep_time < 60
when 'Chroot problem' || 'Failed to upload'
puts 'retry'
needs_wait = true
build.retry!
- sleep = (60*5) if sleep < (60*5)
+ sleep_time = (60*5) if sleep_time < (60*5)
when 'Failed to build' || 'Build for superseded Source' || 'Cancelled build' || 'Dependency wait'
has_failed = true
end
-
- if has_failed
- print_state(source)
- exit 1
- end
- if needs_wait
- sleep(sleep)
- next
- else
- puts 'Builds look fine, moving on to publication checks'
- break
- end
end
-end
-while true
- source = get_source
- if source.status == 'Pending'
- sleep(60*2)
+ if needs_wait
+ sleep(sleep_time)
next
end
- puts 'Soure no longer pending...'
+
+ if has_failed
+ print_state(source)
+ exit 1
+ end
+
+ puts 'Builds look fine, moving on to publication checks'
break
end
-while true
+while source.status == 'Pending'
+ sleep(60*2)
+ source = get_source() # We need a new source to get the status update.
+end
+puts 'Soure no longer pending, waiting for binaries...'
+
+loop do
has_pending = false
- source = get_source()
source_id = File.basename(source.self_link)
- build_summary = ppa.getBuildSummariesForSourceIds(:source_ids => source_id)
+ build_summary = $ppa.getBuildSummariesForSourceIds(:source_ids => source_id)
status = build_summary[source_id]['status']
case status
when 'FULLYBUILT_PENDING'
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list