From nobody Thu May 9 03:28:55 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+94564+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+94564+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1664522039; cv=none; d=zohomail.com; s=zohoarc; b=S87i8eXtZkgGfnxEJzw/jtnWhZioSR5JlHC49l1Hxxw9PAPflKzXyjMJwZxqfbPEuNj552fw9VLyEQdbG57Mlm3EeD0AXHU6RqMiR+4SsA6bfvD4araGho3si5Dx3nXnvBFAtSN2nThmcPk0di3elQv8jAOmQzpUNUi1QBbc29A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664522039; h=Content-Type:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=vr56PLCCoTTDcTTjeH8QXVu6Ct+E4Qp3DNc3DGqrXYc=; b=an7iWAuyi1Pv7pt8QwfNmNXEEyWLFFD38pLBxjac5IgLFCH5uH/xy7kQE0TTofT5Td5gTX/+Ukii60aERy02rmOsPYZPVbvHARjmn7fG3UICq9/3daBUFy1DGwS15KEdYXPKh4S74kbN3fM5FN2CntULL2k6HhhvrU09i67P0lU= 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+94564+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1664522039201520.9043536047194; Fri, 30 Sep 2022 00:13:59 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id rIgpYY1788612xxcSdsSA6R7; Fri, 30 Sep 2022 00:13:57 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web09.2985.1664522036825620267 for ; Fri, 30 Sep 2022 00:13:57 -0700 X-Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-3-ydqFUh1tNH2Af71-U2l5bg-1; Fri, 30 Sep 2022 03:13:48 -0400 X-MC-Unique: ydqFUh1tNH2Af71-U2l5bg-1 X-Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6CAC11C05152 for ; Fri, 30 Sep 2022 07:13:48 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4090F40EFB02 for ; Fri, 30 Sep 2022 07:13:48 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E74C4180039F; Fri, 30 Sep 2022 09:13:46 +0200 (CEST) Date: Fri, 30 Sep 2022 09:13:46 +0200 From: "Gerd Hoffmann" To: devel@edk2.groups.io Subject: [edk2-devel] edk2/ovmf version tracking Message-ID: <20220930071346.wza2ksyxb3igsxim@sirius.home.kraxel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,kraxel@redhat.com X-Gm-Message-State: Srb4kYffDX8kLiH1lWWgN0EWx1787277AA= Content-Disposition: inline DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1664522037; bh=hUa9BD9D94zLqfVCZjN9hROxXnyAvu4ITIHi6aVRxd8=; h=Content-Type:Date:From:Reply-To:Subject:To; b=YC3gbqD4a1ty72FcI3XziegKuvZ8VVKV5g5ALGTwxddYIrI0szoKzlySNVvFGFsxawG ZFBco+QKJIzcvBVh7obe0Cai3bVlz1p/9zSNjGzDZkQp4iNVVyzYzfc6//Ss+Z3oKuUOt dhAwrDV+GwjL6h6BFUK3dQIXqfvTrcrDyYY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1664522041313100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Hi, OVMF builds carry version '0.0.0'. I'd like to replace that with something more useful. Attached below is a patch doing that by hooking a script into PREBUILD. That is probably not the most elegant way to do it ... While looking around I have not found any edk2 version information in the source tree. So, when building from a edk2 tarball there is no version information available. Other projects have a VERSION file in the toplevel directory, or something language-specific like the version field in python's setup.cfg. I think ekd2 should store the name of the most recent stable tag in some file too. I think the version information should be automatically generated by some script to be as precise a possible. When building from a git checkout we can get the version information from git. When building packages (rpm/deb/...) storing the package version would be useful too, either by automatically detecting package builds (as the script below does for rpm builds), or by allowing to override the version information using build options so package build scrips can handle it that way. Comments? Suggestions how to do that best? take care, Gerd diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index f39d9cd117e6..94029720318f 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -24,6 +24,7 @@ [Defines] BUILD_TARGETS =3D NOOPT|DEBUG|RELEASE SKUID_IDENTIFIER =3D DEFAULT FLASH_DEFINITION =3D OvmfPkg/OvmfPkgX64.fdf + PREBUILD =3D sh OvmfPkg/SmbiosPlatformDxe/Version.= sh =20 # # Defines for default states. These can be changed on the command line. diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/Smbios= PlatformDxe/SmbiosPlatformDxe.c index 94249d3ff1b0..e3a16196bbdc 100644 --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -14,10 +14,11 @@ #include // EFI_SMBIOS_PROTOCOL =20 #include "SmbiosPlatformDxe.h" +#include "Version.h" =20 #define TYPE0_STRINGS \ "EFI Development Kit II / OVMF\0" /* Vendor */ \ - "0.0.0\0" /* BiosVersion */ \ + EDK2_BUILD_VERSION "\0" /* BiosVersion */ \ "02/06/2015\0" /* BiosReleaseDate */ // // Type definition and contents of the default Type 0 SMBIOS table. diff --git a/OvmfPkg/SmbiosPlatformDxe/.gitignore b/OvmfPkg/SmbiosPlatformD= xe/.gitignore new file mode 100644 index 000000000000..a40297ad16db --- /dev/null +++ b/OvmfPkg/SmbiosPlatformDxe/.gitignore @@ -0,0 +1 @@ +Version.h diff --git a/OvmfPkg/SmbiosPlatformDxe/Version.sh b/OvmfPkg/SmbiosPlatformD= xe/Version.sh new file mode 100755 index 000000000000..31d4f5c0080b --- /dev/null +++ b/OvmfPkg/SmbiosPlatformDxe/Version.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +outfile=3D"${0%.sh}.h" + +if test "${RPM_PACKAGE_NAME}" !=3D ""; then + # building rpm package + VERSION=3D"${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RE= LEASE}" +elif test -d .git -a -x "$(which git)"; then + # building from git checkout + VERSION=3D"$(git describe --tag --match edk2-stable*)" +else + # fallback + VERSION=3D"unknown" +fi + +cat <