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

Rohan Garg rohangarg-guest at moszumanska.debian.org
Thu Feb 19 16:12:33 UTC 2015


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

The following commit has been merged in the master branch:
commit 7a82f752308530567b484e8ce316bc851cd3fd83
Author: Rohan Garg <rohan at kde.org>
Date:   Thu Feb 19 17:12:18 2015 +0100

    Fix large amounts of warnings and start warning if no changes files are found
---
 dci/build.rb | 188 ++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 96 insertions(+), 92 deletions(-)

diff --git a/dci/build.rb b/dci/build.rb
index 86892e8..fbfae91 100644
--- a/dci/build.rb
+++ b/dci/build.rb
@@ -11,17 +11,16 @@ require_relative '../lib/dci'
 ##      * All resulting debs are put in /build/
 ##      * Copy resulting files using dcmd cp /build/*/package_name*.changes
 
-
 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
-
-    opts.on('-w dir', '--workspace dir', 'Workspace dir to find repository mappings') do |dir|
-        options[:workspace] = dir
-    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
 end.parse!
 
 RESULT_DIR = '/build/'
@@ -29,94 +28,99 @@ RESULT_DIR = '/build/'
 logger = DCILogger.instance
 
 dpkg_buildopts = %w(-us -uc -sa)
-dpkg_buildopts << "-B" unless RbConfig::CONFIG['host_cpu'] == 'x86_64'
+dpkg_buildopts << '-B' unless RbConfig::CONFIG['host_cpu'] == 'x86_64'
 
 
-if not ARGV[1].end_with? '.changes'
-    logger.fatal("#{ARGV[1]} is not an actual changes file. Abort!")
+if !ARGV[1].end_with? '.changes'
+  logger.fatal("#{ARGV[1]} is not an actual changes file. Abort!")
 else
-    package_name = `grep Source #{ARGV[1]}`.split(':')[-1].strip
-    package_version = `grep Version #{ARGV[1]}`.split(':')[-1].strip
-    package_release = `grep Distribution #{ARGV[1]}`.split(':')[-1].strip
-
-    logger.info("Starting build for #{package_name}")
-    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
-    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.exists? 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
-            end
+  package_name = `grep Source #{ARGV[1]}`.split(':')[-1].strip
+  # package_version = `grep Version #{ARGV[1]}`.split(':')[-1].strip
+  package_release = `grep Distribution #{ARGV[1]}`.split(':')[-1].strip
+
+  logger.info("Starting build for #{package_name}")
+  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
+  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']} #{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
+      end
     end
+  end
+
+  logger.info('Updating chroot')
+  dci_run_cmd('apt-get update')
+  system('apt-get -y dist-upgrade')
+
+  logger.info('Installing some extra tools')
+  system('apt-get -y install devscripts ubuntu-dev-tools libdistro-info-perl')
+
+  logger.info('Extracting source')
+  Dir.mktmpdir do |dir|
+    Dir.chdir(dir) do
+      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 }
+      Dir.chdir(package_folder[0]) do
+        logger.info('Figuring out build deps')
+        c = DebianControl.new
+        c.parse!
+        build_depends = []
+        c.source['build-depends'].each do |dep|
+          build_depends << dep.name
+        end
+
+        logger.info("Installing build deps : #{build_depends}")
+        system("apt-get -y install #{build_depends.join(' ')}")
+        logger.info('Finished installing build deps')
+
+        logger.info('Start building the package')
+        system("dpkg-buildpackage -j`nproc` #{dpkg_buildopts.join(' ')}")
+        system('dh_install --fail-missing')
+        logger.error('Not all files have been installed!') unless $?.success?
+      end
+      FileUtils.mkdir_p(RESULT_DIR) unless Dir.exist? RESULT_DIR
+      changes_files = Dir.glob('*changes').select { |changes| !changes.include? 'source' }
+
+      DCILogger.warn 'No changes file found!' if changes_file.empty?
+
+      changes_files.each do |changes_file|
+        logger.info("Copying #{changes_file} ...")
+        system("dcmd chmod 666 #{changes_file}")
+        logger.info('Running lintian checks ...')
+
+        # Lintian checks
+        system("lintian -iI --pedantic --show-overrides --color auto #{changes_file}")
+        logger.error('Lintian check failed!') unless $?.success?
+        logger.info('Finished running lintian checks')
+
+        # Content of debs
+        logger.info('Contents of debs')
+        Dir.glob('*.deb') do |deb|
+          system("lesspipe #{deb}")
+        end
 
-    logger.info("Updating chroot")
-    dci_run_cmd("apt-get update")
-    system("apt-get -y dist-upgrade")
-
-    logger.info("Installing some extra tools")
-    system("apt-get -y install devscripts ubuntu-dev-tools libdistro-info-perl")
-
-    logger.info("Extracting source")
-    Dir.mktmpdir { |dir|
-        Dir.chdir(dir) {
-          raise "Can't copy changes!" unless system("dcmd cp -v #{ARGV[1]} #{dir}")
-          raise "Can't extract dsc!" unless system("dpkg-source -x *.dsc")
-
-          package_folder = Dir.glob("#{package_name}*").select { |fn| File.directory? fn }
-          Dir.chdir(package_folder[0]) {
-              logger.info("Figuring out build deps")
-              c = DebianControl.new
-              c.parse!
-              build_depends = []
-              c.source['build-depends'].each do |dep|
-                  build_depends << dep.name
-              end
-
-              logger.info("Installing build deps : #{build_depends}")
-              system("apt-get -y install #{build_depends.join(' ')}")
-              logger.info("Finished installing build deps")
-
-              logger.info("Start building the package")
-              system("dpkg-buildpackage -j`nproc` #{dpkg_buildopts.join(' ')}")
-              system("dh_install --fail-missing")
-              logger.error("Not all files have been installed!") unless $?.success?
-          }
-          FileUtils.mkdir_p(RESULT_DIR) unless Dir.exist? RESULT_DIR
-          changes_files = Dir.glob("*changes").select { |changes| !changes.include? 'source' }
-          changes_files.each do |changes_file|
-              logger.info("Copying #{changes_file} ...")
-              system("dcmd chmod 666 #{changes_file}")
-              logger.info("Running lintian checks ...")
-
-              # Lintian checks
-              system("lintian -iI --pedantic --show-overrides --color auto #{changes_file}")
-              logger.error("Lintian check failed!") unless $?.success?
-              logger.info("Finished running lintian checks")
-
-              # Content of debs
-              logger.info("Contents of debs")
-              Dir.glob("*.deb") { |deb|
-                  system("lesspipe #{deb}")
-              }
-
-              system("dcmd mv #{changes_file} #{RESULT_DIR}")
-              system("chmod 2770 #{RESULT_DIR}") unless File.stat(RESULT_DIR).setgid?
-          end
-          logger.info("Build finished!")
-        }
-    }
+        system("dcmd mv #{changes_file} #{RESULT_DIR}")
+        system("chmod 2770 #{RESULT_DIR}") unless File.stat(RESULT_DIR).setgid?
+      end
+      logger.info('Build finished!')
+    end
+  end
 end
 
 logger.close

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list