[SCM] ci-tooling packaging branch, master, updated. 31603f49bb1a2b54f9555c8043870460d1c5ec9b

Harald Sitter apachelogger-guest at moszumanska.debian.org
Mon Oct 5 12:21:26 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=8530960

The following commit has been merged in the master branch:
commit 85309604ea673e167a9313927771e84522ad65ec
Author: Harald Sitter <sitter at kde.org>
Date:   Mon Oct 5 13:44:51 2015 +0200

    pack builder into a class
---
 kci/builder.rb | 846 +++++++++++++++++++++++++++++----------------------------
 1 file changed, 427 insertions(+), 419 deletions(-)

diff --git a/kci/builder.rb b/kci/builder.rb
index 41ba5a1..25c3f54 100755
--- a/kci/builder.rb
+++ b/kci/builder.rb
@@ -47,472 +47,480 @@ Project = Struct.new(:series, :stability, :name)
 
 $stdout = $stderr
 
-# get basename, distro series, unstable/stable
-components = ARGV.fetch(0).split('_')
-unless components.size == 3
-  abort 'Did not get a valid project identifier via ARGV0'
-end
-project = Project.new(components[0], components[1], components[2])
-
-PPA = "ppa:kubuntu-ci/#{project.stability}"
-
-File.open('/etc/apt/apt.conf.d/apt-cacher', 'w') do |file|
-  file.puts('Acquire::http { Proxy "http://10.0.3.1:3142"; };')
-end
+class Builder
+  def self.run
+    # get basename, distro series, unstable/stable
+    components = ARGV.fetch(0).split('_')
+    unless components.size == 3
+      abort 'Did not get a valid project identifier via ARGV0'
+    end
+    project = Project.new(components[0], components[1], components[2])
 
-# PWD
-abort 'Could not change dir to ARGV1' unless Dir.chdir(ARGV[1])
+    @ppa = "@ppa:kubuntu-ci/#{project.stability}"
 
-WORKSPACE_PATH = ARGV[1]
+    File.open('/etc/apt/apt.conf.d/apt-cacher', 'w') do |file|
+      file.puts('Acquire::http { Proxy "http://10.0.3.1:3142"; };')
+    end
 
-# 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.
-at_exit do
-  FileUtils.chown_R('jenkins', 'jenkins', WORKSPACE_PATH, verbose: true)
-end
+    # PWD
+    abort 'Could not change dir to ARGV1' unless Dir.chdir(ARGV[1])
 
-# install deps
-`apt-get install -y xz-utils dpkg-dev ruby dput debhelper pkg-kde-tools devscripts python-launchpadlib ubuntu-dev-tools git`
+    @workspace_path = ARGV.fetch(1)
 
-# version
-changelog = Changelog.new('packaging')
-version = CI::BuildVersion.new(changelog)
-source_name = changelog.name
+    # 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.
+    at_exit do
+      FileUtils.chown_R('jenkins', 'jenkins', @workspace_path, verbose: true)
+    end
 
-FileUtils.rm_r('build') if File.exist?('build')
-FileUtils.mkpath('build/source/')
+    # install deps
+    `apt-get install -y xz-utils dpkg-dev ruby dput debhelper pkg-kde-tools devscripts python-launchpadlib ubuntu-dev-tools git`
 
-# copy upstream sources around
-if Dir.exist?('source') && !Dir.glob('source/*').empty?
-  abort 'Failed to copy source' unless system('cp -r source/* build/source/')
-  Dir.chdir('build/source') do
-    FileUtils.rm_rf(Dir.glob('**/.bzr'))
-    FileUtils.rm_rf(Dir.glob('**/.git'))
-    FileUtils.rm_rf(Dir.glob('**/.svn'))
-  end
+    # version
+    changelog = Changelog.new('packaging')
+    version = CI::BuildVersion.new(changelog)
+    source_name = changelog.name
 
-  # create orig tar
-  Dir.chdir('build/') do
-    tar = "#{source_name}_#{version.tar}.orig.tar"
-    abort 'Failed to create a tarball' unless system("tar -cf #{tar} source")
-    abort 'Failed to compress the tarball' unless system("xz -6 #{tar}")
-  end
+    FileUtils.rm_r('build') if File.exist?('build')
+    FileUtils.mkpath('build/source/')
 
