summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/spec2yocto.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/spec2yocto.py b/tools/spec2yocto.py
index 16497fa4a..62f70ab6f 100755
--- a/tools/spec2yocto.py
+++ b/tools/spec2yocto.py
@@ -502,6 +502,7 @@ class RePattern:
patternUrl = r'^Url:\s*(.*)'
patternGroup = r'^Group:\s*(.*)'
patternLicense = r'^License:\s*(.*)'
+ patternVersion = r'^Version:\s*(.*)'
patternFiles = r'^%files\s*(.*)'
@@ -1118,6 +1119,17 @@ Group: devel
return res_license
return ""
+
+ def get_version(self):
+ '''
+ Return the version of the package.
+ '''
+ for line in self.__spect_dico[self.__introduction_section] :
+ description = re.findall(RePattern.patternVersion, line)
+ if len( description ) > 0:
+ return description[0]
+ return ""
+
def get_section_key(self, __flag):
'''
Return the list of "__flag" sections of the spec file.
@@ -1510,6 +1522,7 @@ class MetaSpec:
_section = self.__spec_parser.get_section()
_priority = "10"
_license = self.__spec_parser.get_license()
+ _version = self.__spec_parser.get_version()
file_d.write( "DESCRIPTION = \"%s\"\n" % _description )
if len( _homepage ) < 2:
@@ -1518,6 +1531,7 @@ class MetaSpec:
file_d.write( "SECTION = \"%s\"\n" % _section )
file_d.write( "LICENSE = \"%s\"\n" % _license )
+ file_d.write( "PV = \"%s\"\n" % _version )
file_d.write( "\n" )
file_d.write( "SRC_URI = \"\"\n" )
file_d.write( "\n" )