rser: change version rule 76/12376/1
authorHyoun Jiil <jiil.hyoun@samsung.com>
Thu, 14 Nov 2013 07:24:15 +0000 (16:24 +0900)
committerHyoun Jiil <jiil.hyoun@samsung.com>
Thu, 14 Nov 2013 07:25:06 +0000 (16:25 +0900)
[Description] support version number over 3 dot notation

Change-Id: I64118f8d865bb132ea5b1866c046a579bfff0985
Signed-off-by: Hyoun Jiil <jiil.hyoun@samsung.com>
package/changelog
package/pkginfo.manifest
src/common/parser.rb

index 1850f9698a9e08156331fb42301b3746205e0d2b..3d96d4456c608630413214370edf7340ae25aab9 100644 (file)
@@ -1,3 +1,6 @@
+* 2.1.51
+- support version number over 3 dots 
+== hyoun jiil <jiil.hyoun@samsung.com> 2013-11-14
 * 2.1.50
 - Fixed Timeout problem 
 == donghee yang <donghee.yang@samsung.com> 2013-10-08
index 49e716b08a2fad991123bc486d67b6a77f27e2ea..3a8a57c3ba2f46db7f8309c070b07ffeddc712f2 100644 (file)
@@ -1,5 +1,5 @@
 Source : dibs
-Version :2.1.50
+Version :2.1.51
 Maintainer : taejun ha<taejun.ha@samsung.com>, jiil hyoun <jiil.hyoun@samsung.com>, donghyuk yang <donghyouk.yang@samsung.com>, donghee yang <donghee.yang@samsung.com>, sungmin kim <dev.sungmin.kim@samsung.com
 
 Package : tizen-dibs-test
index 0bd7d13fb8ffa94e33a4c08be526691fd7bc3285..d636e142f843a287ff0512ed04b33617c19ccb42 100644 (file)
@@ -48,31 +48,32 @@ class Parser
                        #variable initialize
                        state = "INIT"
                        f.each_line do |l|
+                l.tr!("\r","")
                                # commant
                                if l.strip.start_with? "#" then next end
 
-                               field_name = l.split(':')[0].strip
+                               field_name = l.split(':')[0]
 
                                case state
                                when "INIT" then
                                        case field_name
-                                       when /^$/ then next
-                                       when /^Source$/i  then
+                                       when /^[ \t]*$/ then next
+                                       when /^[ \t]*Source[ \t]*$/i  then
                                                state = "COMMON"
                                                if common_source.empty? then common_source = l.sub(/^[ \t]*Source[ \t]*:[ \t]*/i,"").strip
                                                else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
                                                end
-                                       when /^Version$/i then
+                                       when /^[ \t]*Version[ \t]*$/i then
                                                state = "COMMON"
                                                if common_version.empty? then common_version = check_version l.sub(/^[ \t]*Version[ \t]*:[ \t]*/i,"").strip
                                                else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
                                                end
-                                       when /^Maintainer$/i then
+                                       when /^[ \t]*Maintainer[ \t]*$/i then
                                                state = "COMMON"
                                                if common_maintainer.empty? then common_maintainer = l.sub(/^[ \t]*Maintainer[ \t]*:[ \t]*/i,"").strip
                                                else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
                                                end
-                                       when /^Package$/i then
+                                       when /^[ \t]*Package[ \t]*$/i then
                                                state = "PACKAGE"
                                                package_name = l.sub(/^[ \t]*Package[ \t]*:[ \t]*/i,"").strip
                                                if not package_name.empty? then
@@ -83,12 +84,12 @@ class Parser
                                                else
                                                        raise RuntimeError, "Package name is not set in \"#{file}\" file"
                                                end
