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

Rohan Garg rohangarg-guest at moszumanska.debian.org
Fri Jun 12 18:24:28 UTC 2015


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

The following commit has been merged in the master branch:
commit f8b901dd4071e8e28dc36a13adbf7fded485ba6a
Author: Rohan Garg <rohan at garg.io>
Date:   Fri Jun 12 20:24:13 2015 +0200

    Refactor source building to return a source object when finished
---
 lib/ci/build_source.rb | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/lib/ci/build_source.rb b/lib/ci/build_source.rb
index d931cf0..798a6b2 100644
--- a/lib/ci/build_source.rb
+++ b/lib/ci/build_source.rb
@@ -4,18 +4,11 @@ require 'fileutils'
 require_relative '../debian/changelog'
 require_relative '../os'
 require_relative '../debian/source'
+require_relative 'source'
 require_relative 'build_version'
 
-class AbstractSource
-  attr_reader :package_name
-  attr_reader :package_version
-
-  def run
-    fail 'Not implemented'
-  end
-end
-
-class VcsSource < AbstractSource
+# Class to build out source package from a VCS
+class VcsSourceBuilder
   def copy_source
     # copy sources around
     FileUtils.rm_r('build') if File.exist?('build')
@@ -33,7 +26,7 @@ class VcsSource < AbstractSource
 
   def create_orig_tar
     Dir.chdir('build/') do
-      tar = "#{@package_name}_#{@tar_version}.orig.tar"
+      tar = "#{@name}_#{@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
@@ -45,7 +38,7 @@ class VcsSource < AbstractSource
 
     # Rip out locale install
     Dir.chdir("build/source/") do
-      Dir.glob("debian/*.install").each do | install_file_path |
+      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\/.*$/, '')
@@ -54,14 +47,16 @@ class VcsSource < AbstractSource
         end
 
         # FIXME: bloody workaround for kconfigwidgets and kdelibs4support containing legit locale data
-        next if @package_name == 'kconfigwidgets' || @package_name == 'kdelibs4support'
-        subbed = File.open(install_file_path).read().gsub(/^.*usr\/share\/locale.*$/, '')
+        next if @name == 'kconfigwidgets' ||
+                @name == 'kdelibs4support'
+
+        subbed = File.open(install_file_path).read.gsub(%r{^.*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 |
+      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')
@@ -100,7 +95,7 @@ class VcsSource < AbstractSource
                         email: 'kubuntu-ci at lists.launchpad.net' },
               debian: { name: 'Debian CI',
                         email: 'null at debian.org' }
-            }
+    }
     # version
     changelog = nil
     Dir.chdir('packaging') do
@@ -108,16 +103,22 @@ class VcsSource < AbstractSource
       changelog = Changelog.new
     end
 
-    @package_name = changelog.name
+    @name = changelog.name
     build_version = CI::BuildVersion.new(changelog)
     @package_version = build_version.base if @source.format.type == :native
     @package_version = build_version.full if @source.format.type == :quilt
-    @tar_version = build_version.tar
+    @version = build_version.tar
 
     copy_source
     create_orig_tar
     copy_packaging
     log_change
     build
+
+    s = Source.new
+    s['name'] = @name
+    s['version'] = @version
+    s['type'] = @source.format.type
+    s
   end
 end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list