From patchwork Thu Oct 14 11:59:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14502 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by patchwork.libcamera.org (Postfix) with ESMTPS id E848DBDB1C for ; Tue, 9 Nov 2021 17:50:33 +0000 (UTC) Received: from pendragon.ideasonboard.com (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 66D5FDEE for ; Tue, 9 Nov 2021 18:50:33 +0100 (CET) Authentication-Results: perceval.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ZVbxWenQ"; dkim-atps=neutral Delivered-To: kbingham@ideasonboard.com Received: from perceval.ideasonboard.com by perceval.ideasonboard.com with LMTP id SKK/Bb4baGF+RgAA4E0KoQ (envelope-from ) for ; Thu, 14 Oct 2021 13:59:58 +0200 Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by perceval.ideasonboard.com (Postfix) with ESMTPS id 02A581B48; Thu, 14 Oct 2021 13:59:58 +0200 (CEST) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D1B4968541; Thu, 14 Oct 2021 13:59:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ZVbxWenQ"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0153268541 for ; Thu, 14 Oct 2021 13:59:55 +0200 (CEST) Received: by mail-wr1-x433.google.com with SMTP id v17so18613254wrv.9 for ; Thu, 14 Oct 2021 04:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yP+LjnWU25B8Je3bqKbsTJp/P9y+WFJYKaiWQO8fOnc=; b=ZVbxWenQyqzSGgxChSKHG2aopBP/p9rN4Y/xB6BetTnv8mpR6rhxkNP7WTuMi0yZfe ubyEUFnnrZvAuORPMAKh/STvsKbTIsKr3mb4Gy6XvRbxts03WoElfvE97grzJ8ZVBibE rT9I/sENUPr5/XS5mLKJleu2f6wbhQ6WhhdGDEKz8y0rDSlRJgbZ8b8y1D0uJvkjeGkN g2rLdMg14k8tXbvKUAFNwikoZ6QMVRwMe7lXxvy4f8I6+BUTv2zm0+RGnLRnWr7CHuz7 KkmTrBOV05VU/McQe1H9lFJttIZ2UCyd49CLn55lbaIOtut8RWgKCCHDLeOwUS02UiMe Qrow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yP+LjnWU25B8Je3bqKbsTJp/P9y+WFJYKaiWQO8fOnc=; b=7OAXZNuHdarvizsmwh5kiM4pt0r6j79wxF6c3q6g8WzsqSNS/KU1GPD57To+tTQaBo XoRZU8PGv3OamjS1x90804sZzVpMgV1JHOXbyJV4h8bfBBtaqWrX0ZSADh//4AHjy2gp KwUdIViOCsvDFEAgDoV/eXKZ7ov0h98q+EIVnEg5qjlEjHq2JUl5bTs9Pco8XUq1Y0Go mo6DAzlPuerai3+D+Gzftu5Lvg7tV3yg+NHlokfUwcDur2WTHz0kzDXSi7JttOKD0yZa YgHxdRGYllzK8XCnqNOJlTbA6go1KiXcuEddXBgr1i1efNAutWK5ZkK5SRJxLz6IELs4 kFYw== X-Gm-Message-State: AOAM532XfSZwBJEn4jiY7wRxfnwbaRIUQUnmq9P7M99Rab1PG6T8pn3a /1Pb2rMkd64KG2Qu+Q7+RkaVulaLQZBY65pN X-Google-Smtp-Source: =?utf-8?q?ABdhPJyQlwEORyqZqzls+MnEtUFzh37wpOtsryHYS?= =?utf-8?q?j2CBE6+58J3XPqdkqmAKgGSMcmRi/UIgdVFcg=3D=3D?= X-Received: by 2002:a1c:3b44:: with SMTP id i65mr5326339wma.161.1634212794449; Thu, 14 Oct 2021 04:59:54 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:26af:fb8f:5d03:5eab]) by smtp.gmail.com with ESMTPSA id y191sm8658324wmc.36.2021.10.14.04.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 04:59:53 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 14 Oct 2021 12:59:50 +0100 Message-Id: <20211014115951.2996808-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211014115951.2996808-1-naush@raspberrypi.com> References: <20211014115951.2996808-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 1/2] utils: gen-version: Pass the meson source root to the gen-version.sh script X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" X-TUID: MolLis3raJyb Resent-From: Kieran Bingham Resent-To: parsemail@patchwork.libcamera.org The gen-version.sh script expects to be called from a git repo, and sets its src_root variable accordingly. This may not always be the case if it is built from a tarball source - full support for which is in a future commit. The MESON_SOURCE_ROOT environnement variable does not get set when called from the meson vcs_tag() function, but does when called from the run_command() function, so that cannot be used either. Instead, explicitly pass the meson source root to the gen-version.sh script. Signed-off-by: Naushir Patuck --- meson.build | 3 ++- src/libcamera/meson.build | 2 +- utils/gen-version.sh | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index a49c484fe64e..556a3f7c42f8 100644 --- a/meson.build +++ b/meson.build @@ -17,7 +17,8 @@ project('libcamera', 'c', 'cpp', # git version tag, the build metadata (e.g. +211-c94a24f4) is omitted from # libcamera_git_version. libcamera_git_version = run_command('utils/gen-version.sh', - meson.build_root()).stdout().strip() + meson.build_root(), + meson.source_root()).stdout().strip() if libcamera_git_version == '' libcamera_git_version = meson.project_version() endif diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 243dd3c180eb..d8dd8344002c 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -95,7 +95,7 @@ libcamera_sources += control_sources gen_version = meson.source_root() / 'utils' / 'gen-version.sh' -version_cpp = vcs_tag(command : [gen_version, meson.build_root()], +version_cpp = vcs_tag(command : [gen_version, meson.build_root(), meson.source_root()], input : 'version.cpp.in', output : 'version.cpp', fallback : meson.project_version()) diff --git a/utils/gen-version.sh b/utils/gen-version.sh index b09ad495f86a..da191691a7c5 100755 --- a/utils/gen-version.sh +++ b/utils/gen-version.sh @@ -4,10 +4,10 @@ # Generate a version string using git describe build_dir="$1" +src_dir="$2" # Bail out if the directory isn't under git control -src_dir=$(git rev-parse --git-dir 2>&1) || exit 1 -src_dir=$(readlink -f "$src_dir/..") +git rev-parse --git-dir > /dev/null 2>&1 || exit 1 # Get a short description from the tree. version=$(git describe --abbrev=8 --match "v[0-9]*" 2>/dev/null)