From 474f5268038b59df59fd916559d94da3597cd070 Mon Sep 17 00:00:00 2001 From: =?utf8?q?K=C3=A9vin=20THIERRY?= Date: Wed, 22 Oct 2014 08:59:56 +0200 Subject: [PATCH] Add package version in recipes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Bug-Tizen: BTY-55 Change-Id: Ied4a9f672012907c68fb0b1d06a74f774ce84652 Signed-off-by: Kévin THIERRY --- tools/spec2yocto.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/spec2yocto.py b/tools/spec2yocto.py index 16497fa..62f70ab 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" ) -- 2.7.4