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

Harald Sitter apachelogger-guest at moszumanska.debian.org
Tue Oct 13 11:52:15 UTC 2015


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

The following commit has been merged in the master branch:
commit c3275f812e36ccd4ca91db501ebe55d30141b155
Author: Harald Sitter <sitter at kde.org>
Date:   Tue Oct 13 13:51:43 2015 +0200

    introduce some tech to build from tars rather than scms
---
 kci/orig_sourcer.rb                                |  5 ++
 lib/ci/orig_source_builder.rb                      | 96 ++++++++++++++++++++++
 .../test_run/packaging/debian/changelog            |  5 ++
 .../test_run/packaging/debian/control              | 56 +++++++++++++
 .../test_run/packaging/debian/rules                |  9 ++
 .../test_run}/packaging/debian/source/format       |  0
 .../test_run/packaging/debian/watch                |  3 +
 test/test_ci_orig_source_builder.rb                | 36 ++++++++
 8 files changed, 210 insertions(+)

diff --git a/kci/orig_sourcer.rb b/kci/orig_sourcer.rb
new file mode 100755
index 0000000..b8ef716
--- /dev/null
+++ b/kci/orig_sourcer.rb
@@ -0,0 +1,5 @@
+require_relative '../lib/ci/orig_source_builder'
+
+sourcer = OrigSourceBuilder.new
+sourcer.get_tar
+sourcer.build
diff --git a/lib/ci/orig_source_builder.rb b/lib/ci/orig_source_builder.rb
new file mode 100644
index 0000000..00cb4fb
--- /dev/null
+++ b/lib/ci/orig_source_builder.rb
@@ -0,0 +1,96 @@
+require 'fileutils'
+
+require_relative '../debian/changelog'
+require_relative 'build_version'
+require_relative 'source'
+
+module CI
+  class OrigSourceBuilder
+    def initialize
+      # @name
+      # @version
+      # @tar
+
+      @build_rev = 1
+      @flavor = 'kubuntu'
+
+      @packagingdir = File.absolute_path('packaging')
+
+      Dir.mkdir('build')
+      @builddir = File.absolute_path('build')
+
+      # FIXME: builder should generate a Source instance
+    end
+
+    # FIXME: why would the builder need to know how to get the source?
+    def get_tar
+      Dir.chdir(@packagingdir) do
+        system('uscan',
+               '--report-status',
+               '--force-download',
+               '--download-current-version',
+               "--destdir=#{@builddir}")
+      end
+    end
+
+    # FIXME: this needs to happen magically somehow?
+    def sourcepath
+      return @sourcedir if @sourcedir
+      Dir.chdir('build') do
+        tar = Dir.glob('*.tar.*')
+        abort unless tar.size != 1 || tar.zie != 2
+        tar = tar[0]
+        abort unless system('tar', '-xf', tar)
+        # FIXME: this should possibly simply extract to a subdir and make sure
+        #        that the everything is in ONE subdir or else move it in one.
+        #        the present code wouldn't handle tars with multiple files
+        #        rather than a dir.
+        dirs = Dir.glob('*').reject { |d| !File.directory?(d) }
+        abort unless dirs.size == 1
+        @sourcedir = File.absolute_path(dirs[0])
+      end
+      @sourcedir
+    end
+
+    def log_change
+      # FIXME: this has email and fullname from env, see build_source
+      # FIXME: code copy from build_source
+      changelog = Changelog.new
+      fail "Can't parse changelog!" if changelog.nil?
+      base_version = changelog.version
+      if base_version.include?('ubuntu')
+        base_version = base_version.split('ubuntu')
+        base_version = base_version[0..-2].join('ubuntu')
+      end
+      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'")
+        # :nocov:
+        # dch cannot actually fail because we parse the changelog beforehand
+        # so it is of acceptable format here already.
+        fail 'Failed to create changelog entry'
+        # :nocov:
+      end
+    end
+
+    def build
+      FileUtils.cp_r(Dir.glob("#{@packagingdir}/*"), sourcepath, verbose: true)
+      Dir.chdir(sourcepath) do
+        log_change
+        build_internal
+      end
+    end
+
+    def build_internal
+      # FIXME: code copy from build_source
+      # dpkg-buildpackage
+      Dir.chdir(sourcepath) do
+        system('update-maintainer')
+        # Force -sa as reprepreo refuses to accept uploads without orig.
+        return if system('dpkg-buildpackage', '-us', '-uc', '-S', '-d', '-sa')
+        fail 'Could not run dpkg-buildpackage!'
+      end
+    end
+  end
+end
diff --git a/test/data/test_ci_orig_source_builder/test_run/packaging/debian/changelog b/test/data/test_ci_orig_source_builder/test_run/packaging/debian/changelog
new file mode 100644
index 0000000..0171efd
--- /dev/null
+++ b/test/data/test_ci_orig_source_builder/test_run/packaging/debian/changelog
@@ -0,0 +1,5 @@
+dragon (4:15.08.1-0ubuntu1) wily; urgency=medium
+
+  * New upstream release (15.08.1)
+
+ -- Clive Johnston <clivejo at aol.com>  Tue, 22 Sep 2015 16:07:13 +0100
diff --git a/test/data/test_ci_orig_source_builder/test_run/packaging/debian/control b/test/data/test_ci_orig_source_builder/test_run/packaging/debian/control
new file mode 100644
index 0000000..3dfeb38
--- /dev/null
+++ b/test/data/test_ci_orig_source_builder/test_run/packaging/debian/control
@@ -0,0 +1,56 @@
+Source: dragon
+Section: kde
+Priority: optional
+Maintainer: Debian/Kubuntu Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>
+Uploaders: Sune Vuorela <sune at debian.org>, Maximiliano Curia <maxy at debian.org>
+Build-Depends: cmake,
+               debhelper (>= 9),
+               extra-cmake-modules (>= 1.3.0),
+               kdoctools-dev,
+               kio-dev,
+               libkf5config-dev,
+               libkf5configwidgets-dev,
+               libkf5coreaddons-dev,
+               libkf5dbusaddons-dev,
+               libkf5i18n-dev,
+               libkf5iconthemes-dev,
+               libkf5jobwidgets-dev,
+               libkf5notifications-dev,
+               libkf5parts-dev,
+               libkf5solid-dev,
+               libkf5widgetsaddons-dev,
+               libkf5windowsystem-dev,
+               libkf5xmlgui-dev,
+               libphonon4qt5-dev,
+               libphonon4qt5experimental-dev,
+               pkg-kde-tools (>> 0.15.15),
+               qtbase5-dev (>= 5.3.0)
+Standards-Version: 3.9.6
+Homepage: http://www.kde.org/
+Vcs-Browser: http://anonscm.debian.org/cgit/pkg-kde/kde-applications/dragon.git/
+Vcs-Git: git://anonscm.debian.org/pkg-kde/kde-applications/dragon.git
+
+Package: dragonplayer
+Section: video
+Architecture: any
+Depends: ${misc:Depends}, ${shlibs:Depends}
+Description: simple video player
+ A video player with a different philosophy: Simple, uncluttered interface.
+ .
+ Features:
+  - Plays DVDs, VCDs, all video formats supported by the Phonon backend in use.
+  - Bundled with a simple web-page KPart.
+  - Starts quickly.
+ .
+ This package is part of the KDE multimedia module.
+
+Package: dragonplayer-dbg
+Section: debug
+Architecture: any
+Priority: extra
+Depends: dragonplayer (= ${binary:Version}), ${misc:Depends}
+Description: debugging symbols for dragonplayer
+ This package contains debugging files used to investigate problems with
+ dragonplayer.
+ .
+ This package is part of the KDE multimedia module.
diff --git a/test/data/test_ci_orig_source_builder/test_run/packaging/debian/rules b/test/data/test_ci_orig_source_builder/test_run/packaging/debian/rules
new file mode 100755
index 0000000..cbc6244
--- /dev/null
+++ b/test/data/test_ci_orig_source_builder/test_run/packaging/debian/rules
@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+
+include /usr/share/pkg-kde-tools/qt-kde-team/3/debian-qt-kde.mk
+
+override_dh_auto_install:
+	$(overridden_command) --destdir=debian/dragonplayer
+
+override_dh_strip:
+	$(overridden_command) --dbg-package=dragonplayer-dbg
diff --git a/test/data/test_ci_build_source/test_build_fail/packaging/debian/source/format b/test/data/test_ci_orig_source_builder/test_run/packaging/debian/source/format
similarity index 100%
copy from test/data/test_ci_build_source/test_build_fail/packaging/debian/source/format
copy to test/data/test_ci_orig_source_builder/test_run/packaging/debian/source/format
diff --git a/test/data/test_ci_orig_source_builder/test_run/packaging/debian/watch b/test/data/test_ci_orig_source_builder/test_run/packaging/debian/watch
new file mode 100644
index 0000000..82f6410
--- /dev/null
+++ b/test/data/test_ci_orig_source_builder/test_run/packaging/debian/watch
@@ -0,0 +1,3 @@
+version=3
+http://download.kde.org/stable/applications/15.08.1/src/dragon-([\d\.]*).tar.xz
+http://download.kde.org/unstable/applications/([\d\.]*)/src/dragon-([\d\.]*).tar.xz
diff --git a/test/test_ci_orig_source_builder.rb b/test/test_ci_orig_source_builder.rb
new file mode 100644
index 0000000..327e0eb
--- /dev/null
+++ b/test/test_ci_orig_source_builder.rb
@@ -0,0 +1,36 @@
+require 'simplecov'
+require 'simplecov-rcov'
+SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter,
+                        SimpleCov::Formatter::RcovFormatter]
+SimpleCov.start
+
+require_relative 'lib/testcase'
+
+require_relative '../lib/ci/orig_source_builder'
+
+module CI
+  class OrigSourceBuilderTest < TestCase
+    def setup
+      FileUtils.cp_r(Dir.glob("#{data}/*"), Dir.pwd)
+    end
+
+    def test_run
+      assert_false(Dir.glob('*').empty?)
+      builder = OrigSourceBuilder.new
+
+      builder.get_tar
+      assert_path_exist('build/dragon_15.08.1.orig.tar.xz')
+      assert_path_exist('build/dragon-15.08.1.tar.xz')
+
+      assert_path_exist(builder.sourcepath)
+      assert_equal("#{Dir.pwd}/build/dragon-15.08.1", builder.sourcepath)
+
+      builder.build
+
+      assert_path_exist('build/dragon_15.08.1-0kubuntu1.debian.tar.xz')
+      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')
+    end
+  end
+end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list