[SCM] ci-tooling packaging branch, master, updated. 4ba4cd4d4db0370792c24161be05653afa8b3625
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Wed Feb 25 15:43:17 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=e0dc4de
The following commit has been merged in the master branch:
commit e0dc4deb6685d1e9498fa75e4de9aff820e99ab3
Author: Harald Sitter <sitter at kde.org>
Date: Wed Feb 25 16:37:36 2015 +0100
throw away old ppa-wait scripts
---
ppa-wait.py | 180 ------------------------------------------------------------
ppa-wait.rb | 173 ---------------------------------------------------------
2 files changed, 353 deletions(-)
diff --git a/ppa-wait.py b/ppa-wait.py
deleted file mode 100644
index 6025df2..0000000
--- a/ppa-wait.py
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2014 Harald Sitter <sitter at kde.org>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import re
-import sys
-import time
-from lazr.restfulclient.errors import HTTPError
-from launchpadlib.launchpad import Launchpad
-import urllib
-import shutil
-import socket
-
-# Because buffering delays output to exit Oo
-sys.stdout = sys.stderr
-
-lp = Launchpad.login_with("kubuntu-dev-tools", "production", credentials_file='/var/lib/jenkins/tooling/cred')
-#lp = Launchpad.login_with("kubuntu-dev-tools", "production", version="devel")
-
-def getPPAObject(owner, PPA):
- return lp.people[owner].getPPAByName(name=PPA)
-
-def print_state(source):
- print("%s/%s (%s) %s" % (source.distro_series.name,
- source.source_package_name,
- source.source_package_version,
- source.status))
- build_logs = {}
- anchor_file = open('_anchor-chain','w')
- for build in source.getBuilds():
- print(" %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
- anchor_file.write(("%s %s
" % (build.arch_tag, build.build_log_url)))
- anchor_file.close()
- build_log_marker = 'BUILD -'
- for arch in build_logs:
- log = build_logs[arch]
- build_log_marker += (" [%s] (%s)" % (arch, log))
- print(build_log_marker)
- for binary in source.getPublishedBinaries():
- print(" %s %s" % (binary.display_name,
- binary.status))
-
-def get_logs(source):
- print("getting logs...")
- try:
- shutil.rmtree('logs/')
- except:
- pass
- os.mkdir('logs/')
- for build in source.getBuilds():
- # As of sometime around 2014-10-22 build log retrieval started to get stuck.
- # Supposedly because of bugged out timeout. So, force a timeout and retry.
- socket.setdefaulttimeout(30)
- # TODO: nesting dolls are cool.
- try:
- urllib.urlretrieve(build.build_log_url, ("logs/%s.log.gz" % build.arch_tag))
- except:
- try:
- # Try again...
- urllib.urlretrieve(build.build_log_url, ("logs/%s.log.gz" % build.arch_tag))
- except:
- # And one last time...
- urllib.urlretrieve(build.build_log_url, ("logs/%s.log.gz" % build.arch_tag))
- # 15.04+ use amd64 as arch:indep architecture. Query Launchpad to get the right arch.
- archindep = source.distro_series.nominatedarchindep.architecture_tag
- if archindep:
- f = open('archindep','w')
- f.write(archindep)
- print("logs done.")
-
-pkg_name = sys.argv[1]
-pkg_version = sys.argv[2]
-ppa_name = sys.argv[3]
-
-ppa = getPPAObject("kubuntu-ci", ppa_name)
-
-print "------------------------- Waiting for LP Builds -------------------------"
-
-def getSource():
- fail_count = 0
- while True:
- try:
- return ppa.getPublishedSources(source_name=pkg_name, version=pkg_version)[0]
- except socket.error as e:
- if fail_count >= 2:
- raise e
- print("Got a socket error, assuming a connection fail, trying agian in 10 seconds.")
- time.sleep(10)
- fail_count += 1
-
-# If it takes 20 minutes for the source to arrive it probably got rejected
-fail_count = 20 # This is minutes
-while True:
- source = None
- try:
- # This will raise on index access if we have no sources yet.
- source = getSource()
- except:
- time.sleep(60)
- fail_count -= 1
- if fail_count <= 0:
- print("Upload was likely rejected, we've been waiting for well over 20 minutes!")
- sys.exit(1)
- continue
- sleep = 0
- has_failed = False
- needs_wait = False
- for build in source.getBuilds():
- state = build.buildstate
- if state == 'Needs building' or state == 'Currently building' or state == 'Uploading build' or state == 'Cancelling build':
- needs_wait = True
- if sleep < 60:
- sleep = 60
- continue
- if state == 'Chroot problem' or state == 'Failed to upload':
- has_failed = True
- if state == 'Failed to build' or state == 'Build for superseded Source' or state == 'Cancelled build' or state == 'Dependency wait':
- has_failed = True
- if has_failed:
- print_state(source)
- sys.exit(1)
- if needs_wait:
- time.sleep(sleep)
- continue
- else:
- print("Builds look fine, moving on to publication checks")
- break
-
-# Builds are fine, check publication of source itself
-while True:
- source = getSource()
- if source.status == 'Pending':
- time.sleep(60*2)
- continue
- print("Source no longer pending.")
- break
-
-# Make sure the binaries are actually published as expected
-while True:
- has_pending = False
- source = getSource()
- source_id = os.path.basename(source.self_link)
- build_summary = ppa.getBuildSummariesForSourceIds(source_ids=source_id)
- status = build_summary[source_id]['status']
- if status == 'FULLYBUILT_PENDING':
- has_pending = True
- elif status != 'FULLYBUILT':
- print("Something very terrible happened as overall state is %s, which was not expected at all" % (status))
- print_state(getSource())
- sys.exit(1)
- if not has_pending:
- print("All things are published, hooray.")
- break
- time.sleep(60)
-source = getSource()
-print_state(source)
-get_logs(source)
-
-print("PPA Wait done.")
-sys.exit(0)
diff --git a/ppa-wait.rb b/ppa-wait.rb
deleted file mode 100644
index cfde817..0000000
--- a/ppa-wait.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'fileutils'
-require_relative 'lib/lp'
-
-Launchpad::authenticate
-
-$ppa = Launchpad::Rubber::from_url('https://api.launchpad.net/devel/~kubuntu-ci/+archive/ubuntu/unstable')
-
-def print_state(source)
- 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|
- 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
- anchor_file.write("%s %s
" % [build.arch_tag, build.build_log_url])
- end
- anchor_file.close
-
- build_log_marker = 'BUILD -'
- build_logs.each_pair do |arch, log|
- build_log_marker += " [#{arch}] (#{log})"
- end
- puts build_log_marker
-
- source.getPublishedBinaries().each do |binary|
- puts " #{binary.display_name} #{binary.status}"
- 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
- 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
-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
-
-#################################
-
-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_time = 60 if sleep_time < 60
- when 'Chroot problem' || 'Failed to upload'
- puts 'retry'
- needs_wait = true
- build.retry!
- 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
- end
-
- if needs_wait
- sleep(sleep_time)
- next
- end
-
- if has_failed
- print_state(source)
- exit 1
- end
-
- puts 'Builds look fine, moving on to publication checks'
- break
-end
-
-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_id = File.basename(source.self_link)
- build_summary = $ppa.getBuildSummariesForSourceIds(:source_ids => source_id)
- status = build_summary[source_id]['status']
- case status
- when 'FULLYBUILT_PENDING'
- has_pending = true
- when 'FULLYBUILT'
- has_pending = false
- else
- puts "Something very terrible happened as the overall state is #{status}, which was not expected at all"
- print_state(get_source())
- exit 1
- end
- if not has_pending
- puts 'All things are published, hooray!'
- break
- end
- sleep(60)
-end
-
-source = get_source()
-print_state(source)
-get_logs(source)
-
-puts 'PPA Wait done.'
-exit 0
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list