From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932616AbcFOQC2 (ORCPT ); Wed, 15 Jun 2016 12:02:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:40812 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932430AbcFOQC0 (ORCPT ); Wed, 15 Jun 2016 12:02:26 -0400 Date: Wed, 15 Jun 2016 18:02:24 +0200 From: "Luis R. Rodriguez" To: Michal Marek Cc: "Luis R. Rodriguez" , Julia.Lawall@lip6.fr, Gilles.Muller@lip6.fr, nicolas.palix@imag.fr, linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr Subject: Re: [PATCH 2/4] scripts: add reqs python library Message-ID: <20160615160224.GP11948@wotan.suse.de> References: <1465942217-14452-1-git-send-email-mcgrof@kernel.org> <1465942217-14452-3-git-send-email-mcgrof@kernel.org> <576108B3.30008@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <576108B3.30008@suse.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 15, 2016 at 09:50:11AM +0200, Michal Marek wrote: > On 2016-06-15 00:10, Luis R. Rodriguez wrote: > > + weight = (int(rel_specs['VERSION']) << 32) + \ > > + (int(rel_specs['PATCHLEVEL']) << 16) + \ > > + (sublevel << 8 ) + \ > > + (extra * 60) + (relmod * 2) > > This is going to silently break as soon as we have a version number with > e.g. a time stamp embedded. Well this is adhering to a linux_version_cmp type, surely we can adjust it with alternatives. It just happens that with the common stuff this suffices. Do you have a specific string in mind I can use to test against? > And there is actually no need to convert the > version string to an integer. You can convert them to arrays of > components and compare the components one by one. You can, however weight is used to as a generic formula to determine in one shot if you have a release >= than what is required. Its inspired by how KERNEL_VERSION() is used: #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) Luis