[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=fa8c7d5

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

    resolve numerous style violations in incoming_watcher.rb
---
 lib/reprepro/incoming_watcher.rb | 106 +++++++++++++++++++++------------------
 1 file changed, 56 insertions(+), 50 deletions(-)

diff --git a/lib/reprepro/incoming_watcher.rb b/lib/reprepro/incoming_watcher.rb
index 74015a8..804a92a 100644
--- a/lib/reprepro/incoming_watcher.rb
+++ b/lib/reprepro/incoming_watcher.rb
@@ -13,11 +13,14 @@ module Reprepro
       notifier = INotify::Notifier.new
       notifier.watch(path, :create) do |event|
         next unless event.name.end_with?('.changes')
-        system('reprepro', '-V', '-b', repo, '--waitforlock', '1000', 'processincoming', 'default', event.name)
+        system('reprepro', '-V', '-b', repo, '--waitforlock', '1000',
+               'processincoming', 'default', event.name)
         # S3MIRRORS.each do |mirror|
         #   # NOTE: Make sure that when modifying this command, the target ends
         #   # with a '/'
-        #   system("s3cmd -c #{repo}/s3cfg -v sync #{repo}/pool #{repo}/dists s3://#{mirror}/dci/#{FOLDER_NAME[repo]}/debian/")
+        #   system("s3cmd -c #{repo}/s3cfg -v sync " \
+        #          "#{repo}/pool #{repo}/dists" " \
+        #          "s3://#{mirror}/dci/#{FOLDER_NAME[repo]}/debian/")
         # end
       end
       notifier.run
@@ -31,66 +34,69 @@ if __FILE__ == $PROGRAM_NAME
 end
 # :nocov:
 
+require 'rb-inotify'
+require 'logger'
+require 'thwait'
 
-  #!/usr/bin/env ruby
-  require 'rb-inotify'
-  require 'logger'
-  require 'thwait'
-
-  S3MIRRORS = ['pangea-data', 'pangea-data-lax-dci']
-  repos = []
-  threads = []
-  FOLDER_NAME = {}
+S3MIRRORS = ['pangea-data', 'pangea-data-lax-dci']
+repos = []
+threads = []
+FOLDER_NAME = {}
 
-  logger = Logger.new(STDOUT)
-  logger.info "Starting ..."
+logger = Logger.new(STDOUT)
+logger.info 'Starting ...'
 
-  notifier = INotify::Notifier.new
+notifier = INotify::Notifier.new
 
-  Dir['/home/publisher/repos/*'].each do |d|
-    next if d.include? 'processchanges'
-    repos << d if File.directory? d
-  end
+Dir['/home/publisher/repos/*'].each do |d|
+  next if d.include? 'processchanges'
+  repos << d if File.directory? d
+end
 
-  logger.info "Will process #{repos}"
+logger.info "Will process #{repos}"
 
-  logger.info 'Initial sync ...'
+logger.info 'Initial sync ...'
 
-  # NOTE: Make sure that when modifying this command, the target ends
-  # with a '/'
-  repos.each do |repo|
-    FOLDER_NAME[repo] ||= repo.split('/')[-1]
-    S3MIRRORS.each do |mirror|
-      logger.info "Sending to #{mirror}/#{FOLDER_NAME[repo]}"
-      system("s3cmd -c #{repo}/s3cfg -v sync #{repo}/pool #{repo}/dists s3://#{mirror}/dci/#{FOLDER_NAME[repo]}/debian/")
-    end
+# NOTE: Make sure that when modifying this command, the target ends
+# with a '/'
+repos.each do |repo|
+  FOLDER_NAME[repo] ||= repo.split('/')[-1]
+  S3MIRRORS.each do |mirror|
+    logger.info "Sending to #{mirror}/#{FOLDER_NAME[repo]}"
+    origin = "#{repo}/pool #{repo}/dists"
+    target = "s3://#{mirror}/dci/#{FOLDER_NAME[repo]}/debian/"
+    system("s3cmd -c #{repo}/s3cfg -v sync #{origin} #{target}")
   end
-  logger.info 'Intial sync complete!'
+end
+logger.info 'Intial sync complete!'
 
-  repos.each do |repo|
-    threads << Thread.new do
-      logger.info "Processing #{repo}"
-      notifier.watch("#{repo}/incoming", :create) do |event|
-        if event.name.end_with? '.changes'
-          logger.info "Processing #{event.name}"
-          File.open(repo, 'r') do |f|
-            f.flock(File::LOCK_EX)
-            logger.info 'Locked reprepro dir'
-            system("reprepro -V -b #{repo} --waitforlock 1000 processincoming incoming #{event.name}")
-            logger.info 'INFO: Uploading to S3'
-            S3MIRRORS.each do |mirror|
-              logger.info "Sending to #{mirror}/#{FOLDER_NAME[repo]}"
-              # NOTE: Make sure that when modifying this command, the target ends
-              # with a '/'
-              system("s3cmd -c #{repo}/s3cfg -v sync #{repo}/pool #{repo}/dists s3://#{mirror}/dci/#{FOLDER_NAME[repo]}/debian/")
-            end
-            f.flock(File::LOCK_UN)
+repos.each do |repo|
+  threads << Thread.new do
+    logger.info "Processing #{repo}"
+    notifier.watch("#{repo}/incoming", :create) do |event|
+      if event.name.end_with? '.changes'
+        logger.info "Processing #{event.name}"
+        File.open(repo, 'r') do |f|
+          f.flock(File::LOCK_EX)
+          logger.info 'Locked reprepro dir'
+          system('reprepro', '-V', '-b', repo, '--waitforlock', '1000',
+                 'processincoming', 'incoming', event.name)
+          logger.info 'INFO: Uploading to S3'
+          S3MIRRORS.each do |mirror|
+            logger.info "Sending to #{mirror}/#{FOLDER_NAME[repo]}"
+            # NOTE: Make sure that when modifying this command, the target ends
+            # with a '/'
+            origin = "#{repo}/pool #{repo}/dists"
+            target = "s3://#{mirror}/dci/#{FOLDER_NAME[repo]}/debian/"
+            system("s3cmd -c #{repo}/s3cfg -v sync #{origin} #{target}")
           end
+          f.flock(File::LOCK_UN)
         end
       end
-      logger.info "Installed watch for #{repo}"
     end
+    logger.info "Installed watch for #{repo}"
   end
+end
 
-  notifier.run
-  ThreadsWait.all_waits(threads)
+notifier.run
+ThreadsWait.all_waits(threads)

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list