[SCM] ci-tooling packaging branch, master, updated. bf6916c7f87518e23bfec112d7ac4fca15b60fa5
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Thu Dec 3 13:41:49 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=52c321d
The following commit has been merged in the master branch:
commit 52c321daa64ae3a42738546afcce1487a4d930dd
Author: Harald Sitter <sitter at kde.org>
Date: Thu Dec 3 14:24:43 2015 +0100
fix a million rubocop violations in source.rb
---
dci/source.rb | 111 ++++++++++++++++++++++++++++++++++------------------------
1 file changed, 65 insertions(+), 46 deletions(-)
diff --git a/dci/source.rb b/dci/source.rb
index e5fdd67..a36bd0e 100644
--- a/dci/source.rb
+++ b/dci/source.rb
@@ -10,25 +10,28 @@ require_relative '../lib/logger'
require_relative '../lib/dci'
require_relative '../lib/ci/build_version'
-raise "No workspace dir defined!" unless ARGV[1]
+abort 'No workspace dir defined!' unless ARGV[1]
options = {}
-OptionParser.new do | opts |
- opts.banner = "Usage: dci.rb build -c repo1,repo2 file.changes"
- opts.on('-r r1,r2,r3', '--repos REPOS', Array, 'Comma separated repositories to add to the schroot before build') do |repos|
- options[:repos] = repos
- end
+OptionParser.new do |opts|
+ opts.banner = 'Usage: dci.rb build -c repo1,repo2 file.changes'
+ opts.on('-r r1,r2,r3', '--repos REPOS', Array,
+ 'Comma separated repositories to add to the' \
+ ' schroot before build') do |repos|
+ options[:repos] = repos
+ end
- opts.on('-w dir', '--workspace dir', 'Workspace dir to find repository mappings') do |dir|
- options[:workspace] = dir
- end
+ opts.on('-w dir', '--workspace dir',
+ 'Workspace dir to find repository mappings') do |dir|
+ options[:workspace] = dir
+ end
- opts.on('-R release', '--release release', 'Build for release') do |release|
- options[:release] = release
- end
+ opts.on('-R release', '--release release', 'Build for release') do |release|
+ options[:release] = release
+ end
end.parse!
-raise "Release is not optional!" unless options[:release]
+abort 'Release is not optional!' unless options[:release]
$logger = DCILogger.instance
@@ -37,31 +40,32 @@ $logger.info("Parsed #{options}")
$logger.info("Adding custom repos #{options[:repos]}")
-# Skip if there is only one repo in the options, since thats the 'default' config
-# FIXME: This is a workaround till I figure out how to make ruby parse empty values for options
+# Skip if there is only one repo in the options, since thats the 'default'
+# config
+# FIXME: This is a workaround till I figure out how to make ruby parse empty
+# values for options
if !options[:repos].nil? && options[:repos].count > 1
- File.delete('/etc/apt/sources.list.d/extra_repos.list') if File.exist?('/etc/apt/sources.list.d/extra_repos.list')
-
- Dir.chdir(options[:workspace]) do
- EXTRA_REPOS = 'extra_repos.json'
- if File.exist? EXTRA_REPOS
- extra_repos = JSON::parse(File.read(EXTRA_REPOS))
- options[:repos].each do |repo|
- # Default repos are ignored since they should already be in the chroot
- next if repo == 'default'
- system("echo 'deb #{extra_repos[repo]['url']} #{options[:release]} main' >> /etc/apt/sources.list.d/extra_repos.list")
- system("echo '#{extra_repos[repo]['key']}' | apt-key add -")
- $logger.info("Added deb #{extra_repos[repo]['url']} #{options[:release]} main")
- end
- end
+ File.delete('/etc/apt/sources.list.d/extra_repos.list') if File.exist?('/etc/apt/sources.list.d/extra_repos.list')
+
+ Dir.chdir(options[:workspace]) do
+ EXTRA_REPOS = 'extra_repos.json'
+ if File.exist? EXTRA_REPOS
+ extra_repos = JSON.parse(File.read(EXTRA_REPOS))
+ options[:repos].each do |repo|
+ # Default repos are ignored since they should already be in the chroot
+ next if repo == 'default'
+ system("echo 'deb #{extra_repos[repo]['url']} #{options[:release]} main' >> /etc/apt/sources.list.d/extra_repos.list")
+ system("echo '#{extra_repos[repo]['key']}' | apt-key add -")
+ $logger.info("Added deb #{extra_repos[repo]['url']} #{options[:release]} main")
+ end
end
+ end
end
# These should never fail
dci_run_cmd('apt-get update && apt-get -y dist-upgrade')
dci_run_cmd('apt-get -y install devscripts lsb-release locales libdistro-info-perl pbuilder aptitude')
-
Dir.chdir(ARGV[1]) do
# Get source name and what not
@@ -74,7 +78,9 @@ Dir.chdir(ARGV[1]) do
source_dir = PACKAGING_DIR if s.format.type == :native
end
- fail 'Source contains packaging but is not a native package' unless defined? PACKAGING_DIR
+ unless defined? PACKAGING_DIR
+ fail 'Source contains packaging but is not a native package'
+ end
cl = nil
Dir.chdir(PACKAGING_DIR) do
@@ -98,41 +104,53 @@ Dir.chdir(ARGV[1]) do
# create orig tar
tar = "#{source_name}_#{bv.tar}.orig.tar"
File.delete(tar) if File.exist? tar
- fail 'Failed to create a tarball' unless system("tar -cf #{tar} #{source_dir}")
+ unless system("tar -cf #{tar} #{source_dir}")
+ fail 'Failed to create a tarball'
+ end
fail 'Failed to compress the tarball' unless system("xz -6 #{tar}")
- system("cp -aR #{PACKAGING_DIR}/debian #{source_dir}") if s.format.type == :quilt
+ if s.format.type == :quilt
+ system("cp -aR #{PACKAGING_DIR}/debian #{source_dir}")
+ end
Dir.chdir(source_dir) do
- fail 'Failed to create changelog entry' unless system({ 'DEBFULLNAME' => 'Debian CI',
- 'DEBEMAIL' => 'null at debian.org' },
- "dch -b -v #{version} -D #{options[:release]} 'Automatic Debian Build'")
-
+ env = { 'DEBFULLNAME' => 'Debian CI',
+ 'DEBEMAIL' => 'null at debian.org' }
+ cmd = "dch -b -v #{version} -D #{options[:release]}" \
+ " 'Automatic Debian Build'"
+ fail 'Failed to create changelog entry' unless system(env, cmd)
# Rip out locale install and upstream patches
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\/.*$/, '')
+ man_regex = %r{^.*usr/share/man/(\*|\w+)/man\d/.*$}
+ subbed = File.open(install_file_path).read.gsub(man_regex, '')
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.*$/, '')
+ next if %w(kconfigwidgets kdelibs4support).include?(source_name)
+ locale_regex = %r{^.*usr/share/locale.*$}
+ subbed = File.open(install_file_path).read.gsub(locale_regex, '')
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
+ # 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')
- $logger.info("#{package_name} is now empty, trying to add lintian override")
- File.open(lintian_overrides_path, 'a') { |file| file.write("#{package_name}: empty-binary-package
") }
+ lintian_overrides_path = install_file_path.gsub('.install',
+ '.lintian-overrides')
+ $logger.info("#{package_name} is now empty, trying to add lintian" \
+ ' override')
+ File.open(lintian_overrides_path, 'a') do |file|
+ file.write("#{package_name}: empty-binary-package
")
+ end
end
# Rip out upstream patches
@@ -148,7 +166,6 @@ Dir.chdir(ARGV[1]) do
Dir.glob('debian/*.symbols*').each do |f|
File.delete(f)
end
-
end
Dir.mktmpdir do |dir|
@@ -156,7 +173,9 @@ Dir.chdir(ARGV[1]) do
FileUtils.cp_r("#{tar}.xz", dir)
Dir.chdir("#{dir}/#{source_dir}") do
# dpkg-buildpackage
- fail 'Failed to build source package' unless system('dpkg-buildpackage -S -uc -us')
+ unless system('dpkg-buildpackage -S -uc -us')
+ fail 'Failed to build source package'
+ end
end
Dir.chdir(dir) do
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list