[SCM] ci-tooling packaging branch, master, updated. 1d6683492f2a1b2b4cc553847ad00a7140baa277

Harald Sitter apachelogger-guest at moszumanska.debian.org
Fri Nov 13 12:46:50 UTC 2015


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

The following commit has been merged in the master branch:
commit 1d6683492f2a1b2b4cc553847ad00a7140baa277
Author: Harald Sitter <sitter at kde.org>
Date:   Fri Nov 13 13:46:47 2015 +0100

    force a suitable distribution value through dch for orig source builds
---
 lib/ci/orig_source_builder.rb       | 13 +++++++++++--
 test/test_ci_orig_source_builder.rb | 25 +++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/lib/ci/orig_source_builder.rb b/lib/ci/orig_source_builder.rb
index 4c126cb..8679119 100644
--- a/lib/ci/orig_source_builder.rb
+++ b/lib/ci/orig_source_builder.rb
@@ -1,6 +1,7 @@
 require 'fileutils'
 
 require_relative '../debian/changelog'
+require_relative '../lsb'
 require_relative 'build_version'
 require_relative 'source'
 require_relative 'tar_fetcher'
@@ -9,12 +10,15 @@ module CI
   class OrigSourceBuilder
     extend Gem::Deprecate
 
-    def initialize
+    def initialize(release: LSB::DISTRIB_CODENAME)
       # @name
       # @version
       # @tar
+      @release = release
 
+      # FIXME: hardcoded
       @build_rev = 1
+      # FIXME: hardcoded
       @flavor = 'kubuntu'
 
       @packagingdir = File.absolute_path('packaging')
@@ -70,7 +74,12 @@ module CI
       base_version = "#{base_version}#{@flavor}#{@build_rev}"
       # FIXME: code copy from build_source
       # FIXME: dch should include build url
-      unless system("dch -b -v #{base_version} 'Automatic CI Build'")
+      dch = %w(dch)
+      dch << '--force-bad-version'
+      dch << '--distribution' << @release
+      dch << '-v' << base_version
+      dch << 'Automatic CI Build'
+      unless system(*dch)
         # :nocov:
         # dch cannot actually fail because we parse the changelog beforehand
         # so it is of acceptable format here already.
diff --git a/test/test_ci_orig_source_builder.rb b/test/test_ci_orig_source_builder.rb
index b4e76c3..7f20cff 100644
--- a/test/test_ci_orig_source_builder.rb
+++ b/test/test_ci_orig_source_builder.rb
@@ -5,9 +5,15 @@ require_relative '../lib/ci/orig_source_builder'
 module CI
   class OrigSourceBuilderTest < TestCase
     def setup
+      LSB.reset
+      LSB.instance_variable_set(:@hash, DISTRIB_CODENAME: 'vivid')
       FileUtils.cp_r(Dir.glob("#{data}/*"), Dir.pwd)
     end
 
+    def teardown
+      LSB.reset
+    end
+
     def test_run
       assert_false(Dir.glob('*').empty?)
 
@@ -22,6 +28,8 @@ module CI
       assert_path_exist('build/dragon_15.08.1-0kubuntu1_source.changes')
       assert_path_exist('build/dragon_15.08.1-0kubuntu1.dsc')
       assert_path_exist('build/dragon_15.08.1.orig.tar.xz')
+      changes = File.read('build/dragon_15.08.1-0kubuntu1_source.changes')
+      assert_include(changes.split($/), 'Distribution: vivid')
     end
 
     def test_existing_builddir
@@ -32,5 +40,22 @@ module CI
       end
       assert_path_exist('build')
     end
+
+    def test_unreleased_changelog
+      assert_false(Dir.glob('*').empty?)
+
+      tarball = WatchTarFetcher.new('packaging/debian/watch').fetch(Dir.pwd)
+
+      builder = OrigSourceBuilder.new(release: 'unstable')
+      builder.build(tarball)
+
+      debian_tar = Dir.glob('build/dragon_15.08.1-0kubuntu1.debian.tar.*')
+      assert_false(debian_tar.empty?)
+      assert_path_exist('build/dragon_15.08.1-0kubuntu1_source.changes')
+      assert_path_exist('build/dragon_15.08.1-0kubuntu1.dsc')
+      assert_path_exist('build/dragon_15.08.1.orig.tar.xz')
+      changes = File.read('build/dragon_15.08.1-0kubuntu1_source.changes')
+      assert_include(changes.split($/), 'Distribution: unstable')
+    end
   end
 end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list