[SCM] ci-tooling packaging branch, master, updated. 8c477694ab08140319a94eff90f09b63cdbcdca7
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Thu Sep 17 10:44:51 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=db0eecd
The following commit has been merged in the master branch:
commit db0eecd1b80f30f53a94f6d735606dc4f4491880
Author: Harald Sitter <sitter at kde.org>
Date: Thu Sep 17 12:35:44 2015 +0200
drop ppa-wai it is no longer used
---
kci/ppa-wait.py | 180 --------------------------------------------------------
1 file changed, 180 deletions(-)
diff --git a/kci/ppa-wait.py b/kci/ppa-wait.py
deleted file mode 100755
index df640a9..0000000
--- a/kci/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 40 minutes for the source to arrive it probably got rejected
-fail_count = 40 # 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)
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list