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

Rohan Garg rohangarg-guest at moszumanska.debian.org
Tue Oct 20 16:34:55 UTC 2015


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

The following commit has been merged in the master branch:
commit 5cb00a33e5ba9a481d0bac53097e3257a6337025
Author: Rohan Garg <rohan at garg.io>
Date:   Tue Oct 20 18:19:30 2015 +0200

    Fix CI::PackageBuilder to use new dsc attribute
---
 lib/ci/build_binary.rb | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/lib/ci/build_binary.rb b/lib/ci/build_binary.rb
index 5a5f8cf..57882a1 100644
--- a/lib/ci/build_binary.rb
+++ b/lib/ci/build_binary.rb
@@ -4,22 +4,24 @@ require_relative 'source'
 
 module CI
   class PackageBuilder
+    BUILD_DIR  = 'build'
+    RESULT_DIR = 'result'
+
     class DependencyResolver
       RESOLVER_BIN = '/usr/lib/pbuilder/pbuilder-satisfydepends'
 
-      def self.resolve(extract_path)
+      def self.resolve(dir)
         fail "Can't find #{RESOLVER_BIN}!" unless File.executable?(RESOLVER_BIN)
+
         system('sudo',
                RESOLVER_BIN,
                '--control',
-               "#{extract_path}/debian/control")
+               "#{dir}/debian/control")
       end
     end
 
-    def extract(dir)
-      @extract_path = "#{dir}/build"
-      FileUtils.mkpath(@extract_path)
-      system('dpkg-source', '-x', @dsc, @extract_path)
+    def extract
+      system('dpkg-source', '-x', @source.dsc, BUILD_DIR)
     end
 
     def build_package
@@ -28,13 +30,13 @@ module CI
       # Only build arch independent packages on AMD64
       dpkg_buildopts << '-B' unless RbConfig::CONFIG['host_cpu'] == 'x86_64'
 
-      Dir.chdir(@extract_path) do
+      Dir.chdir(BUILD_DIR) do
         system('dpkg-buildpackage', *dpkg_buildopts)
       end
     end
 
     def print_contents
-      Dir.chdir('binary') do
+      Dir.chdir(RESULT_DIR) do
         debs = Dir.glob('*.deb')
         debs.each do |deb|
           system('lesspipe', deb)
@@ -43,8 +45,10 @@ module CI
     end
 
     def copy_binaries
-      Dir.mkdir('result') unless Dir.exist?('result')
-      changes = Dir.glob("#{@extract_path}/..")
+      Dir.mkdir(RESULT_DIR) unless Dir.exist?(RESULT_DIR)
+      changes = Dir.glob("#{BUILD_DIR}/../*.changes")
+
+      changes.select! {|e| !e.include? 'source.changes' }
 
       unless changes.size == 1
         fail "Not exactly one changes file WTF -> #{changes}"
@@ -54,16 +58,17 @@ module CI
     end
 
     def build(source)
-      @dsc = "#{source.name}_#{source.version}.dsc"
-      fail "Could not find #{dsc}" unless File.exist? @dsc
-
       @source = source
-      extract(@source)
-      DependencyResolver.resolve(@source, @extract_path)
+
+      fail "Could not find #{@source.dsc}" unless File.exist? @source.dsc
+
+
+      extract
+      DependencyResolver.resolve(BUILD_DIR)
 
       build_package
-      print_contents
       copy_binaries
+      print_contents
     end
   end
 end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list