From nobody Mon Apr 29 08:53:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90513+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90513+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1655177149; cv=none; d=zohomail.com; s=zohoarc; b=Tpb8BtILaG7t2Ejur7lr07EfrJ07mgUkCmQgfH4mg06v6HaKYpE/kzfvA7nrXsmrjgOMn2eGq22NxInGAhhn4MH4XgLXeU4t65bEPU+gZfUGkqeUTXeyFfevGwqZZkn++HwLnRALdKQM0oVmu3SiUHq+Lm8SKCkQfNc/avevraI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655177149; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=xl61fiUkw0Swi/EDjSZhBsCQNKbaD3fPAq+2KGfqgyo=; b=IoLfT4krC/5akSmhotARW5rAJ2XUldahzE/muZinJy+ap/LRWBZ1hPTnFzKP7RyXjJgEknvFeOr7CBihdnEXhdMrYwDdV9XWJ9Giu3rMNo3Sdz33QM34Z71D4hzhC+elB50AKSDtxw+1lD8/uan+/EcKJgjAiHaR4CbC5EwoTsY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90513+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1655177149635302.185104486221; Mon, 13 Jun 2022 20:25:49 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 7QRRYY1788612xRXQmepZsE6; Mon, 13 Jun 2022 20:25:48 -0700 X-Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mx.groups.io with SMTP id smtpd.web11.1921.1655177147384264282 for ; Mon, 13 Jun 2022 20:25:48 -0700 X-Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LMYdw34MvzRjMR; Tue, 14 Jun 2022 11:22:28 +0800 (CST) X-Received: from kwepemm600004.china.huawei.com (7.193.23.242) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 14 Jun 2022 11:25:40 +0800 X-Received: from kwephisprg16640.huawei.com (10.247.83.252) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 14 Jun 2022 11:25:40 +0800 From: "wenyi,xie via groups.io" To: , , , CC: , Subject: [edk2-devel] [PATCH EDK2 v1 1/1] edksetup.sh:The version compare issue in shell script Date: Tue, 14 Jun 2022 11:25:34 +0800 Message-ID: <20220614032534.3386430-2-xiewenyi2@huawei.com> In-Reply-To: <20220614032534.3386430-1-xiewenyi2@huawei.com> References: <20220614032534.3386430-1-xiewenyi2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.247.83.252] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,xiewenyi2@huawei.com X-Gm-Message-State: JDc3r3ASFjiB4OzOqfCJrNvzx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1655177148; bh=1snVO8RgYF9KbXEn1zpahRYHWQNTCT357eda/TLd/8s=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=aan5y1RdQgnDtXcP8JvJK/FkuaBuTnvHehWtr4mXYEIUZAkRr9NJ8WvYBG4QOg7sgLv jUve1WA1VszQGrU/5tl6YijoYaBPlNYWV+cVu4lQvWOfGfRfXlfZj/OaX/OmRdrfIAJAk f1IeJ/xLQ9Qtw2FHEuFKDZPmK+dyyFval9M= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1655177151814100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3948 In function of SetupPython3, the version of python will be compared to get the new one. When python 3.10 is compared with python 3.4, the result is not right. Because the version number is treated as a float and 3.10 is smaller than 3.4. So using sort to arrange the version from old to new in order to get the new one. Cc: Andrew Fish Cc: Leif Lindholm Cc: Michael D Kinney Signed-off-by: Wenyi Xie --- edksetup.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/edksetup.sh b/edksetup.sh index 06d2f041e635..b9da62440f71 100755 --- a/edksetup.sh +++ b/edksetup.sh @@ -20,6 +20,11 @@ SCRIPTNAME=3D"edksetup.sh" RECONFIG=3DFALSE =20 +function IsVersionGreaterThan() +{ + test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" !=3D "$1"; +} + function HelpMsg() { echo "Usage: $SCRIPTNAME [Options]" @@ -122,7 +127,7 @@ function SetupPython3() export PYTHON_COMMAND=3D$python continue fi - if [[ "$origin_version" < "$python_version" ]]; then + if IsVersionGreaterThan $python_version $origin_version; then origin_version=3D$python_version export PYTHON_COMMAND=3D$python fi @@ -164,7 +169,7 @@ function SetupPython() export PYTHON_COMMAND=3D$python continue fi - if [[ "$origin_version" < "$python_version" ]]; then + if IsVersionGreaterThan $python_version $origin_version; then origin_version=3D$python_version export PYTHON_COMMAND=3D$python fi --=20 2.20.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90513): https://edk2.groups.io/g/devel/message/90513 Mute This Topic: https://groups.io/mt/91742510/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-