[SCM] ci-tooling packaging branch, master, updated. b6b1e94f6a97ef3704003d1be11c8f0dcd89d7c8
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Mon Apr 27 12:25:24 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=b6b1e94
The following commit has been merged in the master branch:
commit b6b1e94f6a97ef3704003d1be11c8f0dcd89d7c8
Author: Harald Sitter <sitter at kde.org>
Date: Mon Apr 27 14:25:17 2015 +0200
add initial build_source refactor of the other build script
---
kci/build_source.rb | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 135 insertions(+)
diff --git a/kci/build_source.rb b/kci/build_source.rb
new file mode 100644
index 0000000..08f6379
--- /dev/null
+++ b/kci/build_source.rb
@@ -0,0 +1,135 @@
+#!/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
+`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/')
+`cp -rv 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 some more
+`cp -rv packaging/* build/source/`
+
+# 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))
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list