From patchwork Wed Sep 8 09:54:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 12480765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CA54C433FE for ; Wed, 8 Sep 2021 09:54:48 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E74FF61158 for ; Wed, 8 Sep 2021 09:54:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E74FF61158 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.181617.328867 (Exim 4.92) (envelope-from ) id 1mNuHw-0002pC-7Q; Wed, 08 Sep 2021 09:54:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 181617.328867; Wed, 08 Sep 2021 09:54:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mNuHv-0002oH-Vl; Wed, 08 Sep 2021 09:54:39 +0000 Received: by outflank-mailman (input) for mailman id 181617; Wed, 08 Sep 2021 09:54:38 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mNuHu-0001EI-4X for xen-devel@lists.xenproject.org; Wed, 08 Sep 2021 09:54:38 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c2f1fdc5-108a-11ec-b148-12813bfff9fa; Wed, 08 Sep 2021 09:54:30 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c2f1fdc5-108a-11ec-b148-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1631094870; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qNr9KSzgnELykt88dPBpEyZ6wsbID+Fk75Z7xVFv0NI=; b=GiSqzthqW2ZRwbgm0rqK1TNl9aGSMCUyp+bAcz64F9IRDl2O+bmq1D4C zaSmVPfwOUGreT7FsDj04QTg7+qy+fsKb6uQMBSl/sThbqPiADFu4QyNl 7MvldZgq9geH+0hYMz75UhGXsR+2OkEeXgINWnOUDa99NQ3TpNPXbQenA w=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: TEp3lFiQCKdFcOnbcMELEiY57LjMHq9nWflMVXnA4QGUeCG7MaikXmLDWaPjXq2buvsKTXYVer aTROEza9lzQXnohAeQlKtiLW4qaVa5YFycHGuyLG0hN6rQVJhx5a91c/q/hjEA3sWNlIcW45HU FBb5/D0Lm53u1QtiT6x+NShp/0hXY2IHtSy96aeQ9Hlus/a9Y87qTBQ9tLV8afymE71uouGrSk NgvsXUdS+FTqlspecNKSweRyiTWAa+linCCxiUx+2pn+e6WXX/NCo10gl88TcO8Iaov3sl30yg qRRcOUicFyIvj89y2jp73PpM X-SBRS: 5.1 X-MesageID: 53993479 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:DyHrDaywYbFr/qAmlg9xKrPwKr1zdoMgy1knxilNoRw8SKOlfq eV7ZMmPH7P+U8ssR4b+OxoVJPsfZqYz+8W3WBzB8bHYOCFgguVxehZhOOIqQEIWReOk9K1vZ 0QFZSWY+efMbEVt6rHCXGDYrUd/OU= X-IronPort-AV: E=Sophos;i="5.85,277,1624334400"; d="scan'208";a="53993479" From: Anthony PERARD To: CC: Andrew Cooper , Jan Beulich , Anthony PERARD , "Daniel De Graaf" , "Daniel P. Smith" , Ian Jackson , Wei Liu , George Dunlap , Julien Grall , Stefano Stabellini Subject: [XEN PATCH 2/2] build: add --full to version.sh to guess $(XEN_FULLVERSION) Date: Wed, 8 Sep 2021 10:54:22 +0100 Message-ID: <20210908095422.438324-3-anthony.perard@citrix.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210908095422.438324-1-anthony.perard@citrix.com> References: <20210908095422.438324-1-anthony.perard@citrix.com> MIME-Version: 1.0 Running $(MAKE) like that in a $(shell ) while parsing the Makefile doesn't work reliably. In some case, make will complain with "jobserver unavailable: using -j1. Add '+' to parent make rule.", which will be part of "$(make xenversion)" output. It isn't possible to distinguish between the output produced by the target "xenversion" and `make`'s own output. Instead of running make, this patch "improve" `version.sh` to try to guess the output of `make xenversion`. This only works as long as $(XEN_VENDORVERSION) isn't set, or $(XEN_EXTRAVERSION) isn't overridden. This fix GitLab CI's build job "debian-unstable-gcc-arm64" on which $(shell $(MAKE) xenversion) in "flask/policy/Makefile.common" reliably produce more output than just the xenversion. This patch also allows to run for example `make --debug=a` without breaking the build when flask policy is enabled. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich --- tools/flask/policy/Makefile.common | 2 +- version.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/flask/policy/Makefile.common b/tools/flask/policy/Makefile.common index bea5ba4b6a40..7f470cd02861 100644 --- a/tools/flask/policy/Makefile.common +++ b/tools/flask/policy/Makefile.common @@ -35,7 +35,7 @@ OUTPUT_POLICY ?= $(BEST_POLICY_VER) # ######################################## -POLICY_FILENAME = $(FLASK_BUILD_DIR)/xenpolicy-$(shell $(MAKE) -C $(XEN_ROOT)/xen xenversion --no-print-directory) +POLICY_FILENAME = $(FLASK_BUILD_DIR)/xenpolicy-$(shell $(XEN_ROOT)/version.sh --full $(XEN_ROOT)/xen/Makefile) POLICY_LOADPATH = /boot # List of policy versions supported by the hypervisor diff --git a/version.sh b/version.sh index e894ee7e0469..abd19ce79ac8 100755 --- a/version.sh +++ b/version.sh @@ -1,5 +1,18 @@ #!/bin/sh +opt_full=false +while [ $# -gt 1 ]; do + case "$1" in + --full) opt_full=true ;; + *) break ;; + esac + shift +done + MAJOR=`grep "export XEN_VERSION" $1 | sed 's/.*=//g' | tr -s " "` MINOR=`grep "export XEN_SUBVERSION" $1 | sed 's/.*=//g' | tr -s " "` -printf "%d.%d" $MAJOR $MINOR + +if $opt_full; then + EXTRAVERSION=$(grep "export XEN_EXTRAVERSION" $1 | sed 's/^.* ?=\s\+//; s/\$([^)]*)//g; s/ //g') +fi +printf "%d.%d%s" $MAJOR $MINOR $EXTRAVERSION