-  # Copy packaging
-  unless system('cp -r packaging/debian build/source/')
-    abort 'Failed to copy packaging'
-  end
-else
-  # This is a native package as we have no upstream source directory.
-  # TODO: quite possibly this should be porperly validated via source format and
-  #       or changelog version format.
-  unless system('cp -r packaging/* build/source/')
-    abort 'Failed to copy packaging'
-  end
-end
+    # copy upstream sources around
+    if Dir.exist?('source') && !Dir.glob('source/*').empty?
+      abort 'Failed to copy source' unless system('cp -r source/* build/source/')
+      Dir.chdir('build/source') do
+        FileUtils.rm_rf(Dir.glob('**/.bzr'))
+        FileUtils.rm_rf(Dir.glob('**/.git'))
+        FileUtils.rm_rf(Dir.glob('**/.svn'))
+      end
 
-# Create changelog entry
-Dir.chdir('build/source/') do
-  env = {
-    'DEBFULLNAME' => 'Kubuntu CI',
-    'DEBEMAIL' => 'kubuntu-ci at lists.launchpad.net'
-  }
-  args = []
-  args << '-b'
-  args << '-v' << version.full
-  args << '-D' << project.series
-  args << '"Automatic Kubuntu Build"'
-  abort 'Failed to create changelog entry' unless system(env, 'dch', *args)
-end
+      # create orig tar
+      Dir.chdir('build/') do
+        tar = "#{source_name}_#{version.tar}.orig.tar"
+        abort 'Failed to create a tarball' unless system("tar -cf #{tar} source")
+        abort 'Failed to compress the tarball' unless system("xz -6 #{tar}")
+      end
 
-# Rip out locale install
-Dir.chdir('build/source/') do
-  Dir.glob('debian/*.install').each do |install_file_path|
-    # Strip localized manpages
-    # e.g.  usr /share /man /  *  /man 7 /kf5options.7
-    man_regex = %r{^.*usr/share/man/(\*|\w+)/man\d/.*$}
-    subbed = File.open(install_file_path).read.gsub(man_regex, '')
-    File.open(install_file_path, 'w') do |f|
-      f << subbed
+      # Copy packaging
+      unless system('cp -r packaging/debian build/source/')
+        abort 'Failed to copy packaging'
+      end
+    else
+      # This is a native package as we have no upstream source directory.
+      # TODO: quite possibly this should be porperly validated via source format and
+      #       or changelog version format.
+      unless system('cp -r packaging/* build/source/')
+        abort 'Failed to copy packaging'
+      end
     end
 
-    # FIXME: bloody workaround for kconfigwidgets and kdelibs4support containing
-    # legit locale data
-    next if source_name == 'kconfigwidgets' || source_name == 'kdelibs4support'
-    locale_regex = %r{^.*usr/share/locale.*$}
-    subbed = File.open(install_file_path).read.gsub(locale_regex, '')
-    File.open(install_file_path, 'w') do |f|
-      f << subbed
+    # Create changelog entry
+    Dir.chdir('build/source/') do
+      env = {
+        'DEBFULLNAME' => 'Kubuntu CI',
+        'DEBEMAIL' => 'kubuntu-ci at lists.launchpad.net'
+      }
+      args = []
+      args << '-b'
+      args << '-v' << version.full
+      args << '-D' << project.series
+      args << '"Automatic Kubuntu Build"'
+      abort 'Failed to create changelog entry' unless system(env, 'dch', *args)
     end
