[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

Jesse Wolfe jes5199 at gmail.com
Wed Jul 14 10:29:57 UTC 2010


The following commit has been merged in the upstream branch:
commit c6f02f2ee0c9b14f1106b5f6fa8e61cd92cf6f06
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Wed Feb 17 14:05:06 2010 -0800

    Fix #3167 Duplicate constant warnings in dpkg.rb
    
    There's a limitation in Ruby 1.8.x that makes constants behave
    differently than developers seem to expect:
    Constants defined inside a do/end block do not get inserted into the
    namespace of 'self', they instead go into the toplevel (Object)
    namespace.
    These providers exhibit bugs since they use constants with the same
    name in the same namespace.
    Other providers and other dynamically generated classes using constants
    without an explicit namespace should be considered to have a code smell.
    
    Signed-off-by: Jesse Wolfe <jes5199 at gmail.com>

diff --git a/lib/puppet/provider/package/dpkg.rb b/lib/puppet/provider/package/dpkg.rb
index d6ec56a..06050ce 100755
--- a/lib/puppet/provider/package/dpkg.rb
+++ b/lib/puppet/provider/package/dpkg.rb
@@ -32,14 +32,14 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
         return packages
     end
 
-    REGEX = %r{^(\S+) +(\S+) +(\S+) (\S+) (\S*)$}
-    FIELDS = [:desired, :error, :status, :name, :ensure]
+    self::REGEX = %r{^(\S+) +(\S+) +(\S+) (\S+) (\S*)$}
+    self::FIELDS = [:desired, :error, :status, :name, :ensure]
 
     def self.parse_line(line)
-        if match = REGEX.match(line)
+        if match = self::REGEX.match(line)
             hash = {}
 
-            FIELDS.zip(match.captures) { |field,value|
+            self::FIELDS.zip(match.captures) { |field,value|
                 hash[field] = value
             }
 
diff --git a/lib/puppet/provider/package/pkg.rb b/lib/puppet/provider/package/pkg.rb
index 978042d..148ef0d 100644
--- a/lib/puppet/provider/package/pkg.rb
+++ b/lib/puppet/provider/package/pkg.rb
@@ -27,14 +27,14 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
         packages
     end
 
-    REGEX = %r{^(\S+)\s+(\S+)\s+(\S+)\s+}
-    FIELDS = [:name, :version, :status]
+    self::REGEX = %r{^(\S+)\s+(\S+)\s+(\S+)\s+}
+    self::FIELDS = [:name, :version, :status]
 
     def self.parse_line(line)
         hash = {}
-        if match = REGEX.match(line)
+        if match = self::REGEX.match(line)
 
-            FIELDS.zip(match.captures) { |field,value|
+            self::FIELDS.zip(match.captures) { |field,value|
                 hash[field] = value
             }
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list