From d15be4fe2ff3e70717117a938dbe5a11cec60a7b Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 12 Apr 2023 11:41:02 +0100 Subject: gentoo auto-resync : 12:04:2023 - 11:41:02 --- dev-ruby/timers/Manifest | 2 + .../timers/files/timers-4.3.5-timers-slow.patch | 259 +++++++++++++++++++++ dev-ruby/timers/timers-4.3.5-r1.ebuild | 33 +++ 3 files changed, 294 insertions(+) create mode 100644 dev-ruby/timers/files/timers-4.3.5-timers-slow.patch create mode 100644 dev-ruby/timers/timers-4.3.5-r1.ebuild (limited to 'dev-ruby/timers') diff --git a/dev-ruby/timers/Manifest b/dev-ruby/timers/Manifest index bd806fa407d1..a0b28574365b 100644 --- a/dev-ruby/timers/Manifest +++ b/dev-ruby/timers/Manifest @@ -1,5 +1,7 @@ +AUX timers-4.3.5-timers-slow.patch 6315 BLAKE2B 0d38c8f1954d4eddca2333586667c27f9a2e9e775ebedd862b359c973f4ec8b811cc2e6cc56a8b8e826d207e969d71be8229b8fd520d23270bd5226c4d595f5c SHA512 2c6010448f0c2025297691bc3ad71e58bb56bd9914d1847bb2da9b53eb768b9fc52005534ec867cd839bb076b89e72fd2a87a935ea0aa1460d0adbd5096a61c5 DIST timers-4.3.3.tar.gz 12928 BLAKE2B af64b44116565a8cb6b68349de6a46e8b67d22508e16e204af104ed7a59cc1db1dae0c36917ccde1932c33e53d9d71fc57cb317570cc24aaee82531ce178f37c SHA512 4a715e4a786f98ec429a250de53cfa67bed6b5a99b6298c21251e6dcf1315f1185d8c45bea01025832046381ebac462cd35415f7573d58c55c30b47c2567d4bf DIST timers-4.3.5.tar.gz 15651 BLAKE2B 2dc34bb23a4971c673aff5120502714035fe31aed34854b5f7beb744ca46ad704b88d1403ad594ea49f71bb709db7942ed521d237e2477fe2e9d41cc3cd2b538 SHA512 fa5a25eda15628f5a17cd2e7acc4eb2819a766de7ffdba03d425a93cb3229f0f7b8083e9990b5308e65c2d8aab396e33dd4d152252888eff1cc0039cac6a5e46 EBUILD timers-4.3.3.ebuild 1015 BLAKE2B 729d0a31831754cf8fe5e2adbb14c25d73fa1ad0c815a75e2dbf027b32e66ca403e474a3d48a17a525fd585b6123c1b1b109e917540f945b60e33ee4f3eb8ea2 SHA512 f75c7fa3b3c5ad7838ec345866dac7f068b7e05a709c5d523c11aecaea054ddcff2aebd58d712116b133230be12997e97bc4889a8a35fa9fec70150fe7bd763d +EBUILD timers-4.3.5-r1.ebuild 949 BLAKE2B a446fc3cf1e67cdc5fd8ef1277a7449cd087e097cc3535022423eb542e6969e0e7057a43c702e3320c93b1d87f916e8312c5c6034c5de967692c5fff48e32eaa SHA512 2c8a2b813fce76cb34ac3b458929c66ebfb09e02b915d9594ff1b01902cc49243c1c8e6e0bd0b67927bd94699e0ae1720e6affa0eedc7698b4c7bcbd6da76bc3 EBUILD timers-4.3.5.ebuild 858 BLAKE2B de720741ac65cbfbcbad2fc49a690079473bd11062e2b8a1b2d920d0436c74b0f50d03eff0db25842463d4a4eee6d227e48f8e9617885018d74d1ca08100e5f1 SHA512 48dbdbb819aca49e97fb086bc87060cfa59f73d087105890116447fc8bf0097dc85a914a1a28cec36e1b5a6bb210d00bb0a3a5680a19df3fe45124d49b3d3374 MISC metadata.xml 392 BLAKE2B 304dd3c8c4a7b5a75301a3aa2b3d2bcd386f4c2b13921b3170e537563a41c4405670731b4d5825f1195542c7ef9d07253357c6d3366eab04136b0aca31c92777 SHA512 08118b5d6da0eb1be39cff419520f2d700eab618c180985e155428bae3d33c58a5c3b9ddc9f125fbb39917fb90ac51a5b2383f81b209a864557a2e0187239944 diff --git a/dev-ruby/timers/files/timers-4.3.5-timers-slow.patch b/dev-ruby/timers/files/timers-4.3.5-timers-slow.patch new file mode 100644 index 000000000000..da786b724a6d --- /dev/null +++ b/dev-ruby/timers/files/timers-4.3.5-timers-slow.patch @@ -0,0 +1,259 @@ +https://github.com/socketry/timers/issues/82 +https://github.com/socketry/timers/commit/039bbd2750d5e50721789ef5d3404b18c36517bc + +From 039bbd2750d5e50721789ef5d3404b18c36517bc Mon Sep 17 00:00:00 2001 +From: Samuel Williams +Date: Wed, 12 Apr 2023 17:25:59 +1200 +Subject: [PATCH] Modernize gem (#83) + +* Improve robustness of `Timer#inspect`. + +* 100% test coverage. +--- a/fixtures/timer_quantum.rb ++++ b/fixtures/timer_quantum.rb +@@ -1,3 +1,5 @@ ++# frozen_string_literal: true ++ + # Released under the MIT License. + # Copyright, 2022, by Samuel Williams. + +--- a/lib/timers/group.rb ++++ b/lib/timers/group.rb +@@ -92,8 +92,9 @@ def wait + # - 0: timers ready to fire + # - +ve: timers waiting to fire + def wait_interval(offset = current_offset) +- handle = @events.first +- handle.time - Float(offset) if handle ++ if handle = @events.first ++ handle.time - Float(offset) ++ end + end + + # Fire all timers that are ready. +--- a/lib/timers/priority_heap.rb ++++ b/lib/timers/priority_heap.rb +@@ -84,9 +84,10 @@ def valid? + + private + +- def swap(i, j) +- @contents[i], @contents[j] = @contents[j], @contents[i] +- end ++ # Left here for reference, but unused. ++ # def swap(i, j) ++ # @contents[i], @contents[j] = @contents[j], @contents[i] ++ # end + + def bubble_up(index) + parent_index = (index - 1) / 2 # watch out, integer division! +--- a/lib/timers/timer.rb ++++ b/lib/timers/timer.rb +@@ -23,12 +23,11 @@ def initialize(group, interval, recurring = false, offset = nil, &block) + @interval = interval + @recurring = recurring + @block = block +- @offset = offset +- ++ @offset = nil + @handle = nil + + # If a start offset was supplied, use that, otherwise use the current timers offset. +- reset(@offset || @group.current_offset) ++ reset(offset || @group.current_offset) + end + + def paused? +@@ -73,7 +72,7 @@ def cancel + @handle = nil + + # This timer is no longer valid: +- @group.timers.delete self if @group ++ @group.timers.delete(self) if @group + end + + # Reset this timer. Do not call while paused. +@@ -117,18 +116,18 @@ def fires_in + + # Inspect a timer + def inspect +- buffer = "#{to_s[0..-2]} ".dup ++ buffer = to_s[0..-2] + + if @offset +- if fires_in >= 0 +- buffer << "fires in #{fires_in} seconds" ++ delta_offset = @offset - @group.current_offset ++ ++ if delta_offset > 0 ++ buffer << " fires in #{delta_offset} seconds" + else +- buffer << "fired #{fires_in.abs} seconds ago" ++ buffer << " fired #{delta_offset.abs} seconds ago" + end + + buffer << ", recurs every #{interval}" if recurring +- else +- buffer << "dead" + end + + buffer << ">" +--- a/lib/timers/wait.rb ++++ b/lib/timers/wait.rb +@@ -17,6 +17,7 @@ def self.for(duration, &block) + + timeout.while_time_remaining(&block) + else ++ # If there is no "duration" to wait for, we wait forever. + loop do + yield(nil) + end +--- a/license.md ++++ b/license.md +@@ -28,6 +28,7 @@ Copyright, 2017-2020, by Olle Jonsson. + Copyright, 2020, by Tim Smith. + Copyright, 2021, by Wander Hillen. + Copyright, 2022, by Yoshiki Takagi. ++Copyright, 2023, by Peter Goldstein. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal +--- a/test/timers/group.rb ++++ b/test/timers/group.rb +@@ -36,18 +36,31 @@ + expect(called).to be == true + expect(fired).to be == true + end ++ ++ it "repeatedly calls the wait block if it sleeps less than the interval" do ++ called = 0 ++ fired = false ++ ++ group.after(0.1) { fired = true } ++ ++ group.wait do |interval| ++ called += 1 ++ sleep(0.01) ++ end ++ ++ expect(called).to be > 1 ++ expect(fired).to be == true ++ end + end + + it "sleeps until the next timer" do + interval = 0.1 +- started_at = Time.now + + fired = false + group.after(interval) {fired = true} + group.wait + + expect(fired).to be == true +- expect(Time.now - started_at).to be_within(TIMER_QUANTUM).of(interval) + end + + it "fires instantly when next timer is in the past" do +@@ -88,6 +101,26 @@ + end.to raise_exception(TypeError) + end + ++ with "#now_and_after" do ++ it "fires the timer immediately" do ++ result = [] ++ ++ group.now_and_after(TIMER_QUANTUM * 2) { result << :foo } ++ ++ expect(result).to be == [:foo] ++ end ++ ++ it "fires the timer at the correct time" do ++ result = [] ++ ++ group.now_and_after(TIMER_QUANTUM * 2) { result << :foo } ++ ++ group.wait ++ ++ expect(result).to be == [:foo, :foo] ++ end ++ end ++ + with "recurring timers" do + it "continues to fire the timers at each interval" do + result = [] +--- a/test/timers/group/cancel.rb ++++ b/test/timers/group/cancel.rb +@@ -10,6 +10,17 @@ + describe Timers::Group do + let(:group) {subject.new} + ++ it "can cancel a timer" do ++ fired = false ++ ++ timer = group.after(0.1) { fired = true } ++ timer.cancel ++ ++ group.wait ++ ++ expect(fired).to be == false ++ end ++ + it "should be able to cancel twice" do + fired = false + +@@ -51,4 +62,18 @@ + expect(group.timers).to be(:empty?) + expect(x).to be == 0 + end ++ ++ with "#cancel" do ++ it "should cancel all timers" do ++ timers = 3.times.map do ++ group.every(0.1) {} ++ end ++ ++ expect(group.timers).not.to be(:empty?) ++ ++ group.cancel ++ ++ expect(group.timers).to be(:empty?) ++ end ++ end + end +--- a/test/timers/wait.rb ++++ b/test/timers/wait.rb +@@ -14,9 +14,14 @@ + it "repeats until timeout expired" do + timeout = Timers::Wait.new(interval*repeats) + count = 0 ++ previous_remaining = nil + + timeout.while_time_remaining do |remaining| +- expect(remaining).to be_within(TIMER_QUANTUM).of(timeout.duration - (count * interval)) ++ if previous_remaining ++ expect(remaining).to be_within(TIMER_QUANTUM).of(previous_remaining - interval) ++ end ++ ++ previous_remaining = remaining + + count += 1 + sleep(interval) +@@ -34,4 +39,18 @@ + + expect(result).to be == :done + end ++ ++ with "#for" do ++ with "no duration" do ++ it "waits forever" do ++ count = 0 ++ Timers::Wait.for(nil) do ++ count += 1 ++ break if count > 10 ++ end ++ ++ expect(count).to be > 10 ++ end ++ end ++ end + end diff --git a/dev-ruby/timers/timers-4.3.5-r1.ebuild b/dev-ruby/timers/timers-4.3.5-r1.ebuild new file mode 100644 index 000000000000..35732c62e28d --- /dev/null +++ b/dev-ruby/timers/timers-4.3.5-r1.ebuild @@ -0,0 +1,33 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +USE_RUBY="ruby27 ruby30 ruby31 ruby32" + +RUBY_FAKEGEM_EXTRADOC="readme.md" + +RUBY_FAKEGEM_GEMSPEC="timers.gemspec" +RUBY_FAKEGEM_RECIPE_TEST="sus" + +inherit ruby-fakegem + +DESCRIPTION="Pure Ruby one-shot and periodic timers" +HOMEPAGE="https://github.com/socketry/timers" +SRC_URI="https://github.com/socketry/timers/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="4" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86 ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" + +PATCHES=( + # https://github.com/socketry/timers/issues/82 + "${FILESDIR}"/${P}-timers-slow.patch +) + +all_ruby_prepare() { + sed -i -e 's:_relative ": "./:' ${RUBY_FAKEGEM_GEMSPEC} || die + + # Avoid performance-based tests since we cannot guarantee specific performance levels. + rm -f test/timers/performance.rb || die +} -- cgit v1.2.3