From patchwork Sat Sep 16 21:52:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Shumaker X-Patchwork-Id: 256 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost.localdomain [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 41937140C818 for ; Sat, 16 Sep 2017 21:53:16 +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.3 required=2.5 tests=RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.1 Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Sat, 16 Sep 2017 21:53:16 +0000 (UTC) Received: from orion.archlinux.org (localhost.localdomain [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 7B68167A243FE; Sat, 16 Sep 2017 21:53:14 +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; Sat, 16 Sep 2017 21:53:14 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 5ED052BD76; Sat, 16 Sep 2017 21:53:14 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=none Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 2642D2BD74 for ; Sat, 16 Sep 2017 21:53:13 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Sat, 16 Sep 2017 21:53:13 +0000 (UTC) Received: from orion.archlinux.org (localhost.localdomain [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 90F8767A243F7; Sat, 16 Sep 2017 21:53:12 +0000 (UTC) Received: from mav.lukeshu.com (mav.lukeshu.com [IPv6:2001:19f0:5c00:8069:5400:ff:fe26:6a86]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Sat, 16 Sep 2017 21:53:12 +0000 (UTC) Received: from build64-par (unknown [IPv6:2601:803:202:9275:21f:e2ff:fe4d:191b]) by mav.lukeshu.com (Postfix) with ESMTPSA id 8710683CF1; Sat, 16 Sep 2017 17:53:11 -0400 (EDT) From: Luke Shumaker To: arch-projects@archlinux.org Date: Sat, 16 Sep 2017 17:52:39 -0400 Message-Id: <3e0d01666b05313ad4636f3096cb466b49b6dd11.1505598374.git.lukeshu@parabola.nu> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: <9a3433a5-9e51-f85c-8f35-466efe166fd8@archlinux.org> References: <9a3433a5-9e51-f85c-8f35-466efe166fd8@archlinux.org> <87377m9v91.wl-lukeshu@lukeshu.com> Subject: [arch-projects] [devtools][PATCH 1/1] makechrootpkg: move init_variables() to be part of main() X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.24 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: Luke Shumaker Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" The reason it wasn't moved before was just to keep the diffs (with --ignore-all-space) smaller, to make merging and rebasing work easier. Moving code around in a file tends to make that difficult. But, readability wise, it belongs in main(). --- makechrootpkg.in | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/makechrootpkg.in b/makechrootpkg.in index 160ec9a..05826b2 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -15,29 +15,6 @@ m4_include(lib/archroot.sh) shopt -s nullglob -init_variables() { - default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg) - makepkg_args=("${default_makepkg_args[@]}") - keepbuilddir=false - update_first=false - clean_first=false - run_namcap=false - temp_chroot=false - chrootdir= - passeddir= - makepkg_user= - declare -ga install_pkgs - declare -gi ret=0 - - bindmounts_ro=() - bindmounts_rw=() - - copy=$USER - [[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER - [[ -z "$copy" || $copy = root ]] && copy=copy - src_owner=${SUDO_USER:-$USER} -} - usage() { echo "Usage: ${0##*/} [options] -r [--] [makepkg args]" echo ' Run this script in a PKGBUILD dir to build a package inside a' @@ -325,7 +302,26 @@ move_products() { # }}} main() { - init_variables + default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg) + makepkg_args=("${default_makepkg_args[@]}") + keepbuilddir=false + update_first=false + clean_first=false + run_namcap=false + temp_chroot=false + chrootdir= + passeddir= + makepkg_user= + declare -a install_pkgs + declare -i ret=0 + + bindmounts_ro=() + bindmounts_rw=() + + copy=$USER + [[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER + [[ -z "$copy" || $copy = root ]] && copy=copy + src_owner=${SUDO_USER:-$USER} while getopts 'hcur:I:l:nTD:d:U:' arg; do case "$arg" in