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

Harald Sitter apachelogger-guest at moszumanska.debian.org
Thu Dec 3 13:41:49 UTC 2015


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

The following commit has been merged in the master branch:
commit b6db74beb597af42bf25f3ba2a1f115a4b5cf34f
Author: Harald Sitter <sitter at kde.org>
Date:   Thu Dec 3 14:08:58 2015 +0100

    remove build.rb
    
    unused and full of violations
---
 kci/build.rb | 438 -----------------------------------------------------------
 1 file changed, 438 deletions(-)

diff --git a/kci/build.rb b/kci/build.rb
deleted file mode 100755
index a7c00df..0000000
--- a/kci/build.rb
+++ /dev/null
@@ -1,438 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'fileutils'
-require_relative 'lib/lp'
-
-# change dir into workspace.
-Dir.chdir(ARGV[0])
-
-class SourcePublisher
-    def initialize(source_name, source_version)
-        @ppa = Launchpad::Rubber::from_url('https://api.launchpad.net/devel/~kubuntu-ci/+archive/ubuntu/unstable')
-        @source_name = source_name
-        @source_version = source_version
-    end
-
-    def wait
-        #################################
-
-        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 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!'
-                return false
-            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)
-                return false
-            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())
-                return false
-            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.'
-        return true
-    end
-
-    private
-    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 => @source_name,
-                                          :version => @source_version)[0]
-        raise '' if source == nil
-        return source
-    end
-end
-
-
-
-# Upload
-def timeout_spawn(cmd, timeout)
-    pid = Process.spawn(cmd, {:pgroup => true})
-    begin
-        Timeout.timeout(timeout) do
-            Process.waitpid(pid, 0)
-            return ($?.exitstatus == 0)
-        end
-    rescue Timeout::Error
-        Process.kill(15, -Process.getpgid(pid))
-        return false
-    end
-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.
-    dput = "dput #{PPA} ../#{changelog.name}_#{changelog.version(Changelog::BASE | Changelog::BASESUFFIX)}*.changes"
-    success = false
-    2.times do |count|
-        # Note: count starts at 0 ;)
-        if timeout_spawn(dput, 60 * (30.0/(count+1)))
-            success = true
-            break
-        end
-    end
-    raise '		 !!!!!!!!!!!!!!!! dput failed two times !!!!!!!!!!!!!!!!' unless success
-    Dir.chdir('../..') do # main dir
-        publisher = SourcePublisher.new(changelog.name, changelog.version)
-        raise 'PPA Interaction Failed' unless publisher.wait
-    end
-end
-
-exit 0 unless File.exist?('logs/i386.log.gz')
-
-def segmentify(data, start_marker, end_marker)
-    start_index = data.index(start_marker)
-    end_index = data.index(end_marker)
-    return [] unless start_index and end_index
-    data = data.slice(start_index..end_index).split("
")
-    data.shift # Ditch start line
-    data.pop # Ditch end line
-    return data
-end
-
-def puts_kci(type, str)
-    puts "KCI-#{type} :: #{str}"
-end
-
-def puts_error(str)
-    puts_kci('E', str)
-end
-
-def puts_warning(str)
-    puts_kci('W', str)
-end
-
-def puts_info(str)
-    puts_kci('I', str)
-end
-
-def cmake_parse_optional!(data)
-    missing = []
-    start_line = false
-    while not data.empty?
-        line = data.shift
-        if !start_line and line.empty?
-            start_line = true
-            next
-        elsif start_line and not line.empty?
-            next if line.strip.empty?
-            match = line.match(/^ *\* (.*)$/)
-            if match and match.size > 1
-                missing << match[1]
-            end
-        else
-            # Line is empty and the start conditions didn't match.
-            # Either the block is not valid or we have reached the end.
-            # In any case, break here.
-            break
-        end
-    end
-    return missing
-end
-
-def cmake_parse_package(line)
-    _package='Could not find a package configuration file provided by'
-    match = line.match(/^\s+#{_package}\s+"(.+)"/)
-    if match and match.size > 1
-        return [match[1]]
-    end
-    return []
-end
-
-def cmake_parse_warning(line)
-    return [] unless line.include?('CMake Warning')
-    # Lines coming from MacroOptionalFindPackage (from old parsing).
-    return [] if line.include?('CMake Warning at /usr/share/kde4/apps/cmake/modules/MacroOptionalFindPackage.cmake')
-    # Lines coming from find_package (from old parsing).
-    return [] if line.match(/CMake Warning at [^ :]+:\d+ \(find_package\)/)
-    # Lines coming from warnings inside the actual CMakeLists.txt as those can be arbitrary.
-    # ref: "CMake Warning at src/worker/CMakeLists.txt:33 (message):"
-    return [] if line.match(/CMake Warning at [^ :]*CMakeLists.txt:\d+ \(message\)/)
-    return [] if line.start_with?('CMake Warning (dev)')
-    return [] if line.start_with?('CMake Warning:')
-    return [line]
-end
-
-def puts_cmake(data, source_name)
-    data = segmentify(data, "dh_auto_configure", "dh_auto_build")
-    return if data.empty?
-    
-    missing = []
-    warnings = []
-    while not data.empty?
-        line = data.shift
-        if line.include?('The following OPTIONAL packages have not been found')
-            missing += cmake_parse_optional!(data)
-        elsif line.include?('Could not find a package configuration file provided by')
-            missing += cmake_parse_package(line)
-        elsif line.include?('CMake Warning')
-            warnings += cmake_parse_warning(line)
-        end
-    end
-    
-    missing.uniq!
-    warnings.uniq!
-    
-    puts "KCI::CMAKE"
-    
-    ignore_missing = []
-    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
-    
-    missing.each do |dep|
-        p dep
-        p ignore_missing
-        ignore = false
-        ignore_missing.each do |possibly_ignore|
-            p possibly_ignore == dep
-            p dep.start_with?(possibly_ignore)
-            p dep.start_with?(possibly_ignore.chomp('*'))
-            if possibly_ignore == dep or dep.start_with?(possibly_ignore) or dep.start_with?(possibly_ignore.chomp('*'))
-                ignore = true
-                break
-            end
-        end
-        next if ignore
-        puts_warning("Missing Dep: #{dep}")
-    end
-    
-    warnings.each do |warning|
-        puts_warning(warning)
-    end
-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
-
-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')
-        
-        # Do not print symbols warnings if we already auto-updated.
-        if args[:updated_symbols] and 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
-
-architectures_with_log = []
-Dir.chdir('logs/') do
-    `gunzip *.log.gz`
-    Dir.glob('*.log').each do |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
-if log_data.match(/dpkg-gensymbols: warning: (.*)\/symbols doesn't match completely debian\/(.*).symbols/)
-    puts 'KCI::SYMBOLS'
-    if log_data.include?('dpkg-gensymbols: warning: some new symbols appeared')
-        match = log_data.match(/--- debian\/(.*).symbols/)
-        if match and match.size > 1
-            Dir.chdir("#{WORKSPACE_PATH}/packaging") do
-                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 #{tar_version} -c #{architectures_with_log.join(',')} #{WORKSPACE_PATH}/logs/*.log"
-                    system("pkgkde-symbolshelper batchpatch -v #{tar_version} -c #{architectures_with_log.join(',')} #{WORKSPACE_PATH}/logs/*.log")
-                    updated_symbols = ($? == 0)
-                    puts_info("Auto-updated symbols of #{lib_package}")
-                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"')
-            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)
-
-# TODO: try to figure out when a qml dep is needed and make sure it is there...

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list