Add package version in recipes 75/29175/1
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Wed, 22 Oct 2014 06:59:56 +0000 (08:59 +0200)
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Wed, 22 Oct 2014 07:01:23 +0000 (09:01 +0200)
Bug-Tizen: BTY-55
Change-Id: Ied4a9f672012907c68fb0b1d06a74f774ce84652
Signed-off-by: Kévin THIERRY <kevin.thierry@open.eurogiciel.org>
tools/spec2yocto.py

index 16497fa..62f70ab 100755 (executable)
@@ -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" )