-  end
-  # If the package is now empty, lintian override the empty warning to avoid
-  # false positives
-  Dir.glob('debian/*.install').each do | install_file_path |
-    next unless File.open(install_file_path, 'r').read.strip.empty?
-    package_name = File.basename(install_file_path, '.install')
-    lintian_overrides_path = install_file_path.gsub('.install',
-                                                    '.lintian-overrides')
-    puts "#{package_name} is now empty, trying to add lintian override"
-    File.open(lintian_overrides_path, 'a') do |file|
-      file.write("#{package_name}: empty-binary-package
")
-    end
-  end
-  # Rip out symbol files unless we are on latest
-  unless project.series == KCI.latest_series
-    symbols = Dir.glob('debian/symbols') +
-              Dir.glob('debian/*.symbols') +
-              Dir.glob('debian/*.symbols.*')
-    symbols.each { |s| FileUtils.rm(s) }
-  end
-end
 
-# dpkg-buildpackage
-Dir.chdir('build/source/') do
-  system('update-maintainer')
-  unless system('dpkg-buildpackage -us -uc -S -d')
-    abort 'Failed to build source package'
-  end
-end
+    # Rip out locale install
+    Dir.chdir('build/source/') do
+      Dir.glob('debian/*.install').each do |install_file_path|
+        # Strip localized manpages
+        # e.g.  usr /share /man /  *  /man 7 /kf5options.7
+        man_regex = %r{^.*usr/share/man/(\*|\w+)/man\d/.*$}
+        subbed = File.open(install_file_path).read.gsub(man_regex, '')
+        File.open(install_file_path, 'w') do |f|
+          f << subbed
+        end
 
-# 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.
-# 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.
-# If it contains an uncommon arch -> remove it -> if it is empty now, abort
-# If it contains any -> replace with !uncommon
-# This is a cheapster hack implementation to avoid having to implement write
-# support in Debian control.
-begin
-  Debian::DSCArch.twiddle!('build/')
-rescue Debian::DSCArch::Error => e
-  # NOTE: this can raise a number of errors and we want them all to be fatal
-  #  to prevent unhandled dscs or completely empty architectures from
-  #  getting uploaded.
-  abort e
-end
+        # FIXME: bloody workaround for kconfigwidgets and kdelibs4support containing
+        # legit locale data
+        next if source_name == 'kconfigwidgets' || source_name == 'kdelibs4support'
+        locale_regex = %r{^.*usr/share/locale.*$}
+        subbed = File.open(install_file_path).read.gsub(locale_regex, '')
+        File.open(install_file_path, 'w') do |f|
+          f << subbed
+        end
+      end
+      # If the package is now empty, lintian override the empty warning to avoid
+      # false positives
+      Dir.glob('debian/*.install').each do | install_file_path |
+        next unless File.open(install_file_path, 'r').read.strip.empty?
+        package_name = File.basename(install_file_path, '.install')
+        lintian_overrides_path = install_file_path.gsub('.install',
+                                                        '.lintian-overrides')
+        puts "#{package_name} is now empty, trying to add lintian override"
+        File.open(lintian_overrides_path, 'a') do |file|
+          file.write("#{package_name}: empty-binary-package
")
+        end
+      end
+      # Rip out symbol files unless we are on latest
+      unless project.series == KCI.latest_series
+        symbols = Dir.glob('debian/symbols') +
+                  Dir.glob('debian/*.symbols') +
+                  Dir.glob('debian/*.symbols.*')
+        symbols.each { |s| FileUtils.rm(s) }
+      end
+    end
 
-# Sign
-Dir.chdir('build/') do
-  changes = Dir.glob('*.changes')
-  abort "Expected only one changes file #{changes}" if changes.size != 1
-  unless system("debsign -k#{KEYID} #{changes[0]}")
-    abort 'Failed to sign the source.'
-  end
-end
+    # dpkg-buildpackage
+    Dir.chdir('build/source/') do
+      system('update-maintainer')
+      unless system('dpkg-buildpackage -us -uc -S -d')
+        abort 'Failed to build source package'
+      end
+    end
 
-# Upload
-def timeout_spawn(cmd, timeout)
-  thread = Thread.new do
-    loop do
-      warn '---- ps aux ----'
-      warn `ps aux |grep dput`
-      warn '----'
-      sleep 60
+    # 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.
+    # 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.
+    # If it contains an uncommon arch -> remove it -> if it is empty now, abort
+    # If it contains any -> replace with !uncommon
+    # This is a cheapster hack implementation to avoid having to implement write
+    # support in Debian control.
+    begin
+      Debian::DSCArch.twiddle!('build/')
+    rescue Debian::DSCArch::Error => e
+      # NOTE: this can raise a number of errors and we want them all to be fatal
+      #  to prevent unhandled dscs or completely empty architectures from
+      #  getting uploaded.
+      abort e
     end
-  end
 
-  pid = Process.spawn(cmd, pgroup: true)
-  begin
-    puts "waitpid with timeout"
-    Timeout.timeout(timeout) do
-      Process.waitpid(pid, 0)
-      puts "return wait pid"
-      return ($?.exitstatus == 0)
+    # Sign
+    Dir.chdir('build/') do
+      changes = Dir.glob('*.changes')
+      abort "Expected only one changes file #{changes}" if changes.size != 1
+      unless system("debsign -k#{KEYID} #{changes[0]}")
+        abort 'Failed to sign the source.'
+      end
     end
-  rescue Timeout::Error
-    puts "timeout error"
-    Process.kill(15, -Process.getpgid(pid))
-    return false
-  end
-ensure
-  thread.kill
-end
 
-Dir.chdir('build/source/') do
-  changelog = Changelog.new
-  # Upload likes to get stuck, so we do timeout control to prevent all of
-  # builder from getting stuck.
-  # We try to dput two times in a row giving it first 30 minutes and then
-  # 15 minutes to complete. If it didn't manage to upload after that we
-  # ignore the package and move on.
-  `cp -rf /var/lib/jenkins/.ssh /root/`
-  `chown -Rv root:root /root/.ssh`
-  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} ../#{changelog.name}_#{changelog.version(Changelog::BASE | Changelog::BASESUFFIX)}*.changes"
-  success = false
-  4.times do |count|
-    # Note: count starts at 0 ;)
-    if timeout_spawn(dput, 60 * (30.0 / (count + 1)))
-      puts "spawn timeout goody"
-      success = true
-      break
+    # Upload
+    def timeout_spawn(cmd, timeout)
+      thread = Thread.new do
+        loop do
+          warn '---- ps aux ----'
+          warn `ps aux |grep dput`
+          warn '----'
+          sleep 60
+        end
+      end
+
+      pid = Process.spawn(cmd, pgroup: true)
+      begin
+        puts "waitpid with timeout"
+        Timeout.timeout(timeout) do
+          Process.waitpid(pid, 0)
+          puts "return wait pid"
+          return ($?.exitstatus == 0)
+        end
+      rescue Timeout::Error
+        puts "timeout error"
+        Process.kill(15, -Process.getpgid(pid))
+        return false
+      end
+    ensure
+      thread.kill
     end
-    puts "spawn timout badly"
-    sleep(60) # Sleep for a minute
-  end
-  abort '		 !!!!!!!!!!!! dput failed two times !!!!!!!!!!!!' unless success
-  Dir.chdir('../..') do # main dir
-    puts "before require"
-    require_relative 'source_publisher'
-    puts "after require; before new"
-    publisher = SourcePublisher.new(changelog.name, changelog.version, project.stability)
-    puts "after new"
-    abort 'PPA Build Failed' unless publisher.wait
-    # Write upload data to file, we perhaps want to do something outside the
-    # build container.
-    data = { name: changelog.name,
-             version: changelog.version,
-             type: project.stability }
-    File.write('source.json', JSON.generate(data))
-  end
-end
 
-unless File.exist?('logs/i386.log')
-  puts "found no logs"
-  exit 0
-end
+    Dir.chdir('build/source/') do
+      changelog = Changelog.new
+      # Upload likes to get stuck, so we do timeout control to prevent all of
+      # builder from getting stuck.
+      # We try to dput two times in a row giving it first 30 minutes and then
+      # 15 minutes to complete. If it didn't manage to upload after that we
+      # ignore the package and move on.
+      `cp -rf /var/lib/jenkins/.ssh /root/`
+      `chown -Rv root:root /root/.ssh`
+      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} ../#{changelog.name}_#{changelog.version(Changelog::BASE | Changelog::BASESUFFIX)}*.changes"
+      success = false
+      4.times do |count|
+        # Note: count starts at 0 ;)
+        if timeout_spawn(dput, 60 * (30.0 / (count + 1)))
+          puts "spawn timeout goody"
+          success = true
+          break
+        end
+        puts "spawn timout badly"
+        sleep(60) # Sleep for a minute
+      end
+      abort '		 !!!!!!!!!!!! dput failed two times !!!!!!!!!!!!' unless success
+      Dir.chdir('../..') do # main dir
+        puts "before require"
+        require_relative 'source_publisher'
+        puts "after require; before new"
+        publisher = SourcePublisher.new(changelog.name, changelog.version, project.stability)
+        puts "after new"
+        abort '@ppa Build Failed' unless publisher.wait
+        # Write upload data to file, we perhaps want to do something outside the
+        # build container.
+        data = { name: changelog.name,
+                 version: changelog.version,
+                 type: project.stability }
+        File.write('source.json', JSON.generate(data))
+      end
+    end
 
