From patchwork Tue Feb 20 01:57:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via arch-projects X-Patchwork-Id: 420 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 954FF220385E for ; Tue, 20 Feb 2018 01:57:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIM_SIGNED=0.1, DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.0.10] [127.0.0.10] [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Tue, 20 Feb 2018 01:57:18 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id CD9AE8D2B3A6C; Tue, 20 Feb 2018 01:57:09 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Tue, 20 Feb 2018 01:57:09 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 9ADCD2C36F; Tue, 20 Feb 2018 01:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1519091829; bh=gPdMQNmq2ufjeJWPeZhJv/2Bl3SGIlvIXr6gfpZXpzk=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc; b=FqpwQHG381GEMuH6YTzfP+g27rpFqMgtexERRvp8uHQIWKe121Xc45NDCJFmtgVot ZyxQwzRg037eJsjIDopk8Np7p2Oly22aLBIxI8WROwr+5zXSgtcSAgLvKEjQbT84Zq WVLpVt2ov8ZipJph+2hNiPE9AC6gs+tSpZ95rm/6LQPKY/b038bTY8S/N4kqd0L26v 63wYSYLIola/exrfF4680ZXTRHr8O3Ewf7FZR24mCiqjlJ7kDkTjfJXZgjwxJ0T87d E50IlOKGeQ0Rd1U645rmimz4rIHhHLoRCWiluIW9vGBVnhgLFVyD9+cU2N4KyE2YuV mg9HPcLrxBqi2T6HtTiVZEfrEGJ9uvLGFdE+nAo7WUmox4d17c2rb3EKcDo4SjhpaS ln+Xvpnopsb4AliY3dFY7/95Q/+idtOeR+LHHPz4MioV5yC5oGJUD6bgaQPa6p2/R4 04S5TsDw5VPOLH+7UPrNuKVzHF+hOvqLNchXpOr4cOXe6+9YaFpHJVxc8N2KHSQ2kh hz3gwMWZIiELc1N8jLkofvAo5fA3XSYVTuiahOJfemCStqtj3BnplX2EZQhc4aehWM YEGUxKlKU25KFFh7qmXTly9GWn3TtAiRfzI3YMkRzIxIGnCzKOlTIhV+81olZjiHpF pgmNBL9eR/HQcnCTI9GZYkWs= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 5F87F2BDFE for ; Tue, 20 Feb 2018 01:57:07 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Tue, 20 Feb 2018 01:57:07 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 482AF8D2B3A68; Tue, 20 Feb 2018 01:56:56 +0000 (UTC) Received: from localhost.localdomain (ool-18bdf232.dyn.optonline.net [24.189.242.50]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) (Authenticated sender: eschwartz) by orion.archlinux.org (Postfix) with ESMTPSA id B42C78D2B3A67; Tue, 20 Feb 2018 01:56:55 +0000 (UTC) To: arch-projects@archlinux.org Date: Mon, 19 Feb 2018 20:57:34 -0500 Message-Id: <20180220015734.29867-1-eschwartz@archlinux.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180219201145.14057-4-eschwartz@archlinux.org> References: <20180219201145.14057-4-eschwartz@archlinux.org> Subject: [arch-projects] [dbscripts] [PATCH v3 3/5] db-update: replace external find command with bash globbing 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: , From: Eli Schwartz via arch-projects Reply-To: Arch Linux projects development discussion Cc: Eli Schwartz Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" Don't bother emitting errors. bash doesn't show globbing errors if it cannot read a directory to try globbing there. And the former code never aborted on errors anyway, as without `set -o pipefail` the sort command swallowed the return code. Signed-off-by: Eli Schwartz --- v3: remove extraneous use of [[ -d ... ]] db-functions | 4 ++++ db-update | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/db-functions b/db-functions index e8eb2bc..394c7a2 100644 --- a/db-functions +++ b/db-functions @@ -2,6 +2,10 @@ . /usr/share/makepkg/util.sh +# global shell options for enhanced bash scripting +shopt -s globstar nullglob + + # Some PKGBUILDs need CARCH to be set CARCH="x86_64" diff --git a/db-update b/db-update index a8d885a..4e17184 100755 --- a/db-update +++ b/db-update @@ -9,9 +9,11 @@ if (( $# >= 1 )); then fi # Find repos with packages to release -if ! staging_repos=($(find "${STAGING}" -mindepth 1 -type f -name "*${PKGEXTS}" -printf '%h\n' | sort -u)); then - die "Could not read %s" "$STAGING" -fi +mapfile -t -d '' staging_repos < <( + for f in "${STAGING}"/**/*${PKGEXTS}; do + printf '%s\0' "${f%/*}" + done | sort -uz +) repos=() for staging_repo in ${staging_repos[@]##*/}; do