[SCM] ci-tooling packaging branch, master, updated. 2e8749a70f5444e9d18e3ab65a2ce6d8df631737
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Sat Mar 7 14:22:41 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=2e8749a
The following commit has been merged in the master branch:
commit 2e8749a70f5444e9d18e3ab65a2ce6d8df631737
Author: Harald Sitter <sitter at kde.org>
Date: Sat Mar 7 15:22:36 2015 +0100
add a source impl to back the build process I wrote like a month ago
not tested or anything
---
lib/ci/source.rb | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
diff --git a/lib/ci/source.rb b/lib/ci/source.rb
new file mode 100644
index 0000000..8238b28
--- /dev/null
+++ b/lib/ci/source.rb
@@ -0,0 +1,105 @@
+class AbstractSource
+ attr_reader :package_name
+ attr_reader :package_version
+
+ def run
+ fail 'Not implemented'
+ end
+end
+
+class VcsSource < AbstractSource
+ def copy_source
+ # copy sources around
+ FileUtils.rm_r('build') if File.exist?('build')
+ FileUtils.mkpath('build/source/')
+ FileUtils.cp_r(Dir.glob('source/*'), 'build/source/', verbose: true)
+
+ %w(.bzr .git .hg .svn).each do |vcsdir|
+ FileUtils.rm_rf(Dir.glob("build/source/**/#{vcsdir}"))
+ end
+ end
+
+ def create_orig_tar
+ Dir.chdir('build/') do
+ tar = "#{source_name}_#{tar_version}.orig.tar"
+ fail 'Failed to create a tarball' unless system("tar -cf #{tar} source")
+ fail 'Failed to compress the tarball' unless system("xz -6 #{tar}")
+ end
+ end
+
+ def copy_packaging
+ # Copy some more
+ FileUtils.cp_r(Dir.glob("packaging/*"), "build/source/", verbose: true)
+
+ # 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
+ subbed = File.open(install_file_path).read().gsub(/^.*usr\/share\/man\/(\*|\w+)\/man\d\/.*$/, '')
+ 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'
+ subbed = File.open(install_file_path).read().gsub(/^.*usr\/share\/locale.*$/, '')
+ 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') { |file| file.write("#{package_name}: empty-binary-package
") }
+ end
+ end
+ end
+
+ def log_change
+ # Create changelog entry
+ Dir.chdir("build/source/") do
+ env['DEBFULLNAME'] = 'Kubuntu CI'
+ env['DEBEMAIL'] = 'kubuntu-ci at lists.launchpad.net'
+ # FXIME project undefined
+ unless system("dch -b -v #{@package_version} -D #{project.series} 'Automatic Kubuntu Build'")
+ fail 'Failed to create changelog entry'
+ end
+ end
+ end
+
+ def build
+ # dpkg-buildpackage
+ Dir.chdir('build/source/') do
+ system('update-maintainer')
+ fail 'Failed to build source package' unless system('dpkg-buildpackage -us -uc -S')
+ end
+ end
+
+ def run
+ # version
+ changelog = nil
+ Dir.chdir('packaging') do
+ changelog = Changelog.new
+ end
+
+ # Note that the kubuntu version needs to be part of the *base* version as otherwise
+ # different series uploads can end up with exactly the same tar name and launchpad
+ # freaks out. So, kubuntu version in base/suffix not revision/suffix.
+ eval `grep VERSION_ID /etc/os-release`.strip
+
+ @package_name = changelog.name
+ version_suffix = "+git#{DateTime.now().strftime('%Y%m%d.%H%M')}+#{VERSION_ID}"
+ @tar_version = "#{changelog.version(Changelog::BASE)}#{version_suffix}"
+ @package_version = "#{changelog.version(Changelog::EPOCH | Changelog::BASE)}#{version_suffix}-0ubuntu0" # <-- needs git version and bzr version possibly
+
+ copy_source
+ create_orig_tar
+ copy_packaging
+ log_change
+ build
+ end
+end
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list