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

Rohan Garg rohangarg-guest at moszumanska.debian.org
Wed Dec 17 17:46:46 UTC 2014


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

The following commit has been merged in the master branch:
commit 98046cd5dd134e799a03f765fb20b0f3ce55c52d
Author: Rohan Garg <rohan at kde.org>
Date:   Wed Dec 17 18:46:33 2014 +0100

    Some additional flags to add custom repos
---
 dci/build.rb | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/dci/build.rb b/dci/build.rb
index 29d5034..d19337e 100644
--- a/dci/build.rb
+++ b/dci/build.rb
@@ -1,14 +1,28 @@
 require 'logger'
 require 'tmpdir'
 require 'fileutils'
+require 'optparse'
+require 'json'
 require_relative '../lib/debian/control'
 
 ## Some notes :
 ##      * All builds happen in /tmp/<tmp dir>
-##      * All resulting debs are put in /build/binary/
+##      * 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
+end.parse!
+
 logger = Logger.new(STDOUT)
 
 if not ARGV[1].end_with? '.changes'
@@ -20,6 +34,22 @@ else
     result_dir = '/build/'
 
     logger.info("Starting build for #{package_name}")
+    logger.info("Adding custom repos #{options[:list]}")
+    if !options[:repos].nil?
+        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|
+                    system("echo #{repo['url']} >> /etc/apt/sources.list.d/extra_repos.list")
+                    system("echo #{repo['key']} | apt-key add -")
+                end
+            end
+        end
+    end
+
     logger.info("Updating chroot")
     system("apt-get update && apt-get -y dist-upgrade")
     

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list