From patchwork Fri Feb 16 03:45:04 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: 398 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 4B6092192047 for ; Fri, 16 Feb 2018 03:45:09 +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.9.2] [127.0.0.10] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Fri, 16 Feb 2018 03:45:09 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id E982F8AF28CAA; Fri, 16 Feb 2018 03:45:02 +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; Fri, 16 Feb 2018 03:45:02 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 738DF2BE1D; Fri, 16 Feb 2018 03:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1518752701; bh=1546IonCRVR1S3/+45GZDGnLXodeekExXfghqhMp3s8=; 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=UBF/hn7dg+ZmB4dXvB8t8aBypD6Oq2c0lX+18dZhWQgmyWuNKlhrIxC1MIM2+dpYj h0A32jSOJldrnwqMcmcNvdtPYDjU2SEOAFp/yM3ktOo7yVvxbgARyRPrX7qfrZn4T7 XGvE0BHoQLjV727I5JGfxBg35QUsbxW60orhxZF1b+HcBMDYkcekezOAvTrzF3/pq8 TgM4V/8CzKwpnRkyFrInwJNFjgn2pRyUO/k4tY/v4axP2qWY2ccCPuGkoYsjqOhiTy O1Uh1h9XC63pm6wgTnHTAVncHP6npGuaUTM/XoUcdq3zPD2roVYOmUNZF9xTl3TAsL mF4ev+w1/s3pst1PbNaO7pwH0nB2bV/6qSsQvzul3jSkiAiVGm+yO80OJxG+2i1ye5 uqsJpykrZc308k880HrXqPOaOBHPBGde56jqOSxv3zsmfgBCA7E+tJdE1VvZ2CODfT 4SeLcnQn1rpAefPo+PLE69XiU2x0whYFcZ5/LwznBpTdVeDv1gzqRNHVlxs5tsZM0r NtgZm2gBDz77ZLuhkr3gDHl6HiX9jHorg7xQZ8ZhGfL+7CShkn9HsSCMZGhAGwp47x GR7JakshBDQf2fjE9dzFLR0IxCQfBUGDCWU/jSJQnIW8YCoLOREwt+0djE3hYa3nVl 6Rh+o3LgKLjhVlFIOvhauAWY= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id E24FA2BE1D for ; Fri, 16 Feb 2018 03:44:58 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Fri, 16 Feb 2018 03:44:58 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 079358AF28C6B; Fri, 16 Feb 2018 03:44:45 +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 7A6CD8AF28C6A; Fri, 16 Feb 2018 03:44:44 +0000 (UTC) To: arch-projects@archlinux.org Date: Thu, 15 Feb 2018 22:45:04 -0500 Message-Id: <20180216034504.27610-4-eschwartz@archlinux.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180216034504.27610-1-eschwartz@archlinux.org> References: <20180216034504.27610-1-eschwartz@archlinux.org> Subject: [arch-projects] [dbscripts] [PATCH 3/3] Globally set $PKGEXT to a bash extended glob representing valid choices. X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.25 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" This can be anything makepkg.conf accepts, therefore it needs to be able to match all that. Document the fact that this has *always* been some sort of glob, and update the two cases where this was (not!) being evaluated by bash [[ ... ]], to use a proxy function is_globfile() Signed-off-by: Eli Schwartz --- config | 3 ++- db-functions | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/config b/config index d2c1942..7a90fc6 100644 --- a/config +++ b/config @@ -25,7 +25,8 @@ TMPDIR="/var/tmp" ARCHES=(x86_64) DBEXT=".db.tar.gz" FILESEXT=".files.tar.gz" -PKGEXT=".pkg.tar.?z" +# bash glob listing allowed extensions. Note that db-functions turns on extglob. +PKGEXT=".pkg.tar.@(gz|bz2|xz|lzo|lrz|Z)" SRCEXT=".src.tar.gz" # Allowed licenses: get sourceballs only for licenses in this array diff --git a/db-functions b/db-functions index f0f8980..7cf8444 100644 --- a/db-functions +++ b/db-functions @@ -3,7 +3,7 @@ . /usr/share/makepkg/util.sh # global shell options for enhanced bash scripting -shopt -s globstar nullglob +shopt -s extglob globstar nullglob # Some PKGBUILDs need CARCH to be set @@ -20,6 +20,11 @@ restore_umask () { umask $UMASK >/dev/null } +# Check if a file exists, even if the file uses wildcards +is_globfile() { + [[ -f $1 ]] +} + # just like mv -f, but we touch the file and then copy the content so # default ACLs in the target dir will be applied mv_acl() { @@ -378,8 +383,8 @@ check_pkgrepos() { local pkgver="$(getpkgver ${pkgfile})" || return 1 local pkgarch="$(getpkgarch ${pkgfile})" || return 1 - [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT} ]] && return 1 - [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}${PKGEXT}.sig ]] && return 1 + is_globfile "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} && return 1 + is_globfile "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig && return 1 [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/} ]] && return 1 [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile##*/}.sig ]] && return 1