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

Rohan Garg rohangarg-guest at moszumanska.debian.org
Fri Nov 20 12:17:20 UTC 2015


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

The following commit has been merged in the master branch:
commit 437ba6410a8deb89170ab8e9b33186b88c10ad20
Author: Rohan Garg <rohan at garg.io>
Date:   Fri Nov 20 13:17:17 2015 +0100

    Use begin/ensure to cleanup
---
 ci/imager.rb | 45 ++++++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/ci/imager.rb b/ci/imager.rb
index 8b5f561..e920b5a 100755
--- a/ci/imager.rb
+++ b/ci/imager.rb
@@ -8,28 +8,27 @@ fail "No live-config found!" unless File.exist?('live-config')
 Apt.update
 Apt.install(%w(live-build live-images qemu-user-static))
 
-FileUtils.mkdir_p 'result'
-
-Dir.chdir('live-config') do
-  system('make clean')
-  system('./configure')
-  ec = system('make')
-  FileUtils.cp_r(Dir.glob('live*'), '../result', verbose: true)
+begin
+  FileUtils.mkdir_p 'result'
+  Dir.chdir('live-config') do
+    system('make clean')
+    system('./configure')
+    fail 'Failed to build image!' unless system('make')
+    FileUtils.cp_r(Dir.glob('live*'), '../result', verbose: true)
+  end
+ensure
   system('make clean')
+  # Workaround for docker not having suidmaps. We run as root in the docker
+  # which will result in uid/gid of written things to be 0 rather than whatever
+  # jenkins has. So instead we have a fake jenkins user in the docker we can
+  # chmod to. This ultimately ensures that the owernship is using the uid of
+  # the host jenkins (equal to docker jenkins) such that we don't end up with
+  # stuff owned by others.
+  at_exit do
+    FileUtils.chown_R('jenkins', 'jenkins', Dir.pwd, verbose: true)
+  end
+
+  Signal.trap 'TERM' do
+    FileUtils.chown_R('jenkins', 'jenkins', Dir.pwd, verbose: true)
+  end
 end
-
-# Workaround for docker not having suidmaps. We run as root in the docker
-# which will result in uid/gid of written things to be 0 rather than whatever
-# jenkins has. So instead we have a fake jenkins user in the docker we can
-# chmod to. This ultimately ensures that the owernship is using the uid of
-# the host jenkins (equal to docker jenkins) such that we don't end up with
-# stuff owned by others.
-at_exit do
-  FileUtils.chown_R('jenkins', 'jenkins', Dir.pwd, verbose: true)
-end
-
-Signal.trap 'TERM' do
-  FileUtils.chown_R('jenkins', 'jenkins', Dir.pwd, verbose: true)
-end
-
-exit 1 unless ec

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list