end
when /^Version$/i then
state = "COMMON"
- if common_version.empty? then common_version = l.sub(/^[ \t]*Version[ \t]*:[ \t]*/i,"").strip
+ 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
end
when /^Version$/i then
state = "COMMON"
- if common_version.empty? then common_version = l.sub(/^[ \t]*Version[ \t]*:[ \t]*/i,"").strip
+ 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
end
multi_line = nil
when /^Version$/i then
- if common_version.empty? and package.version.empty? then package.version = l.sub(/^[ \t]*Version[ \t]*:[ \t]*/i,"").strip
+ 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
return pkglist
end
+ def Parser.check_version(version)
+ if not version =~ /^[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*$/ then
+ raise RuntimeError, "Version format not matched \"#{version}\"\nVersion format must be \"{digit}.{digit}.{digit}\""
+ end
+ puts version
+ return version
+ end
+
def Parser.read_changelog(file)
return read_multy_pkginfo_from(file,true)[3]
end