From 4fc356ae8183780fc5a6dd875600fd0e3ee9d6fd Mon Sep 17 00:00:00 2001 From: bill-auger Date: Sun, 9 Aug 2020 00:35:39 -0400 Subject: normalize `source` calls --- src/abslibre-tools/createworkdir | 6 ++++-- src/abslibre-tools/diff-unfree | 6 ++++-- src/abslibre-tools/libreaddiff | 6 ++++-- src/abslibre-tools/libredbdiff | 8 ++++++-- src/abslibre-tools/librerelease | 8 ++++++-- src/abslibre-tools/librestage | 6 ++++-- src/aur | 4 +++- src/chroot-tools/chcleanup.in | 2 +- src/chroot-tools/chcleanup.lib.gen | 2 +- src/chroot-tools/librechroot | 7 ++++--- src/chroot-tools/libremakepkg | 13 +++++++------ src/dagpkg | 7 +++++-- src/gitget/gitget | 4 +++- src/gitget/libregit | 4 +++- src/is_built | 4 +++- src/lib/blacklist.sh | 6 ++++-- src/lib/conf.sh.in | 4 ++-- src/lib/libreblacklist | 7 ++++--- src/lib/librelib | 2 +- src/lib/libremessages | 5 +++-- src/lib/librexgettext | 3 ++- src/lib/messages.sh | 2 +- src/librefetch/librefetch | 6 ++++-- src/librefetch/librefetch-install | 5 ++++- src/pkgbuild-check-nonfree | 6 +++--- src/pkgbuild-summarize-nonfree | 2 +- src/repo-diff | 4 +++- src/toru/toru-info | 6 ++++-- src/toru/toru-path | 6 ++++-- src/toru/toru-where | 4 +++- 30 files changed, 101 insertions(+), 54 deletions(-) diff --git a/src/abslibre-tools/createworkdir b/src/abslibre-tools/createworkdir index 0cf4a7a..d6f45a1 100755 --- a/src/abslibre-tools/createworkdir +++ b/src/abslibre-tools/createworkdir @@ -23,10 +23,12 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . + set -euE -. "$(librelib messages)" -. "$(librelib conf)" +source "$(librelib conf)" +source "$(librelib messages)" + main() { load_conf libretools.conf WORKDIR ABSLIBRERECV ABSLIBRESEND diff --git a/src/abslibre-tools/diff-unfree b/src/abslibre-tools/diff-unfree index 2587efd..01dba8d 100755 --- a/src/abslibre-tools/diff-unfree +++ b/src/abslibre-tools/diff-unfree @@ -23,8 +23,10 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -. "$(librelib messages)" -. "$(librelib conf)" + +source "$(librelib messages)" +source "$(librelib conf)" + usage() { print "Usage: %s [community|packages] [unfree-package] [repo]" "${0##*/}" diff --git a/src/abslibre-tools/libreaddiff b/src/abslibre-tools/libreaddiff index 8482f92..a65c67e 100755 --- a/src/abslibre-tools/libreaddiff +++ b/src/abslibre-tools/libreaddiff @@ -20,10 +20,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . + set -e -. "$(librelib messages)" -. "$(librelib conf)" +source "$(librelib conf)" +source "$(librelib messages)" + usage() { print 'Usage: %s repo [arch]' "${0##*/}" diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff index 28031a2..2d92c4d 100755 --- a/src/abslibre-tools/libredbdiff +++ b/src/abslibre-tools/libredbdiff @@ -19,9 +19,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . + set -euE -o pipefail -. "$(librelib messages)" -. "$(librelib conf)" + +source "$(librelib conf)" +source "$(librelib messages)" + setup_traps declare -r name="Libredbdiff" @@ -34,6 +37,7 @@ declare -r field_pkgname_total="$((field_pkgname_prbl + field_pkgname_arch))" declare -r printf_format="%s %-${field_pkgname_prbl}s%-${field_pkgname_arch}s %s | %s\n" declare -r printf_format_noarch="%s %-${field_pkgname_total}s %s\n" + init_conf() { declare -rg conffile_prbl="$statedir/pacman.conf.parabola" declare -rg conffile_arch="$statedir/pacman.conf.archlinux" diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease index 9c301ee..c8518fb 100755 --- a/src/abslibre-tools/librerelease +++ b/src/abslibre-tools/librerelease @@ -36,9 +36,12 @@ # create_signature() is taken from pacman:makepkg, which is GPLv2+, # so we take the '+' to combine it with our GPLv3+. + set -euE -. "$(librelib messages)" -. "$(librelib conf)" + +source "$(librelib conf)" +source "$(librelib messages)" + setup_traps dryrun="" @@ -53,6 +56,7 @@ readonly rsync_flags=( --progress ) + # Functions #################################################################### list0_files() { diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage index c68b61b..93538b1 100755 --- a/src/abslibre-tools/librestage +++ b/src/abslibre-tools/librestage @@ -23,8 +23,10 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -. "$(librelib messages)" -. "$(librelib conf)" + +source "$(librelib conf)" +source "$(librelib messages)" + LimitArch="*" diff --git a/src/aur b/src/aur index 8ec7b60..1ead68d 100755 --- a/src/aur +++ b/src/aur @@ -20,7 +20,9 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -. "$(librelib messages)" + +source "$(librelib messages)" + usage() { print "Usage: %s [-h] PKGNAME [PKGNAME2 PKGNAME3...]" "${0##*/}" diff --git a/src/chroot-tools/chcleanup.in b/src/chroot-tools/chcleanup.in index 700c8b5..55ab9bf 100644 --- a/src/chroot-tools/chcleanup.in +++ b/src/chroot-tools/chcleanup.in @@ -68,7 +68,7 @@ if [[ -f ./PKGBUILD ]]; then if [[ ! -f ./.SRCINFO || ./PKGBUILD -nt ./.SRCINFO ]]; then sudo -u "#$(stat -c %u -- ./PKGBUILD)" sh -c 'makepkg --printsrcinfo > .SRCINFO' fi - CARCH="$(. /etc/makepkg.conf; printf '%s' "$CARCH")" + CARCH="$(source /etc/makepkg.conf; printf '%s' "$CARCH")" mapfile -t DEPENDS < <(sed -nE -e "s/^\\s+(|make|check)depends(|_${CARCH}) = //p" -e '/^\s*pkgname/q' < .SRCINFO) else DEPENDS=() diff --git a/src/chroot-tools/chcleanup.lib.gen b/src/chroot-tools/chcleanup.lib.gen index 71dc327..1ea1766 100755 --- a/src/chroot-tools/chcleanup.lib.gen +++ b/src/chroot-tools/chcleanup.lib.gen @@ -4,5 +4,5 @@ set -e commonsh=$1 echo '. /usr/share/makepkg/util.sh' -. "$commonsh"; declare -f _l _p +source "$commonsh"; declare -f _l _p sed -n '/^eval/,/^\S/p' "$commonsh" diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 0edbdd9..56a8292 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -32,13 +32,14 @@ set -euE # - the case statement in main() that runs them -. "$(librelib conf)" -. "$(librelib messages)" -. "$(librelib chroot/makechrootpkg)" +source "$(librelib conf)" +source "$(librelib messages)" +source "$(librelib chroot/makechrootpkg)" shopt -s nullglob umask 0022 + ################################################################################ # Wrappers for files in ${pkglibexecdir}/chroot/ # ################################################################################ diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index d6bb17f..274600d 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -24,9 +24,10 @@ set -euE # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -. "$(librelib conf)" -. "$(librelib messages)" -. "$(librelib chroot/makechrootpkg)" + +source "$(librelib conf)" +source "$(librelib messages)" +source "$(librelib chroot/makechrootpkg)" set -o pipefail shopt -s nullglob @@ -47,9 +48,9 @@ hook_pre_build=(:) hook_post_build=(:) hook_check_pkgbuild=(:) hook_check_pkg=(:) -. "$(librelib chroot/hooks-chcleanup.sh)" -. "$(librelib chroot/hooks-check.sh)" -. "$(librelib chroot/hooks-distcc.sh)" +source "$(librelib chroot/hooks-chcleanup.sh)" +source "$(librelib chroot/hooks-check.sh)" +source "$(librelib chroot/hooks-distcc.sh)" # Boring/mundane functions ##################################################### diff --git a/src/dagpkg b/src/dagpkg index 1196149..400b017 100755 --- a/src/dagpkg +++ b/src/dagpkg @@ -21,10 +21,13 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . + + set -e -. "$(librelib messages)" -. "$(librelib conf)" +source "$(librelib conf)" +source "$(librelib messages)" + # Globals: # - temp_dir diff --git a/src/gitget/gitget b/src/gitget/gitget index 59b2fba..b139590 100755 --- a/src/gitget/gitget +++ b/src/gitget/gitget @@ -18,7 +18,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. "$(librelib messages)" + +source "$(librelib messages)" + # from makepkg dir_is_empty() { diff --git a/src/gitget/libregit b/src/gitget/libregit index e80d6cc..9301fcc 100755 --- a/src/gitget/libregit +++ b/src/gitget/libregit @@ -17,7 +17,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. "$(librelib messages)" + +source "$(librelib messages)" + usage() { print 'Usage: %s REPO REF DIR' "${0##*/}" diff --git a/src/is_built b/src/is_built index 1a204a9..41569e0 100755 --- a/src/is_built +++ b/src/is_built @@ -20,7 +20,9 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -. "$(librelib messages)" + +source "$(librelib messages)" + usage() { print "Usage: %s [-h] PKGNAME [PKGVER]" "${0##*/}" "${0##*/}" diff --git a/src/lib/blacklist.sh b/src/lib/blacklist.sh index 84333e8..6b1898d 100755 --- a/src/lib/blacklist.sh +++ b/src/lib/blacklist.sh @@ -19,8 +19,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . + # make sure XDG_CACHE_HOME is set -. "$(librelib conf)" +source "$(librelib conf)" + # Usage: blacklist-normalize <$file # Normalizes the syntax of the blacklist on stdin. @@ -50,7 +52,7 @@ blacklist-cat() { # Usage: blacklist-update # Updates (or creates) the cached copy of the blacklist. blacklist-update() ( - . "$(librelib messages)" + source "$(librelib messages)" load_conf libretools.conf BLACKLIST || return local remote_blacklist="$BLACKLIST" diff --git a/src/lib/conf.sh.in b/src/lib/conf.sh.in index 0cd0a03..25afa1d 100644 --- a/src/lib/conf.sh.in +++ b/src/lib/conf.sh.in @@ -127,7 +127,7 @@ load_conf() { # Load the files for file in "${files[@]}"; do if [[ -r $file ]]; then - . "$file" || return 6 # $EXIT_NOTCONFIGURED + source "$file" || return 6 # $EXIT_NOTCONFIGURED fi done @@ -236,6 +236,6 @@ load_PKGBUILD() { unset_PKGBUILD # shellcheck disable=2034 CARCH="$(get_var makepkg CARCH "$(uname -m)")" - . "$file" + source "$file" pkgbase=${pkgbase:-${pkgname[0]}} } diff --git a/src/lib/libreblacklist b/src/lib/libreblacklist index 809e141..948647e 100755 --- a/src/lib/libreblacklist +++ b/src/lib/libreblacklist @@ -17,12 +17,12 @@ # along with this program. If not, see . if [[ "${0##*/}" != libreblacklist ]]; then - . "$(librelib blacklist)" + source "$(librelib blacklist)" else set -euE lib_file="$(librelib blacklist)" - . "$lib_file" + source "$lib_file" usage-outside() { sed -n '/^# Usage:/,/()/p' "$lib_file" | @@ -40,7 +40,8 @@ else usage() { export TEXTDOMAIN='librelib' export TEXTDOMAINDIR='/usr/share/locale' - . "$(librelib messages)" + source "$(librelib messages)" + if [[ $# -eq 0 ]]; then print "Usage: %s [-h] COMMAND [ARGUMENTS]" "${0##*/}" print "Tool for working with the nonfree software blacklist" diff --git a/src/lib/librelib b/src/lib/librelib index b3fb9c2..caf26fe 100755 --- a/src/lib/librelib +++ b/src/lib/librelib @@ -49,7 +49,7 @@ usage() { changed with the environmental variable LIBRETOOLS_LIBRARY_PATH.' "$default_libdir" echo print "Example usage:" - printf ' . $(%s conf)\n' "$cmd" + printf ' source $(%s conf)\n' "$cmd" echo print "Options:" flag '-h' 'Show this message' diff --git a/src/lib/libremessages b/src/lib/libremessages index 95f2afa..43779af 100755 --- a/src/lib/libremessages +++ b/src/lib/libremessages @@ -16,10 +16,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . + if [[ "${0##*/}" != libremessages ]]; then - . "$(librelib messages)" + source "$(librelib messages)" else set -euE - . "$(librelib messages)" + source "$(librelib messages)" "$@" fi diff --git a/src/lib/librexgettext b/src/lib/librexgettext index dce7010..793dec7 100755 --- a/src/lib/librexgettext +++ b/src/lib/librexgettext @@ -52,7 +52,8 @@ errusage() { } usage() { - . "$(librelib messages)" + source "$(librelib messages)" + print 'Usage: %s [OPTIONS] FILES...' "${0##*/}" print 'Generates .pot files for programs using libremessages' echo diff --git a/src/lib/messages.sh b/src/lib/messages.sh index 67cdab5..283102d 100644 --- a/src/lib/messages.sh +++ b/src/lib/messages.sh @@ -36,7 +36,7 @@ _INCLUDE_MESSAGES_SH=true # Inherit most functions from devtools # ################################################################################ -. "$(librelib common)" +source "$(librelib common)" ################################################################################ # Own functions # diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 38355b2..d8e40a6 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -32,8 +32,10 @@ # create_signature() is taken from pacman:makepkg, which is GPLv2+, # so we take the '+' to combine it with our GPLv3+. -. "$(librelib conf)" -. "$(librelib messages)" + +source "$(librelib conf)" +source "$(librelib messages)" + setup_traps trap 'rm -f -- "${tmpfiles[@]}"; rm -rf -- "${tmpdirs[@]}"' EXIT diff --git a/src/librefetch/librefetch-install b/src/librefetch/librefetch-install index 2cdb014..5f4fd82 100755 --- a/src/librefetch/librefetch-install +++ b/src/librefetch/librefetch-install @@ -20,8 +20,11 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . + set -ueE -. "$(librelib messages)" + +source "$(librelib messages)" + # These lines were installed by previous versions of this script old_code=( diff --git a/src/pkgbuild-check-nonfree b/src/pkgbuild-check-nonfree index 965d0ab..6cd6b1c 100755 --- a/src/pkgbuild-check-nonfree +++ b/src/pkgbuild-check-nonfree @@ -30,9 +30,9 @@ # i appologize that i deleted your vim metadata - no wait, not sorry :) -. "$(librelib messages)" -. "$(librelib conf)" -. "$(librelib blacklist)" +source "$(librelib blacklist)" +source "$(librelib conf)" +source "$(librelib messages)" usage() { diff --git a/src/pkgbuild-summarize-nonfree b/src/pkgbuild-summarize-nonfree index 2cf5ea6..fe0e342 100755 --- a/src/pkgbuild-summarize-nonfree +++ b/src/pkgbuild-summarize-nonfree @@ -19,7 +19,7 @@ # along with Parabola. If not, see . -. "$(librelib messages)" +source "$(librelib messages)" # Make sure these match pkgbuild-check-nonfree declare -ri _E_ERROR=1 diff --git a/src/repo-diff b/src/repo-diff index 58f9ba7..403dd47 100755 --- a/src/repo-diff +++ b/src/repo-diff @@ -19,7 +19,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. "$(librelib messages)" + +source "$(librelib messages)" + usage() { print "Usage: %s arch/core/i686 parabola/core/i686" "${0##*/}" diff --git a/src/toru/toru-info b/src/toru/toru-info index 0226ea5..538d011 100755 --- a/src/toru/toru-info +++ b/src/toru/toru-info @@ -19,8 +19,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. "$(librelib messages)" -. "$(librelib conf)" + +source "$(librelib conf)" +source "$(librelib messages)" + main() { for _pkg in "$@"; do diff --git a/src/toru/toru-path b/src/toru/toru-path index 84b3d4c..d9c35e6 100755 --- a/src/toru/toru-path +++ b/src/toru/toru-path @@ -20,8 +20,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. "$(librelib messages)" -. "$(librelib conf)" + +source "$(librelib conf)" +source "$(librelib messages)" + usage() { print 'Usage: [T=$TORUPATH] [V=true] [F=true] %q [-h]' "${0##*/}" diff --git a/src/toru/toru-where b/src/toru/toru-where index 5eb491b..3e53926 100755 --- a/src/toru/toru-where +++ b/src/toru/toru-where @@ -18,7 +18,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. "$(librelib conf)" + +source "$(librelib conf)" + main() { load_conf libretools.conf TORUPATH || exit -- cgit v1.2.2