From patchwork Wed Jun 27 07:05:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erich Eckner X-Patchwork-Id: 657 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id A9D245177260 for ; Wed, 27 Jun 2018 07:06:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=DKIM_SIGNED=0.1, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,T_DKIM_INVALID=1 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Wed, 27 Jun 2018 07:06:43 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 0DA47B698240F; Wed, 27 Jun 2018 07:06:39 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Wed, 27 Jun 2018 07:06:39 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id C6B512D0EA; Wed, 27 Jun 2018 07:06:38 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=eckner.net header.i=@eckner.net header.b=Q9mStv8H Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id F08C72D0E6 for ; Wed, 27 Jun 2018 07:06:36 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Wed, 27 Jun 2018 07:06:36 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id DBA96B698240A for ; Wed, 27 Jun 2018 07:06:32 +0000 (UTC) Received: from v1.homerecords.de (v1.homerecords.de [62.141.45.186]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Wed, 27 Jun 2018 07:06:32 +0000 (UTC) Received: from localhost (nlopc43.ioq.uni-jena.de [141.35.50.156]) by v1.homerecords.de (Postfix) with ESMTPSA id 672E4598939D; Wed, 27 Jun 2018 09:06:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eckner.net; s=default; t=1530083192; bh=B/vW/uErtkMGF+AVjy6QF8ZJe08NBH85lQZ/RP9iRis=; l=1147; h=Authentication-Results:Received-SPF:From:To:Cc:Subject:Date: Message-Id:X-Mailer; b=Q9mStv8HWlJLBRShqqsKJLhA8MK2AkLN8PDrJbK1Q5MXuDTYgHLax2woOONL69+CE EWpfAE2yDtwqu9wEBhMsT7f2KjoTGFUINeJ2t430BcL0BB/DERcr973R4+Ze4csgFw fam971SbYRwMmC1iS6Liop/61t2cQ9l+7oljlRvI= Authentication-Results: 45186.vs.webtropia.com; spf=pass (sender IP is 141.35.50.156) smtp.mailfrom=erich@eckner.net smtp.helo=localhost Received-SPF: pass (45186.vs.webtropia.com: connection is authenticated) From: arch@eckner.net To: arch-projects@archlinux.org Date: Wed, 27 Jun 2018 09:05:43 +0200 Message-Id: <20180627070542.24144-1-arch@eckner.net> X-Mailer: git-send-email 2.18.0 Subject: [arch-projects] [devtools] [PATCH] remove empty tree if "--verifysource" failed X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux projects development discussion Cc: Erich Eckner Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" From: Erich Eckner makechrootpkg's download_sources() leaves a stray directory if "makepkg --verifysource" failed. We use "setup_workdir" instead of "mktemp -d", because this ensures the correct garbage collection. Signed-off-by: Erich Eckner --- makechrootpkg.in | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/makechrootpkg.in b/makechrootpkg.in index d81be84..4b72a36 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -250,18 +250,14 @@ download_sources() { local copydir=$1 local makepkg_user=$2 - local builddir - builddir="$(mktemp -d)" - chown "$makepkg_user:" "$builddir" + setup_workdir + chown "$makepkg_user:" "$WORKDIR" # Ensure sources are downloaded sudo -u "$makepkg_user" --preserve-env=GNUPGHOME \ - env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \ + env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \ makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o || die "Could not download sources." - - # Clean up garbage from verifysource - rm -rf "$builddir" } # Usage: move_products $copydir $owner