From nobody Thu May 2 13:50:41 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 206.53.239.180 is neither permitted nor denied by domain of freelists.org) client-ip=206.53.239.180; envelope-from=patchew-devel-bounce@freelists.org; helo=turing.freelists.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=none (zoho.com: 206.53.239.180 is neither permitted nor denied by domain of freelists.org) smtp.mailfrom=patchew-devel-bounce@freelists.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from turing.freelists.org (turing.freelists.org [206.53.239.180]) by mx.zohomail.com with SMTPS id 1519872674659925.1691340362694; Wed, 28 Feb 2018 18:51:14 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 9961423FC7; Wed, 28 Feb 2018 21:50:42 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0krrNud3Lg0f; Wed, 28 Feb 2018 21:50:42 -0500 (EST) Received: from turing.freelists.org (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 4ECD323F8A; Wed, 28 Feb 2018 21:50:42 -0500 (EST) Received: with ECARTIS (v1.0.0; list patchew-devel); Wed, 28 Feb 2018 21:50:42 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 113CF23FC7 for ; Wed, 28 Feb 2018 21:50:42 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KTxy8ocwwayw for ; Wed, 28 Feb 2018 21:50:42 -0500 (EST) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 75CA223F8A for ; Wed, 28 Feb 2018 21:50:41 -0500 (EST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5C428182D11 for ; Thu, 1 Mar 2018 02:50:40 +0000 (UTC) Received: from lemon.usersys.redhat.com (ovpn-12-46.pek2.redhat.com [10.72.12.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E7FE2166BAE; Thu, 1 Mar 2018 02:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org; s=turing; t=1519872642; bh=wt3Iaf5f8ZusmTMgwhDTjGPwqXKGTEOrSqDljrC4uz8=; h=From:To:Cc:Subject:Date:Reply-To:List-help:List-unsubscribe: List-Id:List-subscribe:List-owner:List-post:List-archive; b=Uv+zxuUx0CK0mBNZMSLx1aBe70MSETCyeKLVgxJfsOk9bddLrkvsZVdQdKqFD1RhY R1XL9suUibCyeqk1mjclBpBeBV1D9N9pd/ed86GZA7+xnpvx/2MdPIsLzGCUoKGPL3 g9ytPram7PgpLpFgLhxGdzwu7s8yCfn2PD7FldZE= X-Virus-Scanned: Debian amavisd-new at turing.freelists.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org; s=turing; t=1519872642; bh=wt3Iaf5f8ZusmTMgwhDTjGPwqXKGTEOrSqDljrC4uz8=; h=From:To:Cc:Subject:Date:Reply-To:List-help:List-unsubscribe: List-Id:List-subscribe:List-owner:List-post:List-archive; b=Uv+zxuUx0CK0mBNZMSLx1aBe70MSETCyeKLVgxJfsOk9bddLrkvsZVdQdKqFD1RhY R1XL9suUibCyeqk1mjclBpBeBV1D9N9pd/ed86GZA7+xnpvx/2MdPIsLzGCUoKGPL3 g9ytPram7PgpLpFgLhxGdzwu7s8yCfn2PD7FldZE= X-Original-To: patchew-devel@freelists.org X-Virus-Scanned: Debian amavisd-new at turing.freelists.org From: Fam Zheng To: patchew-devel@freelists.org Cc: pbonzini@redhat.com Subject: [patchew-devel] [PATCH] cli: clone recursively only for tester Date: Thu, 1 Mar 2018 10:50:34 +0800 Message-Id: <20180301025034.20913-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 01 Mar 2018 02:50:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 01 Mar 2018 02:50:40 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'famz@redhat.com' RCPT:'' X-archive-position: 62 X-ecartis-version: Ecartis v1.0.0 Sender: patchew-devel-bounce@freelists.org Errors-to: patchew-devel-bounce@freelists.org X-original-sender: famz@redhat.com Precedence: normal Reply-To: patchew-devel@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: patchew-devel X-List-ID: patchew-devel List-subscribe: List-owner: List-post: List-archive: X-list: patchew-devel X-ZohoMail-DKIM: pass (identity @freelists.org) X-ZohoMail: RDKM_0 RSF_4 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Both tester and apply (applier mode) subcommands call git_clone_repo. "--recursive" option was added so that repos that contain submodules will likely just work with all the submodules present (although that can be optimized too, to save time and bandwidth), but it is not necessary for appliers and can significantly slow down the process because the submodule repos are not cached. Signed-off-by: Fam Zheng --- patchew-cli | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/patchew-cli b/patchew-cli index eb8b91c..52329e1 100755 --- a/patchew-cli +++ b/patchew-cli @@ -29,7 +29,7 @@ COOKIE_FILENAME =3D os.path.expanduser("~/.patchew.cookie= ") class APIError(Exception): pass =20 -def git_clone_repo(clone, remote, head, logf, checkout=3DTrue): +def git_clone_repo(clone, remote, head, logf, checkout=3DTrue, recursive= =3DFalse): cache_repo =3D os.path.join(os.path.expanduser("~/.cache/patchew-git-c= ache"), "".join([x for x in remote if x.isalnum()]) = + "-" + \ hashlib.sha1(remote.encode("utf-8"))= .hexdigest()) @@ -46,8 +46,11 @@ def git_clone_repo(clone, remote, head, logf, checkout= =3DTrue): subprocess.check_call(["git", "remote", "add", "-f", "--mirror=3Dfetch= ", remote_name, remote], cwd=3Dcache_repo, stdout=3Dlogf, stderr=3Dlogf) - subprocess.check_call(["git", "clone", "-q", "--recursive", cache_repo= , clone], - stderr=3Dlogf, stdout=3Dlogf) + clone_cmd =3D ["git", "clone", "-q"] + if recursive: + clone_cmd +=3D ["--recursive"] + clone_cmd +=3D [cache_repo, clone] + subprocess.check_call(clone_cmd, stderr=3Dlogf, stdout=3Dlogf) if checkout: subprocess.check_call(["git", "checkout", head, "-b", "test"], stderr=3Dlogf, stdout=3Dlogf, @@ -510,7 +513,7 @@ class TesterCommand(SubCommand): is_timeout =3D False try: clone =3D os.path.join(wd, "src") - git_clone_repo(clone, r["repo"], r["head"], logf) + git_clone_repo(clone, r["repo"], r["head"], logf, True) base =3D r["base"] if base: subprocess.check_call(["git", "branch", "base", base], --=20 2.14.3