[DRE-commits] r2525 - in packages/ruby-gnome2/trunk/debian: . patches

acornet at alioth.debian.org acornet at alioth.debian.org
Wed Mar 19 22:07:05 UTC 2008


Author: acornet
Date: 2008-03-19 22:07:04 +0000 (Wed, 19 Mar 2008)
New Revision: 2525

Added:
   packages/ruby-gnome2/trunk/debian/patches/glib-mkenums.patch
Modified:
   packages/ruby-gnome2/trunk/debian/changelog
   packages/ruby-gnome2/trunk/debian/patches/series
Log:
Add glib-mkenums.patch, fixes generated C code to be cleaner (Closes: #471610).

Modified: packages/ruby-gnome2/trunk/debian/changelog
===================================================================
--- packages/ruby-gnome2/trunk/debian/changelog	2008-03-18 19:40:27 UTC (rev 2524)
+++ packages/ruby-gnome2/trunk/debian/changelog	2008-03-19 22:07:04 UTC (rev 2525)
@@ -1,8 +1,10 @@
 ruby-gnome2 (0.16.0-11) UNRELEASED; urgency=low
 
   * Add Vcs-* fields.
+  * Add glib-mkenums.patch, fixes generated C code to be cleaner
+    (Closes: #471610).
 
- -- Arnaud Cornet <acornet at debian.org>  Wed, 12 Dec 2007 23:14:31 +0100
+ -- Arnaud Cornet <acornet at debian.org>  Wed, 19 Mar 2008 22:57:21 +0100
 
 ruby-gnome2 (0.16.0-10~lenny1) testing-security; urgency=high
 

Added: packages/ruby-gnome2/trunk/debian/patches/glib-mkenums.patch
===================================================================
--- packages/ruby-gnome2/trunk/debian/patches/glib-mkenums.patch	                        (rev 0)
+++ packages/ruby-gnome2/trunk/debian/patches/glib-mkenums.patch	2008-03-19 22:07:04 UTC (rev 2525)
@@ -0,0 +1,117 @@
+Index: ruby-gnome2-0.16.0/glib/src/lib/glib-mkenums.rb
+===================================================================
+--- ruby-gnome2-0.16.0.orig/glib/src/lib/glib-mkenums.rb	2008-03-19 22:54:49.000000000 +0100
++++ ruby-gnome2-0.16.0/glib/src/lib/glib-mkenums.rb	2008-03-19 22:54:52.000000000 +0100
+@@ -3,23 +3,23 @@
+ #
+ # C language enum description generation library like as glib-mkenums tool.
+ #
+-# Copyright(C) 2006 Ruby-GNOME2 Project.
++# Copyright(C) 2006-2008 Ruby-GNOME2 Project.
+ #
+ # This program is licenced under the same license of Ruby-GNOME2.
+ #
+-# $Id: glib-mkenums.rb,v 1.6 2006/12/27 17:11:16 mutoh Exp $
+-#
+ 
+ module GLib
+-  class Enum
++  class EnumDefinition
+     attr_accessor :EnumName, :enum_name, :ENUM_NAME, :ENUM_SHORT
+     attr_accessor :type, :Type
+     attr_accessor :g_type_prefix, :prefix
+ 
++    attr_reader :constants
++
+     def initialize(name, const_lines, g_type_prefix)
+       @EnumName = name
+       @g_type_prefix = g_type_prefix
+-      @consts = []
++      @constants = []
+       @enum_name = @EnumName.sub(/^[A-Z]/){|v| v.downcase}.gsub(/[A-Z]+/){|v| "_" + v.downcase}.sub(/(^_|_$)/, "")
+       @ENUM_NAME = @enum_name.upcase
+       @ENUM_SHORT = @ENUM_NAME.sub(/^#{@g_type_prefix.sub(/_TYPE.*$/, "")}/, "").sub(/^_/, "")
+@@ -33,20 +33,17 @@
+       if const_lines.include? "<<"
+         @type = "flags"
+         @Type = "Flags"
+-        regexp = /^\s*([^\s]*)\s.*\n/
+       else
+         @type = "enum"
+         @Type = "Enum"
+-        regexp = /^\s*([^\s,]*).*\n/
+       end
+-      consts = []
+-      const_lines.scan(regexp){|name|
+-        consts << name[0] unless name[0] =~ /(^[\/\*]|^$)/
+-      }
+-      @prefix = extract_prefix(consts)
+-      consts.each do |name|
+-        # consts = [name, nick]
+-        @consts << [name, name.sub(/#{@prefix}/, "").gsub(/_/, "-").downcase]
++      constants = []
++      const_lines.scan(/^\s*([^\s,]*).*\n/) do |name|
++        constants << name[0] unless name[0] =~ /(^[\/\*]|^$)/
++      end
++      @prefix = extract_prefix(constants)
++      constants.each do |name|
++        @constants << [name, name.sub(/#{@prefix}/, "").gsub(/_/, "-").downcase]
+       end
+     end
+ 
+@@ -66,7 +63,7 @@
+     end
+ 
+     def create_c
+-      consts = "\n" + @consts.collect{|name, nick| 
++      constants = "\n" + @constants.collect{|name, nick|
+         %Q[      { #{name}, "#{name}", "#{nick}" },\n] 
+       }.join +
+         %Q[      { 0, NULL, NULL }]
+@@ -78,7 +75,7 @@
+ {
+   static GType etype = 0;
+   if (etype == 0) {
+-    static const G#{@Type}Value values[] = {#{consts}
++    static const G#{@Type}Value values[] = {#{constants}
+     };
+     etype = g_#{@type}_register_static ("#{@EnumName}", values);
+   }
+@@ -99,8 +96,8 @@
+       enums = []
+       data.scan(/^\s*typedef\s+enum\s*
+                 \{?\s*(.*?)
+-                \}\s*(\w+);/mx){|consts, name|
+-        enum = Enum.new(name, consts, g_type_prefix)
++                \}\s*(\w+);/mx){|constants, name|
++        enum = new(name, constants, g_type_prefix)
+         enums << enum
+       }
+       enums
+@@ -142,7 +139,7 @@
+         File.open(path) do |i|
+           data = i.read
+         end
+-        @targets << [path, Enum.parse(data, g_type_prefix)]
++        @targets << [path, EnumDefinition.parse(data, g_type_prefix)]
+       end
+     end
+ 
+@@ -161,7 +158,7 @@
+ 
+     # Create a C source as a String.
+     def create_c
+-      ret = "\n/* Generated by glib-mkenums.rb ($Revision: 1.6 $) */ \n\n"
++      ret = "\n/* Generated by glib-mkenums.rb ($Id: glib-mkenums.rb 2852 2008-03-15 01:50:44Z ktou $) */ \n\n"
+       ret << %Q[#include "#{@target_filename}.h"\n]
+       @include_files.each do |file|
+         ret << "#include <#{file}>\n"
+@@ -177,7 +174,7 @@
+       header = "#{@target_filename}.h"
+       const = "__#{File.basename(header).upcase.gsub(/-|\./, '_')}__"
+ 
+-      ret = "\n/* Generated by glib-mkenums.rb ($Revision: 1.6 $) */ \n\n"
++      ret = "\n/* Generated by glib-mkenums.rb ($Id: glib-mkenums.rb 2852 2008-03-15 01:50:44Z ktou $) */ \n\n"
+       ret << "#ifndef #{const}\n"
+       ret << "#define #{const}\n\n"
+       ret << "#include <glib-object.h>\n\n"

Modified: packages/ruby-gnome2/trunk/debian/patches/series
===================================================================
--- packages/ruby-gnome2/trunk/debian/patches/series	2008-03-18 19:40:27 UTC (rev 2524)
+++ packages/ruby-gnome2/trunk/debian/patches/series	2008-03-19 22:07:04 UTC (rev 2525)
@@ -9,3 +9,4 @@
 window-warning.patch
 poppler-0.6.patch
 CVE-2007-6183.patch
+glib-mkenums.patch




More information about the Pkg-ruby-extras-commits mailing list