From patchwork Thu Mar 30 15:44:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?RnLDqWTDqXJpYyBNYXJ0aW5zb25z?= X-Patchwork-Id: 21940 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6360FC77B62 for ; Thu, 30 Mar 2023 15:45:12 +0000 (UTC) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by mx.groups.io with SMTP id smtpd.web10.28925.1680191109620069962 for ; Thu, 30 Mar 2023 08:45:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=D5LqnlLc; spf=pass (domain: gmail.com, ip: 209.85.221.52, mailfrom: frederic.martinsons@gmail.com) Received: by mail-wr1-f52.google.com with SMTP id h17so19540981wrt.8 for ; Thu, 30 Mar 2023 08:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680191107; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2BcR/uGzEXfL6UolqHEOdeWKieUzdUS3CcmmeXV2eGs=; b=D5LqnlLc1eluuGqruM9sLTHZiU2z/9H6KFJ2lPvKFIxueXNDshHR05MJX3tYGhtEYk c5aOJwVIT0FZ8fTcaDGZG2VX2UxbopEMKDhg2yxsjJ/QGu3lqZLSmXqmln7uvwm+Crr6 ii4hNnIodTRctiLmL7O+hxS7mx/HxiDkxc2qiiYZmP9YlorwGCvSEcS4l6QaIJ9M48sz XcO269QtIznfLkqhRT1Cp8FLt3P16qauOyUiB69l+j7LYl7UpebAUUv6mfsgt2BpXZZY ZJs/wJayeyGi85BsEJl+F1C1ENxR1H7RTOVzQD0uoabDAl+QC4Qp3h1tcpMoCG7SYaFc 7HVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680191107; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2BcR/uGzEXfL6UolqHEOdeWKieUzdUS3CcmmeXV2eGs=; b=mZkKdN0F/9K/B+wSWgIDgZbpob9SSZEurCyyIOjV6LAcxY6ijP7Hl56GTIzcouoTiM 6i5ll3wk//63pZIL5bUi0l5kKfOZgZQ7SfmnwYJ6UjEMSjL22WDlkugrDjcdnGQpOdW+ uqP9cPBHTCDDXWFRlM0H9J0h1MIcUtFluqEodaHBT8Wx6SxYbfbBFXciFsVkxhLH7Lif I2C6FoL53RachjyCt8UbGVc+DfKmCph2LeE7+ou8JW+5nenE/IwurUXaGwYxqf/LHrT1 wZn/QLz1SIndpozy06QFKv9AHjuqFhKqC0LxiAVDXtJBR7dkxAOWMfDkA+rdrAnc2bjK Vdgw== X-Gm-Message-State: AAQBX9cjSwvJpQgvzGqhOkt3EE9TCMToruDMMXMvJWwuGdp3M0SntE1M zJcSClrOh7PZcwAdkAs9BbVDlIIts0w= X-Google-Smtp-Source: AKy350aOuwmHaO/8wqNEEPmmYzwccMXWq0BkUU1L3nXTyOVpGz+QFKuVbd70cqkZ0kxnDO2eX4E6sg== X-Received: by 2002:a05:6000:1206:b0:2ce:a8e9:bb3d with SMTP id e6-20020a056000120600b002cea8e9bb3dmr18693406wrx.4.1680191107362; Thu, 30 Mar 2023 08:45:07 -0700 (PDT) Received: from work-pc.. ([2a01:e0a:8d5:c6c0:c898:b1f6:d5c7:39c5]) by smtp.gmail.com with ESMTPSA id x12-20020a5d650c000000b002c5544b3a69sm33151056wru.89.2023.03.30.08.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 08:45:07 -0700 (PDT) From: frederic.martinsons@gmail.com To: openembedded-core@lists.openembedded.org Cc: alex.kiernan@gmail.com Subject: [PATCH V5 6/6] cargo-update-recipe-crates: don't walk on the whole dir Date: Thu, 30 Mar 2023 17:44:53 +0200 Message-Id: <6279ccad3163dca527872a9144d63fb8f07c6f0e.1680190966.git.frederic.martinsons@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 30 Mar 2023 15:45:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/179343 From: Frederic Martinsons There is no need to do such things, Cargo.lock file has to be at the root of CARGO_LOCK_SRC_DIR. This avoid finding other possible Cargo.lock that would be in subdir (for example if a patch is applied on the recipe, we can have .pc subdir in S and a Cargo.lock can be there) Signed-off-by: Frederic Martinsons --- .../cargo-update-recipe-crates.bbclass | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/meta/classes-recipe/cargo-update-recipe-crates.bbclass b/meta/classes-recipe/cargo-update-recipe-crates.bbclass index daa363b0dd..549cfe627e 100644 --- a/meta/classes-recipe/cargo-update-recipe-crates.bbclass +++ b/meta/classes-recipe/cargo-update-recipe-crates.bbclass @@ -68,10 +68,14 @@ def get_crates(f): import os crates = "# Autogenerated with 'bitbake -c update_crates ${PN}'\n\n" found = False -for root, dirs, files in os.walk('${CARGO_LOCK_SRC_DIR}'): - for file in files: - if file == 'Cargo.lock': - crates += get_crates(os.path.join(root, file)) +for file in os.listdir('${CARGO_LOCK_SRC_DIR}'): + if file == 'Cargo.lock': + try: + cargo_lock_path = os.path.join('${CARGO_LOCK_SRC_DIR}', file) + crates += get_crates(cargo_lock_path) + except Exception as e: + raise ValueError("Cannot parse '%s'" % cargo_lock_path) from e + else: found = True if not found: raise ValueError("Unable to find Cargo.lock in ${CARGO_LOCK_SRC_DIR}")