[SCM] ci-tooling packaging branch, master, updated. f51d0d9c94368e0e99eb14510fe9df1b3b5eb5c6
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Mon Dec 7 10:53:47 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=f51d0d9
The following commit has been merged in the master branch:
commit f51d0d9c94368e0e99eb14510fe9df1b3b5eb5c6
Author: Harald Sitter <sitter at kde.org>
Date: Mon Dec 7 11:53:41 2015 +0100
resolve more style issues in builder
---
kci/builder.rb | 108 ++++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 81 insertions(+), 27 deletions(-)
diff --git a/kci/builder.rb b/kci/builder.rb
index 38e5892..a1359b0 100755
--- a/kci/builder.rb
+++ b/kci/builder.rb
@@ -4,6 +4,7 @@ require 'fileutils'
require 'json'
require 'timeout'
+require_relative '../lib/apt'
require_relative '../lib/ci/build_source'
require_relative '../lib/debian/dsc_arch_twiddle'
require_relative '../lib/kci'
@@ -14,6 +15,7 @@ require_relative '../lib/lint/result'
require_relative '../lib/lint/series'
require_relative '../lib/lint/symbols'
+# rubocop:disable Style/BlockComments
=begin
-> build_source
- copy upstream source
@@ -35,7 +37,9 @@ require_relative '../lib/lint/symbols'
- qml-checker
-> update_symbols
=end
+# rubocop:enable Style/BlockComments
+# The Kubuntu CI Builder class. So old. So naughty.
class KCIBuilder
class CoverageError < Exception; end
@@ -43,12 +47,12 @@ class KCIBuilder
KEYID = '6A0C5BF2'
Project = Struct.new(:series, :stability, :name)
- def self.testing=(testing)
- @testing = testing
- end
+ class << self
+ attr_writer :testing
- def self.testing
- @testing ||= false
+ def testing
+ @testing ||= false
+ end
end
def self.build_and_publish(project, source)
@@ -63,7 +67,14 @@ class KCIBuilder
if `ssh-keygen -F ppa.launchpad.net`.strip.empty?
`ssh-keyscan -H ppa.launchpad.net >> ~/.ssh/known_hosts`
end
- dput = "dput -d -c #{DPUTCONF} #{@ppa} #{source.name}_#{source.build_version.tar}*.changes"
+ dput_args = [
+ '-d',
+ '-c',
+ DPUTCONF,
+ @ppa,
+ "#{source.name}_#{source.build_version.tar}*.changes"
+ ]
+ dput = "dput #{dput_args.join(' ')}"
success = false
4.times do |count|
# Note: count starts at 0 ;)
@@ -76,7 +87,9 @@ class KCIBuilder
abort ' !!!!!!!!!! dput failed two times !!!!!!!!!!' unless success
Dir.chdir('..') do # main dir
require_relative 'source_publisher'
- publisher = SourcePublisher.new(source.name, source.version, project.stability)
+ publisher = SourcePublisher.new(source.name,
+ source.version,
+ project.stability)
abort 'PPA Build Failed' unless publisher.wait
# Write upload data to file, we perhaps want to do something outside the
# build container.
@@ -109,11 +122,11 @@ class KCIBuilder
@workspace_path = ARGV.fetch(1)
# Workaround for docker not having suidmaps. We run as root in the docker
- # which will result in uid/gid of written things to be 0 rather than whatever
- # jenkins has. So instead we have a fake jenkins user in the docker we can
- # chmod to. This ultimately ensures that the owernship is using the uid of
- # the host jenkins (equal to docker jenkins) such that we don't end up with
- # stuff owned by others.
+ # which will result in uid/gid of written things to be 0 rather than
+ # whatever jenkins has. So instead we have a fake jenkins user in the docker
+ # we can chmod to. This ultimately ensures that the owernship is using the
+ # uid of the host jenkins (equal to docker jenkins) such that we don't end
+ # up with stuff owned by others.
at_exit do
FileUtils.chown_R('jenkins', 'jenkins', @workspace_path, verbose: true)
end unless testing
@@ -122,7 +135,8 @@ class KCIBuilder
# Mangle dsc to not do ARM builds unless explicitly enabled.
# With hundreds of distinct sources on CI, building all of them on three
- # architectures, of which one is not too commonly used, is extremly excessive.
+ # architectures, of which one is not too commonly used, is extremly
+ # excessive.
# Instead, by default we only build on the common architectures with extra
# architectures needing to be enabled explicitly.
# To achieve this mangle the Architecture field in the control file.
@@ -153,7 +167,7 @@ class KCIBuilder
build_and_publish(project, source)
unless File.exist?('logs/i386.log')
- puts "found no logs"
+ puts 'found no logs'
exit 0
end
@@ -169,7 +183,8 @@ class KCIBuilder
end
end
- archindep = File.read('archindep').strip rescue 'amd64' # Get archindep from PPA script.
+ # Get archindep created by PPA script.
+ archindep = File.read('archindep').strip
log_data = File.open("logs/#{archindep}.log").read
updated_symbols = update_symbols(log_data, logs, architectures_with_log,
@@ -265,30 +280,57 @@ class KCIBuilder
puts_kci('I', str)
end
+ # Local
+ def self.git_config(*args, global: false)
+ cmd = %w(git config)
+ cmd << '--global' if global
+ system(*cmd, *args)
+ end
+
+ # Global
+ def self.ggit_config(*args)
+ git_config(*args, global: true)
+ end
+
+ def self.symbol_patch(version, architectures, logs)
+ system('pkgkde-symbolshelper', 'batchpatch',
+ '-v', version,
+ '-c', architectures.join(','),
+ logs.join(' '))
+ end
+
+ def self.gensymbols_regex
+ start = 'dpkg-gensymbols: warning:'
+ %r{#{start} (.*)/symbols doesn't match completely debian/(.*).symbols}
+ end
+
def self.update_symbols(log_data, logs, architectures_with_log, project,
source)
updated_symbols = false
# FIXME: stability wtf
- gensymbols_regex = %r{dpkg-gensymbols: warning: (.*)/symbols doesn't match completely debian/(.*).symbols}
if project.series == KCI.latest_series && log_data.match(gensymbols_regex)
puts 'KCI::SYMBOLS'
- if log_data.include?('warning: some symbols or patterns disappeared in the symbols file')
+ retraction_warn = 'warning: some symbols or patterns disappeared in ' \
+ 'the symbols file'
+ if log_data.include?(retraction_warn)
puts_error('It would very much appear that symbols have been retracted')
else
- match = log_data.match(/--- debian\/(.*).symbols/)
+ match = log_data.match(%r{--- debian/(.*).symbols})
if match && match.size > 1
Dir.chdir('packaging') do
- system('git config --global user.email "kubuntu-ci at lists.launchpad.net"')
- system('git config --global user.name "Kubuntu CI"')
- system('git config core.sparsecheckout')
- system("git checkout -f remotes/packaging/kubuntu_#{project.stability}")
+ ggit_config('user.email', 'kubuntu-ci at lists.launchpad.net')
+ ggit_config('user.name', 'Kubuntu CI')
+ git_config('core.sparsecheckout')
+ remote_ref = "remotes/packaging/kubuntu_#{project.stability}"
+ system("git checkout -f #{remote_ref}")
system('git branch -a')
system('git status')
system('git reset --hard')
captures = match.captures
captures.each do |lib_package|
- puts "pkgkde-symbolshelper batchpatch -v #{source.build_version.base} -c #{architectures_with_log.join(',')} #{logs.join(' ')}"
- system("pkgkde-symbolshelper batchpatch -v #{source.build_version.base} -c #{architectures_with_log.join(',')} #{logs.join(' ')}")
+ symbol_patch(source.build_version.base,
+ architectures_with_log,
+ logs)
updated_symbols = ($? == 0)
puts_info("Auto-updated symbols of #{lib_package}")
end
@@ -299,8 +341,8 @@ class KCIBuilder
system('git commit -a -m "Automatic symbol update"')
end
else
- puts_error('Failed to update symbols as the package name(s) could not be'\
- ' parsed.')
+ puts_error('Failed to update symbols as the package name(s) could ' \
+ 'not be parsed.')
end
end
end
@@ -341,7 +383,19 @@ if __FILE__ == $PROGRAM_NAME
file.puts('Acquire::http { Proxy "http://10.0.3.1:3142"; };')
end
- `apt-get install -y xz-utils dpkg-dev ruby dput debhelper pkg-kde-tools devscripts python-launchpadlib ubuntu-dev-tools git`
+ build_depends = %w(
+ xz-utils
+ dpkg-dev
+ ruby
+ dput
+ debhelper
+ pkg-kde-tools
+ devscripts
+ python-launchpadlib
+ ubuntu-dev-tools
+ git
+ )
+ Apt.install(build_depends)
KCIBuilder.run
end
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list