[SCM] ci-tooling packaging branch, master, updated. f0fd122b57bc800e42e765ac2a008fd60134e4b5
Rohan Garg
rohangarg-guest at moszumanska.debian.org
Mon Jan 26 14:32:31 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=f0fd122
The following commit has been merged in the master branch:
commit f0fd122b57bc800e42e765ac2a008fd60134e4b5
Author: Rohan Garg <rohan at kde.org>
Date: Mon Jan 26 15:31:42 2015 +0100
Abstract away run_cmd under lib/dci.rb
---
dci/build.rb | 4 +++-
dci/imager.rb | 14 ++++++++------
dci/mozilla.rb | 9 +++++----
dci/source.rb | 24 ++++--------------------
lib/dci.rb | 20 ++++++++++++++++++++
5 files changed, 40 insertions(+), 31 deletions(-)
diff --git a/dci/build.rb b/dci/build.rb
index d36a8d8..2bbf909 100644
--- a/dci/build.rb
+++ b/dci/build.rb
@@ -4,6 +4,7 @@ require 'optparse'
require 'json'
require_relative '../lib/debian/control'
require_relative '../lib/logger'
+require_relative '../lib/dci'
## Some notes :
## * All builds happen in /tmp/<tmp dir>
@@ -61,7 +62,8 @@ else
end
logger.info("Updating chroot")
- system("apt-get update && apt-get -y dist-upgrade")
+ 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")
diff --git a/dci/imager.rb b/dci/imager.rb
index 748519d..7f5e5f6 100644
--- a/dci/imager.rb
+++ b/dci/imager.rb
@@ -1,6 +1,8 @@
-require_relative '../lib/logger'
require 'fileutils'
+require_relative '../lib/logger'
+require_relative '../lib/dci'
+
fail 'Need a release to build for!' unless ARGV[1]
fail 'Need a flavor to build!' unless ARGV[2]
@@ -69,7 +71,7 @@ MIRROR = 'http://127.0.0.1:3142/debian'
Dir.chdir('build') do
logger.info('Installing some extra utils')
- system('apt-get update')
+ dci_run_cmd('apt-get update')
system('apt-get -y install live-images live-build live-tools')
system('lb clean --purge')
system("lb config --config kde-desktop \
@@ -106,15 +108,15 @@ Dir.chdir('build') do
exit 1
end
- packages.each { |package|
+ packages.each do |package|
File.write("config/package-lists/netrunner.list.chroot", package + "
", mode: 'a')
- }
+ end
File.delete('config/archives/dci.list') if File.exist? 'config/archives/dci.list'
- repos.each { |repo|
+ repos.each do |repo|
logger.info("Adding #{repo} to ISO")
File.write('config/archives/dci.list', repo + "
", mode: 'a')
- }
+ end
File.write('config/archives/dci.key', REPO_KEY)
diff --git a/dci/mozilla.rb b/dci/mozilla.rb
index 0cb7e65..fdda0eb 100644
--- a/dci/mozilla.rb
+++ b/dci/mozilla.rb
@@ -1,6 +1,7 @@
require_relative '../lib/logger'
require_relative '../lib/debian/changelog'
require_relative '../lib/debian/control'
+require_relative '../lib/dci'
require 'open-uri'
require 'thwait'
@@ -184,10 +185,10 @@ Pin-Priority: 1000
# Run dpkg-buildpackage in new dir
firefox_dir = Dir["firefox-*"][0]
Dir.chdir(firefox_dir) {
- system("dpkg-buildpackage -S -sa -uc -us")
+ dci_run_cmd("dpkg-buildpackage -S -sa -uc -us")
}
- system('dcmd cp firefox*.changes /build/')
+ system("dcmd cp firefox*.changes /build/")
}
end
@@ -195,8 +196,8 @@ def build_thunderbird
$logger.info("Needs implementing")
end
-run_cmd('apt-get update')
-run_cmd('apt-get -y install ubuntu-dev-tools mercurial ruby-nokogiri distro-info')
+dci_run_cmd("apt-get update")
+system("apt-get -y install ubuntu-dev-tools mercurial ruby-nokogiri distro-info")
UBUNTU_RELEASES = `ubuntu-distro-info -a`.split
DEBIAN_RELEASES = `debian-distro-info -a`.split
diff --git a/dci/source.rb b/dci/source.rb
index 6385557..7d6cefb 100644
--- a/dci/source.rb
+++ b/dci/source.rb
@@ -5,6 +5,7 @@ require 'json'
require_relative '../lib/debian/changelog'
require_relative '../lib/debian/control'
require_relative '../lib/logger'
+require_relative '../lib/dci'
raise "No workspace dir defined!" unless ARGV[1]
@@ -31,23 +32,6 @@ $logger = DCILogger.instance
$logger.info("Arguments passed were #{ARGV}")
$logger.info("Parsed #{options}")
-def run_cmd(cmd)
- retry_count = 0
- begin
- if retry_count <= 5
- raise unless system(cmd)
- else
- $logger.fatal("#{cmd} keeps failing! :(")
- exit 1
- end
- rescue RuntimeError
- $logger.warn("Trying to run #{cmd} again!")
- retry_count += 1
- sleep(retry_count * 20)
- retry
- end
-end
-
$logger.info("Adding custom repos #{options[:repos]}")
# Skip if there is only one repo in the options, since thats the 'default' config
@@ -71,8 +55,8 @@ if !options[:repos].nil? && options[:repos].count > 1
end
# These should never fail
-run_cmd('apt-get update && apt-get -y dist-upgrade')
-run_cmd('apt-get -y install devscripts lsb-release locales libdistro-info-perl')
+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')
Dir.chdir(ARGV[1]) do
@@ -127,7 +111,7 @@ Dir.chdir(ARGV[1]) do
end
# FIXME: bloody workaround for kconfigwidgets and kdelibs4support containing legit locale data
- next if source_name == 'kconfigwidgets' or source_name == 'kdelibs4support'
+ next if source_name == 'kconfigwidgets' or source_name == 'kdelibs4support'
subbed = File.open(install_file_path).read().gsub(/^.*usr\/share\/locale.*$/, '')
File.open(install_file_path, 'w') do |f|
f << subbed
diff --git a/lib/dci.rb b/lib/dci.rb
new file mode 100644
index 0000000..00db4b1
--- /dev/null
+++ b/lib/dci.rb
@@ -0,0 +1,20 @@
+require_relative 'logger'
+
+$logger = DCILogger.instance
+
+def dci_run_cmd(cmd)
+ retry_count = 0
+ begin
+ if retry_count <= 5
+ raise unless system(cmd)
+ else
+ $logger.fatal("#{cmd} keeps failing! :(")
+ exit 1
+ end
+ rescue RuntimeError
+ $logger.warn("Trying to run #{cmd} again!")
+ retry_count += 1
+ sleep(retry_count * 20)
+ retry
+ end
+end
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list