[SCM] ci-tooling packaging branch, master, updated. b899afe2189b4459db6228324de5d6317aecbd77
Harald Sitter
apachelogger-guest at moszumanska.debian.org
Mon Dec 7 12:25:19 UTC 2015
Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=98aabde
The following commit has been merged in the master branch:
commit 98aabdeb337728a8534348c2bc24cfa719abd3a3
Author: Harald Sitter <sitter at kde.org>
Date: Mon Dec 7 13:24:18 2015 +0100
reduce overall component splitting complexity
---
lib/debian/changelog.rb | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/lib/debian/changelog.rb b/lib/debian/changelog.rb
index a9bbd02..6401409 100644
--- a/lib/debian/changelog.rb
+++ b/lib/debian/changelog.rb
@@ -28,17 +28,7 @@ class Changelog
@version = match[2]
# Don't even bother with the rest, we don't care right now.
- version = @version.dup
- # Split the entire thing.
- @comps = {}
- @comps[:revision] = version.slice!(version.rindex('-')..-1) rescue ''
- if version.include?('~git')
- @comps[:base_suffix] = version.slice!(version.rindex('~git')..-1) rescue ''
- else
- @comps[:base_suffix] = version.slice!(version.rindex('+git')..-1) rescue ''
- end
- @comps[:base] = version.slice!(version.rindex(':')+1..-1) rescue version
- @comps[:epoch] = version.slice!(0..version.rindex(':')+1) rescue ''
+ fill_comps(@version.dup)
end
def version(flags = ALL)
@@ -49,4 +39,28 @@ class Changelog
ret += @comps[:revision] if flags & REVISION > 0
ret
end
+
+ private
+ # right parition
+ # @return [Array] of size 2 with the remainder of str as first and the right
+ # sub-string as last.
+ # @note The sub-string always contains the separator itself as well.
+ def rpart(str, sep)
+ first, second, third = str.rpartition(sep)
+ return [third, ''] if first.empty? && second.empty?
+ [first, [second, third].join]
+ end
+
+ def fill_comps(version)
+ # Split the entire thing.
+ @comps = {}
+ # For reasons beyond my apprehension the original behavior is to retain
+ # the separators in the results, which requires somewhat acrobatic
+ # partitioning to keep them around for compatibility.
+ version, @comps[:revision] = rpart(version, '-')
+ git_seperator = version.include?('~git') ? '~git' : '+git'
+ version, @comps[:base_suffix] = rpart(version, git_seperator)
+ @comps[:epoch], _, @comps[:base] = version.rpartition(':')
+ @comps[:epoch] += ':' unless @comps[:epoch].empty?
+ end
end
--
ci-tooling packaging
More information about the pkg-kde-commits
mailing list