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

Rohan Garg rohangarg-guest at moszumanska.debian.org
Sat Nov 22 11:37:45 UTC 2014


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

The following commit has been merged in the master branch:
commit db7fa05d52c03aef09e9cfc240a3a611b2852c9f
Author: Rohan Garg <rohan at kde.org>
Date:   Sat Nov 22 12:37:25 2014 +0100

    A bit of refactoring
    
    Split out changelog class into it's own file
---
 builder.rb              | 54 +------------------------------------------------
 lib/debian/changelog.rb | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 53 deletions(-)

diff --git a/builder.rb b/builder.rb
index 83f9982..9cec7a6 100644
--- a/builder.rb
+++ b/builder.rb
@@ -3,6 +3,7 @@
 require 'date'
 require 'fileutils'
 require 'timeout'
+require_relative 'lib/debian/changelog'
 
 ENV['HOME'] = '/var/lib/jenkins'
 ENV['PATH'] = '/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin'
@@ -31,59 +32,6 @@ WORKSPACE_PATH = ARGV[1]
 # install deps
 `apt-get install -y xz-utils dpkg-dev ruby dput debhelper pkg-kde-tools devscripts python-launchpadlib ubuntu-dev-tools git`
 
-class Changelog
-    # This is a simplified parser that only reads the first line (latest entry)
-    # to get version and name of the package. It is used because parsechangelog
-    # has been observed to be incredibly slow at what it does, while it in fact
-    # provides more information than we need. So here's the super optimized
-    # version for us.
-    
-    attr_reader :name
-
-    EPOCH      = 0b1
-    BASE       = 0b10
-    BASESUFFIX = 0b100
-    REVISION   = 0b1000
-    ALL        = 0b1111
-
-    def initialize()
-        line = File.open('debian/changelog', &:gets)
-        # plasma-framework (5.3.0-0ubuntu1) utopic; urgency=medium
-        match = line.match(/^(.*) \((.*)\) (\w+); urgency=(\w+)/)
-        # Need a  match and 5 elements.
-        # 0: full match
-        # 1: source name
-        # 2: version
-        # 3: distribution series
-        # 4: urgency
-        raise 'E: Cannot read debian/changelog' if match.nil? or match.size != 5        
-        @name = match[1]
-        @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 ""
-    end
-    
-    def version(flags = ALL)
-        p flags
-        ret = ""
-        ret += @comps[:epoch] if flags & EPOCH > 0
-        ret += @comps[:base] if flags & BASE > 0
-        ret += @comps[:base_suffix] if flags & BASESUFFIX > 0
-        ret += @comps[:revision] if flags & REVISION > 0
-        return ret
-    end
-end
 
 # version
 Dir.chdir('packaging') do
diff --git a/lib/debian/changelog.rb b/lib/debian/changelog.rb
new file mode 100644
index 0000000..d33ca6b
--- /dev/null
+++ b/lib/debian/changelog.rb
@@ -0,0 +1,53 @@
+class Changelog
+    # This is a simplified parser that only reads the first line (latest entry)
+    # to get version and name of the package. It is used because parsechangelog
+    # has been observed to be incredibly slow at what it does, while it in fact
+    # provides more information than we need. So here's the super optimized
+    # version for us.
+    
+    attr_reader :name
+
+    EPOCH      = 0b1
+    BASE       = 0b10
+    BASESUFFIX = 0b100
+    REVISION   = 0b1000
+    ALL        = 0b1111
+
+    def initialize()
+        line = File.open('debian/changelog', &:gets)
+        # plasma-framework (5.3.0-0ubuntu1) utopic; urgency=medium
+        match = line.match(/^(.*) \((.*)\) (\w+); urgency=(\w+)/)
+        # Need a  match and 5 elements.
+        # 0: full match
+        # 1: source name
+        # 2: version
+        # 3: distribution series
+        # 4: urgency
+        raise 'E: Cannot read debian/changelog' if match.nil? or match.size != 5        
+        @name = match[1]
+        @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 ""
+    end
+    
+    def version(flags = ALL)
+        p flags
+        ret = ""
+        ret += @comps[:epoch] if flags & EPOCH > 0
+        ret += @comps[:base] if flags & BASE > 0
+        ret += @comps[:base_suffix] if flags & BASESUFFIX > 0
+        ret += @comps[:revision] if flags & REVISION > 0
+        return ret
+    end
+end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list