Hello community, here is the log from the commit of package rubygem-yast-rake for openSUSE:Leap:15.2 checked in at 2020-05-01 15:06:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/rubygem-yast-rake (Old) and /work/SRC/openSUSE:Leap:15.2/.rubygem-yast-rake.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-yast-rake" Fri May 1 15:06:39 2020 rev:25 rq:796684 version:0.2.37 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/rubygem-yast-rake/rubygem-yast-rake.changes 2020-01-15 15:59:58.915816117 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.rubygem-yast-rake.new.2738/rubygem-yast-rake.changes 2020-05-01 15:06:40.210482664 +0200 @@ -1,0 +2,40 @@ +Wed Feb 5 08:32:16 UTC 2020 - Ladislav Slezák <[email protected]> + +- Added "rake server" task (bsc#1162826) +- 0.2.37 + +------------------------------------------------------------------- +Fri Sep 6 10:44:43 UTC 2019 - Ladislav Slezák <[email protected]> + +- Submit the SLE12-SP5 packages to Updates (not to GA) (bsc#1149771) +- Added the SLE15-SP2 target +- 0.2.36 + +------------------------------------------------------------------- +Thu Aug 22 10:35:10 CEST 2019 - [email protected] + +- Using rb_default_ruby_abi tag in the spec file in order to + handle several ruby versions (bsc#1146403). +- 0.2.35 + +------------------------------------------------------------------- +Thu Jun 27 12:10:33 UTC 2019 - Josef Reidinger <[email protected]> + +- support proper rubocop version in rake check:rubocop + (bsc#1139270) +- 0.2.34 + +------------------------------------------------------------------- +Thu Jun 20 11:39:40 UTC 2019 - Ladislav Slezák <[email protected]> + +- :sle_latest is SLE15-SP2 now (bsc#1138835) +- 0.2.33 + +------------------------------------------------------------------- +Wed Apr 10 10:36:06 UTC 2019 - Ladislav Slezák <[email protected]> + +- Submit SLE12-SP5 to GA, it is still in the development mode + (related to bsc#1130043) +- 0.2.32 + +------------------------------------------------------------------- Old: ---- yast-rake-0.2.31.gem New: ---- yast-rake-0.2.37.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-yast-rake.spec ++++++ --- /var/tmp/diff_new_pack.WogY51/_old 2020-05-01 15:06:40.690483706 +0200 +++ /var/tmp/diff_new_pack.WogY51/_new 2020-05-01 15:06:40.694483715 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-yast-rake # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,14 @@ Name: rubygem-yast-rake -Version: 0.2.31 +Version: 0.2.37 Release: 0 %define mod_name yast-rake %define mod_full_name %{mod_name}-%{version} BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: %{rubygem gem2rpm} BuildRequires: %{ruby} BuildRequires: ruby-macros >= 5 +BuildRequires: rubygem(%{rb_default_ruby_abi}:gem2rpm) Url: http://github.org/openSUSE/yast-rake Source: http://rubygems.org/gems/%{mod_full_name}.gem Summary: Rake tasks providing basic work-flow for Yast development ++++++ yast-rake-0.2.31.gem -> yast-rake-0.2.37.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/VERSION new/VERSION --- old/VERSION 2019-03-21 11:24:36.000000000 +0100 +++ new/VERSION 2019-06-27 16:55:34.000000000 +0200 @@ -1 +1 @@ -0.2.31 +0.2.37 Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/data/index.html new/data/index.html --- old/data/index.html 1970-01-01 01:00:00.000000000 +0100 +++ new/data/index.html 2019-06-27 16:55:34.000000000 +0200 @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- This is a simple main page for the "rake server" task. --> +<html> +<head> + <title>Source Code Tarball Server</title> +</head> +<body> + +<h1>Source Code Tarball Server</h1> +<p>This server provides dynamically generated source code tarballs.</p> + +<h2>Supported URL Paths</h2> +<p> + <ul> + <li> + <b><a href = "/archive/current.tar.gz">/archive/current.tar.gz</a></b> + - dynamically generated tarball with the current source files + </li> + <li> + <b><a href = "/servers/index.json">/servers/index.json</a></b> + - index of other running servers on the machine + </li> + </ul> +</p> + +</body> +</html> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/data/targets.yml new/data/targets.yml --- old/data/targets.yml 2019-03-21 11:24:36.000000000 +0100 +++ new/data/targets.yml 2019-06-27 16:55:34.000000000 +0200 @@ -64,7 +64,7 @@ obs_api: "https://api.suse.de/" obs_project: "Devel:YaST:SLE-12-SP5" obs_sr_project: "SUSE:SLE-12-SP5:Update" - obs_target: "SLE_12_SP5" + obs_target: "SUSE_SLE-12-SP5_Update" :sle15: obs_api: "https://api.suse.de/" obs_project: "Devel:YaST:SLE-15" @@ -75,11 +75,16 @@ obs_project: "Devel:YaST:SLE-15-SP1" obs_sr_project: "SUSE:SLE-15-SP1:Update" obs_target: "SUSE_SLE-15-SP1_Update" +:sle15sp2: + obs_api: "https://api.suse.de/" + obs_project: "Devel:YaST:SLE-15-SP2" + obs_sr_project: "SUSE:SLE-15-SP2:Update" + obs_target: "SUSE_SLE-15-SP2_Update" :sle_latest: obs_api: "https://api.suse.de/" obs_project: "Devel:YaST:Head" - obs_sr_project: "SUSE:SLE-15-SP1:GA" - obs_target: "SUSE_SLE-15-SP1_GA" + obs_sr_project: "SUSE:SLE-15-SP2:GA" + obs_target: "SUSE_SLE-15-SP2_GA" :factory: obs_project: "YaST:Head" obs_sr_project: "openSUSE:Factory" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/install.rake new/lib/tasks/install.rake --- old/lib/tasks/install.rake 2019-03-21 11:24:36.000000000 +0100 +++ new/lib/tasks/install.rake 2019-06-27 16:55:34.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Yast rake # @@ -76,13 +78,13 @@ config.install_locations.each_pair do |glob, install_to| FileUtils.mkdir_p(install_to, verbose: true) unless File.directory?(install_to) Dir[glob].each do |source| - begin - # do not use FileUtils.cp_r as it have different behavior if target - # exists and we copy a symlink - sh "cp -r '#{source}' '#{install_to}'" - rescue => e - raise "Cannot install file #{source} to #{install_to}: #{e.message}" - end + + # do not use FileUtils.cp_r as it have different behavior if target + # exists and we copy a symlink + sh "cp -r '#{source}' '#{install_to}'" + rescue StandardError => e + raise "Cannot install file #{source} to #{install_to}: #{e.message}" + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/pot.rake new/lib/tasks/pot.rake --- old/lib/tasks/pot.rake 2019-03-21 11:24:36.000000000 +0100 +++ new/lib/tasks/pot.rake 2019-06-27 16:55:34.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Yast rake # @@ -27,16 +29,16 @@ namespace :check do # print failed lines and a hint to STDERR def report_pot_errors(lines) - $stderr.puts "Failed lines:" - $stderr.puts "-" * 30 - $stderr.puts lines - $stderr.puts "-" * 30 + warn "Failed lines:" + warn "-" * 30 + warn lines + warn "-" * 30 $stderr.puts - $stderr.puts "Note: \#{foo} substitution in translatable strings does" \ + warn "Note: \#{foo} substitution in translatable strings does" \ " not work properly, use" - $stderr.puts " _(\"foo %{bar} baz\") % { :bar => bar }" - $stderr.puts "or" - $stderr.puts " _(\"foo %s baz\") % bar" + warn " _(\"foo %{bar} baz\") % { :bar => bar }" + warn "or" + warn " _(\"foo %s baz\") % bar" $stderr.puts end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/rubocop.rake new/lib/tasks/rubocop.rake --- old/lib/tasks/rubocop.rake 2019-03-21 11:24:36.000000000 +0100 +++ new/lib/tasks/rubocop.rake 2019-06-27 16:55:34.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Yast rake # @@ -13,6 +15,20 @@ # #++ +def rubocop_bin + return @rubocop_bin if @rubocop_bin + return @rubocop_bin = ENV["RUBOCOP_BIN"] if ENV["RUBOCOP_BIN"] + + version = File.read(".rubocop.yml").include?("rubocop-0.71.0") ? "0.71.0" : "0.41.2" + binary = `/usr/sbin/update-alternatives --list rubocop | grep '#{version}'`.strip + if !system("which #{binary}") + raise "cannot find proper version of rubocop binary in " \ + "'/usr/sbin/update-alternatives --list rubocop'." \ + "If rubocop is installed via gem, define its binary name via env variable RUBOCOP_BIN." + end + @rubocop_bin = binary +end + # run Rubocop in parallel # @param params [String] optional Rubocop parameters def run_rubocop(params = "") @@ -26,8 +42,8 @@ # a) use -P with number of processors to run the commands in parallel # b) use -n to set the maximum number of files per process, this number # is computed to equally distribute the files across the workers - sh "rubocop -L | sort -R | xargs -P`nproc` -n$(expr `rubocop -L | wc -l` / " \ - "`nproc` + 1) rubocop #{params}" + sh "#{rubocop_bin} -L | sort -R | xargs -P`nproc` -n$(expr `#{rubocop_bin} -L | wc -l` / " \ + "`nproc` + 1) #{rubocop_bin} #{params}" end namespace :check do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/run.rake new/lib/tasks/run.rake --- old/lib/tasks/run.rake 2019-03-21 11:24:36.000000000 +0100 +++ new/lib/tasks/run.rake 2019-06-27 16:55:34.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Yast rake # @@ -32,8 +34,9 @@ clients = Dir["**/src/clients/*.rb"] client = clients.reduce do |min, n| next n if min.nil? + # use client with shortest name by default - min.size > n.size ? n : min + (min.size > n.size) ? n : min end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/server.rake new/lib/tasks/server.rake --- old/lib/tasks/server.rake 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/tasks/server.rake 2019-06-27 16:55:34.000000000 +0200 @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +#-- +# Yast rake +# +# Copyright (C) 2020, SUSE LLC +# This library is free software; you can redistribute it and/or modify +# it only under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +#++ + +require_relative "../yast/tarball_server" + +# Rake task for running a source code web server, +# designed for the `yupdate` script. +desc "Start an HTTP server providing dynamically generated source code tarball" +task :server, [:port] do |_task, args| + server = Yast::TarballServer.new(args[:port]) + + puts "Starting tarball webserver:" + server.addresses.each { |a| puts " * #{a}" } + puts + + server.start +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/spellcheck.rake new/lib/tasks/spellcheck.rake --- old/lib/tasks/spellcheck.rake 2019-03-21 11:24:36.000000000 +0100 +++ new/lib/tasks/spellcheck.rake 2019-06-27 16:55:34.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Yast rake # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/spellcheck_task.rb new/lib/tasks/spellcheck_task.rb --- old/lib/tasks/spellcheck_task.rb 2019-03-21 11:24:36.000000000 +0100 +++ new/lib/tasks/spellcheck_task.rb 2019-06-27 16:55:34.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Yast rake # @@ -33,8 +35,8 @@ module Yast # Defines a spellcheck rake task class SpellcheckTask < Rake::TaskLib - GLOBAL_SPELL_CONFIG_FILE = File.expand_path("../spell.yml", __FILE__) - CUSTOM_SPELL_CONFIG_FILE = ".spell.yml".freeze + GLOBAL_SPELL_CONFIG_FILE = File.expand_path("spell.yml", __dir__) + CUSTOM_SPELL_CONFIG_FILE = ".spell.yml" # define the Rake task in the constructor def initialize @@ -65,11 +67,12 @@ # @return [Aspell] the speller object def speller return @speller if @speller + # raspell is an optional dependency, handle the missing case nicely begin require "raspell" rescue LoadError - $stderr.puts "ERROR: Ruby gem \"raspell\" is not installed." + warn "ERROR: Ruby gem \"raspell\" is not installed." exit 1 end @@ -105,9 +108,9 @@ duplicates = dict1 & dict2 return if duplicates.empty? - $stderr.puts "Warning: Found dictionary duplicates in the local dictionary " \ + warn "Warning: Found dictionary duplicates in the local dictionary " \ "(#{CUSTOM_SPELL_CONFIG_FILE}):\n" - duplicates.each { |duplicate| $stderr.puts " #{duplicate}" } + duplicates.each { |duplicate| warn " #{duplicate}" } $stderr.puts end @@ -161,6 +164,7 @@ def misspelled_on_line(text) switch_block_tag if block_line?(text) return [] if inside_block + speller.list_misspelled([text]) - config["dictionary"] end @@ -179,7 +183,7 @@ if files_to_check.all? { |file| check_file(file) } puts "Spelling OK." else - $stderr.puts "Spellcheck failed! (Fix it or add the words to " \ + warn "Spellcheck failed! (Fix it or add the words to " \ "'#{CUSTOM_SPELL_CONFIG_FILE}' file if it is OK.)" exit 1 end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/test_unit.rake new/lib/tasks/test_unit.rake --- old/lib/tasks/test_unit.rake 2019-03-21 11:24:36.000000000 +0100 +++ new/lib/tasks/test_unit.rake 2019-06-27 16:55:34.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Yast rake # @@ -36,6 +38,8 @@ Coveralls::RakeTask.new Rake::Task["coveralls:push"].invoke end + + nil end def run_sequential_tests(files) @@ -56,7 +60,7 @@ run_parallel_tests(files) else if parallel_tests_wanted? - $stderr.puts "WARNING: parallel tests enabled, but 'parallel_rspec' is" \ + warn "WARNING: parallel tests enabled, but 'parallel_rspec' is" \ " not installed, falling back to the standard 'rspec' runner." end run_sequential_tests(files) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/version.rake new/lib/tasks/version.rake --- old/lib/tasks/version.rake 2019-03-21 11:24:36.000000000 +0100 +++ new/lib/tasks/version.rake 2019-06-27 16:55:34.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Yast rake # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/yast/index_servlet.rb new/lib/yast/index_servlet.rb --- old/lib/yast/index_servlet.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/yast/index_servlet.rb 2019-06-27 16:55:34.000000000 +0200 @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +#-- +# Yast rake +# +# Copyright (C) 2020, SUSE LLC +# This library is free software; you can redistribute it and/or modify +# it only under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +#++ + +require "webrick" + +module Yast + # a webrick servlet which returns a basic HTML info about the server, + # just to avoid that nasty 404 error page when someone opens the + # server URL in a web browser + class IndexServlet < WEBrick::HTTPServlet::AbstractServlet + INDEX_FILE = File.expand_path("../../data/index.html", __dir__) + + def do_GET(_request, response) + response.status = 200 + response.content_type = "text/html" + response.body = File.read(INDEX_FILE) + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/yast/rake.rb new/lib/yast/rake.rb --- old/lib/yast/rake.rb 2019-03-21 11:24:36.000000000 +0100 +++ new/lib/yast/rake.rb 2019-06-27 16:55:34.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Yast rake # @@ -36,7 +38,7 @@ end # load own tasks -task_path = File.expand_path("../../tasks", __FILE__) +task_path = File.expand_path("../tasks", __dir__) Dir["#{task_path}/*.rake"].each do |f| load f end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/yast/servers_servlet.rb new/lib/yast/servers_servlet.rb --- old/lib/yast/servers_servlet.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/yast/servers_servlet.rb 2019-06-27 16:55:34.000000000 +0200 @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +#-- +# Yast rake +# +# Copyright (C) 2020, SUSE LLC +# This library is free software; you can redistribute it and/or modify +# it only under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +#++ + +require "json" +require "webrick" + +module Yast + # a webrick servlet which lists all rake servers running on this machine + class ServersServlet < WEBrick::HTTPServlet::AbstractServlet + def do_GET(_request, response) + response.status = 200 + response.content_type = "application/json" + response.body = servers.to_json + end + + private + + # find the locally running "rake server" processes + def servers + output = `pgrep -a -f "rake server \\([0-9]+,.*\\)"` + output.lines.map do |l| + l.match(/rake server \(([0-9]+),(.*)\)/) + { + port: Regexp.last_match[1], + dir: Regexp.last_match[2] + } + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/yast/tarball_server.rb new/lib/yast/tarball_server.rb --- old/lib/yast/tarball_server.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/yast/tarball_server.rb 2019-06-27 16:55:34.000000000 +0200 @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +#-- +# Yast rake +# +# Copyright (C) 2020, SUSE LLC +# This library is free software; you can redistribute it and/or modify +# it only under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +#++ + +require "webrick" +require "socket" + +require_relative "index_servlet" +require_relative "servers_servlet" +require_relative "tarball_servlet" + +module Yast + # a webrick server which provides the source tarballs + # + # the server handles these URL paths: + # - "/archive/current.tar.gz" - the generated source code tarball + # - "/servers/index.json" - index of the tarball servers running on this machine + # - "/" - just a simple index page + # + # to stop the server press Ctrl+C + class TarballServer + # the default port number + DEFAULT_HTTP_PORT = 8000 + + attr_reader :port + + # create all URLs valid for this machine, use all network interfaces + # (except the loop backs, the server will be used only from outside) + # @return [Array<String>] list of URLs + def addresses + # ignore the loopback addresses + hosts = Socket.ip_address_list.reject { |a| a.ipv4_loopback? || a.ipv6_loopback? } + # IPv6 addresses need to be closed in square brackets in URLs + hosts.map! { |a| a.ipv6? ? "[#{a.ip_address}]" : a.ip_address.to_s } + # include also the hostname to make it easier to write + hostname = Socket.gethostname + hosts << hostname if !hostname&.empty? + hosts.map! { |h| "http://#{h}:#{port}" } + end + + # constructor + # + # @param port [Integer,nil] the port number, if nil the port will be found automatically + # + def initialize(port = nil) + @port = port || find_port + end + + # start the webserver, it can be closed by pressing Ctrl+C or by sending SIGTERM signal + def start + dir = File.basename(Dir.pwd) + # change the process title so we can find the running + # servers and their ports just by simple grepping the running processes + Process.setproctitle("rake server (#{port},#{dir})") + + # Use "*" to bind also the IPv6 addresses + server = WEBrick::HTTPServer.new(Port: port, BindAddress: "*") + server.mount("/archive/current.tar.gz", TarballServlet) + server.mount("/servers/index.json", ServersServlet) + server.mount("/", IndexServlet) + + # stop the server when receiving a signal like Ctrl+C + # (inspired by the "un.rb" from the Ruby stdlib) + signals = ["TERM", "QUIT"] + signals.concat(["HUP", "INT"]) if $stdin.tty? + signals.each do |s| + trap(s) { server.shutdown } + end + + server.start + end + + private + + # is the local port already taken by some other application? + # @param port [Integer] the port number + # @return [Boolean] true if the port is taken, false otherwise + def port_taken?(port) + # open the port and close it immediately, if that succeeds + # some other application is already using it + TCPSocket.new("localhost", port).close + true + rescue Errno::ECONNREFUSED + false + end + + # find a free port starting from the default port number + # @return [Integer] the free port number + def find_port + DEFAULT_HTTP_PORT.step.find { |p| !port_taken?(p) } + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/yast/tarball_servlet.rb new/lib/yast/tarball_servlet.rb --- old/lib/yast/tarball_servlet.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/yast/tarball_servlet.rb 2019-06-27 16:55:34.000000000 +0200 @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +#-- +# Yast rake +# +# Copyright (C) 2020, SUSE LLC +# This library is free software; you can redistribute it and/or modify +# it only under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +#++ + +require "webrick" + +module Yast + # a webrick servlet which dynamically creates a tarball + # with the content of the current Git checkout + class TarballServlet < WEBrick::HTTPServlet::AbstractServlet + def do_GET(_request, response) + response.status = 200 + response.content_type = "application/gzip" + response.body = source_archive + end + + private + + # compress the current sources into a tarball, + # no caching to ensure we always provide the latest content + def source_archive + # pack all Git files (including the non-tracked files (-o), + # use --ignore-failed-read to not fail for removed files) + # -z and --null: NUL-delimited + git = "git ls-files --cached --others --exclude-standard -z" + tar = "tar --create --ignore-failed-read --null --files-from -" + `#{git} | #{tar} | #{gzip}` + end + + # find which gzip is installed, use the faster parallel gzip ("pigz") if it is available + # @return [String] "pigz or "gzip" + def gzip + return @gzip if @gzip + + # parallel gzip installed? + @gzip = system("which pigz") ? "pigz" : "gzip" + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/yast/tasks.rb new/lib/yast/tasks.rb --- old/lib/yast/tasks.rb 2019-03-21 11:24:36.000000000 +0100 +++ new/lib/yast/tasks.rb 2019-06-27 16:55:34.000000000 +0200 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Yast rake # @@ -23,7 +25,7 @@ # Yast::Task module contains helper methods module Tasks # Targets definition - TARGETS_FILE = File.expand_path("../../../data/targets.yml", __FILE__) + TARGETS_FILE = File.expand_path("../../data/targets.yml", __dir__) def self.configuration(&block) ::Packaging.configuration(&block) @@ -34,7 +36,7 @@ # use the first *.spec file found, assume all spec files # contain the same version File.readlines(Dir.glob("package/*.spec").first) - .grep(/^\s*Version:\s*/).first.sub("Version:", "").strip + .grep(/^\s*Version:\s*/).first.sub("Version:", "").strip end def self.submit_to(target, file = TARGETS_FILE) @@ -43,6 +45,7 @@ if config.nil? raise "No configuration found for #{target}. Known values: #{targets.keys.join(", ")}" end + Yast::Tasks.configuration do |conf| config.each do |meth, val| conf.public_send("#{meth}=", val) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2019-03-21 11:24:36.000000000 +0100 +++ new/metadata 2020-03-05 17:06:27.000000000 +0100 @@ -1,43 +1,43 @@ --- !ruby/object:Gem::Specification name: yast-rake version: !ruby/object:Gem::Version - version: 0.2.31 + version: 0.2.37 platform: ruby authors: - Josef Reidinger autorequire: bindir: bin cert_chain: [] -date: 2019-03-21 00:00:00.000000000 Z +date: 2020-03-05 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency - name: rake + name: packaging_rake_tasks requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '0' + version: 1.1.4 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '0' + version: 1.1.4 - !ruby/object:Gem::Dependency - name: packaging_rake_tasks + name: rake requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: 1.1.4 + version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: 1.1.4 + version: '0' description: | Rake tasks that support work-flow of Yast developer. It allows packaging repo, send it to build service, create submit request to target repo or run client @@ -49,17 +49,23 @@ files: - COPYING - VERSION +- data/index.html - data/targets.yml - lib/tasks/install.rake - lib/tasks/pot.rake - lib/tasks/rubocop.rake - lib/tasks/run.rake +- lib/tasks/server.rake - lib/tasks/spell.yml - lib/tasks/spellcheck.rake - lib/tasks/spellcheck_task.rb - lib/tasks/test_unit.rake - lib/tasks/version.rake +- lib/yast/index_servlet.rb - lib/yast/rake.rb +- lib/yast/servers_servlet.rb +- lib/yast/tarball_server.rb +- lib/yast/tarball_servlet.rb - lib/yast/tasks.rb homepage: https://github.com/yast/yast-rake licenses: @@ -80,7 +86,8 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.0.1 +rubyforge_project: +rubygems_version: 2.7.6.2 signing_key: specification_version: 4 summary: Rake tasks providing basic work-flow for Yast development
