[SCM] ci-tooling packaging branch, master, updated. ddbe7c6ed035849bf83de2e83747e5b648ccb5af
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Thu Sep 17 13:12:42 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=71bf13d
The following commit has been merged in the master branch:
commit 71bf13d5fcbe0af7ca23934104fc107f2bb0ccba
Author: Harald Sitter <sitter at kde.org>
Date: Thu Sep 17 15:12:12 2015 +0200
ditch legacy scripts not used
build_source was replaced by lib/ci/build_source and needs a new frontend
script. tarbuild is legacy stuff that is largey replaced by build_source
---
kci/build_source.rb | 148 ----------------------------------------------------
kci/tarbuild.rb | 93 ---------------------------------
2 files changed, 241 deletions(-)
diff --git a/kci/build_source.rb b/kci/build_source.rb
deleted file mode 100755
index f2cdcf9..0000000
--- a/kci/build_source.rb
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'fileutils'
-require 'json'
-
-require_relative 'lib/ci/build_version'
-require_relative 'lib/debian/changelog'
-
-Project = Struct.new(:series, :stability, :name)
-
-# get basename, distro series, unstable/stable
-components = ARGV[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
-
-# PWD
-abort 'Could not change dir to ARGV1' unless Dir.chdir(ARGV[1])
-
-WORKSPACE_PATH = ARGV[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.
-at_exit do
- FileUtils.chown_R('jenkins', 'jenkins', WORKSPACE_PATH, verbose: true)
-end
-
-# install deps
-# TODO: clean out and probably get rid entirely
-`apt-get install -y xz-utils dpkg-dev ruby dput debhelper pkg-kde-tools devscripts python-launchpadlib ubuntu-dev-tools git`
-
-# version
-changelog = Changelog.new('packaging')
-version = CI::BuildVersion.new(changelog)
-source_name = changelog.name
-
-# copy sources around
-FileUtils.rm_r('build') if File.exist?('build')
-FileUtils.mkpath('build/source/')
-
-# copy upstream sources around
-if Dir.exist?('source')
- 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 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
-
- # 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
-
-# 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
-
-# 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
-
- # 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 vivid
- unless project.series == 'vivid'
- 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 -S -us -uc')
- abort 'Failed to build source package'
- end
-end
-
-# Write metadata about the upload for other scripts to use.
-changelog = Changelog.new('build/source/')
-data = { name: changelog.name,
- version: changelog.version,
- type: project.stability }
-File.write('source.json', JSON.generate(data))
diff --git a/kci/tarbuild.rb b/kci/tarbuild.rb
deleted file mode 100755
index e606dfe..0000000
--- a/kci/tarbuild.rb
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env ruby
-
-ENV['PATH'] = '/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin'
-if Process.uid == 0
- File.open('/etc/apt/apt.conf.d/apt-cacher', 'w') { |file| file.puts('Acquire::http { Proxy "http://10.0.3.1:3142"; };') }
- exit 1 unless system("apt-get update")
- exit 1 unless system("apt-get install -y ruby ruby-dev")
- exit 1 unless system("gem install jenkins_api_client oauth")
-end
-
-require "fileutils"
-require_relative "lib/debian/changelog"
-require_relative "lib/lp"
-
-eval %x[grep VERSION_ID /etc/os-release].strip
-DISTRIB_CODENAME = %x[grep DISTRIB_CODENAME /etc/lsb-release].strip.split("=")[-1]
-
-_version = "5.4.0"
-job_dist = ARGV[0]
-job_type = ARGV[1]
-job_name = ARGV[2]
-
-source_name = nil
-Dir.chdir("packaging") do
- changelog = Changelog.new
- source_name = changelog.name
-end
-
-ppa = Launchpad::Rubber::from_url("https://api.launchpad.net/devel/~kubuntu-ci/+archive/ubuntu/stage")
-distro_series = Launchpad::Rubber::from_url("https://api.launchpad.net/devel/ubuntu/#{DISTRIB_CODENAME}")
-begin
- source = ppa.getPublishedSources(source_name: source_name,
- distro_series: distro_series,
- exact_match: true)[0] # This is sorted
-rescue
- # no source in ppa yet
- puts "Found no previous upload in PPA..."
- source = nil
-end
-
-Dir.mkdir("build-area") unless File.exist?("build-area")
-Dir.chdir("build-area") do
- # cleanup previous builds - drop changes, that way we can retain the packages
- # while avoiding conflicts with debsign/dput wildcards.
- Dir.glob("*.changes").each { |c| File.delete(c) }
-
- # Get orig tar.
- tar = "#{job_name}-#{_version}.tar.xz"
- unless File.exist?(tar)
- raise "tar download failed" unless system("wget http://download.qt-project.org/official_releases/qt/5.4/#{_version}/submodules/#{job_name}-#{_version}.tar.xz")
- end
- base = File.basename(tar, ".tar.xz")
- split_base = base.split("-")
- version = split_base.pop
- name = split_base.join("-")
- orig_tar= "#{name}_#{version}.orig.tar.xz"
- File.delete(orig_tar) if File.exist?(orig_tar)
- raise "failed to symlink orig tar" unless system("ln -s #{tar} #{orig_tar}")
-end
-
-# Figure out the version to use
-pkg_version = nil
-# FIXME: _version needs to be compared with what is in the PPA to bump it
-if source
- ppa_too_old = system("dpkg --compare-versions #{_version} gt #{source.source_package_version}")
- unless ppa_too_old
- pkg_version = source.source_package_version
- match = pkg_version.match(/(.*~ppa)(\d+)/)
- # Bump the ppa revision.
- pkg_version = match[1] + (match[2].to_i + 1).to_s
- end
-end
-if pkg_version.nil? # Fallback
- pkg_version = "#{_version}-0ubuntu1~ubuntu#{VERSION_ID}~ppa1"
-end
-
-Dir.chdir("build-area") do
- FileUtils.rm_rf("#{job_name}-#{_version}")
- Dir.mkdir("#{job_name}-#{_version}")
- `tar -xf "#{job_name}_#{_version}.orig.tar.xz" -C #{job_name}-#{_version} --strip-components 1`
- `cp -rv ../packaging/* #{job_name}-#{_version}/`
- Dir.chdir("#{job_name}-#{_version}") do
- FileUtils.rm_rf(".bzr")
- FileUtils.rm_rf(".git")
- raise unless system({'DEBFULLNAME' => 'Kubuntu CI',
- 'DEBEMAIL' => 'kubuntu-ci at lists.launchpad.net'},
- "dch -v #{pkg_version} -D #{DISTRIB_CODENAME} -b 'PPA Build'")
- raise unless system("dpkg-buildpackage -S -us -uc -sa")
- end
-end
-
-# Source package now exist in build-area/.
-# Yield back to jenkins script to do host things...
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list