[SCM] ci-tooling packaging branch, master, updated. 569b3ca0d1ab57271dae2d0f08fabbc2e43b700a
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Tue Mar 24 14:20:56 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=f217686
The following commit has been merged in the master branch:
commit f2176868b9a4c33c4f0e687bcbd0d414723a6b67
Author: Harald Sitter <sitter at kde.org>
Date: Tue Mar 24 10:43:57 2015 +0100
rename previous ci/source, move source descriptor out of qml dep
---
lib/ci/{source.rb => build_source.rb} | 0
lib/ci/source.rb | 119 +++++++---------------------------
lib/qml_dependency_verifier.rb | 28 +-------
test/test_ci_source.rb | 46 +++++++++++++
4 files changed, 72 insertions(+), 121 deletions(-)
diff --git a/lib/ci/source.rb b/lib/ci/build_source.rb
similarity index 100%
copy from lib/ci/source.rb
copy to lib/ci/build_source.rb
diff --git a/lib/ci/source.rb b/lib/ci/source.rb
index 8238b28..e4c21cf 100644
--- a/lib/ci/source.rb
+++ b/lib/ci/source.rb
@@ -1,105 +1,34 @@
-class AbstractSource
- attr_reader :package_name
- attr_reader :package_version
-
- def run
- fail 'Not implemented'
- end
-end
-
-class VcsSource < AbstractSource
- def copy_source
- # copy sources around
- FileUtils.rm_r('build') if File.exist?('build')
- FileUtils.mkpath('build/source/')
- FileUtils.cp_r(Dir.glob('source/*'), 'build/source/', verbose: true)
-
- %w(.bzr .git .hg .svn).each do |vcsdir|
- FileUtils.rm_rf(Dir.glob("build/source/**/#{vcsdir}"))
+require 'json'
+
+module CI
+ # Build source descriptor
+ class Source
+ attr_reader :name
+ attr_reader :version
+ attr_reader :type
+
+ def []=(key, value)
+ var = "@#{key}".to_sym
+ instance_variable_set(var, value)
end
- end
- def create_orig_tar
- Dir.chdir('build/') do
- tar = "#{source_name}_#{tar_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}")
+ def self.from_json(json)
+ JSON.parse(json, object_class: self)
end
- end
-
- def copy_packaging
- # Copy some more
- FileUtils.cp_r(Dir.glob("packaging/*"), "build/source/", verbose: true)
-
- # Rip out locale install
- Dir.chdir("build/source/") do
- 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\/.*$/, '')
- File.open(install_file_path, 'w') do |f|
- f << subbed
- end
- # FIXME: bloody workaround for kconfigwidgets and kdelibs4support containing legit locale data
- next if source_name == 'kconfigwidgets' || source_name == 'kdelibs4support'
- subbed = File.open(install_file_path).read().gsub(/^.*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 |
- 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')
- puts "#{package_name} is now empty, trying to add lintian override"
- File.open(lintian_overrides_path, 'a') { |file| file.write("#{package_name}: empty-binary-package
") }
+ def to_json(*args)
+ ret = {}
+ instance_variables.each do |var|
+ value = instance_variable_get(var)
+ key = var.to_s
+ key.slice!(0) # Nuke the @
+ ret[key] = value
end
+ ret.to_json(*args)
end
- end
- def log_change
- # Create changelog entry
- Dir.chdir("build/source/") do
- env['DEBFULLNAME'] = 'Kubuntu CI'
- env['DEBEMAIL'] = 'kubuntu-ci at lists.launchpad.net'
- # FXIME project undefined
- unless system("dch -b -v #{@package_version} -D #{project.series} 'Automatic Kubuntu Build'")
- fail 'Failed to create changelog entry'
- end
- end
- end
-
- def build
- # dpkg-buildpackage
- Dir.chdir('build/source/') do
- system('update-maintainer')
- fail 'Failed to build source package' unless system('dpkg-buildpackage -us -uc -S')
- end
- end
-
- def run
- # version
- changelog = nil
- Dir.chdir('packaging') do
- changelog = Changelog.new
+ def ==(other)
+ name == other.name && version == other.version && type == other.type
end
-
- # Note that the kubuntu version needs to be part of the *base* version as otherwise
- # different series uploads can end up with exactly the same tar name and launchpad
- # freaks out. So, kubuntu version in base/suffix not revision/suffix.
- eval `grep VERSION_ID /etc/os-release`.strip
-
- @package_name = changelog.name
- version_suffix = "+git#{DateTime.now().strftime('%Y%m%d.%H%M')}+#{VERSION_ID}"
- @tar_version = "#{changelog.version(Changelog::BASE)}#{version_suffix}"
- @package_version = "#{changelog.version(Changelog::EPOCH | Changelog::BASE)}#{version_suffix}-0ubuntu0" # <-- needs git version and bzr version possibly
-
- copy_source
- create_orig_tar
- copy_packaging
- log_change
- build
end
end
diff --git a/lib/qml_dependency_verifier.rb b/lib/qml_dependency_verifier.rb
index 8de8f3c..a1cc181 100644
--- a/lib/qml_dependency_verifier.rb
+++ b/lib/qml_dependency_verifier.rb
@@ -2,36 +2,12 @@ require 'logger'
require 'logger/colors'
require_relative 'apt'
+require_relative 'ci/source'
require_relative 'dpkg'
require_relative 'lp'
require_relative 'lsb'
require_relative 'qml'
-# FIXME: should get moved somewhere and used in builder as well as
-# ppa-copy-package
-# Build source descriptor
-class Source
- attr_reader :name
- attr_reader :version
- attr_reader :type
-
- def []=(key, value)
- var = "@#{key}".to_sym
- instance_variable_set(var, value)
- end
-
- # def to_json(*a)
- # ret = {}
- # instance_variables.each do |var|
- # value = instance_variable_get(var)
- # key = var.to_s
- # key.slice!(0) # Nuke the @
- # ret[key] = value
- # end
- # ret.to_json(*a)
- # end
-end
-
class QMLDependencyVerifier
PACKAGE_MAP = {
'org.kde.plasma.plasmoid' => 'plasma-framework',
@@ -46,7 +22,7 @@ class QMLDependencyVerifier
def source
## Read source defintion
- @source ||= JSON.parse(File.read('source.json'), object_class: Source)
+ @source ||= CI::Source.from_json(File.read('source.json'))
end
def binaries
diff --git a/test/test_ci_source.rb b/test/test_ci_source.rb
new file mode 100644
index 0000000..5d10172
--- /dev/null
+++ b/test/test_ci_source.rb
@@ -0,0 +1,46 @@
+require_relative '../lib/ci/source'
+require_relative 'lib/testcase'
+
+# Test ci/source
+class CISourceTest < TestCase
+ def setup
+ @hash = { 'name' => 'kcmutils',
+ 'version' => '2.0',
+ 'type' => 'stable' }
+ end
+
+ def test_to_json
+ s = CI::Source.new
+ @hash.each do |key, value|
+ s[key.to_sym] = value
+ end
+ json = s.to_json
+ assert_equal(@hash, JSON.parse(json))
+ end
+
+ def test_from_json
+ s1 = CI::Source.new
+ @hash.each do |key, value|
+ s1[key.to_sym] = value
+ end
+ json = JSON.generate(@hash)
+ s2 = CI::Source.from_json(json)
+ assert_equal(s1, s2)
+ end
+
+ def test_compare
+ s1 = CI::Source.new
+ @hash.each do |key, value|
+ s1[key.to_sym] = value
+ end
+
+ s2 = CI::Source.new
+ @hash.each do |key, value|
+ s2[key.to_sym] = value
+ end
+
+ assert_equal(s1, s2)
+ s2[:version] = '0.0'
+ assert_not_equal(s1, s2)
+ end
+end
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list