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

Harald Sitter apachelogger-guest at moszumanska.debian.org
Mon Dec 7 09:07:05 UTC 2015


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

The following commit has been merged in the master branch:
commit 4c9c1fc40ba4707b0bab49cb53feb558d8efef47
Author: Harald Sitter <sitter at kde.org>
Date:   Mon Dec 7 09:54:38 2015 +0100

    resolve numerous style violations in build.rb
---
 dci/build.rb | 49 ++++++++++++++++++++++++++++++++-----------------
 1 file changed, 32 insertions(+), 17 deletions(-)

diff --git a/dci/build.rb b/dci/build.rb
index ba7d5c6..7947e06 100644
--- a/dci/build.rb
+++ b/dci/build.rb
@@ -14,11 +14,13 @@ require_relative '../lib/dci'
 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|
+  opts.on('-r r1,r2,r3', '--repos REPOS', Array,
+          'Comma separated repos 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|
+  opts.on('-w dir', '--workspace dir',
+          'Workspace dir to find repository mappings') do |dir|
     options[:workspace] = dir
   end
 end.parse!
@@ -30,7 +32,6 @@ logger = DCILogger.instance
 dpkg_buildopts = %w(-us -uc -sa)
 dpkg_buildopts << '-B' unless RbConfig::CONFIG['host_cpu'] == 'x86_64'
 
-
 if !ARGV[1].end_with? '.changes'
   logger.fatal("#{ARGV[1]} is not an actual changes file. Abort!")
 else
@@ -45,19 +46,21 @@ else
   # 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')
+    extra_file = '/etc/apt/sources.list.d/extra_repos.list'
+    File.delete(extra_file) if File.exist?(extra_file)
 
     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']} #{package_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']} #{package_release} main to the sources")
-        end
+      next unless 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'
+        url = extra_repos[repo]['url']
+        key = extra_repos[repo]['key']
+        system("echo 'deb #{url} #{package_release} main' >> #{extra_file}")
+        system("echo '#{key}' | apt-key add -")
+        logger.info("Added deb #{url} #{package_release} main to the sources")
       end
     end
   end
@@ -67,7 +70,14 @@ else
   system('apt-get -y dist-upgrade')
 
   logger.info('Installing some extra tools')
-  system('apt-get -y install aptitude devscripts pbuilder ubuntu-dev-tools libdistro-info-perl')
+  packages = %w(
+    aptitude
+    devscripts
+    pbuilder
+    ubuntu-dev-tools
+    libdistro-info-perl
+  )
+  system("apt-get -y install #{packages}")
 
   logger.info('Extracting source')
   Dir.mktmpdir do |dir|
@@ -75,7 +85,9 @@ else
       fail "Can't copy changes!" unless system("dcmd cp -v #{ARGV[1]} #{dir}")
       fail "Can't extract dsc!" unless system('dpkg-source -x *.dsc')
 
-      package_folder = Dir.glob("#{package_name}*").select { |fn| File.directory? fn }
+      package_folder = Dir.glob("#{package_name}*").select do |fn|
+        File.directory?(fn)
+      end
       Dir.chdir(package_folder[0]) do
         system('/usr/lib/pbuilder/pbuilder-satisfydepends')
         fail "Can't install build deps!" unless $?.success?
@@ -89,7 +101,9 @@ else
         end
       end
       FileUtils.mkdir_p(RESULT_DIR) unless Dir.exist? RESULT_DIR
-      changes_files = Dir.glob('*changes').select { |changes| !changes.end_with? '_source.changes' }
+      changes_files = Dir.glob('*changes').select do |changes|
+        !changes.end_with? '_source.changes'
+      end
 
       logger.warn('No changes file found!') if changes_files.empty?
 
@@ -100,7 +114,8 @@ else
 
         # Lintian checks
         if RbConfig::CONFIG['host_cpu'] == 'x86_64'
-          system("lintian -iI --pedantic --show-overrides --color auto #{changes_file}")
+          system('lintian -iI --pedantic --show-overrides --color auto ' \
+                 "#{changes_file}")
           logger.warn('Lintian check failed!') unless $?.success?
           logger.info('Finished running lintian checks')
         end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list