From patchwork Sat Dec 26 07:27:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 1842 Return-Path: Delivered-To: patchwork@archlinux.org Received: from mail.archlinux.org [2a01:4f9:c010:3052::1] by patchwork.archlinux.org with IMAP (fetchmail-6.4.14) for (single-drop); Sat, 26 Dec 2020 07:30:40 +0000 (UTC) Received: from mail.archlinux.org by mail.archlinux.org with LMTP id aNH2FaDm5l/wFgMAK+/4rw (envelope-from ) for ; Sat, 26 Dec 2020 07:30:40 +0000 Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by mail.archlinux.org (Postfix) with ESMTPS id 03B4F32298B; Sat, 26 Dec 2020 07:30:40 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id B216D2C525; Sat, 26 Dec 2020 07:30:34 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 41D192111B for ; Sat, 26 Dec 2020 07:27:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on luna.archlinux.org X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED=0.1, DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,FREEMAIL_FROM=0.5, RCVD_IN_DNSWL_NONE=-0.0001,SPF_HELO_NONE=0.001, T_DMARC_POLICY_NONE=0.01,T_DMARC_SIMPLE_DKIM=0.01 autolearn=no autolearn_force=no version=3.4.4 X-Spam-BL-Results: [127.0.0.10] [127.0.5.0] [127.0.0.10] Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by luna.archlinux.org (Postfix) with ESMTPS for ; Sat, 26 Dec 2020 07:27:41 +0000 (UTC) Received: by mail-pf1-x42a.google.com with SMTP id t8so3512052pfg.8 for ; Fri, 25 Dec 2020 23:27:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=L8GGgM7l/Z+uLcK0VX8XLcIwCoiz2TK5LMRLoGa3F+0=; b=CXUuIwjDUcrPLtGriXegK2Yk1WUXrrLg8+KARulkVaKqKvJrGEXhaeHYlMySirS3Kz Dvt15AssIESuRoNz0lDzpqmWmMwzkUpnJ9nAfxXRMbVAIVpCZyKQOU1DzpJr20N+qwNF 82nE0wXNtx/u793w5e/Qk5cf+YKhr8BdwScDyQovrfxXF2RNe9XgjUGLN2X/FQvWDIGg iMQkNO3Khk05nrKS+DzehDvnp/aJoGC+Nw7n6KW3eBAFJxiVkIp5xed4H+xPZmknC5Rv QGZFdDAA39sw+QJBm8sOBs2r26wBCLxXol3LVzzrUT0mmpXiTvO9e0WJxlXU3zYg6Ykk hfDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L8GGgM7l/Z+uLcK0VX8XLcIwCoiz2TK5LMRLoGa3F+0=; b=NkDMfkkIOvKAHRyRsDU3WsJP0BIklrjAnEwC5MHQ2W3xU3mQZAPtGWC7txRn3edl9m GrTDFxsmkjyWeotxSyBAR5MivU6K851rjGxn6+IDLGtIlwFDclJZOuRwVwxzfOrw2HxM dIVVuOrLnyEt6M+jWGl6xDmL17OkH+TPJC09oKh+uIZW8aFfDU3qSkEKjXzDivIq6fm6 gDBb5CieqtC0o2ID0GfkUi6udnwsIijuzG3cvXvA/M6sVzk61NBSUffYxF+Ki69aUPFs JznnMCkg7/LY4mMQmFE2kHpJAV8wsxISoiiFLyTRn1zn639+ERtaIltR1OdYYjQl7FPt vt0g== X-Gm-Message-State: AOAM5332suPrPgVvD4hyJVf8BlV55a9Cdt2uYeYaGv7iwfW5noLEa0Je goMK1vtakGPeMuVgJ9jEyXBisM44/3k= X-Google-Smtp-Source: ABdhPJzq3CSci8PLeI3V74HbTmzJi/uakiNT906J+bnJ7OexKxsatGmX1cOg1unW0g2ONa2+GPdtNg== X-Received: by 2002:a63:5023:: with SMTP id e35mr35393005pgb.56.1608967659363; Fri, 25 Dec 2020 23:27:39 -0800 (PST) Received: from archbookpro.hsd1.ca.comcast.net (c-67-188-114-10.hsd1.ca.comcast.net. [67.188.114.10]) by smtp.gmail.com with ESMTPSA id q35sm7234652pjh.38.2020.12.25.23.27.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Dec 2020 23:27:38 -0800 (PST) From: Denton Liu To: pacman-contrib@lists.archlinux.org Subject: [PATCH 2/4] pacdiff: Implement die() Date: Fri, 25 Dec 2020 23:27:18 -0800 Message-Id: X-Mailer: git-send-email 2.29.2.889.g5298b911bd In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: pacman-contrib@lists.archlinux.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussion list for pacman-contrib development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: pacman-contrib-bounces@lists.archlinux.org Sender: "pacman-contrib" Authentication-Results: mail.archlinux.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=CXUuIwjD; dmarc=pass (policy=none) header.from=gmail.com; spf=none (mail.archlinux.org: domain of pacman-contrib-bounces@lists.archlinux.org has no SPF policy when checking 2a01:4f8:160:3033::2) smtp.mailfrom=pacman-contrib-bounces@lists.archlinux.org X-Rspamd-Queue-Id: 03B4F32298B X-Spamd-Result: default: False [2.99 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_MISSING_CHARSET(2.50)[]; TO_DN_NONE(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[67.188.114.10:received]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_COUNT_FIVE(0.00)[6]; FROM_HAS_DN(0.00)[]; FROM_NEQ_ENVFROM(0.00)[liudenton@gmail.com,pacman-contrib-bounces@lists.archlinux.org]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[pacman-contrib@lists.archlinux.org]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM(-0.00)[-1.000]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER_MAILLIST(0.00)[] X-Rspamd-Server: mail.archlinux.org In a future commit, we will be making more use of this function. For now, implement it and use it in the one place where it's applicable. Signed-off-by: Denton Liu --- src/pacdiff.sh.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pacdiff.sh.in b/src/pacdiff.sh.in index c4dbd89..46a5adf 100644 --- a/src/pacdiff.sh.in +++ b/src/pacdiff.sh.in @@ -34,6 +34,11 @@ declare -i USE_FIND=0 USE_LOCATE=0 USE_PACDB=0 OUTPUTONLY=0 # Import libmakepkg source "$LIBRARY"/util/message.sh +die() { + error "$@" + exit 1 +} + usage() { cat </dev/null && (( ! OUTPUTONLY )); then - error "Cannot find the $diffprog binary required for viewing differences." - exit 1 + die "Cannot find the $diffprog binary required for viewing differences." fi case $(( USE_FIND + USE_LOCATE + USE_PACDB )) in