-                                       when /^\*[ \t]*([0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*)[ \t]*$/ then
+                                       when /^\*[ \t]*([0-9][.0-9]*)[ \t]*$/ then
                                                state = "CHANGELOG"
                                                change_log[change_version] = change_contents.strip if not change_version.nil?
                                                change_version = Version.new($1)
                                                change_contents = ""
-                                       when /^Include$/i then
+                                       when /^[ \t]*Include[ \t]*$/i then
                                                pfile = File.dirname(file) + "/" + l.sub(/^[ \t]*Include[ \t]*:[ \t]*/i,"").strip
                                                if File.exist? pfile then
                                                        pkglist = pkglist + (Parser.read_multy_pkginfo_from pfile)
@@ -100,37 +101,37 @@ class Parser
                                                else
                                                        raise RuntimeError, "Not exist \"#{pfile}\""
                                                end
-                                       when /^ORIGIN$/ then #for compatable
+                                       when /^[ \t]*ORIGIN[ \t]*$/ then #for compatable
                                                multi_line = nil
                                                next
                                        else raise RuntimeError, "Can't parse below line in \"#{file}\" file \n\t#{l}"
                                        end
                                when "COMMON" then
                                        case field_name
-                                       when /^$/ then state = "INIT"
-                                       when /^Source$/i then
+                                       when /^[ \t]*$/ then state = "INIT"
+                                       when /^[ \t]*Source[ \t]*$/i then
                                                state = "COMMON"
                                                if common_source.empty? then common_source = l.sub(/^[ \t]*Source[ \t]*:[ \t]*/i,"").strip
                                                else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
                                                end
-                                       when /^Version$/i then
+                                       when /^[ \t]*Version[ \t]*$/i then
                                                state = "COMMON"
                                                if common_version.empty? then common_version = check_version l.sub(/^[ \t]*Version[ \t]*:[ \t]*/i,"").strip
                                                else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
                                                end
-                                       when /^Maintainer$/i then
+                                       when /^[ \t]*Maintainer[ \t]*$/i then
                                                state = "COMMON"
                                                if common_maintainer.empty? then common_maintainer = l.sub(/^[ \t]*Maintainer[ \t]*:[ \t]*/i,"").strip
                                                else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
                                                end
-                                       when /^ORIGIN$/ then #for compatable
+                                       when /^[ \t]*ORIGIN[ \t]*$/ then #for compatable
                                                multi_line = nil
                                                next
                                        else raise RuntimeError, "Can't parse below line in \"#{file}\" file \n\t#{l}"
                                        end
                                when "PACKAGE" then
                                        case field_name
-                                       when /^$/ then
+                                       when /^[ \t]*$/ then
                                                state = "INIT"
                                                if not package.package_name.empty? then
                                                        pkglist.push package
@@ -138,71 +139,71 @@ class Parser
                                                else raise RuntimeError, "Package name is not set in \"#{file}\" file"
                                                end
                                                multi_line = nil
-                                       when /^Source$/i then
+                                       when /^[ \t]*Source[ \t]*$/i then
                                                if common_source.empty? and package.source.empty? then package.source = l.sub(/^[ \t]*Source[ \t]*:[ \t]*/i,"").strip
                                                else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
                                                end
                                                multi_line = nil
-                                       when /^Version$/i then
+                                       when /^[ \t]*Version[ \t]*$/i then
                                                if common_version.empty? and package.version.empty? then package.version = check_version l.sub(/^[ \t]*Version[ \t]*:[ \t]*/i,"").strip
                                                else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
                                                end
                                                multi_line = nil
-                                       when /^Maintainer$/i then
+                                       when /^[ \t]*Maintainer[ \t]*$/i then
                                                if common_maintainer.empty? and package.maintainer.empty? then package.maintainer = l.sub(/^[ \t]*Maintainer[ \t]*:[ \t]*/i,"").strip
                                                else raise RuntimeError, "#{field_name} information is conflict in \"#{file}\" file\nIf use #{field_name} field in Common section then Package section can't contain #{field_name} field"
                                                end
                                                multi_line = nil
-                                       when /^OS$/i then
+                                       when /^[ \t]*OS[ \t]*$/i then
                                                package.os_list = l.sub(/^[ \t]*OS[ \t]*:[ \t]*/i,"").tr(" \t\n\r", "").split(",")
                                                package.os = package.os_list[0]
                                                multi_line = nil
-                                       when /^Label$/i then
+                                       when /^[ \t]*Label[ \t]*$/i then
                                                package.label = l.sub(/^[ \t]*Label[ \t]*:[ \t]*/i,"").strip
                                                multi_line = nil
-                                       when /^Build-host-os$/i then
+                                       when /^[ \t]*Build-host-os[ \t]*$/i then
                                                package.build_host_os = l.sub(/^[ \t]*Build-host-os[ \t]*:[ \t]*/i,"").tr(" \t\n\r", "").split(",")
                                                multi_line = nil
-                                       when /^Attribute$/i then
+                                       when /^[ \t]*Attribute[ \t]*$/i then
                                                package.attribute = l.sub(/^[ \t]*Attribute[ \t]*:[ \t]*/i,"").tr(" \t\n\r","").split("|")
                                                multi_line = nil
-                                       when /^Install-dependency$/i then
+                                       when /^[ \t]*Install-dependency[ \t]*$/i then
                                                package.install_dep_list = dep_parser l.sub(/^[ \t]*Install-dependency[ \t]*:[ \t]*/i,"").split(',')
                                                multi_line = nil
-                                       when /^Build-dependency$/i then
+                                       when /^[ \t]*Build-dependency[ \t]*$/i then
                                                package.build_dep_list = dep_parser l.sub(/^[ \t]*Build-dependency[ \t]*:[ \t]*/i,"").split(',')
                                                multi_line = nil
-                                       when /^Source-dependency$/i then
+                                       when /^[ \t]*Source-dependency[ \t]*$/i then
                                                package.source_dep_list = dep_parser l.sub(/^[ \t]*Source-dependency[ \t]*:[ \t]*/i,"").split(',')
                                                multi_line = nil
-                                       when /^Conflicts$/i then
+                                       when /^[ \t]*Conflicts[ \t]*$/i then
                                                package.conflicts = dep_parser l.sub(/^[ \t]*Conflicts[ \t]*:[ \t]*/i,"").split(',')
                                                multi_line = nil
-                                       when /^Src-path$/i then
+                                       when /^[ \t]*Src-path[ \t]*$/i then
                                                package.src_path = l.sub(/^[ \t]*Src-path[ \t]*:[ \t]*/i,"").strip
                                                multi_line = nil
-                                       when /^Path$/i then
+                                       when /^[ \t]*Path[ \t]*$/i then
                                                package.path = l.sub(/^[ \t]*Path[ \t]*:[ \t]*/i,"").strip
                                                multi_line = nil
-                                       when /^Origin$/i then
+                                       when /^[ \t]*Origin[ \t]*$/i then
                                                package.origin = l.sub(/^[ \t]*Origin[ \t]*:[ \t]*/i,"").strip
                                                multi_line = nil
-                                       when /^SHA256$/i then
+                                       when /^[ \t]*SHA256[ \t]*$/i then
                                                package.checksum = l.sub(/^[ \t]*SHA256[ \t]*:[ \t]*/i,"").strip
                                                multi_line = nil
-                                       when /^Size$/i then
+                                       when /^[ \t]*Size[ \t]*$/i then
                                                package.size = l.sub(/^[ \t]*Size[ \t]*:[ \t]*/i,"").strip
                                                multi_line = nil
-                                       when /^Uncompressed-size$/i then
+                                       when /^[ \t]*Uncompressed-size[ \t]*$/i then
                                                package.uncompressed_size = l.sub(/^[ \t]*Uncompressed-size[ \t]*:[ \t]*/i,"").strip
                                                multi_line = nil
-                                       when /^Description$/i then
+                                       when /^[ \t]*Description[ \t]*$/i then
                                                package.description = l.sub(/^[ \t]*Description[ \t]*:[ \t]*/i,"").strip
                                                multi_line = "Description"
-                                       when /^ORIGIN$/ then #for compatable
+                                       when /^[ \t]*ORIGIN[ \t]*$/ then #for compatable
                                                multi_line = nil
                                                next
-                                       when /^C-/ then
+                                       when /^[ \t]*C-/ then
                                                if package.custom.empty? then package.custom = l.rstrip
                                                else package.custom = package.custom + "\n" + l.rstrip
                                                end
@@ -216,7 +217,7 @@ class Parser
                                        end
                                when "CHANGELOG" then
                                        case field_name
-                                       when /^$/ then
+                                       when /^[ \t]*$/ then
                                                state = "INIT"
                                                if not change_version.nil? then
                                                        if change_log[change_version].nil? then change_log[change_version] = change_contents.strip
@@ -225,7 +226,7 @@ class Parser
                                                end
                                                change_version = nil
                                                change_contents = ""
-                                       when /^\*[ \t]*([0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*)[ \t]*$/ then
+                                       when /^\*[ \t]*([0-9][.0-9]*)[ \t]*$/ then
                                                if not change_version.nil? then
                                                        if change_log[change_version].nil? then change_log[change_version] = change_contents.strip
                                                        else raise RuntimeError, "change log version is duplicated in \"#{file}\" file \n\t#{l}"
@@ -254,8 +255,8 @@ class Parser
        end
 
        def Parser.check_version(version)
-               if not version =~ /^[0-9][0-9]*(.[0-9][0-9]*)*$/ then
-                       raise RuntimeError, "Version format not matched \"#{version}\"\nVersion format must be \"{digit}.{digit}.{digit}\""
+               if not version =~ /^[0-9][.0-9]*$/ then
+                       raise RuntimeError, "Version format not matched \"#{version}\"\nVersion format must be \"{digit}.{digit}...\""
                end
                return version
        end