-def segmentify(data, start_marker, end_marker)
-  warn 'Compatibility function segmentify called. BuildLogSegmenter should be' \
-       ' used instead.'
-  BuildLogSegmenter.segmentify(data, start_marker, end_marker)
-end
+    unless File.exist?('logs/i386.log')
+      puts "found no logs"
+      exit 0
+    end
 
-def puts_kci(type, str)
-  Lint::ResultLogger.puts_kci(type, str)
-end
+    def segmentify(data, start_marker, end_marker)
+      warn 'Compatibility function segmentify called. BuildLogSegmenter should be' \
+           ' used instead.'
+      BuildLogSegmenter.segmentify(data, start_marker, end_marker)
+    end
 
-def puts_error(str)
-  puts_kci('E', str)
-end
+    def puts_kci(type, str)
+      Lint::ResultLogger.puts_kci(type, str)
+    end
 
-def puts_warning(str)
-  puts_kci('W', str)
-end
+    def puts_error(str)
+      puts_kci('E', str)
+    end
 
-def puts_info(str)
-  puts_kci('I', str)
-end
+    def puts_warning(str)
+      puts_kci('W', str)
+    end
 
-def ignore?(array_of_ignores, thing_to_check)
-  array_of_ignores.each do |possibly_ignore|
-    if thing_to_check == possibly_ignore ||
-       thing_to_check.start_with?(possibly_ignore) ||
-       thing_to_check.start_with?(possibly_ignore.chomp('*'))
-      return true
+    def puts_info(str)
+      puts_kci('I', str)
     end
