[SCM] ci-tooling packaging branch, master, updated. 48dd9be7fc213cfb9a70f33e7e895e0c5c894703
Rohan Garg
rohangarg-guest at moszumanska.debian.org
Tue Oct 6 14:31:39 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=48dd9be
The following commit has been merged in the master branch:
commit 48dd9be7fc213cfb9a70f33e7e895e0c5c894703
Author: Rohan Garg <rohan at garg.io>
Date: Tue Oct 6 16:30:21 2015 +0200
Refactor PackageBuilder so that it uses CI::Source
---
lib/ci/build_binary.rb | 113 ++++++++++++++++++++++---------------------------
1 file changed, 50 insertions(+), 63 deletions(-)
diff --git a/lib/ci/build_binary.rb b/lib/ci/build_binary.rb
index 96ff08f..5a5f8cf 100644
--- a/lib/ci/build_binary.rb
+++ b/lib/ci/build_binary.rb
@@ -1,82 +1,69 @@
require 'fileutils'
-class Source
- attr_reader :dsc
- attr_reader :extract_path
-
- def initialize(dsc)
- @dsc = dsc
- end
-
- def extract(dir)
- @extract_path = "#{dir}/build"
- FileUtils.mkpath(@extract_path)
- system('dpkg-source', '-x', @dsc, @extract_path)
- end
-end
-
-class Builder
- class DependencyResolver
- RESOLVER_BIN = '/usr/lib/pbuilder/pbuilder-satisfydepends'
+require_relative 'source'
+
+module CI
+ class PackageBuilder
+ class DependencyResolver
+ RESOLVER_BIN = '/usr/lib/pbuilder/pbuilder-satisfydepends'
+
+ def self.resolve(extract_path)
+ fail "Can't find #{RESOLVER_BIN}!" unless File.executable?(RESOLVER_BIN)
+ system('sudo',
+ RESOLVER_BIN,
+ '--control',
+ "#{extract_path}/debian/control")
+ end
+ end
- def self.resolve(source)
- fail "Can't find #{RESOLVER_BIN}!" unless File.executable?(RESOLVER_BIN)
- system('sudo',
- RESOLVER_BIN,
- '--control',
- "#{source.extract_path}/debian/control")
+ def extract(dir)
+ @extract_path = "#{dir}/build"
+ FileUtils.mkpath(@extract_path)
+ system('dpkg-source', '-x', @dsc, @extract_path)
end
- end
- def build_package
- dpkg_buildopts = %w(-us -uc -sa -jauto)
+ def build_package
+ dpkg_buildopts = %w(-us -uc -sa -jauto)
- # Only build arch independent packages on AMD64
- dpkg_buildopts << '-B' unless RbConfig::CONFIG['host_cpu'] == 'x86_64'
+ # Only build arch independent packages on AMD64
+ dpkg_buildopts << '-B' unless RbConfig::CONFIG['host_cpu'] == 'x86_64'
- Dir.chdir(@source.extract_path) do
- system('dpkg-buildpackage', *dpkg_buildopts)
+ Dir.chdir(@extract_path) do
+ system('dpkg-buildpackage', *dpkg_buildopts)
+ end
end
- end
- def print_contents
- Dir.chdir('binary') do
- debs = Dir.glob('*.deb')
- debs.each do |deb|
- system('lesspipe', deb)
+ def print_contents
+ Dir.chdir('binary') do
+ debs = Dir.glob('*.deb')
+ debs.each do |deb|
+ system('lesspipe', deb)
+ end
end
end
- end
- def copy_binaries
- Dir.mkdir('result') unless Dir.exist?('result')
- changes = Dir.glob("#{@source.extract_path}/..")
+ def copy_binaries
+ Dir.mkdir('result') unless Dir.exist?('result')
+ changes = Dir.glob("#{@extract_path}/..")
- unless changes.size == 1
- fail "Not exactly one changes file WTF -> #{changes}"
- end
-
- system('dcmd', 'cp', '-v', *changes, 'result/')
- end
+ unless changes.size == 1
+ fail "Not exactly one changes file WTF -> #{changes}"
+ end
- def build(source)
- @source = source
- DependencyResolver.resolve(@source)
+ system('dcmd', 'cp', '-v', *changes, 'result/')
+ end
- build_package
- print_contents
- copy_binaries
- end
-end
+ def build(source)
+ @dsc = "#{source.name}_#{source.version}.dsc"
+ fail "Could not find #{dsc}" unless File.exist? @dsc
-class PackageBuilder
- def run
- dsc = Dir.glob('*.dsc')
- fail "Not exactly one dsc WTF -> #{dsc}" unless dsc.size == 1
- s = Source.new(dsc)
- s.extract('binary/')
+ @source = source
+ extract(@source)
+ DependencyResolver.resolve(@source, @extract_path)
- b = Builder.new
- b.build(s)
+ build_package
+ print_contents
+ copy_binaries
+ end
end
end
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list