-  end
-  false
-end
 
-def puts_cmake(data, source_name)
-  # Bit of compat code. Very lovely... NOT
-  parser = CMakeParser.new(data)
-  unless parser.valid
-    puts_info 'CMakeParser could not parse the log correctly. Aborting parser.'
-    return
-  end
-  missing = parser.missing
-  warnings = parser.warnings
-  disabled_features = parser.disabled_features
-
-  puts 'KCI::CMAKE'
-
-  # Force an ignore on Qt5TextToSpeech, it's not released as of right now.
-  # 2015-03-05
-  ignore_missing = %w(Qt5TextToSpeech)
-  cmake_ignore_path = "#{WORKSPACE_PATH}/packaging/debian/meta/cmake-ignore"
-  if File.exist?(cmake_ignore_path)
-    ignore_missing += File.read(cmake_ignore_path).strip.split("
")
-  end
+    def ignore?(array_of_ignores, thing_to_check)
+      array_of_ignores.each do |possibly_ignore|
+        if thing_to_check == possibly_ignore ||
+           thing_to_check.start_with?(possibly_ignore) ||
+           thing_to_check.start_with?(possibly_ignore.chomp('*'))
+          return true
+        end
+      end
+      false
+    end
 
-  missing.each do |dep|
-    next if ignore?(ignore_missing, dep)
-    puts_warning("Missing Dep: #{dep}")
-  end
+    def puts_cmake(data, source_name)
+      # Bit of compat code. Very lovely... NOT
+      parser = CMakeParser.new(data)
+      unless parser.valid
+        puts_info 'CMakeParser could not parse the log correctly. Aborting parser.'
+        return
+      end
+      missing = parser.missing
+      warnings = parser.warnings
+      disabled_features = parser.disabled_features
+
+      puts 'KCI::CMAKE'
+
+      # Force an ignore on Qt5TextToSpeech, it's not released as of right now.
+      # 2015-03-05
+      ignore_missing = %w(Qt5TextToSpeech)
+      cmake_ignore_path = "#{@workspace_path}/packaging/debian/meta/cmake-ignore"
+      if File.exist?(cmake_ignore_path)
+        ignore_missing += File.read(cmake_ignore_path).strip.split("
")
+      end
 
-  warnings.each do |warning|
-    puts_warning(warning)
-  end
+      missing.each do |dep|
+        next if ignore?(ignore_missing, dep)
+        puts_warning("Missing Dep: #{dep}")
+      end
 
-  disabled_features.each do |disabled_feature|
-    next if ignore?(ignore_missing, disabled_feature)
-    puts_warning("Disabled Feature: #{disabled_feature}")
-  end
-end
+      warnings.each do |warning|
+        puts_warning(warning)
+      end
 
-def puts_list_missing(data)
-  data = segmentify(data, "=== Start list-missing
", "=== End list-missing
")
-  return if data.empty?
-  puts 'KCI::MISSING'
-  data.each do |line|
-    # Missing files are always considered errors
-    puts_error(line)
-  end
-end
+      disabled_features.each do |disabled_feature|
+        next if ignore?(ignore_missing, disabled_feature)
+        puts_warning("Disabled Feature: #{disabled_feature}")
+      end
+    end
 
-def puts_lintian(data, args = {})
-  data = segmentify(data, "=== Start lintian
", "=== End lintian
")
-  return if data.empty?
-  puts 'KCI::LINTIAN'
-  data.each do |line|
-    next if line.start_with?('warning: ') # random warnings from lintian itself
-
-    # Package names can easily go beyond what shit can suck on, so gag it.
-    next if line.include?('source-package-component-has-long-file-name')
-    next if line.include?('package-has-long-file-name')
-
-    # We really do not care about standards versions for now. They only ever get
-    # bumped by the pkg-kde team anyway.
-    next if line.include?('out-of-date-standards-version')
-    next if line.include?('newer-standards-version')
-
-    # We package an enormous amount of GUI apps without manpages (in fact
-    # they arguably wouldn't even make sense what with being GUI apps). So
-    # ignore any and all manpage warnings to save Harald from having to override
-    # them in every single application repository.
-    next if line.include?('binary-without-manpage')
-
-    # Fuck you
-    next if line.include?('debian-revision-should-not-be-zero')
-    next if line.include?('bad-distribution-in-changes-file wily')
-    next if line.include?('not-binnmuable-any-depends-all')
-
-    # Do not print symbols warnings if we already auto-updated.
-    if args[:updated_symbols] &&
-       line.include?('symbols-file-contains-current-version-with-debian-revision')
-      next
+    def puts_list_missing(data)
+      data = segmentify(data, "=== Start list-missing
", "=== End list-missing
")
+      return if data.empty?
+      puts 'KCI::MISSING'
+      data.each do |line|
+        # Missing files are always considered errors
+        puts_error(line)
+      end
     end
 
-    case line[0..1]
-    when 'W:'
-      puts_warning(line)
-      next
-    when 'E:'
-      puts_error(line)
-      next
+    def puts_lintian(data, args = {})
+      data = segmentify(data, "=== Start lintian
", "=== End lintian
")
+      return if data.empty?
+      puts 'KCI::LINTIAN'
+      data.each do |line|
+        next if line.start_with?('warning: ') # random warnings from lintian itself
+
+        # Package names can easily go beyond what shit can suck on, so gag it.
+        next if line.include?('source-package-component-has-long-file-name')
+        next if line.include?('package-has-long-file-name')
+
+        # We really do not care about standards versions for now. They only ever get
+        # bumped by the pkg-kde team anyway.
+        next if line.include?('out-of-date-standards-version')
+        next if line.include?('newer-standards-version')
+
+        # We package an enormous amount of GUI apps without manpages (in fact
+        # they arguably wouldn't even make sense what with being GUI apps). So
+        # ignore any and all manpage warnings to save Harald from having to override
+        # them in every single application repository.
+        next if line.include?('binary-without-manpage')
+
+        # Fuck you
+        next if line.include?('debian-revision-should-not-be-zero')
+        next if line.include?('bad-distribution-in-changes-file wily')
+        next if line.include?('not-binnmuable-any-depends-all')
+
+        # Do not print symbols warnings if we already auto-updated.
+        if args[:updated_symbols] &&
+           line.include?('symbols-file-contains-current-version-with-debian-revision')
+          next
+        end
+
+        case line[0..1]
+        when 'W:'
+          puts_warning(line)
+          next
+        when 'E:'
+          puts_error(line)
+          next
+        end
+        puts_info(line)
+      end
     end
-    puts_info(line)
-  end
-end
 
-# We need discrete arrays of both logs and architectures they represent
-# to make sure we process them in the correct order when updating symbols.
-logs = []
-architectures_with_log = []
-Dir.chdir('logs/') do
-  # `gunzip *.log.gz`
-  Dir.glob('*.log').each do |log|
-    logs << "#{WORKSPACE_PATH}/logs/#{log}"
-    architectures_with_log << File.basename(log, '.log')
-  end
-end
+    # We need discrete arrays of both logs and architectures they represent
+    # to make sure we process them in the correct order when updating symbols.
+    logs = []
+    architectures_with_log = []
+    Dir.chdir('logs/') do
+      # `gunzip *.log.gz`
+      Dir.glob('*.log').each do |log|
+        logs << "#{@workspace_path}/logs/#{log}"
+        architectures_with_log << File.basename(log, '.log')
+      end
+    end
 
-archindep = File.read('archindep').strip rescue 'amd64' # Get archindep from ppa script.
-log_data = File.open("logs/#{archindep}.log").read
-
-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?('dpkg-gensymbols: warning: some new symbols appeared')
-    match = log_data.match(/--- debian\/(.*).symbols/)
-    if match && match.size > 1
-      Dir.chdir("#{WORKSPACE_PATH}/packaging") do
-        system('git config --global user.email "kubuntu-ci at lists.launchpad.netubuntu-ci@lists.launchpad.net"')
-        system('git config --global user.name "Kubuntu CI"')
-        system('git config core.sparsecheckout')
-        system('git checkout -f remotes/packaging/kubuntu_unstable')
-        system('git branch -a')
-        system('git status')
-        system('git reset --hard')
-        captures = match.captures
-        captures.each do |lib_package|
-          puts "pkgkde-symbolshelper batchpatch -v #{version.base} -c #{architectures_with_log.join(',')} #{logs.join(' ')}"
-          system("pkgkde-symbolshelper batchpatch -v #{version.base} -c #{architectures_with_log.join(',')} #{logs.join(' ')}")
-          updated_symbols = ($? == 0)
-          puts_info("Auto-updated symbols of #{lib_package}")
+    archindep = File.read('archindep').strip rescue 'amd64' # Get archindep from @ppa script.
+    log_data = File.open("logs/#{archindep}.log").read
+
+    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?('dpkg-gensymbols: warning: some new symbols appeared')
+        match = log_data.match(/--- debian\/(.*).symbols/)
+        if match && match.size > 1
+          Dir.chdir("#{@workspace_path}/packaging") do
+            system('git config --global user.email "kubuntu-ci at lists.launchpad.netubuntu-ci@lists.launchpad.net"')
+            system('git config --global user.name "Kubuntu CI"')
+            system('git config core.sparsecheckout')
+            system('git checkout -f remotes/packaging/kubuntu_unstable')
+            system('git branch -a')
+            system('git status')
+            system('git reset --hard')
+            captures = match.captures
+            captures.each do |lib_package|
+              puts "pkgkde-symbolshelper batchpatch -v #{version.base} -c #{architectures_with_log.join(',')} #{logs.join(' ')}"
+              system("pkgkde-symbolshelper batchpatch -v #{version.base} -c #{architectures_with_log.join(',')} #{logs.join(' ')}")
+              updated_symbols = ($? == 0)
+              puts_info("Auto-updated symbols of #{lib_package}")
+            end
+            # Username et al a at pparently is somehow coming from .git or something
+            # a at pparently
+            system('git status')
+            system('git diff')
+            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.')
         end
-        # Username et al apparently is somehow coming from .git or something
-        # apparently
-        system('git status')
-        system('git diff')
-        system('git commit -a -m "Automatic symbol update"')
+      else
+        puts_error('It would very much appear that symbols have been retracted')
       end
-    else
-      puts_error('Failed to update symbols as the package name(s) could not be'\
-                 ' parsed.')
     end
-  else
-    puts_error('It would very much appear that symbols have been retracted')
-  end
-end
 
-puts_cmake(log_data, source_name)
-puts_list_missing(log_data)
-puts_lintian(log_data, updated_symbols: updated_symbols)
-
-# Lint control file
-results = []
-results << Lint::Control.new('packaging').lint
-results << Lint::Series.new('packaging').lint
-results << Lint::Symbols.new('packaging').lint
-
-Lint::ResultLogger.new(results).log
-
-# TODO: this script currently does not impact the build results nor does it
-# create parsable output
-qmlsrcs = %w(
-  bluez-qt
-  breeeze
-  kactivities
-  kalgebra
-  kanagram
-  kate
-  kbreakout
-  kdeplasma-addons
-  kdeclarative
-  kinfocenter
-  koko
-  kscreen
-  ktp-desktop-applets
-  kwin
-  libkdegames
-  plasma-framework
-  plasma-desktop
-  plasma-mediacenter
-  plasma-nm
-  plasma-sdk
-  plasma-volume-control
-  print-manager
-  purpose
-  milou
-  muon
-)
-if !Dir.glob('source/**/*.qml').empty? && qmlsrcs.include?(project.name)
-  require_relative 'lib/qml_dependency_verifier'
-
-  dep_verify = QMLDependencyVerifier.new
-  dep_verify.add_ppa
-  missing_modules = dep_verify.missing_modules
-  missing_modules.each do |package, modules|
-    puts_warning "#{package} has missing dependencies..."
-    modules.uniq! { |mod| { mod.identifier => mod.version } }
-    modules.each do |mod|
-      puts_info "  #{mod} not found."
-      puts_info '    looked for:'
-      mod.import_paths.each do |path|
-        puts_info "      - #{path}"
+    puts_cmake(log_data, source_name)
+    puts_list_missing(log_data)
+    puts_lintian(log_data, updated_symbols: updated_symbols)
+
+    # Lint control file
+    results = []
+    results << Lint::Control.new('packaging').lint
+    results << Lint::Series.new('packaging').lint
+    results << Lint::Symbols.new('packaging').lint
+
+    Lint::ResultLogger.new(results).log
+
+    # TODO: this script currently does not impact the build results nor does it
+    # create parsable output
+    qmlsrcs = %w(
+      bluez-qt
+      breeeze
+      kactivities
+      kalgebra
+      kanagram
+      kate
+      kbreakout
+      kdeplasma-addons
+      kdeclarative
+      kinfocenter
+      koko
+      kscreen
+      ktp-desktop-applets
+      kwin
+      libkdegames
+      plasma-framework
+      plasma-desktop
+      plasma-mediacenter
+      plasma-nm
+      plasma-sdk
+      plasma-volume-control
+      print-manager
+      purpose
+      milou
+      muon
+    )
+    if !Dir.glob('source/**/*.qml').empty? && qmlsrcs.include?(project.name)
+      require_relative 'lib/qml_dependency_verifier'
+
+      dep_verify = QMLDependencyVerifier.new
+      dep_verify.add_ at ppa
+      missing_modules = dep_verify.missing_modules
+      missing_modules.each do |package, modules|
+        puts_warning "#{package} has missing dependencies..."
+        modules.uniq! { |mod| { mod.identifier => mod.version } }
+        modules.each do |mod|
+          puts_info "  #{mod} not found."
+          puts_info '    looked for:'
+          mod.import_paths.each do |path|
+            puts_info "      - #{path}"
+          end
+        end
       end
     end
   end
 end
+
+if __FILE__ == $PROGRAM_NAME
+  Builder.run
+end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list