summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@parabola.nu>2024-02-28 00:59:27 -0700
committerLuke T. Shumaker <lukeshu@parabola.nu>2024-02-28 01:01:57 -0700
commit36cf1d5ec6016c732675013ae12a7a49e06e990e (patch)
treea8098ca2c5ee14e3e3f15611f25ba0fe91de994c
parentfeac111b684c5503c167ddd3a97677522c5d4481 (diff)
make formatlukeshu/fmt
-rwxr-xr-xbuild-aux/write-atomic6
-rwxr-xr-xbuild-aux/write-ifchanged6
-rwxr-xr-xsrc/abslibre-tools/diff-unfree11
-rwxr-xr-xsrc/abslibre-tools/libreaddiff24
-rwxr-xr-xsrc/abslibre-tools/libredbdiff94
-rwxr-xr-xsrc/abslibre-tools/librerelease56
-rwxr-xr-xsrc/abslibre-tools/librestage47
-rwxr-xr-xsrc/aur20
-rwxr-xr-xsrc/chroot-tools/chcleanup.lib.gen3
-rwxr-xr-xsrc/chroot-tools/distcc-tool34
-rw-r--r--src/chroot-tools/hooks-distcc.sh13
-rwxr-xr-xsrc/chroot-tools/librechroot162
-rwxr-xr-xsrc/chroot-tools/libremakepkg72
-rwxr-xr-xsrc/dagpkg13
-rwxr-xr-xsrc/gitget/gitget66
-rwxr-xr-xsrc/gitget/libregit5
-rwxr-xr-xsrc/is_built10
-rwxr-xr-xsrc/lib/blacklist.sh6
-rwxr-xr-xsrc/lib/libreblacklist14
-rwxr-xr-xsrc/lib/librelib4
-rwxr-xr-xsrc/lib/libremessages10
-rwxr-xr-xsrc/lib/librexgettext74
-rw-r--r--src/lib/messages.sh40
-rwxr-xr-xsrc/librefetch/librefetch93
-rwxr-xr-xsrc/librefetch/librefetch-install13
-rwxr-xr-xsrc/librefetch/librefetchdir/libmakepkg/tidy/purge.sh9
-rwxr-xr-xsrc/librefetch/librefetchdir/libmakepkg/tidy/~source_date_epoch.sh4
-rw-r--r--src/libretools.conf2
-rwxr-xr-xsrc/pkgbuild-check-nonfree83
-rwxr-xr-xsrc/pkgbuild-summarize-nonfree32
-rwxr-xr-xsrc/repo-diff15
-rwxr-xr-xsrc/toru/toru-path24
-rw-r--r--test/cases/gitget.bats2
-rw-r--r--test/cases/lib-blacklist.bats79
-rw-r--r--test/cases/lib-conf.bats8
-rw-r--r--test/cases/lib-messages.bats12
-rw-r--r--test/cases/librechroot.bats21
-rw-r--r--test/cases/libredbdiff.bats2
-rw-r--r--test/cases/librefetch.bats16
-rw-r--r--test/cases/librelib.bats16
-rw-r--r--test/cases/libremakepkg.bats53
-rw-r--r--test/cases/librerelease.bats52
-rw-r--r--test/cases/librestage.bats10
-rw-r--r--test/cases/librexgettext.bats13
-rw-r--r--test/cases/pkgbuild-check-nonfree.bats6
-rw-r--r--test/cases/toru-path.bats38
-rw-r--r--test/fixtures/librechroot/PKGBUILD-arches12
-rw-r--r--test/fixtures/librechroot/PKGBUILD-libretools12
-rw-r--r--test/fixtures/librefetch/PKGBUILD-bz212
-rw-r--r--test/fixtures/librefetch/PKGBUILD-mksource12
-rw-r--r--test/fixtures/librefetch/PKGBUILD-recurse12
-rw-r--r--test/fixtures/librefetch/PKGBUILD-split14
-rw-r--r--test/fixtures/librefetch/PKGBUILD-srcbuild2
-rw-r--r--test/fixtures/librefetch/SRCBUILD-srcbuild12
-rw-r--r--test/fixtures/libremakepkg/PKGBUILD-distcc26
-rw-r--r--test/fixtures/libremakepkg/PKGBUILD-hello10
-rw-r--r--test/fixtures/libremakepkg/PKGBUILD-netbuild8
-rw-r--r--test/fixtures/libremakepkg/PKGBUILD-netpackage4
-rw-r--r--test/fixtures/libremakepkg/PKGBUILD-netprepare8
-rw-r--r--test/fixtures/libremakepkg/PKGBUILD-pkgver12
-rw-r--r--test/fixtures/libremakepkg/PKGBUILD-rwstartdir4
-rw-r--r--test/fixtures/libremakepkg/PKGBUILD-signed6
-rw-r--r--test/fixtures/libremakepkg/PKGBUILD-testpkg110
-rw-r--r--test/fixtures/libremakepkg/PKGBUILD-testpkg210
-rw-r--r--test/fixtures/librestage/PKGBUILD-hello10
-rw-r--r--test/fixtures/librexgettext/combine1.sh2
-rw-r--r--test/fixtures/librexgettext/combine2.sh2
-rw-r--r--test/fixtures/librexgettext/test_librexgettext_fails_on_subshell_flag_descriptions.sh6
-rw-r--r--test/fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh16
-rw-r--r--test/fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh18
-rw-r--r--test/fixtures/toru/libre/simple/PKGBUILD2
-rw-r--r--test/fixtures/toru/libre/split-base/PKGBUILD6
-rw-r--r--test/fixtures/toru/libre/split/PKGBUILD6
-rw-r--r--test/lib/common.bash12
-rwxr-xr-xtest/testenv39
75 files changed, 949 insertions, 749 deletions
diff --git a/build-aux/write-atomic b/build-aux/write-atomic
index ab2a417..68d09e7 100755
--- a/build-aux/write-atomic
+++ b/build-aux/write-atomic
@@ -17,5 +17,9 @@
outfile=$1
tmpfile="$(dirname "$outfile")/.tmp.${outfile##*/}.tmp"
-cat > "$tmpfile" || { r=$?; rm -f "$tmpfile"; exit $r; }
+cat >"$tmpfile" || {
+ r=$?
+ rm -f "$tmpfile"
+ exit $r
+}
mv -f "$tmpfile" "$outfile"
diff --git a/build-aux/write-ifchanged b/build-aux/write-ifchanged
index 84dfd6e..4571676 100755
--- a/build-aux/write-ifchanged
+++ b/build-aux/write-ifchanged
@@ -17,9 +17,9 @@
outfile=$1
tmpfile="$(dirname "$outfile")/.tmp.${outfile##*/}.tmp"
-cat > "$tmpfile" || exit $?
+cat >"$tmpfile" || exit $?
if cmp -s "$tmpfile" "$outfile"; then
- rm -f "$tmpfile" || :
+ rm -f "$tmpfile" || :
else
- mv -f "$tmpfile" "$outfile"
+ mv -f "$tmpfile" "$outfile"
fi
diff --git a/src/abslibre-tools/diff-unfree b/src/abslibre-tools/diff-unfree
index 2587efd..b8ed8e9 100755
--- a/src/abslibre-tools/diff-unfree
+++ b/src/abslibre-tools/diff-unfree
@@ -35,7 +35,7 @@ usage() {
}
main() {
- if [[ "$1" == "--help" ]]; then
+ if [[ $1 == "--help" ]]; then
usage
return $EXIT_SUCCESS
fi
@@ -49,9 +49,9 @@ main() {
svnrepo="packages"
case $repo in
- community*) svnrepo="community";;
- multilib*) svnrepo="community";;
- *) :;;
+ community*) svnrepo="community" ;;
+ multilib*) svnrepo="community" ;;
+ *) : ;;
esac
if [[ ! -r PKGBUILD ]]; then
@@ -59,9 +59,8 @@ main() {
exit $EXIT_FAILURE
fi
-
tmp_dir="$(mktemp --tmpdir -d "${package}.XXXXXX")"
- if [[ ! -d "${tmp_dir}" ]]; then
+ if [[ ! -d ${tmp_dir} ]]; then
error "Can't create temp dir"
exit $EXIT_FAILURE
fi
diff --git a/src/abslibre-tools/libreaddiff b/src/abslibre-tools/libreaddiff
index 8482f92..5a48a37 100755
--- a/src/abslibre-tools/libreaddiff
+++ b/src/abslibre-tools/libreaddiff
@@ -37,8 +37,14 @@ main() {
while getopts 'h' arg; do
case "$arg" in
- h) usage; exit $EXIT_SUCCESS ;;
- *) usage >&2; exit $EXIT_INVALIDARGUMENT ;;
+ h)
+ usage
+ exit $EXIT_SUCCESS
+ ;;
+ *)
+ usage >&2
+ exit $EXIT_INVALIDARGUMENT
+ ;;
esac
done
if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then
@@ -52,9 +58,9 @@ main() {
local arch=${2:-mips64el}
diff -U0 \
- <(pacman_list_packages "$repo" "$arch" | sort) \
- <(abslibre_list_packages "$repo" "$arch" | sort) \
- | sed -rn 's/^[+-][^+-].+$/&/p'
+ <(pacman_list_packages "$repo" "$arch" | sort) \
+ <(abslibre_list_packages "$repo" "$arch" | sort) |
+ sed -rn 's/^[+-][^+-].+$/&/p'
}
pacman_list_packages() {
@@ -92,11 +98,11 @@ abslibre_list_packages() {
local CARCH=$arch
local f name
- for f in "${WORKDIR}/abslibre/$repo"/* ; do
+ for f in "${WORKDIR}/abslibre/$repo"/*; do
load_PKGBUILD "$f/PKGBUILD" || continue
- if in_array 'any' "${arch[@]}" || in_array "$CARCH" "${arch[@]}" ; then
- for name in "${pkgname[@]}" ; do
- if [[ -z "$epoch" ]] ; then
+ if in_array 'any' "${arch[@]}" || in_array "$CARCH" "${arch[@]}"; then
+ for name in "${pkgname[@]}"; do
+ if [[ -z $epoch ]]; then
echo "$name-$pkgver-$pkgrel"
else
echo "$name-$epoch:$pkgver-$pkgrel"
diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff
index b5e6331..07080b7 100755
--- a/src/abslibre-tools/libredbdiff
+++ b/src/abslibre-tools/libredbdiff
@@ -58,7 +58,7 @@ enablerepo() {
createdir() {
local dir=$1
- if ! [[ -d "$dir" ]] ; then
+ if ! [[ -d $dir ]]; then
msg "Creating directory %q" "$dir"
mkdir -- "$dir" || die "Failed to create directory %q. Exiting." "$dir"
fi
@@ -66,15 +66,15 @@ createdir() {
# {{ A -lt B }} is like [ A -lt B ], but for pacman version numbers
{{() {
- [[ $# = 4 ]] || panic
- [[ $4 = '}}' ]] || panic
- local a=$1
- local op=$2
- local b=$3
-
- local cmp
- cmp="$(vercmp "$a" "$b")" || die "vercmp failed"
- [ "$cmp" "$op" 0 ]
+ [[ $# == 4 ]] || panic
+ [[ $4 == '}}' ]] || panic
+ local a=$1
+ local op=$2
+ local b=$3
+
+ local cmp
+ cmp="$(vercmp "$a" "$b")" || die "vercmp failed"
+ [ "$cmp" "$op" 0 ]
}
# Globals:
@@ -83,7 +83,7 @@ createdir() {
# - ver_arch : a map of pkgname->prbl_pkgver
# - provides : a map of pkgname->provides
compare_pkgs() {
- if [[ -n "${ver_arch[$pkgname]:-}" ]]; then
+ if [[ -n ${ver_arch[$pkgname]:-} ]]; then
if {{ "${ver_prbl[$pkgname]}" -lt "${ver_arch[$pkgname]}" }}; then
printf "$printf_format" \
'=' \
@@ -92,11 +92,11 @@ compare_pkgs() {
"${ver_prbl[$pkgname]}" \
"${ver_arch[$pkgname]}"
fi
- elif [[ -n "${provides[$pkgname]:-}" ]]; then
+ elif [[ -n ${provides[$pkgname]:-} ]]; then
local _provides provide
read -r -a _provides <<<"${provides[$pkgname]}"
for provide in "${_provides[@]}"; do
- if [[ -n "${ver_arch[$provide]:-}" ]]; then
+ if [[ -n ${ver_arch[$provide]:-} ]]; then
if {{ "${ver_prbl[$pkgname]}" -lt "${ver_arch[$provide]}" }}; then
printf "$printf_format" \
'p' \
@@ -123,9 +123,8 @@ compare_pkgs() {
print_cmp() {
local repo="$1"
- < "$prbl_packages_tmp" \
- awk -F/ -v repo="$repo" '$1 == repo {print $2}' |
- while read -r pkgname _pkgver _provides ; do
+ awk <"$prbl_packages_tmp" -F/ -v repo="$repo" '$1 == repo {print $2}' |
+ while read -r pkgname _pkgver _provides; do
ver_prbl["$pkgname"]="$_pkgver"
provides["$pkgname"]="$_provides"
compare_pkgs
@@ -143,17 +142,17 @@ usage() {
repository name can be specified as argument to compare only
packages in that repository."
echo
- prose "The default mode of operation requires root, and downloads or
+ prose 'The default mode of operation requires root, and downloads or
updates all necessary files for comparison, but does not compare
them. After that mode has been run, run the tool again without
- root with the the \`-n\` flag to not download anything, but to
- compare the already downloaded files."
+ root with the the `-n` flag to not download anything, but to
+ compare the already downloaded files.'
echo
- prose "In the compare mode (if the \`-n\` flag is given), by default it
+ prose 'In the compare mode (if the `-n` flag is given), by default it
will iterate over each of the configured repositories, prefixing
- each section with a line in the format \`[REPO]\`. However, if a
+ each section with a line in the format `[REPO]`. However, if a
REPO is specified on the command line, it scan for packages only
- in that repository, and no \`[REPO]\` line will be printed."
+ in that repository, and no `[REPO]` line will be printed.'
echo
print 'Options:'
flag '-n' "Don't update anything, just compare already downloaded files."
@@ -177,7 +176,7 @@ usage() {
echo
print "The line-format for packages is:"
printf "\t$printf_format" \
- status parabola_pkgname '[arch_pkgname]' parabola_pkgver arch_pkgver
+ status parabola_pkgname '[arch_pkgname]' parabola_pkgver arch_pkgver
echo
print "Where 'status' is one of the characters:"
flag '=' "An Arch package with the same pkgname as a Parabola package
@@ -199,10 +198,10 @@ main() {
arg=$1
shift
case "$arg" in
- -n|--noupdate)
+ -n | --noupdate)
mode=compare
;;
- -h|--help)
+ -h | --help)
usage
exit $EXIT_SUCCESS
;;
@@ -246,7 +245,7 @@ main() {
load_conf libredbdiff.conf statedir repos || exit
init_conf
- if [[ $# = 1 ]]; then
+ if [[ $# == 1 ]]; then
if ! in_array "$1" "${repos[@]}"; then
die "The specified Parabola repo \"%s\" cannot be compared. It's not in the list of repos in the configuration variable \"repos\"." "$1"
fi
@@ -263,10 +262,10 @@ main_update() {
msg "Generating %s %q" Parabola pacman.conf
cp -T /usr/share/pacman/defaults/pacman.conf.x86_64 "$conffile_prbl"
sed -r \
- -e "s|/etc/pacman\.d/mirrorlist$|$mirrorlist_prbl|" \
- -e "s|^#?DBPath\s*=.*|DBPath = $dbpath_prbl|" \
- -e "s|^#?Architecture\s*=.*|Architecture = x86_64|" \
- -i "$conffile_prbl"
+ -e "s|/etc/pacman\.d/mirrorlist$|$mirrorlist_prbl|" \
+ -e "s|^#?DBPath\s*=.*|DBPath = $dbpath_prbl|" \
+ -e "s|^#?Architecture\s*=.*|Architecture = x86_64|" \
+ -i "$conffile_prbl"
local repo
for repo in multilib {libre,pcr,nonprism}{,-multilib}; do
enablerepo "$repo" "$conffile_prbl"
@@ -274,19 +273,19 @@ main_update() {
msg "Generating %s %q" Arch pacman.conf
wget -q \
- -O "$conffile_arch" \
- "https://git.archlinux.org/svntogit/packages.git/plain/pacman/repos/core-x86_64/pacman.conf" ||
+ -O "$conffile_arch" \
+ "https://git.archlinux.org/svntogit/packages.git/plain/pacman/repos/core-x86_64/pacman.conf" ||
die "Failed to download %q. Exiting." "$conffile_arch"
sed -r \
- -e "s|/etc/pacman\.d/mirrorlist$|$mirrorlist_arch|" \
- -e "s|^#?DBPath\s*=.*|DBPath = $dbpath_arch|" \
- -e "s|^#?Architecture\s*=.*|Architecture = x86_64|" \
- -i "$conffile_arch"
+ -e "s|/etc/pacman\.d/mirrorlist$|$mirrorlist_arch|" \
+ -e "s|^#?DBPath\s*=.*|DBPath = $dbpath_arch|" \
+ -e "s|^#?Architecture\s*=.*|Architecture = x86_64|" \
+ -i "$conffile_arch"
enablerepo multilib "$conffile_arch"
- printf 'Server = %s\n' "$mirror_prbl" > "$mirrorlist_prbl"
+ printf 'Server = %s\n' "$mirror_prbl" >"$mirrorlist_prbl"
- printf 'Server = %s\n' "$mirror_arch" > "$mirrorlist_arch"
+ printf 'Server = %s\n' "$mirror_arch" >"$mirrorlist_arch"
}
createdir "$dbpath_prbl"
@@ -304,15 +303,14 @@ main_update() {
}
msg "%s pacman databases are updated. %s is ready. Run %q -n to print results." \
- "$name" "$name" "$cmd"
+ "$name" "$name" "$cmd"
}
main_compare() {
- if ! [[ -f "$conffile_prbl" && \
- -f "$conffile_arch" && \
- -f "$dbpath_prbl/sync/libre.db" && \
- -f "$dbpath_arch/sync/core.db" ]]
- then
+ if ! [[ -f $conffile_prbl &&
+ -f $conffile_arch &&
+ -f "$dbpath_prbl/sync/libre.db" &&
+ -f "$dbpath_arch/sync/core.db" ]]; then
error "You must run %q with out arguments as root to initialize." "$cmd"
usage >&2
exit $EXIT_INVALIDARGUMENT
@@ -328,22 +326,22 @@ main_compare() {
declare -gA provides ver_prbl ver_arch
expac --config "$conffile_arch" -S '%n %v' \
- > "$arch_packages_tmp" || \
+ >"$arch_packages_tmp" ||
die "expac command to get %s package data has failed. Exiting." Arch
local pkgname pkgver
while read -r pkgname pkgver; do
ver_arch["$pkgname"]="$pkgver"
- done < "$arch_packages_tmp"
+ done <"$arch_packages_tmp"
expac --config "$conffile_prbl" -S '%r/%n %v %S' \
- > "$prbl_packages_tmp" || \
+ >"$prbl_packages_tmp" ||
die "expac command to get %s package data has failed. Exiting." Parabola
if [[ $# == 1 ]]; then
print_cmp "$1"
else
- for repo in "${repos[@]}" ; do
+ for repo in "${repos[@]}"; do
echo "[$repo]"
print_cmp "$repo"
done
diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease
index b441a4c..d72d88b 100755
--- a/src/abslibre-tools/librerelease
+++ b/src/abslibre-tools/librerelease
@@ -74,8 +74,7 @@ create_signature() {
gpg --detach-sign --use-agent "${SIGNWITHKEY[@]}" --no-armor "$filename" &>/dev/null || ret=$EXIT_FAILURE
-
- if (( ! ret )); then
+ if ((!ret)); then
msg2 "Created signature file %s." "$filename.sig"
else
error "Failed to sign package file."
@@ -109,7 +108,7 @@ clean_files() (
local file_list=$1
local rmcmd=(rm -fv)
- if [[ -n "${dryrun}" ]]; then
+ if [[ -n ${dryrun} ]]; then
rmcmd=(printf "$(_ "removed '%s' (dry-run)")\n")
fi
@@ -117,7 +116,7 @@ clean_files() (
cd "${WORKDIR}/staging"
xargs -0r -a "$file_list" "${rmcmd[@]}"
find . -depth -mindepth 1 -type d \
- -exec rmdir --ignore-fail-on-non-empty -- '{}' +
+ -exec rmdir --ignore-fail-on-non-empty -- '{}' +
)
################################################################################
@@ -127,12 +126,12 @@ usage() {
print 'Upload packages in $WORKDIR/staging to the Parabola server'
echo
print "Options:"
- flag '-c' 'Clean; delete packages in $WORKDIR/staging'
- flag '-l' "List; list packages but not upload them"
- flag '-u' "Upload-only; do not run db-update on the server"
+ flag '-c' 'Clean; delete packages in $WORKDIR/staging'
+ flag '-l' "List; list packages but not upload them"
+ flag '-u' "Upload-only; do not run db-update on the server"
- flag '-n' "Dry-run; don't actually do anything"
- flag '-h' "Show this message"
+ flag '-n' "Dry-run; don't actually do anything"
+ flag '-h' "Show this message"
}
main() {
@@ -150,7 +149,10 @@ main() {
u) upload_only=true ;;
n) dryrun="--dry-run" ;;
h) mode=usage ;;
- *) usage >&2; return $EXIT_INVALIDARGUMENT ;;
+ *)
+ usage >&2
+ return $EXIT_INVALIDARGUMENT
+ ;;
esac
done
shift $((OPTIND - 1))
@@ -167,12 +169,12 @@ main() {
declare -i ret=0
load_conf makepkg.conf GPGKEY || ret=$?
load_conf libretools.conf WORKDIR REPODEST DBSCRIPTS_CONFIG || ret=$? # and HOOK{PRE,POST}RELEASE, which are optional
- [[ $ret = 0 ]] || exit $ret
+ [[ $ret == 0 ]] || exit $ret
local re_url='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$'
local re_authority='^(([^@]*)@)?([^][@:]*|\[[^]]*\])(:([0-9]*))?$'
local REPODEST_ok=false
- if [[ "$REPODEST" =~ $re_url ]]; then
+ if [[ $REPODEST =~ $re_url ]]; then
REPODEST_ok=true
REPODEST_scheme=${BASH_REMATCH[2]}
@@ -181,12 +183,12 @@ main() {
REPODEST_query=${BASH_REMATCH[7]}
REPODEST_fragment=${BASH_REMATCH[9]}
- if [[ "$REPODEST_authority" =~ $re_authority ]]; then
+ if [[ $REPODEST_authority =~ $re_authority ]]; then
REPODEST_userinfo=${BASH_REMATCH[2]}
REPODEST_host=${BASH_REMATCH[3]}
REPODEST_port=${BASH_REMATCH[5]}
- if [[ "$REPODEST_host" = '['*']' ]]; then
+ if [[ $REPODEST_host == '['*']' ]]; then
REPODEST_host=${REPODEST_HOST#'['}
REPODEST_host=${REPODEST_HOST#']'}
fi
@@ -203,8 +205,8 @@ main() {
plain 'Merge the /etc/libretools.conf.pacnew file!'
return $EXIT_NOTCONFIGURED
fi
- if [[ "$REPODEST_path" = '/~'* ]]; then
- if [[ "$REPODEST_path" = '/~/'* ]]; then
+ if [[ $REPODEST_path == '/~'* ]]; then
+ if [[ $REPODEST_path == '/~/'* ]]; then
REPODEST_path=${REPODEST_path#'/~/'}
else
error 'Unfortunately, `~user` home-directory expansion is not (yet?) supported in libretools.conf:REPODEST'
@@ -220,11 +222,11 @@ main() {
pretty_print_packages() {
find "$WORKDIR/staging/" -mindepth 1 -maxdepth 1 -type d -not -empty | sort |
- while read -r path; do
- msg2 "${path##*/}"
- cd "$path"
- find -L . -type f -not -name '*.lock' | sed 's|^\./| |' | sort
- done
+ while read -r path; do
+ msg2 "${path##*/}"
+ cd "$path"
+ find -L . -type f -not -name '*.lock' | sed 's|^\./| |' | sort
+ done
}
clean() {
@@ -234,7 +236,7 @@ clean() {
local file_list
file_list="$(mktemp -t "${0##*/}.XXXXXXXXXX")"
trap "rm -f -- ${file_list@Q}" EXIT
- list0_files > "$file_list"
+ list0_files >"$file_list"
lock_close 8
@@ -263,7 +265,7 @@ release_packages() {
local file_list="$(mktemp -t ${0##*/}.XXXXXXXXXX)"
trap "rm -f -- ${file_list@Q}" EXIT
- list0_files > "$file_list"
+ list0_files >"$file_list"
lock_close 8
@@ -274,8 +276,7 @@ release_packages() {
-e "ssh ${REPODEST_port:+-p $REPODEST_port}" \
-0 --files-from="$file_list" \
"${WORKDIR}/staging" \
- "$REPODEST_userhost:$REPODEST_path/"
- then
+ "$REPODEST_userhost:$REPODEST_path/"; then
error "Sync failed, try again"
return $EXIT_FAILURE
fi
@@ -299,9 +300,10 @@ release_packages() {
# notify pbot of the excellent work we have done
local packages=${file_list} # TODO: parse package names? - this is gonna be messy
- local login=${REPODEST_userinfo:-somebody} ; login=${login%%:*} ;
+ local login=${REPODEST_userinfo:-somebody}
+ login=${login%%:*}
ssh ${REPODEST_port:+-p "$REPODEST_port"} "${REPODEST_userhost}" \
- "if type pbot-say &>/dev/null; then pbot-say ${login} just published: ${packages}; fi"
+ "if type pbot-say &>/dev/null; then pbot-say ${login} just published: ${packages}; fi"
return $EXIT_SUCCESS
}
diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage
index 7098aac..8fb48e0 100755
--- a/src/abslibre-tools/librestage
+++ b/src/abslibre-tools/librestage
@@ -36,10 +36,10 @@ usage() {
prose "The package(s) are staged for the named repository, or the name
of the parent directory if a repository is not named."
echo
- echo "Supported options:"
- echo " -h Display this help and exit"
- echo " -A <arch> Stage only packages built for arches matching the given"
- echo " wildcard string. Default: *"
+ echo "Supported options:"
+ echo " -h Display this help and exit"
+ echo " -A <arch> Stage only packages built for arches matching the given"
+ echo " wildcard string. Default: *"
}
main() {
@@ -51,19 +51,28 @@ main() {
# Parse options, set up
while getopts 'hA:' arg; do
case $arg in
- h) usage; return $EXIT_SUCCESS;;
- A) LimitArch="$OPTARG";;
- *) usage >&2; return $EXIT_INVALIDARGUMENT;;
+ h)
+ usage
+ return $EXIT_SUCCESS
+ ;;
+ A) LimitArch="$OPTARG" ;;
+ *)
+ usage >&2
+ return $EXIT_INVALIDARGUMENT
+ ;;
esac
done
- local shiftlen=$(( OPTIND - 1 ))
+ local shiftlen=$((OPTIND - 1))
shift $shiftlen
local repo=
case $# in
- 0) repo="$(basename "$(dirname "$PWD")")";;
- 1) repo=$1;;
- *) usage >&2; return $EXIT_INVALIDARGUMENT;;
+ 0) repo="$(basename "$(dirname "$PWD")")" ;;
+ 1) repo=$1 ;;
+ *)
+ usage >&2
+ return $EXIT_INVALIDARGUMENT
+ ;;
esac
if ! [[ -e ./PKGBUILD ]]; then
@@ -74,9 +83,9 @@ main() {
# Load configuration
declare -i ret=0
load_conf libretools.conf WORKDIR || ret=$?
- load_conf makepkg.conf || ret=$? # for PKGDEST, SRCDEST, and SRCPKGDEST, which are optional
+ load_conf makepkg.conf || ret=$? # for PKGDEST, SRCDEST, and SRCPKGDEST, which are optional
load_conf librefetch.conf || ret=$? # for MIRRORS, which is optional
- [[ $ret = 0 ]] || exit $ret
+ [[ $ret == 0 ]] || exit $ret
SRCPKGPOOL="$WORKDIR/staging/sources/parabola"
@@ -92,7 +101,7 @@ main() {
local CARCH _pkgname pkgnames pkgfile
for CARCH in "${arch[@]}"; do
# Skip this arch if necessary
- [[ "$CARCH" == $LimitArch ]] || continue
+ [[ $CARCH == $LimitArch ]] || continue
# This supports both pacman < 5.1 pkgname-debug
# packages and pacman >= 5.1 pkgbase-debug packages.
pkgnames=("${pkgname[@]}" "${pkgname[@]/%/-debug}")
@@ -138,8 +147,8 @@ main() {
for netfile in "${source[@]}"; do
for mirror in "${MIRRORS[@]}"; do
srcurl=${netfile#*::}
- if [[ "$srcurl" == "$mirror"* ]]; then
- if [[ $netfile = *::* ]]; then
+ if [[ $srcurl == "$mirror"* ]]; then
+ if [[ $netfile == *::* ]]; then
srcname=${netfile%%::*}
else
srcname=${netfile##*/}
@@ -147,12 +156,12 @@ main() {
srcpath=''
for path in "./$srcname" "${SRCDEST:-.}/$srcname"; do
- if [[ -f "$path" ]]; then
+ if [[ -f $path ]]; then
srcpath="$path"
break
fi
done
- if [[ -n "$srcpath" ]]; then
+ if [[ -n $srcpath ]]; then
msg "Found generated source file: %s" "$srcname"
local dest="${WORKDIR}/staging/other/${srcurl##"$mirror"}"
mkdir -p -- "${dest%/*}"
@@ -169,7 +178,7 @@ main() {
done
done
- if $staged ; then
+ if $staged; then
return $EXIT_SUCCESS
else
error "Nothing was staged"
diff --git a/src/aur b/src/aur
index 8ec7b60..987babb 100755
--- a/src/aur
+++ b/src/aur
@@ -36,8 +36,14 @@ usage() {
main() {
while getopts 'h' arg; do
case $arg in
- h) usage; return $EXIT_SUCCESS;;
- *) usage >&2; return $EXIT_INVALIDARGUMENT;;
+ h)
+ usage
+ return $EXIT_SUCCESS
+ ;;
+ *)
+ usage >&2
+ return $EXIT_INVALIDARGUMENT
+ ;;
esac
done
if [[ $# -lt 1 ]]; then
@@ -73,7 +79,7 @@ main() {
local url="https://aur.archlinux.org/packages/${pkg:0:2}/$pkg/$pkg.tar.gz"
set -o pipefail
if ! wget -O- -q "$url" | bsdtar xf -; then
- ret=$((ret|EXIT_FAILURE))
+ ret=$((ret | EXIT_FAILURE))
error "Couldn't get %s" "$pkg"
continue
fi
@@ -86,7 +92,7 @@ main() {
# Diff all files with our difftool
local diffed=false
for file in *; do
- if ! cmp -s "${copy_old}/${file}" "${copy_new}/${file}" ; then
+ if ! cmp -s "${copy_old}/${file}" "${copy_new}/${file}"; then
warning "%s != %s" "${copy_old}/${file}" "${copy_new}/${file}"
diffed=true
"${DIFFPROG}" "${copy_old}/${file}" "${copy_new}/${file}"
@@ -123,7 +129,7 @@ main() {
for _dep in "${_deps[@]}"; do
_dep=${_dep/[<>=]*/}
if ! is_built "$_dep"; then
- if ! pacman -Sddp "$_dep" &>/dev/null ; then
+ if ! pacman -Sddp "$_dep" &>/dev/null; then
plain "%s: will be downloaded from AUR" "$_dep"
missing_deps+=("$_dep")
fi
@@ -137,9 +143,9 @@ main() {
if [[ ${#missing_deps[*]} -gt 0 ]]; then
msg "Retrieving missing deps: %s" "${missing_deps[*]}"
"$0" "${missing_deps[@]}"
- ret=$((ret|$?))
+ ret=$((ret | $?))
fi
- return $ret;
+ return $ret
}
main "$@"
diff --git a/src/chroot-tools/chcleanup.lib.gen b/src/chroot-tools/chcleanup.lib.gen
index 71dc327..0c2475d 100755
--- a/src/chroot-tools/chcleanup.lib.gen
+++ b/src/chroot-tools/chcleanup.lib.gen
@@ -4,5 +4,6 @@ set -e
commonsh=$1
echo '. /usr/share/makepkg/util.sh'
-. "$commonsh"; declare -f _l _p
+. "$commonsh"
+declare -f _l _p
sed -n '/^eval/,/^\S/p' "$commonsh"
diff --git a/src/chroot-tools/distcc-tool b/src/chroot-tools/distcc-tool
index 7d9c283..a50093a 100755
--- a/src/chroot-tools/distcc-tool
+++ b/src/chroot-tools/distcc-tool
@@ -41,13 +41,17 @@ panic() {
}
error() {
- local mesg; mesg="$(gettext "$1")"; shift
+ local mesg
+ mesg="$(gettext "$1")"
+ shift
printf -- "$(gettext 'ERROR:') $mesg\n" "$@" >&2
exit 1
}
print() {
- local mesg; mesg="$(gettext "$1")"; shift
+ local mesg
+ mesg="$(gettext "$1")"
+ shift
printf -- "$mesg\n" "$@"
}
@@ -67,7 +71,8 @@ usage() {
errusage() {
if [[ $# -gt 0 ]]; then
- fmt="$(gettext "$1")"; shift
+ fmt="$(gettext "$1")"
+ shift
printf "$(gettext 'ERROR:') $fmt\n" "$@" >&2
fi
usage >&2
@@ -80,17 +85,21 @@ main() {
case "$cmd" in
help)
[[ $# -eq 0 ]] || errusage '%s: invalid number of arguments' "$cmd"
- usage;;
- odaemon|idaemon|rewrite)
+ usage
+ ;;
+ odaemon | idaemon | rewrite)
[[ $# -eq 1 ]] || errusage '%s: invalid number of arguments' "$cmd"
- $cmd "$@";;
+ $cmd "$@"
+ ;;
client)
[[ $# -eq 2 ]] || errusage '%s: invalid number of arguments' "$cmd"
- $cmd "$@";;
+ $cmd "$@"
+ ;;
server)
[[ $# -eq 0 ]] || errusage '%s: invalid number of arguments' "$cmd"
- $cmd "$@";;
- *) errusage 'unknown subcommand: %s' "$cmd";;
+ $cmd "$@"
+ ;;
+ *) errusage 'unknown subcommand: %s' "$cmd" ;;
esac
}
@@ -116,7 +125,7 @@ parse_DISTCC_HOSTS() {
for HOSTSPEC in $(sed 's/#.*//' <<<"$DISTCC_HOSTS"); do
case "$HOSTSPEC" in
# LOCAL_HOST
- localhost|localhost/*|--localslots=*|--localslots_cpp=*)
+ localhost | localhost/* | --localslots=* | --localslots_cpp=*)
# "localhost" runs commands directly, not talking to distccd at
# localhost, use an IP or real hostname for that.
# So, just pass these through.
@@ -203,7 +212,10 @@ server() {
# socket.
client() {
[[ $# -eq 2 ]] || panic
- { printf '%s\n' "$*"; exec cat; } | exec socat UNIX-CONNECT:'/socket' STDIO
+ {
+ printf '%s\n' "$*"
+ exec cat
+ } | exec socat UNIX-CONNECT:'/socket' STDIO
}
################################################################################
diff --git a/src/chroot-tools/hooks-distcc.sh b/src/chroot-tools/hooks-distcc.sh
index 414696e..756a2d4 100644
--- a/src/chroot-tools/hooks-distcc.sh
+++ b/src/chroot-tools/hooks-distcc.sh
@@ -66,8 +66,9 @@ distcc_start_odaemon() {
_distcc_check "$copydir" "$home"
- local _distcc_tool; _distcc_tool="$(librelib chroot/distcc-tool)"
- install -m755 "$_distcc_tool" "$copydir/bin/distcc-tool"
+ local _distcc_tool
+ _distcc_tool="$(librelib chroot/distcc-tool)"
+ install -m755 "$_distcc_tool" "$copydir/bin/distcc-tool"
local DISTCC_HOSTS
DISTCC_HOSTS="$(get_var makepkg DISTCC_HOSTS '')"
@@ -80,15 +81,15 @@ distcc_start_odaemon() {
/bin/distcc-tool idaemon ${DISTCC_HOSTS@Q} </dev/null &>/dev/null &
DISTCC_HOSTS=${rewritten_DISTCC_HOSTS@Q}
fi
- eot
+ eot
install -Dm644 /dev/stdin "$home/.ssh/config" <<-'eot'
Host *
ProxyCommand /bin/distcc-tool client %h %p
- eot
+ eot
"$_distcc_tool" odaemon "$copydir" </dev/null &>/dev/null &
- echo $! > "$copydir/run/distcc-tool-odaemon.pid"
+ echo $! >"$copydir/run/distcc-tool-odaemon.pid"
fi
}
@@ -104,7 +105,7 @@ distcc_stop_odaemon() {
if [[ -f "$copydir/run/distcc-tool-odaemon.pid" ]]; then
local odaemon
- odaemon=$(< "$copydir/run/distcc-tool-odaemon.pid")
+ odaemon=$(<"$copydir/run/distcc-tool-odaemon.pid")
kill -- "$odaemon"
rm -f -- \
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index e3c390a..73c9b0c 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -59,13 +59,13 @@ hack_arch_nspawn_flags() {
while getopts 'hC:M:c:f:s' arg; do
case "$arg" in
M) makepkg_conf="$OPTARG" ;;
- *) :;;
+ *) : ;;
esac
done
# Detect the architecture of the chroot
local CARCH
- if [[ -f "$makepkg_conf" ]]; then
+ if [[ -f $makepkg_conf ]]; then
eval "$(grep -a '^CARCH=' "$makepkg_conf")"
else
CARCH="$(uname -m)"
@@ -73,18 +73,23 @@ hack_arch_nspawn_flags() {
local setarch interpreter
case $CARCH in
- armv7h) setarch=armv7l; interpreter=/usr/bin/qemu-arm-static ;;
- *) setarch=$CARCH; interpreter=/usr/bin/qemu-$CARCH-static ;;
+ armv7h)
+ setarch=armv7l
+ interpreter=/usr/bin/qemu-arm-static
+ ;;
+ *)
+ setarch=$CARCH
+ interpreter=/usr/bin/qemu-$CARCH-static
+ ;;
esac
if ! setarch $setarch /bin/true 2>/dev/null; then
# We're running a cross-arch chroot
# Make sure that qemu-static is set up with binfmt_misc
if [[ -z $(grep -l -xF \
- -e "interpreter $interpreter" \
- -r -- /proc/sys/fs/binfmt_misc 2>/dev/null \
- | xargs -r grep -xF 'enabled') ]]
- then
+ -e "interpreter $interpreter" \
+ -r -- /proc/sys/fs/binfmt_misc 2>/dev/null |
+ xargs -r grep -xF 'enabled') ]]; then
error 'Cannot cross-compile for %s on %s' "$CARCH" "$(uname -m)"
plain 'This requires a binfmt_misc entry for %s.' "$interpreter"
prose 'Such a binfmt_misc entry is provided by the %s
@@ -101,23 +106,25 @@ hack_arch_nspawn_flags() {
# Usage: arch-nspawn $copydir $cmd...
arch-nspawn() {
- local copydir=$1; shift
+ local copydir=$1
+ shift
local cmd=("$@")
local arch_nspawn_flags=("${arch_nspawn_flags[@]}")
hack_arch_nspawn_flags "$copydir"
"$_arch_nspawn" \
- "${arch_nspawn_flags[@]}" \
- "$copydir" \
- "${sysd_nspawn_flags[@]}" \
- -- \
- "${cmd[@]}"
+ "${arch_nspawn_flags[@]}" \
+ "$copydir" \
+ "${sysd_nspawn_flags[@]}" \
+ -- \
+ "${cmd[@]}"
}
# Usage: mkarchroot $copydir $pkgs...
mkarchroot() {
- local copydir=$1; shift
+ local copydir=$1
+ shift
local pkgs=("$@")
local arch_nspawn_flags=("${arch_nspawn_flags[@]}")
@@ -154,7 +161,8 @@ make_empty_repo() {
# Usage: chroot_add_to_local_repo $copydir $pkgfiles...
chroot_add_to_local_repo() {
- local copydir=$1; shift
+ local copydir=$1
+ shift
mkdir -p "$copydir/repo"
local pkgfile
for pkgfile in "$@"; do
@@ -177,7 +185,7 @@ calculate_directories() {
rootdir=''
fi
- if [[ ${COPY:0:1} = / ]]; then
+ if [[ ${COPY:0:1} == / ]]; then
copydir=$COPY
elif [[ -n ${CHROOTDIR:-} ]] && [[ -n ${CHROOT:-} ]]; then
copydir="${CHROOTDIR}/${CHROOT}/${COPY}"
@@ -192,8 +200,8 @@ calculate_directories() {
check_mountpoint() {
local file=$1
local mountpoint mountopts
- mountpoint="$(df -P "$file"|sed '1d;s/.*\s//')"
- mountopts=($(LC_ALL=C mount|awk "{ if (\$3==\"$mountpoint\") { gsub(/[(,)]/, \" \", \$6); print \$6 } }"))
+ mountpoint="$(df -P "$file" | sed '1d;s/.*\s//')"
+ mountopts=($(LC_ALL=C mount | awk "{ if (\$3==\"$mountpoint\") { gsub(/[(,)]/, \" \", \$6); print \$6 } }"))
! in_array nosuid "${mountopts[@]}" && ! in_array noexec "${mountopts[@]}"
}
@@ -240,9 +248,9 @@ usage() {
echo
prose 'This command will make the following configuration changes in the
chroot:'
- bullet 'overwrite `/etc/libretools.d/chroot.conf`' # libretools/librechroot
- bullet 'overwrite `/etc/pacman.d/mirrorlist`' # devtools/arch-nspawn
- bullet 'set `CacheDir` in `/etc/pacman.conf`' # devtools/arch-nspawn
+ bullet 'overwrite `/etc/libretools.d/chroot.conf`' # libretools/librechroot
+ bullet 'overwrite `/etc/pacman.d/mirrorlist`' # devtools/arch-nspawn
+ bullet 'set `CacheDir` in `/etc/pacman.conf`' # devtools/arch-nspawn
prose 'If a new `pacman.conf` is inserted with the `-C` flag, the change
is made after the file is copied in; the `-C` flag doesn'"'"'t
stop the change from being effective.'
@@ -253,47 +261,47 @@ usage() {
echo
prose 'The `-A CARCH` flag is *almost* simply an alias for'
printf ' %s\n' \
- '-C "/usr/share/pacman/defaults/pacman.conf.$CARCH" \' \
- '-M "/usr/share/pacman/defaults/makepkg.conf.$CARCH"'
+ '-C "/usr/share/pacman/defaults/pacman.conf.$CARCH" \' \
+ '-M "/usr/share/pacman/defaults/makepkg.conf.$CARCH"'
prose 'However, before doing that, it actually makes a temporary copy of
`pacman.conf`, and modifies it to:'
- bullet 'set `Architecture` to match the `CARCH` line in `makepkg.conf`'
- bullet 'comment out any `Include = /etc/pacman.d/*.conf` lines'
+ bullet 'set `Architecture` to match the `CARCH` line in `makepkg.conf`'
+ bullet 'comment out any `Include = /etc/pacman.d/*.conf` lines'
echo
prose 'Creating a copy, deleting a copy, or syncing a copy can be fairly
slow; but are very fast if $CHROOTDIR is on a btrfs partition.'
echo
print 'Options:'
flag "-n <$(_ CHROOT)>" 'Name of the chroot to use'
- flag "-l <$(_ COPY)>" 'Name of, or absolute path to, the copy to use'
- flag '-N' 'Disable networking in the chroot'
- flag "-C <$(_ FILE)>" 'Copy this file to `$copydir/etc/pacman.conf`'
- flag "-M <$(_ FILE)>" 'Copy this file to `$copydir/etc/makepkg.conf`'
- flag "-A <$(_ CARCH)>" 'Set the architecture of the copy; simply an
+ flag "-l <$(_ COPY)>" 'Name of, or absolute path to, the copy to use'
+ flag '-N' 'Disable networking in the chroot'
+ flag "-C <$(_ FILE)>" 'Copy this file to `$copydir/etc/pacman.conf`'
+ flag "-M <$(_ FILE)>" 'Copy this file to `$copydir/etc/makepkg.conf`'
+ flag "-A <$(_ CARCH)>" 'Set the architecture of the copy; simply an
alias for the `-C` and `-M` flags, see above.'
flag "-w <$(_ 'PATH[:INSIDE_PATH[:OPTIONS]]')>" 'Bind mount a file or directory, read/write'
flag "-r <$(_ 'PATH[:INSIDE_PATH[:OPTIONS]]')>" 'Bind mount a file or directory, read-only'
echo
print 'Commands:'
print ' Create/copy/delete:'
- flag 'noop|make' 'Do not do anything, but still creates the chroot
+ flag 'noop|make' 'Do not do anything, but still creates the chroot
copy if it does not exist'
- flag 'sync' 'Sync the copy with the clean (`root`) copy'
- flag 'delete' 'Delete the chroot copy'
+ flag 'sync' 'Sync the copy with the clean (`root`) copy'
+ flag 'delete' 'Delete the chroot copy'
print ' Dealing with packages:'
- flag "install-file $(_ FILES...)" 'Like `pacman -U FILES...`'
- flag "install-name $(_ NAMES...)" 'Like `pacman -S NAMES...`'
- flag 'update' 'Like `pacman -Syu`'
- flag 'clean-pkgs' 'Remove all packages from the chroot copy that
+ flag "install-file $(_ FILES...)" 'Like `pacman -U FILES...`'
+ flag "install-name $(_ NAMES...)" 'Like `pacman -S NAMES...`'
+ flag 'update' 'Like `pacman -Syu`'
+ flag 'clean-pkgs' 'Remove all packages from the chroot copy that
are not in base-devel, $CHROOTEXTRAPKG, or named
as a dependency in the file `/startdir/PKGBUILD`
in the chroot copy; and install all packages
that are.'
print ' Other:'
flag "run $(_ CMD...)" 'Run CMD in the chroot copy'
- flag 'enter' 'Enter an interactive shell in the chroot copy'
- flag 'clean-repo' 'Clean /repo in the chroot copy'
- flag 'help' 'Show this message'
+ flag 'enter' 'Enter an interactive shell in the chroot copy'
+ flag 'clean-repo' 'Clean /repo in the chroot copy'
+ flag 'help' 'Show this message'
}
readonly commands=(
noop make sync delete
@@ -313,46 +321,50 @@ main() {
declare -Ai used_opts
while getopts 'n:l:NC:M:A:w:r:' opt; do
case $opt in
- n) CHROOT=$OPTARG;;
- l) COPY=$OPTARG;;
- N) sysd_nspawn_flags+=(--private-network);;
- C|M) arch_nspawn_flags+=(-$opt "$OPTARG");;
+ n) CHROOT=$OPTARG ;;
+ l) COPY=$OPTARG ;;
+ N) sysd_nspawn_flags+=(--private-network) ;;
+ C | M) arch_nspawn_flags+=(-$opt "$OPTARG") ;;
A)
if ! [[ -f "/usr/share/pacman/defaults/pacman.conf.$OPTARG" && -f "/usr/share/pacman/defaults/makepkg.conf.$OPTARG" ]]; then
error 'Unsupported architecture: %s' "$OPTARG"
plain 'See the files in %q for valid architectures.' /usr/share/pacman/defaults/
- return $EXIT_INVALIDARGUMENT;
+ return $EXIT_INVALIDARGUMENT
fi
trap 'rm -f -- "$tmppacmanconf"' EXIT
tmppacmanconf="$(mktemp --tmpdir librechroot-pacman.conf.XXXXXXXXXX)"
sed -r \
- -e "s|^#?\\s*Architecture.+|Architecture = ${OPTARG}|g" \
- -e "s|^.*Include\s*=\s*/etc/pacman.d/.*\.conf|#&|" \
- < "/usr/share/pacman/defaults/pacman.conf.$OPTARG" \
- > "$tmppacmanconf"
- echo -e '\n\n# Enable the volatile i686 [build-support] repo only as needed.' \
- '\n#[build-support]\n#Server = http://mirror.archlinux32.org/$arch/$repo/' \
- '\n\n# Enable the volatile arm [aur] repo only as needed.' \
- '\n#[aur]\n#Server = https://mirror.archlinuxarm.org/$arch/$repo/' \
- >> "$tmppacmanconf"
+ -e "s|^#?\\s*Architecture.+|Architecture = ${OPTARG}|g" \
+ -e "s|^.*Include\s*=\s*/etc/pacman.d/.*\.conf|#&|" \
+ <"/usr/share/pacman/defaults/pacman.conf.$OPTARG" \
+ >"$tmppacmanconf"
+ echo -e '\n\n# Enable the volatile i686 [build-support] repo only as needed.' \
+ '\n#[build-support]\n#Server = http://mirror.archlinux32.org/$arch/$repo/' \
+ '\n\n# Enable the volatile arm [aur] repo only as needed.' \
+ '\n#[aur]\n#Server = https://mirror.archlinuxarm.org/$arch/$repo/' \
+ >>"$tmppacmanconf"
arch_nspawn_flags+=(
-C "$tmppacmanconf"
-M "/usr/share/pacman/defaults/makepkg.conf.$OPTARG"
- );;
- w) sysd_nspawn_flags+=("--bind=$OPTARG");;
- r) sysd_nspawn_flags+=("--bind-ro=$OPTARG");;
- *) usage >&2; return $EXIT_INVALIDARGUMENT;;
+ )
+ ;;
+ w) sysd_nspawn_flags+=("--bind=$OPTARG") ;;
+ r) sysd_nspawn_flags+=("--bind-ro=$OPTARG") ;;
+ *)
+ usage >&2
+ return $EXIT_INVALIDARGUMENT
+ ;;
esac
used_opts[$opt]+=1
done
for opt in n l C M A; do
- if (( ${used_opts[$opt]:-0} > 1 )); then
+ if ((${used_opts[$opt]:-0} > 1)); then
error "Option -%s may only be given once" "$opt"
usage >&2
return $EXIT_INVALIDARGUMENT
fi
done
- if (( ${used_opts[A]:-0} && ( ${used_opts[C]:-0} || ${used_opts[M]:-0} ) )); then
+ if ((${used_opts[A]:-0} && (${used_opts[C]:-0} || ${used_opts[M]:-0}))); then
error "Option -A may not be used together with -C or -M"
usage >&2
return $EXIT_INVALIDARGUMENT
@@ -371,13 +383,14 @@ main() {
fi
shift
case "$mode" in
- noop|make|sync|delete|update|enter|clean-pkgs|clean-repo)
+ noop | make | sync | delete | update | enter | clean-pkgs | clean-repo)
if [[ $# -gt 0 ]]; then
error 'Command `%s` does not take any arguments: %s' "$mode" "$*"
usage >&2
return $EXIT_INVALIDARGUMENT
fi
- :;;
+ :
+ ;;
install-file)
if [[ $# -lt 1 ]]; then
error 'Command `%s` requires at least one file' "$mode"
@@ -396,21 +409,24 @@ main() {
return $EXIT_INVALIDARGUMENT
fi
fi
- :;;
+ :
+ ;;
install-name)
if [[ $# -lt 1 ]]; then
error 'Command `%s` requires at least one package name' "$mode"
usage >&2
return $EXIT_INVALIDARGUMENT
fi
- :;;
+ :
+ ;;
run)
if [[ $# -lt 1 ]]; then
error 'Command `%s` requires at least one argument' "$mode"
usage >&2
return $EXIT_INVALIDARGUMENT
fi
- :;;
+ :
+ ;;
esac
if [[ $mode == help ]]; then
@@ -418,7 +434,7 @@ main() {
return $EXIT_SUCCESS
fi
- [[ $retconf = 0 ]] || exit $retconf
+ [[ $retconf == 0 ]] || exit $retconf
eval "$(calculate_directories)"
readonly LIBREUSER LIBREHOME
@@ -428,7 +444,7 @@ main() {
########################################################################
- if (( EUID )); then
+ if ((EUID)); then
error "This program must be run as root."
return $EXIT_NOPERMISSION
fi
@@ -468,7 +484,7 @@ main() {
printf '%q ' "${CHROOTEXTRAPKG[@]}"
printf ')\n'
fi
- } > "$copydir"/etc/libretools.d/chroot.conf
+ } >"$copydir"/etc/libretools.d/chroot.conf
# "touch" the chroot first
# this will
@@ -479,7 +495,7 @@ main() {
if [[ -n ${tmppacmanconf:-} ]]; then
rm -f -- "$tmppacmanconf"
fi
- trap EXIT # clear the trap to remove the tmp pacman.conf from -A
+ trap EXIT # clear the trap to remove the tmp pacman.conf from -A
arch_nspawn_flags=() # XXX dirty hack, don't apply -C or -M again
fi
@@ -487,7 +503,7 @@ main() {
case "$mode" in
# Create/copy/delete
- noop|make|sync) :;;
+ noop | make | sync) : ;;
delete)
if [[ -d $copydir ]]; then
delete_chroot "$copydir"
@@ -496,7 +512,7 @@ main() {
# Dealing with packages
install-file)
- install_packages "$copydir" "$@" </dev/null
+ install_packages "$copydir" "$@" </dev/null
chroot_add_to_local_repo "$copydir" "$@"
;;
install-name)
@@ -513,7 +529,7 @@ main() {
'mkdir -p /startdir' \
'cd /startdir' \
'/chcleanup' \
- > "$copydir/chrootexec"
+ >"$copydir/chrootexec"
chmod 755 "$copydir/chrootexec"
arch-nspawn "$copydir" /chrootexec </dev/null
;;
diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg
index d3dd160..7b3ba00 100755
--- a/src/chroot-tools/libremakepkg
+++ b/src/chroot-tools/libremakepkg
@@ -36,7 +36,7 @@ umask 0022
# Global variables:
readonly _indent="$(librelib chroot/indent)"
readonly INCHROOT=$([[ -f /.arch-chroot ]] && echo true || echo false)
-NONET=true # can be changed with the -N flag
+NONET=true # can be changed with the -N flag
ROSTARTDIR=true # can be changed with the -W flag
# {PKG,SRC,SRCPKG,LOG}DEST set at runtime by makepkg.conf
# MAKEFLAGS, PACKAGER set at runtime by makepkg.conf
@@ -72,7 +72,8 @@ exit_copy() {
# Usage; run_hook $hookname $args...
run_hook() {
- local hookname=$1; shift
+ local hookname=$1
+ shift
local hookvar="hook_${hookname}[@]"
local fails=()
@@ -94,7 +95,8 @@ run_hook() {
# Usage: add_to_local_repo $copydir $pkgfiles...
add_to_local_repo() {
- local copydir=$1; shift
+ local copydir=$1
+ shift
mkdir -p "$copydir/repo"
local pkgfile
for pkgfile in "$@"; do
@@ -131,7 +133,7 @@ build() (
else
local _run=(sh -c "cd ${startdir@Q} && \$@" --)
fi
- run_ynet=(unshare --mount -- "${_run[@]}")
+ run_ynet=(unshare --mount -- "${_run[@]}")
run_nnet=(unshare --mount --net -- "${_run[@]}")
else
if $ROSTARTDIR; then
@@ -139,7 +141,7 @@ build() (
else
librechroot_flags+=(-w "$startdir:/startdir")
fi
- run_ynet=(librechroot "${librechroot_flags[@]}" run)
+ run_ynet=(librechroot "${librechroot_flags[@]}" run)
run_nnet=(librechroot "${librechroot_flags[@]}" -N run)
fi
$NONET || run_nnet=("${run_ynet[@]}")
@@ -181,24 +183,24 @@ usage() {
print 'Options:'
flag 'librechroot options:' \
- "-n <$(_ CHROOT)>" 'Name of the chroot to use' \
- "-l <$(_ COPY)>" 'Name of, or absolute path to, the chroot copy to use' \
- "-w <$(_ 'PATH[:INSIDE_PATH[:OPTIONS]]')>" 'Bind mount a file or directory, read/write' \
- "-r <$(_ 'PATH[:INSIDE_PATH[:OPTIONS]]')>" 'Bind mount a file or directory, read-only'
+ "-n <$(_ CHROOT)>" 'Name of the chroot to use' \
+ "-l <$(_ COPY)>" 'Name of, or absolute path to, the chroot copy to use' \
+ "-w <$(_ 'PATH[:INSIDE_PATH[:OPTIONS]]')>" 'Bind mount a file or directory, read/write' \
+ "-r <$(_ 'PATH[:INSIDE_PATH[:OPTIONS]]')>" 'Bind mount a file or directory, read-only'
flag 'libremakepkg options:' \
- '-N' "Don't disable networking during prepare(),
+ '-N' "Don't disable networking during prepare(),
build(), and package(). PLEASE don't use
this unless you have a special reason, its
use is a violation of Parabola policy." \
- '-W' "Don't make the startdir read-only. PLEASE
+ '-W' "Don't make the startdir read-only. PLEASE
don't use this unless you have a special
reason, its use is a violation of Parabola
policy." \
- '-R' 'Repackage contents of the package without
+ '-R' 'Repackage contents of the package without
rebuilding' \
- "-S <$(_ SRCPKGFILE)>" 'Use an existing --allsource source-package' \
- '-h' 'Show this message'
+ "-S <$(_ SRCPKGFILE)>" 'Use an existing --allsource source-package' \
+ '-h' 'Show this message'
}
# Convenience method for use in option parsing
@@ -217,20 +219,32 @@ main() {
local srcpkg=''
# Parse command line options ###########################################
- while getopts 'n:l:w:r:NWRS:h' flag ; do
+ while getopts 'n:l:w:r:NWRS:h' flag; do
case "${flag}" in
n) if $INCHROOT; then err_chflag "$flag"; else
- chroot=$OPTARG; fi;;
+ chroot=$OPTARG
+ fi ;;
l) if $INCHROOT; then err_chflag "$flag"; else
- copy=$OPTARG; fi;;
- w|r) if $INCHROOT; then err_chflag "$flag"; else
- librechroot_flags+=(-$flag "$OPTARG"); fi;;
- N) NONET=false;;
- W) ROSTARTDIR=false;;
- R) repack=true; makepkg_args+=(-R);;
- S) srcpkg=$OPTARG;;
- h) usage; exit $EXIT_SUCCESS;;
- *) usage >&2; exit $EXIT_INVALIDARGUMENT;;
+ copy=$OPTARG
+ fi ;;
+ w | r) if $INCHROOT; then err_chflag "$flag"; else
+ librechroot_flags+=(-$flag "$OPTARG")
+ fi ;;
+ N) NONET=false ;;
+ W) ROSTARTDIR=false ;;
+ R)
+ repack=true
+ makepkg_args+=(-R)
+ ;;
+ S) srcpkg=$OPTARG ;;
+ h)
+ usage
+ exit $EXIT_SUCCESS
+ ;;
+ *)
+ usage >&2
+ exit $EXIT_INVALIDARGUMENT
+ ;;
esac
done
shift $((OPTIND - 1))
@@ -246,7 +260,7 @@ main() {
else
load_conf chroot.conf CHROOTDIR CHROOT || exit
[[ -z ${chroot} ]] || CHROOT=$chroot
- if [[ ${copy:0:1} = / ]]; then
+ if [[ ${copy:0:1} == / ]]; then
copydir=$copy
else
copydir="${CHROOTDIR}/${CHROOT}/${copy}"
@@ -266,7 +280,7 @@ main() {
# Quick sanity check ###################################################
- if (( EUID )); then
+ if ((EUID)); then
error "This program must be run as root"
exit $EXIT_NOPERMISSION
fi
@@ -326,14 +340,14 @@ main() {
trap "rm -rf -- ${srcpkgdest@Q}" EXIT
SRCPKGDEST="$srcpkgdest" download_sources "$copydir" "$LIBREUSER" |& indent
srcpkg=("$srcpkgdest"/*)
- if (( ${#srcpkg[@]} != 1 )); then
+ if ((${#srcpkg[@]} != 1)); then
error 'Something went funny with makepkg --allsource'
return $EXIT_FAILURE
fi
# We want to inject "-$pkgarch" in to srcpkg's filename, right before $SRCEXT
local srcext pkgarch srcpkg_filename
srcext="$(MAKEPKG_CONF=$copydir/etc/makepkg.conf get_var makepkg SRCEXT)"
- if [[ "$(bsdtar xfO "$srcpkg" --include='*/.SRCINFO' | grep $'\tarch =')" = $'\tarch = any' ]]; then
+ if [[ "$(bsdtar xfO "$srcpkg" --include='*/.SRCINFO' | grep $'\tarch =')" == $'\tarch = any' ]]; then
pkgarch=any
else
pkgarch=$CARCH
diff --git a/src/dagpkg b/src/dagpkg
index 1196149..73e9412 100755
--- a/src/dagpkg
+++ b/src/dagpkg
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-#
+#
# dagpkg - create a directed graph of package dependencies and build
# them in topological order
@@ -40,7 +40,8 @@ set -e
# End inmediately but print an useful message
trap_exit() {
- local signal=$1; shift
+ local signal=$1
+ shift
local msg=("$@")
term_title "error!"
echo
@@ -136,7 +137,7 @@ visit_pkgbuild() {
# Mark the package as finished
marks[$name]=2
# Append it to the reversed list of packages to build.
- echo "$name" >> "${log}"
+ echo "$name" >>"${log}"
}
main() {
@@ -144,7 +145,7 @@ main() {
declare -i ret=0
load_conf libretools.conf FULLBUILDCMD || ret=$ # and HOOKPREBUILD & HOOKLOCALRELEASE, which are optional
load_conf makepkg.conf CARCH || ret=$?
- [[ $ret = 0 ]] || exit $ret
+ [[ $ret == 0 ]] || exit $ret
setup_traps trap_exit
@@ -200,7 +201,7 @@ main() {
sudo -E pacman -Syu --noconfirm
# run the pre build command from libretools.conf
- if [[ -n "$HOOKPREBUILD" ]]; then
+ if [[ -n $HOOKPREBUILD ]]; then
${HOOKPREBUILD}
fi
@@ -208,7 +209,7 @@ main() {
${FULLBUILDCMD}
# Run local release hook with $1 = $repo
- if [[ -n "$HOOKLOCALRELEASE" ]]; then
+ if [[ -n $HOOKLOCALRELEASE ]]; then
${HOOKLOCALRELEASE} "$(basename "$(dirname "$w")")"
fi
diff --git a/src/gitget/gitget b/src/gitget/gitget
index 59b2fba..2a0ecde 100755
--- a/src/gitget/gitget
+++ b/src/gitget/gitget
@@ -25,11 +25,11 @@ dir_is_empty() {
(
shopt -s dotglob nullglob
files=("$1"/*)
- (( ${#files} == 0 ))
+ ((${#files} == 0))
)
}
-# from makepkg
+# from makepkg
cd_safe() {
if ! cd "$1"; then
error "Failed to change to directory %s" "$1"
@@ -46,7 +46,7 @@ download_git_checkout() {
local name=$4
local push=${5:-}
- if [[ ! -d "$dir/.git" ]] ; then
+ if [[ ! -d "$dir/.git" ]]; then
msg2 "Cloning %s %s repo..." "${name}" "git"
if ! git clone "$url" "$dir"; then
error "Failure while downloading %s %s repo" "${name}" "git"
@@ -61,7 +61,7 @@ download_git_checkout() {
else
cd_safe "$dir"
# Make sure we are fetching the right repo
- if [[ "$url" != "$(git config --get remote.origin.url)" ]] ; then
+ if [[ $url != "$(git config --get remote.origin.url)" ]]; then
if $FORCE; then
git config remote.origin.url "$url"
else
@@ -70,7 +70,7 @@ download_git_checkout() {
exit $EXIT_FAILURE
fi
fi
- if [[ -n $push ]] ; then
+ if [[ -n $push ]]; then
if $FORCE; then
git config remote.origin.pushUrl "$push"
else
@@ -87,7 +87,7 @@ download_git_checkout() {
fi
fi
msg2 "Updating %s %s repo..." "${name}" "git"
- if ! { git fetch --all -p && git checkout "$ref" && git pull origin "$ref"; } ; then
+ if ! { git fetch --all -p && git checkout "$ref" && git pull origin "$ref"; }; then
# only warn on failure to allow offline builds
warning "Failure while updating %s %s repo" "${name}" "git"
fi
@@ -101,7 +101,7 @@ download_git_bare() {
local name=$3
local push=${4:-}
- if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
+ if [[ ! -d $dir ]] || dir_is_empty "$dir"; then
msg2 "Cloning %s %s repo..." "${name}" "git"
if ! git clone --mirror "$url" "$dir"; then
error "Failure while downloading %s %s repo" "${name}" "git"
@@ -115,7 +115,7 @@ download_git_bare() {
else
cd_safe "$dir"
# Make sure we are fetching the right repo
- if [[ "$url" != "$(git config --get remote.origin.url)" ]] ; then
+ if [[ $url != "$(git config --get remote.origin.url)" ]]; then
if $FORCE; then
git config remote.origin.url "$url"
else
@@ -124,7 +124,7 @@ download_git_bare() {
exit $EXIT_FAILURE
fi
fi
- if [[ -n $push ]] ; then
+ if [[ -n $push ]]; then
if $FORCE; then
git config remote.origin.pushUrl "$push"
else
@@ -152,9 +152,9 @@ usage() {
print 'Usage: %s [OPTIONS] [bare|checkout] URL DIRECTORY' "${0##*/}"
print 'A URL-handler for git urls. Capable of updating or cloning.'
echo
- prose "Clones or pulls from the git URL, to a local DIRECTORY. If
- \`bare\` is specified, it will create a bare repository; if
- \`checkout\` is specified, it will create or update a working tree."
+ prose 'Clones or pulls from the git URL, to a local DIRECTORY. If
+ `bare` is specified, it will create a bare repository; if
+ `checkout` is specified, it will create or update a working tree.'
echo
prose 'For a checkout, the tree to checkout is specified by appending
`#ANYTHING=TREE-ISH` to the URL. For example, `#branch=stable`,
@@ -162,13 +162,13 @@ usage() {
is ignored, this is for compatibility with `makepkg` source
URLs.'
echo
- prose "The URL may be prefixed with \`git+\`. This is also for
- compatibility with \`makepkg\` source URLs."
+ prose 'The URL may be prefixed with `git+`. This is also for
+ compatibility with `makepkg` source URLs.'
echo
- prose "It does safety checks, figures out whether to clone or pull, and
+ prose 'It does safety checks, figures out whether to clone or pull, and
other helpful things. This exists because the same
- \`download_git\` function from makepkg was being copied and
- pasted again and again."
+ `download_git` function from makepkg was being copied and
+ pasted again and again.'
echo
print "Options:"
flag '-f' \
@@ -189,22 +189,31 @@ main() {
local name=''
while getopts 'fp:n:h' flag; do
case "${flag}" in
- f) FORCE=true;;
- p) push=$OPTARG;;
- n) name=$OPTARG;;
- h) usage; exit $EXIT_SUCCESS;;
- *) usage >&2; exit $EXIT_INVALIDARGUMENT;;
+ f) FORCE=true ;;
+ p) push=$OPTARG ;;
+ n) name=$OPTARG ;;
+ h)
+ usage
+ exit $EXIT_SUCCESS
+ ;;
+ *)
+ usage >&2
+ exit $EXIT_INVALIDARGUMENT
+ ;;
esac
done
shift $((OPTIND - 1))
- [[ $# == 3 ]] || { usage >&2; exit $EXIT_INVALIDARGUMENT; }
+ [[ $# == 3 ]] || {
+ usage >&2
+ exit $EXIT_INVALIDARGUMENT
+ }
local mode=$1
local url=${2#git+}
local dir=$3
local urlmain=${url%%#*}
local urlfrag=${url#*#}
- if [[ "$urlfrag" == "$urlmain" ]]; then
+ if [[ $urlfrag == "$urlmain" ]]; then
urlfrag=''
fi
local ref=${urlfrag#*=}
@@ -216,9 +225,12 @@ main() {
name=${name:-${dir##*/}}
case "$mode" in
- checkout) download_git_checkout "$urlmain" "$ref" "$dir" "$name" "$push";;
- bare) download_git_bare "$urlmain" "$dir" "$name" "$push";;
- *) usage >&2; exit $EXIT_INVALIDARGUMENT;;
+ checkout) download_git_checkout "$urlmain" "$ref" "$dir" "$name" "$push" ;;
+ bare) download_git_bare "$urlmain" "$dir" "$name" "$push" ;;
+ *)
+ usage >&2
+ exit $EXIT_INVALIDARGUMENT
+ ;;
esac
}
diff --git a/src/gitget/libregit b/src/gitget/libregit
index e80d6cc..09ab60c 100755
--- a/src/gitget/libregit
+++ b/src/gitget/libregit
@@ -32,7 +32,10 @@ usage() {
}
main() {
- [[ $# == 3 ]] || { usage >&2; exit $EXIT_INVALIDARGUMENT; }
+ [[ $# == 3 ]] || {
+ usage >&2
+ exit $EXIT_INVALIDARGUMENT
+ }
repo=$1
ref=$2
dir=$3
diff --git a/src/is_built b/src/is_built
index 1a204a9..cf93a7a 100755
--- a/src/is_built
+++ b/src/is_built
@@ -41,8 +41,14 @@ usage() {
main() {
while getopts 'h' arg; do
case $arg in
- h) usage; exit $EXIT_SUCCESS ;;
- *) usage >&2; exit $EXIT_INVALIDARGUMENT ;;
+ h)
+ usage
+ exit $EXIT_SUCCESS
+ ;;
+ *)
+ usage >&2
+ exit $EXIT_INVALIDARGUMENT
+ ;;
esac
done
if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then
diff --git a/src/lib/blacklist.sh b/src/lib/blacklist.sh
index d36502e..d70ec26 100755
--- a/src/lib/blacklist.sh
+++ b/src/lib/blacklist.sh
@@ -28,7 +28,7 @@ blacklist-normalize() {
# dynamically build sed expression based on number of fields
local -a expr
local fields=5 sep=: i
- for (( i = $fields - 2; i >= 0; --i )); do
+ for ((i = fields - 2; i >= 0; --i)); do
expr+=('-e' "s/^[^:]*(:[^:]*){${i}}$/&${sep}/")
sep+=${sep:0:1}
done
@@ -44,7 +44,7 @@ blacklist-cat() {
# exit on failure, whether set -e or not
blacklist-update || return
fi
- blacklist-normalize < "$file"
+ blacklist-normalize <"$file"
}
# Usage: blacklist-update
@@ -72,7 +72,7 @@ blacklist-update() (
stat_done
sed 's/^/ /' <"$tmp_log" >&2
rm -f -- "$tmp_log"
- if [[ -e "$local_blacklist" ]]; then
+ if [[ -e $local_blacklist ]]; then
_l warning "Using old local cache of blacklist"
else
_l error "Download failed, exiting"
diff --git a/src/lib/libreblacklist b/src/lib/libreblacklist
index 809e141..aa74804 100755
--- a/src/lib/libreblacklist
+++ b/src/lib/libreblacklist
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if [[ "${0##*/}" != libreblacklist ]]; then
+if [[ ${0##*/} != libreblacklist ]]; then
. "$(librelib blacklist)"
else
set -euE
@@ -26,7 +26,7 @@ else
usage-outside() {
sed -n '/^# Usage:/,/()/p' "$lib_file" |
- tr '\n' '\r' | sed 's/\s*()\s*[{(]/\n/g'
+ tr '\n' '\r' | sed 's/\s*()\s*[{(]/\n/g'
}
# The output format of this is:
# - The first line is "Usage:"
@@ -34,7 +34,7 @@ else
# - The last line is the command name (prefixed with "blacklist-")
# - The in-between lines are the extended description.
usage-inside() {
- sed 's/\r/\n/g'<<<"$1"|sed -e '/^$/d' -e 's/^# //'
+ sed 's/\r/\n/g' <<<"$1" | sed -e '/^$/d' -e 's/^# //'
}
usage() {
@@ -49,7 +49,7 @@ else
while read -r sec; do
sec="$(usage-inside "$sec")"
- cmd=$(<<<"$sec" sed -n '$s/^blacklist-//p')
+ cmd=$(sed <<<"$sec" -n '$s/^blacklist-//p')
desc="$(_ "$(sed -n 2p <<<"$sec")")"
flag "$cmd" "${desc//blacklist-/${0##*/} }"
done < <(usage-outside)
@@ -57,9 +57,9 @@ else
while read -r sec; do
sec="$(usage-inside "$sec")"
- cmd=$(<<<"$sec" sed -n '$s/^blacklist-//p')
- if [[ "$cmd" == "$1" ]]; then
- <<<"$sec" sed '$d' |
+ cmd=$(sed <<<"$sec" -n '$s/^blacklist-//p')
+ if [[ $cmd == "$1" ]]; then
+ sed <<<"$sec" '$d' |
while read -r line; do print "$line"; done |
sed "s/blacklist-/${0##*/} /g" |
fmt -us
diff --git a/src/lib/librelib b/src/lib/librelib
index 27649f8..ff1d05f 100755
--- a/src/lib/librelib
+++ b/src/lib/librelib
@@ -30,7 +30,9 @@ _l() {
}
print() {
- local mesg; mesg="$(_ "$1")"; shift
+ local mesg
+ mesg="$(_ "$1")"
+ shift
printf -- "$mesg\n" "$@"
}
diff --git a/src/lib/libremessages b/src/lib/libremessages
index 95f2afa..dc1e8e5 100755
--- a/src/lib/libremessages
+++ b/src/lib/libremessages
@@ -16,10 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if [[ "${0##*/}" != libremessages ]]; then
- . "$(librelib messages)"
+if [[ ${0##*/} != libremessages ]]; then
+ . "$(librelib messages)"
else
- set -euE
- . "$(librelib messages)"
- "$@"
+ set -euE
+ . "$(librelib messages)"
+ "$@"
fi
diff --git a/src/lib/librexgettext b/src/lib/librexgettext
index dce7010..c0b50d8 100755
--- a/src/lib/librexgettext
+++ b/src/lib/librexgettext
@@ -45,7 +45,8 @@ fi
errusage() {
if [[ $# -gt 0 ]]; then
- fmt="$(gettext "$1")"; shift
+ fmt="$(gettext "$1")"
+ shift
printf "${0##*/}: $fmt\n" "$@" >&2
fi
usage >&2
@@ -71,10 +72,10 @@ usage() {
echo
print 'Options:'
flag \
- '--simple=KEYWORD' 'Look for KEYWORD as an additional simple keyword' \
- '--prose=KEYWORD' 'Look for KEYWORD as an additional prose keyword' \
- '-k' 'Disable using the default keywords' \
- '-h, --help' 'Show this text'
+ '--simple=KEYWORD' 'Look for KEYWORD as an additional simple keyword' \
+ '--prose=KEYWORD' 'Look for KEYWORD as an additional prose keyword' \
+ '-k' 'Disable using the default keywords' \
+ '-h, --help' 'Show this text'
}
xgettext-sh() {
@@ -100,7 +101,7 @@ xgettext-flag() {
# offsets.
declare -i empties=0
declare -i i
- for (( i=1; empties < 3; i++ )); do
+ for ((i = 1; empties < 3; i++)); do
local out
out="$(xgettext-sh --keyword="flag:$i,\"$i\"" -- "$file")"
if [[ -n $out ]]; then
@@ -172,7 +173,7 @@ xgettext-flag() {
# See if we need to fiddle with $expectflag
# (and do some sanity checking).
- if [[ $arg != "$((prev_arg+1))" ]]; then
+ if [[ $arg != "$((prev_arg + 1))" ]]; then
if ! $expectflag; then
local pos
if [[ $row != "$prev_row" ]]; then
@@ -180,13 +181,13 @@ xgettext-flag() {
else
printf -v pos "%s:%d" "$file" "$prev_row"
fi
- >&2 printf "%s: $(gettext "flag error: Missing expected flag meaning at argument %d")\n" \
- "$pos" "$((prev_arg+1))"
+ printf >&2 "%s: $(gettext "flag error: Missing expected flag meaning at argument %d")\n" \
+ "$pos" "$((prev_arg + 1))"
exit 1 # $EXIT_FAILURE
- elif [[ $arg == "$((prev_arg+2))" ]]; then
+ elif [[ $arg == "$((prev_arg + 2))" ]]; then
# skipped flag argument
expectflag=false
- elif [[ "$arg" == 1 ]]; then
+ elif [[ $arg == 1 ]]; then
# started new invocation
expectflag=true
elif [[ $arg == 2 ]]; then
@@ -199,8 +200,8 @@ xgettext-flag() {
else
printf -v pos "%s:%d" "$file" "$prev_row"
fi
- >&2 printf "%s: $(gettext "flag error: Jumped from argument %d to %d")\n" \
- "$pos" "$prev_arg" "$arg"
+ printf >&2 "%s: $(gettext "flag error: Jumped from argument %d to %d")\n" \
+ "$pos" "$prev_arg" "$arg"
exit 1 # $EXIT_FAILURE
fi
fi
@@ -227,17 +228,17 @@ xgettext-flag() {
fi
done
if ! $expectflag; then
- >&2 printf "%s:%d: $(gettext "flag error: Missing expected flag meaning at argument %d")\n" \
- "$file" "$prev_row" \
- "$((prev_arg+1))"
+ printf >&2 "%s:%d: $(gettext "flag error: Missing expected flag meaning at argument %d")\n" \
+ "$file" "$prev_row" \
+ "$((prev_arg + 1))"
exit 1 # $EXIT_FAILURE
fi
}
}
whitespace-collapse() {
- tr '\n' '\r' | sed 's/"\r\s*"//g' | tr '\r' '\n' | # This removes the awkward word-wrapping done by xgettext
- sed -r -e 's/(\\n|\\t|\t)/ /g' -e 's/(^|[^.!? ]) +/\1 /g' -e 's/([.!?]) +/\1 /g' # This collapses whitespace
+ tr '\n' '\r' | sed 's/"\r\s*"//g' | tr '\r' '\n' | # This removes the awkward word-wrapping done by xgettext
+ sed -r -e 's/(\\n|\\t|\t)/ /g' -e 's/(^|[^.!? ]) +/\1 /g' -e 's/([.!?]) +/\1 /g' # This collapses whitespace
}
main() {
@@ -249,20 +250,35 @@ main() {
local error=false
declare -i i
- for (( i=1; i <= $#; i++ )); do
+ for ((i = 1; i <= $#; i++)); do
case "${!i}" in
- --simple) i+=1; simple+=(--keyword="${!i}");;
- --simple=*) simple+=(--keyword="${!i#*=}");;
- --prose) i+=1; prose+=(--keyword="${!i}");;
- --prose=*) prose+=(--keyword="${!i#*=}");;
- -k) use_defaults=false;;
- --help|-h) usage; return 0;; # $EXIT_SUCCESS
- --) i+=1; break;;
- -*) errusage "unrecognized option: %s" "${!i}"; error=true;;
- *) files+=("${!i}");;
+ --simple)
+ i+=1
+ simple+=(--keyword="${!i}")
+ ;;
+ --simple=*) simple+=(--keyword="${!i#*=}") ;;
+ --prose)
+ i+=1
+ prose+=(--keyword="${!i}")
+ ;;
+ --prose=*) prose+=(--keyword="${!i#*=}") ;;
+ -k) use_defaults=false ;;
+ --help | -h)
+ usage
+ return 0
+ ;; # $EXIT_SUCCESS
+ --)
+ i+=1
+ break
+ ;;
+ -*)
+ errusage "unrecognized option: %s" "${!i}"
+ error=true
+ ;;
+ *) files+=("${!i}") ;;
esac
done
- files+=("${@:$i}")
+ files+=("${@:i}")
if [[ ${#files[@]} -lt 1 ]]; then
errusage "no input file given"
error=true
diff --git a/src/lib/messages.sh b/src/lib/messages.sh
index 67cdab5..64757c0 100644
--- a/src/lib/messages.sh
+++ b/src/lib/messages.sh
@@ -66,7 +66,9 @@ panic() {
# Like printf, but gettext-aware, and prints a trailing newline
print() {
[[ $# -ge 1 ]] || panic
- local mesg; mesg="$(_ "$1")"; shift
+ local mesg
+ mesg="$(_ "$1")"
+ shift
printf -- "$mesg\n" "$@"
}
@@ -79,12 +81,11 @@ whitespace_collapse() {
[[ $# == 0 ]] || panic
tr '\n' '\r' | sed -r \
- -e 's/\r/ /g' -e 's/\t/ /g' \
- -e 's/(^|[^.!? ]) +/\1 /g' -e 's/([.!?]) +/\1 /g' \
- -e 's/\s+$//'
+ -e 's/\r/ /g' -e 's/\t/ /g' \
+ -e 's/(^|[^.!? ]) +/\1 /g' -e 's/([.!?]) +/\1 /g' \
+ -e 's/\s+$//'
}
-
# Usage: prose MESG [ARGS...]
#
# Do HTML-style whitespace collapsing on the first argument, translate
@@ -92,7 +93,9 @@ whitespace_collapse() {
# printing a paragraph of prose in --help text.
prose() {
[[ $# -ge 1 ]] || panic
- local mesg; mesg="$(_ "$(whitespace_collapse <<<"$1")")"; shift
+ local mesg
+ mesg="$(_ "$(whitespace_collapse <<<"$1")")"
+ shift
printf -- "$mesg" "$@" | fmt -u
}
@@ -101,7 +104,9 @@ prose() {
# remaining lines.
bullet() {
[[ $# -ge 1 ]] || panic
- local mesg; mesg="$(_ "$(whitespace_collapse <<<"$1")")"; shift
+ local mesg
+ mesg="$(_ "$(whitespace_collapse <<<"$1")")"
+ shift
# Wrap the text to 71 columns; 75 (the default) minus a 4 column indent
printf -- "$mesg" "$@" | fmt -u -w 71 | sed -e '1s/^/ - /' -e '2,$s/^/ /'
}
@@ -129,8 +134,7 @@ bullet() {
# NB: The opening curly brace is on a separate line because otherwise
# xgettext gets confused when parsing this file. It's a dumb bug in
# GNU xgettext.
-flag()
-{
+flag() {
local args=("$@")
declare -i flaglen=0
@@ -171,11 +175,12 @@ flag()
else
[[ $# -gt 1 ]] || panic
local flag=$1
- local desc; desc="$(_ "$(whitespace_collapse <<<"$2")")"
+ local desc
+ desc="$(_ "$(whitespace_collapse <<<"$2")")"
shift 2
local lines
- IFS=$'\n' lines=($(fmt -u -w $((71-indent)) <<<"$desc"))
+ IFS=$'\n' lines=($(fmt -u -w $((71 - indent)) <<<"$desc"))
printf -- "$fmt2" "$flag" "${lines[0]}"
[[ ${#lines[@]} -lt 2 ]] || printf -- "$fmt1" "${lines[@]:1}"
fi
@@ -189,11 +194,13 @@ term_title() {
[[ $# -ge 1 ]] || panic
local fmt=''
case "$TERM" in
- screen|tmux)
+ screen | tmux)
# shellcheck disable=1003
- fmt='\ek%s\e\\';;
- xterm*|rxvt*)
- fmt='\e]0;%s\a';;
+ fmt='\ek%s\e\\'
+ ;;
+ xterm* | rxvt*)
+ fmt='\e]0;%s\a'
+ ;;
esac
printf "$fmt" "$(printf -- "$@")"
}
@@ -218,7 +225,8 @@ setup_traps() {
eval "_libremessages_trap_exit() { $1 \"\$@\"; }"
else
_libremessages_trap_exit() {
- local signal=$1; shift
+ local signal=$1
+ shift
echo >&2
error "$@"
trap -- "$signal"
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch
index 0a1bb70..a69ddea 100755
--- a/src/librefetch/librefetch
+++ b/src/librefetch/librefetch
@@ -72,25 +72,25 @@ usage() {
prose "The default build script is 'PKGBUILD', or 'SRCBUILD' if it
exists."
echo
- prose "Other options, if they are valid \`makepkg\` options, are passed
- straight to makepkg."
+ prose 'Other options, if they are valid `makepkg` options, are passed
+ straight to makepkg.'
echo
print "Example usage:"
print ' $ %s https://repo.parabola.nu/other/mypackage/mypackage-1.0.tar.gz' "$cmd"
echo
print "Options:"
flag 'Settings:' \
- "-C" "Force create mode (don't download)" \
- "-D" "Force download mode (don't create)" \
- "-p <$(_ FILE)>" "Use an alternate build script (instead of
+ "-C" "Force create mode (don't download)" \
+ "-D" "Force download mode (don't create)" \
+ "-p <$(_ FILE)>" "Use an alternate build script (instead of
'PKGBUILD'). If an SRCBUILD exists in the same
directory, it is used instead" \
- 'Alternate modes:' \
- "-g, --geninteg" "Generate integrity checks for source files" \
- "-S, --srcbuild" "Print the effective build script (SRCBUILD)" \
- "-M, --makepkg" "Generate and print the location of the
+ 'Alternate modes:' \
+ "-g, --geninteg" "Generate integrity checks for source files" \
+ "-S, --srcbuild" "Print the effective build script (SRCBUILD)" \
+ "-M, --makepkg" "Generate and print the location of the
effective makepkg script" \
- "-h, --help" "Show this message"
+ "-h, --help" "Show this message"
}
main() {
@@ -133,13 +133,13 @@ doit() {
if [[ -f "${BUILDFILEDIR}/SRCBUILD" ]]; then
BUILDFILE="${BUILDFILEDIR}/SRCBUILD"
fi
- if [[ ! -f "$BUILDFILE" ]]; then
+ if [[ ! -f $BUILDFILE ]]; then
error "%s does not exist." "$BUILDFILE"
exit $EXIT_FAILURE
fi
case "$BUILDFILE" in
- */SRCBUILD) srcbuild="$(modified_srcbuild "$BUILDFILE")";;
- *) srcbuild="$(modified_pkgbuild "$BUILDFILE")";;
+ */SRCBUILD) srcbuild="$(modified_srcbuild "$BUILDFILE")" ;;
+ *) srcbuild="$(modified_pkgbuild "$BUILDFILE")" ;;
esac
tmpfiles+=("$srcbuild")
@@ -147,10 +147,10 @@ doit() {
if [[ $mode =~ checksums ]]; then
"$makepkg" "${makepkg_opts[@]}" -g -p "$srcbuild" |
- case ${BUILDFILE##*/} in
- PKGBUILD) sed -e 's/^[a-z]/mk&/' -e 's/^\s/ &/';;
- SRCBUILD) cat;;
- esac
+ case ${BUILDFILE##*/} in
+ PKGBUILD) sed -e 's/^[a-z]/mk&/' -e 's/^\s/ &/' ;;
+ SRCBUILD) cat ;;
+ esac
exit $EXIT_SUCCESS
fi
@@ -178,15 +178,15 @@ doit() {
load_conf librefetch.conf MIRRORS DOWNLOADER || exit
# Canonicalize $src
- if [[ "$src" == libre://* ]]; then
+ if [[ $src == libre://* ]]; then
src="${MIRRORS[0]}/${src#libre://}"
fi
# check to see if $src is a candidate for create mode
- local inmirror=false;
+ local inmirror=false
local mirror
for mirror in "${MIRRORS[@]}"; do
- if [[ "$src" == "$mirror"* ]]; then
+ if [[ $src == "$mirror"* ]]; then
inmirror=true
break
fi
@@ -197,7 +197,7 @@ doit() {
fi
local dlcmd="${DOWNLOADER}"
- [[ $dlcmd = *%u* ]] || dlcmd="$dlcmd %u"
+ [[ $dlcmd == *%u* ]] || dlcmd="$dlcmd %u"
dlcmd="${dlcmd//\%o/\"\$dst\"}"
dlcmd="${dlcmd//\%u/\"\$src\"}"
@@ -253,8 +253,14 @@ parse_options() {
# Feed the options through getopt (sanitize them)
local shrt long args
- shrt="$({ printf '%s\0' "${shrt1[@]}"; printf '%s:\0' "${shrt2[@]}"; } | sort -zu | xargs -0 printf '%s')"
- long="$({ printf '%s\0' "${long1[@]}"; printf '%s:\0' "${long2[@]}"; } | sort -zu | xargs -0 printf '%s,')"
+ shrt="$({
+ printf '%s\0' "${shrt1[@]}"
+ printf '%s:\0' "${shrt2[@]}"
+ } | sort -zu | xargs -0 printf '%s')"
+ long="$({
+ printf '%s\0' "${long1[@]}"
+ printf '%s:\0' "${long2[@]}"
+ } | sort -zu | xargs -0 printf '%s,')"
args="$(getopt -n "$cmd" -o "$shrt" -l "${long%,}" -- "$@")" || ret=$EXIT_INVALIDARGUMENT
eval "set -- $args"
unset shrt long args
@@ -262,25 +268,26 @@ parse_options() {
# Parse the options.
local opt optarg have_optarg
while [[ $# -gt 0 ]]; do
- opt=$1; shift
+ opt=$1
+ shift
have_optarg=false
- if { [[ $opt == --?* ]] && in_array "${opt#--}" "${long2[@]}"; } \
- || { [[ $opt == -? ]] && in_array "${opt#-}" "${shrt2[@]}"; }
- then
- optarg=$1; shift
+ if { [[ $opt == --?* ]] && in_array "${opt#--}" "${long2[@]}"; } ||
+ { [[ $opt == -? ]] && in_array "${opt#-}" "${shrt2[@]}"; }; then
+ optarg=$1
+ shift
have_optarg=true
fi
case "$opt" in
- -C) mode=create;;
- -D) mode=download;;
- -g|--geninteg) mode=checksums;;
- -S|--srcbuild) mode=srcbuild;;
- -M|--makepkg) mode=makepkg;;
- -p) BUILDFILE="$(realpath -Lm -- "$optarg")";;
- -h|--help) mode=help;;
- --) break;;
+ -C) mode=create ;;
+ -D) mode=download ;;
+ -g | --geninteg) mode=checksums ;;
+ -S | --srcbuild) mode=srcbuild ;;
+ -M | --makepkg) mode=makepkg ;;
+ -p) BUILDFILE="$(realpath -Lm -- "$optarg")" ;;
+ -h | --help) mode=help ;;
+ --) break ;;
*)
makepkg_opts+=("$opt")
if $have_optarg; then makepkg_opts+=("$optarg"); fi
@@ -292,14 +299,14 @@ parse_options() {
# check the number of extra_opts
case "$mode" in
help) # don't worry about it
- :;;
- checksums|srcbuild|makepkg) # don't take any extra arguments
+ : ;;
+ checksums | srcbuild | makepkg) # don't take any extra arguments
if [[ ${#extra_opts[@]} != 0 ]]; then
print "%s: found extra non-flag arguments: %s" "$cmd" "${extra_opts[*]}" >&2
ret=$EXIT_INVALIDARGUMENT
fi
;;
- *download*|*create*) # take 1 or 2 extra arguments
+ *download* | *create*) # take 1 or 2 extra arguments
if [[ ${#extra_opts[@]} != 1 ]] && [[ ${#extra_opts[@]} != 2 ]]; then
print "%s: %d non-flag arguments found, expected 1 or 2: %s" "$cmd" ${#extra_opts[@]} >&2
ret=$EXIT_INVALIDARGUMENT
@@ -368,18 +375,17 @@ modified_pkgbuild() {
local pkgbuild=$1
local srcbuild
srcbuild="$(mktemp "${pkgbuild%/*}/${cmd}.XXXXXXXXXXX.PKGBUILD.to.SRCBUILD")"
- printf '%s' "$pkgbuild_append" | cat "$pkgbuild" - > "$srcbuild"
+ printf '%s' "$pkgbuild_append" | cat "$pkgbuild" - >"$srcbuild"
printf '%s\n' "$srcbuild"
}
-
# Modify SRCBUILD ##############################################################
modified_srcbuild() {
local orig=$1
local new
new="$(mktemp "${orig%/*}/${cmd}.XXXXXXXXXXX.SRCBUILD.to.SRCBUILD")"
- sed -e '/PKGDEST=/d' -e '/PKGEXT=/d' < "$orig" > "$new"
+ sed -e '/PKGDEST=/d' -e '/PKGEXT=/d' <"$orig" >"$new"
printf '%s\n' "$new"
}
@@ -398,8 +404,7 @@ create_signature() {
gpg --detach-sign --use-agent "${SIGNWITHKEY[@]}" --no-armor "$filename" &>/dev/null || ret=$EXIT_FAILURE
-
- if (( ! ret )); then
+ if ((!ret)); then
msg2 "Created signature file %s." "$filename.sig"
else
error "Failed to sign package file."
diff --git a/src/librefetch/librefetch-install b/src/librefetch/librefetch-install
index 2cdb014..274b7ac 100755
--- a/src/librefetch/librefetch-install
+++ b/src/librefetch/librefetch-install
@@ -38,7 +38,7 @@ del_line() {
local file=$1
local line=$2
local lineno=($(grep -Fxn -- "$line" "$file" | cut -d: -f1))
- if [[ "${#lineno[@]}" -gt 0 ]]; then
+ if [[ ${#lineno[@]} -gt 0 ]]; then
sed -i "$(printf '%dd;' "${lineno[@]}")" "$file"
fi
}
@@ -66,15 +66,18 @@ main() {
return 1
fi
local file=$2
- if [[ ! -f "$file" ]]; then
+ if [[ ! -f $file ]]; then
error "%s: does not exist: %q" "${0##*/}" "$(realpath -s "$file")"
fi
- if [[ ! -w "$file" ]]; then
+ if [[ ! -w $file ]]; then
error "%s: cannot write to file: %q" "${0##*/}" "$(realpath -s "$file")"
fi
case "$1" in
- remove) pre_remove "$file";;
- *) usage >&2; return 1;;
+ remove) pre_remove "$file" ;;
+ *)
+ usage >&2
+ return 1
+ ;;
esac
}
diff --git a/src/librefetch/librefetchdir/libmakepkg/tidy/purge.sh b/src/librefetch/librefetchdir/libmakepkg/tidy/purge.sh
index a37ff2f..acd3c91 100755
--- a/src/librefetch/librefetchdir/libmakepkg/tidy/purge.sh
+++ b/src/librefetch/librefetchdir/libmakepkg/tidy/purge.sh
@@ -23,7 +23,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-[[ -n "$LIBMAKEPKG_TIDY_PURGE_SH" ]] && return
+[[ -n $LIBMAKEPKG_TIDY_PURGE_SH ]] && return
LIBMAKEPKG_TIDY_PURGE_SH=1
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
@@ -31,7 +31,6 @@ LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
source "$LIBRARY/util/message.sh"
source "$LIBRARY/util/option.sh"
-
packaging_options+=('purge')
tidy_remove+=('tidy_purge')
@@ -40,14 +39,14 @@ tidy_purge() {
msg2 "$(gettext "Purging unwanted files...")"
local pt
for pt in "${PURGE_TARGETS[@]}"; do
- if [[ ${pt} = "${pt%/}" ]]; then
- if [[ ${pt} = "${pt//\/}" ]]; then
+ if [[ ${pt} == "${pt%/}" ]]; then
+ if [[ ${pt} == "${pt//\//}" ]]; then
find . ! -type d -name "${pt}" -exec rm -f -- '{}' +
else
rm -f -- "${pt}"
fi
else
- if [[ ${pt%/} = "${pt//\/}" ]]; then
+ if [[ ${pt%/} == "${pt//\//}" ]]; then
find . -type d -name "${pt%/}" -exec rm -rf -- '{}' +
else
rm -rf -- "${pt}"
diff --git a/src/librefetch/librefetchdir/libmakepkg/tidy/~source_date_epoch.sh b/src/librefetch/librefetchdir/libmakepkg/tidy/~source_date_epoch.sh
index a58f9dd..5d4719c 100755
--- a/src/librefetch/librefetchdir/libmakepkg/tidy/~source_date_epoch.sh
+++ b/src/librefetch/librefetchdir/libmakepkg/tidy/~source_date_epoch.sh
@@ -24,14 +24,14 @@
# This filename starts with a ~ because it sorts after every other
# (printable) ASCII character, and we want this to run last.
-[[ -n "$LIBMAKEPKG_TIDY_SOURCE_DATE_EPOCH_SH" ]] && return
+[[ -n $LIBMAKEPKG_TIDY_SOURCE_DATE_EPOCH_SH ]] && return
LIBMAKEPKG_TIDY_SOURCE_DATE_EPOCH_SH=1
tidy_modify+=('tidy_source_date_epoch')
tidy_source_date_epoch() {
local date='1990-01-01 0:0:0 +0'
- if [[ -n "$SOURCE_DATE_EPOCH" ]]; then
+ if [[ -n $SOURCE_DATE_EPOCH ]]; then
date="@$SOURCE_DATE_EPOCH"
fi
find . -exec touch --no-dereference --date="$date" -- {} +
diff --git a/src/libretools.conf b/src/libretools.conf
index cacd0c9..610783a 100644
--- a/src/libretools.conf
+++ b/src/libretools.conf
@@ -14,7 +14,7 @@ BLACKLIST=https://git.parabola.nu/blacklist.git/plain/blacklist.txt
## Diff tool (vimdiff, gvimdiff, meld, etc)
## Used by `aur`, `diff-unfree`
# shellcheck disable=2046
-DIFFPROG=$(which $([ -z "${DISPLAY:-}" ]||echo kdiff3 meld gvimdiff) vimdiff colordiff diff 2>/dev/null|sed 's/\s.*//;1q')
+DIFFPROG=$(which $([ -z "${DISPLAY:-}" ] || echo kdiff3 meld gvimdiff) vimdiff colordiff diff 2>/dev/null | sed 's/\s.*//;1q')
## ABSLibre
## Used by: `createworkdir`
diff --git a/src/pkgbuild-check-nonfree b/src/pkgbuild-check-nonfree
index 6bec280..6a01fa8 100755
--- a/src/pkgbuild-check-nonfree
+++ b/src/pkgbuild-check-nonfree
@@ -49,13 +49,13 @@ usage() {
print " 32: Is a known nonfree package"
echo
print "Options:"
- flag '-c' 'Use the cached blacklist, do not try downloading'
- flag '-f' 'Allow running as root user'
+ flag '-c' 'Use the cached blacklist, do not try downloading'
+ flag '-f' 'Allow running as root user'
echo
- flag '-q' 'Be quiet'
- flag '-v' 'Be verbose'
+ flag '-q' 'Be quiet'
+ flag '-v' 'Be verbose'
echo
- flag '-h' 'Show this message'
+ flag '-h' 'Show this message'
}
# Make sure these match:
@@ -77,12 +77,18 @@ main() {
local v=1
while getopts 'cfqvh' arg; do
case "$arg" in
- c) cache=true;;
- f) asroot=true;;
- q) v=0;;
- v) v=2;;
- h) usage; return $_E_OK;;
- *) usage >&2; return $_E_ERROR;;
+ c) cache=true ;;
+ f) asroot=true ;;
+ q) v=0 ;;
+ v) v=2 ;;
+ h)
+ usage
+ return $_E_OK
+ ;;
+ *)
+ usage >&2
+ return $_E_ERROR
+ ;;
esac
done
shift $((OPTIND - 1))
@@ -117,7 +123,7 @@ main() {
declare -i ret=0
local pkgbuild
for pkgbuild in "${pkgbuilds[@]}"; do
- pkgbuild_check "$pkgbuild" || ret=$((ret|$?))
+ pkgbuild_check "$pkgbuild" || ret=$((ret | $?))
done
return $ret
}
@@ -147,7 +153,7 @@ pkgbuild_get_pkg_ary() {
local ary="${var}[@]"
local indirect=("${!ary}")
eval "$(declare -f "package_$pkg" | sed -rn "s/^\s*${var}(\+?=)/indirect\1/p")"
- declare -p indirect|sed "s/ indirect=/ ${out}=/"
+ declare -p indirect | sed "s/ indirect=/ ${out}=/"
}
# Checker functions ############################################################
@@ -166,23 +172,29 @@ check_lic() {
case "${license#custom:}" in
WTFPL)
# accept as common, I think it should be in the licenses package
- return $_E_OK;;
- BSD1|BSD2|BSD3|MIT|X11)
+ return $_E_OK
+ ;;
+ BSD1 | BSD2 | BSD3 | MIT | X11)
# accept these as common; they can't be included in the
# 'licenses' package because some text must be customized
- return $_E_OK;;
+ return $_E_OK
+ ;;
BSD4)
warning "The 4-clause BSD license is free but has practical problems."
- return $_E_LIC_NOGPL;;
+ return $_E_LIC_NOGPL
+ ;;
BSD)
warning "License 'BSD' is ambiguous, use 'BSD{1..4}' to specify the number of clauses."
- return $_E_LIC_UNKNOWN;;
+ return $_E_LIC_UNKNOWN
+ ;;
JSON)
error "License '%s' is a known non-free license." "$license"
- return $_E_LIC_NONFREE;;
+ return $_E_LIC_NONFREE
+ ;;
*)
warning "License '%s' is not a common (recognized) license." "$license"
- return $_E_LIC_UNKNOWN;;
+ return $_E_LIC_UNKNOWN
+ ;;
esac
fi
panic 'code should never be reached'
@@ -195,7 +207,7 @@ check_dep() {
local pkg=$1
local line rep
- line="$(blacklist-cat|blacklist-lookup "$pkg")"
+ line="$(blacklist-cat | blacklist-lookup "$pkg")"
rep="$(blacklist-get-rep <<<"$line")"
if [[ -z $line ]]; then
# not mentioned in blacklist; free
@@ -207,7 +219,7 @@ check_dep() {
return $_E_DEP_NONFREE
else
# non-free with free replacement
- if [[ "$rep" == "$pkg" ]]; then
+ if [[ $rep == "$pkg" ]]; then
info '%s: repackaged with the same name' "$pkg"
else
info '%s: replaced by %s' "$pkg" "$rep"
@@ -224,7 +236,7 @@ check_pkg() {
local pkg=$1
local line rep
- line="$(blacklist-cat|blacklist-lookup "$pkg")"
+ line="$(blacklist-cat | blacklist-lookup "$pkg")"
rep="$(blacklist-get-rep <<<"$line")"
if [[ -z $line ]]; then
# not mentioned in blacklist; free
@@ -236,7 +248,7 @@ check_pkg() {
return $_E_PKG_NONFREE
else
# non-free with free replacement
- if [[ "$rep" == "$pkg" ]]; then
+ if [[ $rep == "$pkg" ]]; then
info '%s: repackaged with the same name' "$pkg"
return $_E_OK
else
@@ -258,8 +270,8 @@ pkgbuild_check() (
return $_E_ERROR # not a PKGBUILD
fi
- declare -i ret=0 # the return status
- local dep lic # iterators for us in `for` loops
+ declare -i ret=0 # the return status
+ local dep lic # iterators for us in `for` loops
local ck_deps ck_lics # lists of deps and licenses that have been checked
if [[ ${#pkgname[@]} == 1 ]]; then
@@ -269,17 +281,16 @@ pkgbuild_check() (
fi
# Check if this is blacklisted
- check_pkg "${pkgbase:-${pkgname[0]}}" || ret=$((ret|$?))
+ check_pkg "${pkgbase:-${pkgname[0]}}" || ret=$((ret | $?))
# Check if dependencies are blacklisted
for dep in "${depends[@]}" "${makedepends[@]}" "${checkdepends[@]}" \
- "${optdepends[@]%%:*}" "${mkdepends[@]}"
- do
- check_dep "$dep" || ret=$((ret|$?))
+ "${optdepends[@]%%:*}" "${mkdepends[@]}"; do
+ check_dep "$dep" || ret=$((ret | $?))
ck_deps+=("$dep")
done
# Check the licenses
for lic in "${license[@]}"; do
- check_lic "$lic" || ret=$((ret|$?))
+ check_lic "$lic" || ret=$((ret | $?))
ck_lics+=("$lic")
done
@@ -288,7 +299,7 @@ pkgbuild_check() (
# Make sure a license is set
if [[ ${#ck_lics[@]} == 0 ]]; then
error "The license array is empty"
- ret=$((ret|_E_ERROR))
+ ret=$((ret | _E_ERROR))
fi
else
# Split package
@@ -301,23 +312,23 @@ pkgbuild_check() (
eval "$(pkgbuild_get_pkg_ary "$_pkgname" optdepends _optdepends)"
# Check if this is blacklisted
- check_pkg "$_pkgname" || ret=$((ret|$?))
+ check_pkg "$_pkgname" || ret=$((ret | $?))
# Check if dependencies are blacklisted
for dep in "${_depends[@]}" "${_optdepends[@]%%:*}"; do
if ! in_array "$dep" "${ck_deps[@]}"; then
- check_dep "$dep" || ret=$((ret|$?))
+ check_dep "$dep" || ret=$((ret | $?))
fi
done
# Check the licenses
for lic in "${_license[@]}"; do
if ! in_array "$lic" "${ck_lics[@]}"; then
- check_lic "$lic" || ret=$((ret|$?))
+ check_lic "$lic" || ret=$((ret | $?))
fi
done
if [[ ${#_license[@]} == 0 ]]; then
error "The license array is empty"
- ret=$((ret|_E_ERROR))
+ ret=$((ret | _E_ERROR))
fi
done
fi
diff --git a/src/pkgbuild-summarize-nonfree b/src/pkgbuild-summarize-nonfree
index 4bd76bb..e58544a 100755
--- a/src/pkgbuild-summarize-nonfree
+++ b/src/pkgbuild-summarize-nonfree
@@ -45,9 +45,15 @@ main() {
local quiet=false
while getopts 'qh' arg; do
case "$arg" in
- q) quiet=true;;
- h) usage; exit $EXIT_SUCCESS;;
- *) usage >&2; exit $EXIT_INVALIDARGUMENT;;
+ q) quiet=true ;;
+ h)
+ usage
+ exit $EXIT_SUCCESS
+ ;;
+ *)
+ usage >&2
+ exit $EXIT_INVALIDARGUMENT
+ ;;
esac
done
shift $((OPTIND - 1))
@@ -71,7 +77,7 @@ main() {
parse() {
[[ $# == 1 ]] || panic 'malformed call to parse'
- declare -i s=$1;
+ declare -i s=$1
declare -i ret=$EXIT_SUCCESS
declare -i i
@@ -81,20 +87,26 @@ parse() {
$_E_ERROR)
# could be anything, assume the worst
error "There was an error processing the PKGBUILD"
- ret=$EXIT_FAILURE;;
+ ret=$EXIT_FAILURE
+ ;;
$_E_LIC_UNKNOWN)
- warning "This PKGBUILD has an unknown license";;
+ warning "This PKGBUILD has an unknown license"
+ ;;
$_E_LIC_NOGPL)
- warning "This PKGBUILD has a GPL-incompatible license";;
+ warning "This PKGBUILD has a GPL-incompatible license"
+ ;;
$_E_LIC_NONFREE)
error "This PKGBUILD has a known nonfree license"
- ret=$EXIT_FAILURE;;
+ ret=$EXIT_FAILURE
+ ;;
$_E_DEP_NONFREE)
error "This PKGBUILD depends on known nonfree packages"
- ret=$EXIT_FAILURE;;
+ ret=$EXIT_FAILURE
+ ;;
$_E_PKG_NONFREE)
error "This PKGBUILD is for a known nonfree package"
- ret=$EXIT_FAILURE;;
+ ret=$EXIT_FAILURE
+ ;;
esac
fi
done
diff --git a/src/repo-diff b/src/repo-diff
index 58f9ba7..9655fe2 100755
--- a/src/repo-diff
+++ b/src/repo-diff
@@ -26,7 +26,7 @@ usage() {
print "Compares two repo databases using distro/repo/architecture format."
echo
print 'Shortcuts:'
- flag 'arch' 'expands to Arch Linux repo url'
+ flag 'arch' 'expands to Arch Linux repo url'
flag 'parabola' 'expands to Parabola GNU/Linux-libre repo url'
}
@@ -44,8 +44,8 @@ n() {
# add more distros here
g() {
echo "$1" | sed -e "s,^\([^/]\+\)/\([^/]\+\)/\([^/]\+\)$,\1/\2/os/\3/\2.db," \
- -e "s,^parabola/,http://repo.parabola.nu/," \
- -e "s,^arch\(linux\)\?/,http://mirrors.kernel.org/archlinux/,"
+ -e "s,^parabola/,http://repo.parabola.nu/," \
+ -e "s,^arch\(linux\)\?/,http://mirrors.kernel.org/archlinux/,"
}
main() {
@@ -54,17 +54,18 @@ main() {
exit $EXIT_SUCCESS
fi
- local tmpdir; tmpdir="$(mktemp -d -t "${0##*/}.XXXXXXXXXX")"
+ local tmpdir
+ tmpdir="$(mktemp -d -t "${0##*/}.XXXXXXXXXX")"
pushd "$tmpdir" >/dev/null
d=""
for i in "$1" "$2"; do
n=$(n "$i")
- [[ -n "$n" ]] || exit $EXIT_FAILURE
+ [[ -n $n ]] || exit $EXIT_FAILURE
wget -O "$n" -nv "$(g "$i")"
- b "$n" > "${n}.orig"
+ b "$n" >"${n}.orig"
d+=" ${n}.orig"
done
@@ -76,7 +77,7 @@ main() {
diff -auN "${d[@]}" | diffstat
fi
diff -auN "${d[@]}"
- } > "../${n}.diff"
+ } >"../${n}.diff"
popd >/dev/null
rm -r "$tmpdir"
diff --git a/src/toru/toru-path b/src/toru/toru-path
index 84b3d4c..96d4216 100755
--- a/src/toru/toru-path
+++ b/src/toru/toru-path
@@ -30,25 +30,25 @@ usage() {
prose 'The file `%s` is a Tokyo Cabinet database a mapping between paths
to PKGBUILD files and `pkgname`s and `pkgbase`s. PKGBUILD files
are scanned for in `$ABSROOT` in each of `$REPOS`.' \
- '$TORUPATH/paths.tch'
+ '$TORUPATH/paths.tch'
echo
prose 'Additionally, it creates a timestamp file at `%s`, so that skip
PKGBUILD files that have not changed since the previous
invocation.' \
- '$TORUPATH/lastsync.paths'
+ '$TORUPATH/lastsync.paths'
echo
print 'Configuration:'
flag \
'libretools.conf : TORUPATH' 'Where to store `paths.tch`' \
- 'libretools.conf : REPOS' 'Which repositories to consider from `$ABSROOT`' \
- 'abs.conf : ABSROOT' 'Where to find PKGBUILD files'
+ 'libretools.conf : REPOS' 'Which repositories to consider from `$ABSROOT`' \
+ 'abs.conf : ABSROOT' 'Where to find PKGBUILD files'
echo
print 'Options:'
flag \
'T=$TORUPATH' 'Override libretools.conf:TORUPATH' \
- 'V=true' 'Be verbose' \
- 'F=true' 'Ignore timestamps; force re-scan all PKGBUILDs' \
- '-h' 'Show this message'
+ 'V=true' 'Be verbose' \
+ 'F=true' 'Ignore timestamps; force re-scan all PKGBUILDs' \
+ '-h' 'Show this message'
}
main() {
@@ -59,7 +59,7 @@ main() {
FORCE=${F:-false}
# TODO: add an option to override/augment libretools.conf:REPOS
if [[ $# != 0 ]]; then
- if [[ $# == 1 && "$1" == '-h' ]]; then
+ if [[ $# == 1 && $1 == '-h' ]]; then
usage
return $EXIT_SUCCESS
fi
@@ -68,14 +68,14 @@ main() {
fi
declare -i ret=0
- if [[ -n "${T:-}" ]]; then
+ if [[ -n ${T:-} ]]; then
load_conf libretools.conf REPOS || ret=$?
TORUPATH=$T
else
load_conf libretools.conf TORUPATH REPOS || ret=$?
fi
load_conf abs.conf ABSROOT || ret=$?
- [[ $ret = 0 ]] || exit $ret
+ [[ $ret == 0 ]] || exit $ret
if [ ! -w "$TORUPATH" ]; then
error "Toru's path isn't writable. Please check your TORUPATH: %q" "$TORUPATH"
@@ -93,7 +93,7 @@ main() {
# This loops over ${REPOS[@]} backward. This is because early entries
# in REPOS have higher precidence, but the way this is implemented,
# the later entries have precedence, so we need to flip the order.
- for (( i = ${#REPOS[@]}-1 ; i >= 0 ; i-- )); do
+ for ((i = ${#REPOS[@]} - 1; i >= 0; i--)); do
$VERBOSE && msg "Processing [%s]" "${REPOS[$i]}"
if [ -d "${ABSROOT}/${REPOS[$i]}" ]; then
@@ -130,7 +130,7 @@ main() {
done
done
- date +%s > "${lastsyncfile}"
+ date +%s >"${lastsyncfile}"
}
main "$@"
diff --git a/test/cases/gitget.bats b/test/cases/gitget.bats
index 034075e..69261b4 100644
--- a/test/cases/gitget.bats
+++ b/test/cases/gitget.bats
@@ -21,7 +21,7 @@ load ../lib/common
git init .
git config --local user.email 'libretools-test@localhost'
git config --local user.name 'Test Suite'
- echo a > a
+ echo a >a
git add .
git commit -m 'initial commit'
cd ..
diff --git a/test/cases/lib-blacklist.bats b/test/cases/lib-blacklist.bats
index ba74d04..7d469fe 100644
--- a/test/cases/lib-blacklist.bats
+++ b/test/cases/lib-blacklist.bats
@@ -1,8 +1,10 @@
load ../lib/common
@test "libreblacklist works with just pkgname" {
- v="$(libreblacklist normalize <<<skype)"; [[ $v == 'skype::::' ]]
- v="$(libreblacklist get-pkg <<<skype)"; [[ $v == skype ]]
+ v="$(libreblacklist normalize <<<skype)"
+ [[ $v == 'skype::::' ]]
+ v="$(libreblacklist get-pkg <<<skype)"
+ [[ $v == skype ]]
libreblacklist get-rep <<<irreplaceable | equals $'\n'
libreblacklist get-url <<<skype | equals $'\n'
libreblacklist get-reason <<<skype | equals $'\n'
@@ -10,34 +12,53 @@ load ../lib/common
@test "libreblacklist works with everything set" {
line='linux:conflict:parabola:id:[semifree] blobs and firmware'
- v="$(libreblacklist normalize <<<"$line")"; [[ $v == "$line" ]]
- v="$(libreblacklist get-pkg <<<"$line")"; [[ $v == 'linux' ]]
- v="$(libreblacklist get-rep <<<"$line")"; [[ $v == 'libre/linux-libre' ]]
- v="$(libreblacklist get-url <<<"$line")"; [[ $v == 'https://labs.parabola.nu/issues/id' ]]
- v="$(libreblacklist get-reason <<<"$line")"; [[ $v == '[semifree] blobs and firmware' ]]
+ v="$(libreblacklist normalize <<<"$line")"
+ [[ $v == "$line" ]]
+ v="$(libreblacklist get-pkg <<<"$line")"
+ [[ $v == 'linux' ]]
+ v="$(libreblacklist get-rep <<<"$line")"
+ [[ $v == 'libre/linux-libre' ]]
+ v="$(libreblacklist get-url <<<"$line")"
+ [[ $v == 'https://labs.parabola.nu/issues/id' ]]
+ v="$(libreblacklist get-reason <<<"$line")"
+ [[ $v == '[semifree] blobs and firmware' ]]
}
@test "libreblacklist normalizes correctly" {
libreblacklist normalize <<<'#comment' | equals ''
- v="$(libreblacklist normalize <<<pkg)"; [[ $v == 'pkg::::' ]]
- v="$(libreblacklist normalize <<<pkg:)"; [[ $v == 'pkg::::' ]]
- v="$(libreblacklist normalize <<<pkg::)"; [[ $v == 'pkg::::' ]]
- v="$(libreblacklist normalize <<<pkg:rep)"; [[ $v == 'pkg:rep:::' ]]
- v="$(libreblacklist normalize <<<pkg:rep:)"; [[ $v == 'pkg:rep:::' ]]
- v="$(libreblacklist normalize <<<pkg:rep:ref)"; [[ $v == 'pkg:rep:ref::' ]]
- v="$(libreblacklist normalize <<<pkg:rep:ref:)"; [[ $v == 'pkg:rep:ref::' ]]
- v="$(libreblacklist normalize <<<pkg:rep:ref:id)"; [[ $v == 'pkg:rep:ref:id:' ]]
- v="$(libreblacklist normalize <<<pkg:rep:ref:id:)"; [[ $v == 'pkg:rep:ref:id:' ]]
- v="$(libreblacklist normalize <<<pkg:rep:ref:id:reason)"; [[ $v == 'pkg:rep:ref:id:reason' ]]
+ v="$(libreblacklist normalize <<<pkg)"
+ [[ $v == 'pkg::::' ]]
+ v="$(libreblacklist normalize <<<pkg:)"
+ [[ $v == 'pkg::::' ]]
+ v="$(libreblacklist normalize <<<pkg::)"
+ [[ $v == 'pkg::::' ]]
+ v="$(libreblacklist normalize <<<pkg:rep)"
+ [[ $v == 'pkg:rep:::' ]]
+ v="$(libreblacklist normalize <<<pkg:rep:)"
+ [[ $v == 'pkg:rep:::' ]]
+ v="$(libreblacklist normalize <<<pkg:rep:ref)"
+ [[ $v == 'pkg:rep:ref::' ]]
+ v="$(libreblacklist normalize <<<pkg:rep:ref:)"
+ [[ $v == 'pkg:rep:ref::' ]]
+ v="$(libreblacklist normalize <<<pkg:rep:ref:id)"
+ [[ $v == 'pkg:rep:ref:id:' ]]
+ v="$(libreblacklist normalize <<<pkg:rep:ref:id:)"
+ [[ $v == 'pkg:rep:ref:id:' ]]
+ v="$(libreblacklist normalize <<<pkg:rep:ref:id:reason)"
+ [[ $v == 'pkg:rep:ref:id:reason' ]]
}
@test "libreblacklist works with colons in reason" {
line='package:conflict:parabola:id:my:reason'
- v="$(libreblacklist normalize <<<"$line")"; [[ $v == "$line" ]]
- v="$(libreblacklist get-pkg <<<"$line")"; [[ $v == 'package' ]]
+ v="$(libreblacklist normalize <<<"$line")"
+ [[ $v == "$line" ]]
+ v="$(libreblacklist get-pkg <<<"$line")"
+ [[ $v == 'package' ]]
libreblacklist get-rep <<<"$line" | equals $'\n'
- v="$(libreblacklist get-url <<<"$line")"; [[ $v == 'https://labs.parabola.nu/issues/id' ]]
- v="$(libreblacklist get-reason <<<"$line")"; [[ $v == 'my:reason' ]]
+ v="$(libreblacklist get-url <<<"$line")"
+ [[ $v == 'https://labs.parabola.nu/issues/id' ]]
+ v="$(libreblacklist get-reason <<<"$line")"
+ [[ $v == 'my:reason' ]]
}
@test "libreblacklist prints urls only for valid references" {
@@ -46,9 +67,9 @@ load ../lib/common
}
@test "libreblacklist fails update with no blacklist or network" {
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
BLACKLIST='phony://example.com'
- eot
+ eot
libreblacklist update >$tmpdir/stdout 2>$tmpdir/stderr || status=$?
@@ -58,9 +79,9 @@ load ../lib/common
}
@test "libreblacklist fails cat with no blacklist or network" {
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
BLACKLIST='phony://example.com'
- eot
+ eot
libreblacklist cat >$tmpdir/stdout 2>$tmpdir/stderr || status=$?
@@ -70,9 +91,9 @@ load ../lib/common
}
@test "libreblacklist fails update when BLACKLIST is unset" {
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
BLACKLIST=
- eot
+ eot
libreblacklist update >$tmpdir/stdout 2>$tmpdir/stderr || status=$?
@@ -83,9 +104,9 @@ load ../lib/common
@test "libreblacklist fails cat when syntax error in conf" {
# there is a stray single quote in there
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
BLACKLIST='https://git.parabola.nu/blacklist.git/plain/blacklist.txt
- eot
+ eot
libreblacklist cat >$tmpdir/stdout 2>$tmpdir/stderr || status=$?
diff --git a/test/cases/lib-conf.bats b/test/cases/lib-conf.bats
index 0925640..68ddb7d 100644
--- a/test/cases/lib-conf.bats
+++ b/test/cases/lib-conf.bats
@@ -4,7 +4,7 @@ load ../lib/common
unset PKGDEST
touch "$tmpdir/makepkg.conf"
bash -c "$(printf '. $(librelib conf.sh); MAKEPKG_CONF=%q set_var makepkg PKGDEST /pkgdest' "$tmpdir/makepkg.conf")"
- . "$tmpdir/makepkg.conf"
+ . "$tmpdir/makepkg.conf"
[[ $PKGDEST == /pkgdest ]]
}
@@ -14,7 +14,7 @@ load ../lib/common
# the actual HOME, instead of the test environment HOME. Therefore, we
# will just check that [[ $HOME != /root ]]
cd "$tmpdir"
- echo '. $(librelib conf.sh); echo "$LIBREHOME"' > test.sh
+ echo '. $(librelib conf.sh); echo "$LIBREHOME"' >test.sh
LIBREHOME=$(testsudo bash ./test.sh)
[[ $LIBREHOME != /root ]]
}
@@ -23,7 +23,7 @@ load ../lib/common
require sudo || skip
[[ $USER != root ]]
cd "$tmpdir"
- echo '. $(librelib conf.sh); echo "$LIBREUSER"' > test.sh
+ echo '. $(librelib conf.sh); echo "$LIBREUSER"' >test.sh
LIBREUSER=$(testsudo bash ./test.sh)
[[ $LIBREUSER == "$USER" ]]
@@ -34,7 +34,7 @@ load ../lib/common
@test "lib/conf.sh respects custom HOME" {
cd "$tmpdir"
- echo '. $(librelib conf.sh); echo "$LIBREHOME"' > test.sh
+ echo '. $(librelib conf.sh); echo "$LIBREHOME"' >test.sh
export HOME=/foo
LIBREHOME=$(bash ./test.sh)
diff --git a/test/cases/lib-messages.bats b/test/cases/lib-messages.bats
index 69a5f09..1baa858 100644
--- a/test/cases/lib-messages.bats
+++ b/test/cases/lib-messages.bats
@@ -40,16 +40,16 @@ load ../lib/common
# Note that old versions of `flag` panicked if given an odd
# number of headings, so give an odd number here.
libremessages flag \
- -a adesc \
- -b bdesc \
- Head1: \
- -c cdesc > $tmpdir/out
- cat > $tmpdir/exp <<-eot
+ -a adesc \
+ -b bdesc \
+ Head1: \
+ -c cdesc >$tmpdir/out
+ cat >$tmpdir/exp <<-eot
-a adesc
-b bdesc
Head1:
-c cdesc
- eot
+ eot
diff -u $tmpdir/exp $tmpdir/out
}
diff --git a/test/cases/librechroot.bats b/test/cases/librechroot.bats
index ca61e1e..9ec2d2d 100644
--- a/test/cases/librechroot.bats
+++ b/test/cases/librechroot.bats
@@ -29,7 +29,7 @@ load ../lib/common
@test "librechroot disables networking when requested" {
require network sudo || skip
- testsudo librechroot -l "$BATS_TEST_NAME" run curl https://repo.parabola.nu/ >/dev/null
+ testsudo librechroot -l "$BATS_TEST_NAME" run curl https://repo.parabola.nu/ >/dev/null
not testsudo librechroot -l "$BATS_TEST_NAME" -N run curl https://repo.parabola.nu/ >/dev/null
}
@@ -37,11 +37,11 @@ load ../lib/common
require network sudo || skip
not testsudo librechroot -l "$BATS_TEST_NAME" run lsof
- echo "CHROOTEXTRAPKG=(lsof)" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
+ echo "CHROOTEXTRAPKG=(lsof)" >>"$XDG_CONFIG_HOME"/libretools/chroot.conf
testsudo librechroot -l "$BATS_TEST_NAME" install-name lsof
testsudo librechroot -l "$BATS_TEST_NAME" clean-pkgs
testsudo librechroot -l "$BATS_TEST_NAME" run lsof
- echo "CHROOTEXTRAPKG=()" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf
+ echo "CHROOTEXTRAPKG=()" >>"$XDG_CONFIG_HOME"/libretools/chroot.conf
testsudo librechroot -l "$BATS_TEST_NAME" clean-pkgs
not testsudo librechroot -l "$BATS_TEST_NAME" run lsof
}
@@ -61,7 +61,7 @@ load ../lib/common
testsudo librechroot -l "$BATS_TEST_NAME" run sh -c "
echo 'builduser:x:${builduser_gid}:' >>/etc/group
echo 'builduser:x:${builduser_uid}:${builduser_gid}:builduser:/build:/bin/bash' >>/etc/passwd
- echo 'builduser:!!:$(( $(date -u +%s) / 86400 ))::::::' >>/etc/shadow"
+ echo 'builduser:!!:$(($(date -u +%s) / 86400))::::::' >>/etc/shadow"
# Pre-flight: Make sure `lsof` isn't in the base install
not testsudo librechroot -l "$BATS_TEST_NAME" run lsof
@@ -90,7 +90,7 @@ load ../lib/common
testsudo librechroot -l "$BATS_TEST_NAME" run sh -c "
echo 'builduser:x:${builduser_gid}:' >>/etc/group
echo 'builduser:x:${builduser_uid}:${builduser_gid}:builduser:/build:/bin/bash' >>/etc/passwd
- echo 'builduser:!!:$(( $(date -u +%s) / 86400 ))::::::' >>/etc/shadow"
+ echo 'builduser:!!:$(($(date -u +%s) / 86400))::::::' >>/etc/shadow"
not testsudo librechroot -l "$BATS_TEST_NAME" run test -f /usr/bin/chcleanup
testsudo librechroot -l "$BATS_TEST_NAME" run mkdir /startdir
@@ -156,12 +156,13 @@ load ../lib/common
@test "librechroot fails when syncing a copy with itself" {
require sudo || skip
- testsudo timeout 5 librechroot -l root sync || status=$?
+ testsudo timeout 5 librechroot -l root sync || status=$?
case $status in
- 0|124|137) # success|timeout+TERM|timeout+KILL
- false;;
- *)
- true;;
+ 0 | 124 | 137) # success|timeout+TERM|timeout+KILL
+ false ;;
+ *)
+ true
+ ;;
esac
}
diff --git a/test/cases/libredbdiff.bats b/test/cases/libredbdiff.bats
index ed19b6d..6bd0eec 100644
--- a/test/cases/libredbdiff.bats
+++ b/test/cases/libredbdiff.bats
@@ -8,7 +8,7 @@ setup() {
mirror_prbl='https://repo.parabola.nu/$repo/os/$arch'
mirror_arch='https://mirrors.kernel.org/archlinux/$repo/os/$arch'
repos=(libre)
- eot
+ eot
}
@test "libredbdiff displays help" {
diff --git a/test/cases/librefetch.bats b/test/cases/librefetch.bats
index 21150bb..95de401 100644
--- a/test/cases/librefetch.bats
+++ b/test/cases/librefetch.bats
@@ -3,7 +3,7 @@ load ../lib/common
setup() {
common_setup
- cat >> "$XDG_CONFIG_HOME/pacman/makepkg.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/pacman/makepkg.conf" <<-eot
DLAGENTS=('ftp::/usr/bin/curl -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'
@@ -11,12 +11,12 @@ setup() {
'scp::/usr/bin/scp -C %u %o')
BUILDDIR=""
source ${_librelib_conf_sh_sysconfdir@Q}/makepkg.d/librefetch.conf
- eot
+ eot
install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/libretools/librefetch.conf" <<-eot
MIRRORS=("phony://example.com/dir/")
DOWNLOADER=/usr/bin/false
- eot
+ eot
}
@test "librefetch displays help" {
@@ -54,7 +54,7 @@ setup() {
touch src-libre/foo/file
# Run librefetch
- makepkg -g >& log.txt
+ makepkg -g >&log.txt
# Verify that no temporary files were left around
not test -e librefetch.*
@@ -70,7 +70,7 @@ setup() {
# - The files in the srcball are in the correct order (if the
# order isn't ensured, then this would only sometimes fail,
# unfortunately).
- bsdtar tf "$tmpdir/workdir/srcdest/$srcball" > list-pkg.txt
+ bsdtar tf "$tmpdir/workdir/srcdest/$srcball" >list-pkg.txt
diff -u list.txt list-pkg.txt
# Verify that the signature was created and matches
gpg --quiet --verify "$tmpdir/workdir/srcdest/$srcball"{.sig,} 2>/dev/null
@@ -100,7 +100,7 @@ setup() {
# - The files in the srcball are in the correct order (if the
# order isn't ensured, then this would only sometimes fail,
# unfortunately).
- bsdtar tf "$tmpdir/workdir/srcdest/$srcball" > list-pkg.txt
+ bsdtar tf "$tmpdir/workdir/srcdest/$srcball" >list-pkg.txt
diff -u list.txt list-pkg.txt
# Verify that the signature was created and matches
gpg --quiet --verify "$tmpdir/workdir/srcdest/$srcball"{.sig,} 2>/dev/null
@@ -113,7 +113,7 @@ setup() {
mv PKGBUILD{-recurse,}
makepkg -g
- bsdtar tf "$tmpdir/workdir/srcdest/$srcball" > list-pkg.txt
+ bsdtar tf "$tmpdir/workdir/srcdest/$srcball" >list-pkg.txt
diff -u list.txt list-pkg.txt
gpg --quiet --verify "$tmpdir/workdir/srcdest/$srcball"{.sig,} 2>/dev/null
}
@@ -124,7 +124,7 @@ setup() {
cd "$tmpdir"
mv PKGBUILD{-recurse,}
- :> "$tmpdir/workdir/srcdest/$srcball"
+ : >"$tmpdir/workdir/srcdest/$srcball"
makepkg -g
empty "$tmpdir/workdir/srcdest/$srcball"
gpg --quiet --verify "$tmpdir/workdir/srcdest/$srcball"{.sig,} 2>/dev/null
diff --git a/test/cases/librelib.bats b/test/cases/librelib.bats
index 1bd80ae..0d0738e 100644
--- a/test/cases/librelib.bats
+++ b/test/cases/librelib.bats
@@ -32,10 +32,10 @@ load ../lib/common
v3=$(librelib messages.sh)
v4=$(librelib libremessages.sh)
- [[ -r "$v1" && ! -x "$v1" ]]
- [[ "$v1" == "$v2" ]]
- [[ "$v1" == "$v3" ]]
- [[ "$v1" == "$v4" ]]
+ [[ -r $v1 && ! -x $v1 ]]
+ [[ $v1 == "$v2" ]]
+ [[ $v1 == "$v3" ]]
+ [[ $v1 == "$v4" ]]
}
# conf.sh is non-executable
@@ -45,10 +45,10 @@ load ../lib/common
v3=$(librelib conf.sh)
v4=$(librelib libreconf.sh)
- [[ -r "$v1" && ! -x "$v1" ]]
- [[ "$v1" == "$v2" ]]
- [[ "$v1" == "$v3" ]]
- [[ "$v1" == "$v4" ]]
+ [[ -r $v1 && ! -x $v1 ]]
+ [[ $v1 == "$v2" ]]
+ [[ $v1 == "$v3" ]]
+ [[ $v1 == "$v4" ]]
}
@test "librelib fails to find phony" {
diff --git a/test/cases/libremakepkg.bats b/test/cases/libremakepkg.bats
index 34db6e3..708449d 100644
--- a/test/cases/libremakepkg.bats
+++ b/test/cases/libremakepkg.bats
@@ -5,9 +5,9 @@ shopt -s extglob
setup() {
common_setup
- cat >> "$XDG_CONFIG_HOME/pacman/makepkg.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/pacman/makepkg.conf" <<-eot
unset PKGDEST SRCPKGDEST
- eot
+ eot
}
teardown() {
@@ -78,14 +78,21 @@ teardown() {
mkdir -p "$tmpdir"/{1,2,3}
cp fixtures/libremakepkg/PKGBUILD-testpkg1 "$tmpdir/1/PKGBUILD"
cp fixtures/libremakepkg/PKGBUILD-testpkg2 "$tmpdir/2/PKGBUILD"
- cp fixtures/libremakepkg/PKGBUILD-hello "$tmpdir/3/PKGBUILD"
-
+ cp fixtures/libremakepkg/PKGBUILD-hello "$tmpdir/3/PKGBUILD"
cd "$tmpdir/1"
- testsudo libremakepkg -l "$BATS_TEST_NAME" &> "$tmpdir/out" || { status=$?; tail "$tmpdir/out"|cat -v; return $status; }
+ testsudo libremakepkg -l "$BATS_TEST_NAME" &>"$tmpdir/out" || {
+ status=$?
+ tail "$tmpdir/out" | cat -v
+ return $status
+ }
cd "$tmpdir/2"
- testsudo libremakepkg -l "$BATS_TEST_NAME" &> "$tmpdir/out" || { status=$?; tail "$tmpdir/out"|cat -v; return $status; }
+ testsudo libremakepkg -l "$BATS_TEST_NAME" &>"$tmpdir/out" || {
+ status=$?
+ tail "$tmpdir/out" | cat -v
+ return $status
+ }
testsudo librechroot -l "$BATS_TEST_NAME" run libretools-testpkg1 'first time, pass'
# This next line is actually a separate test, but it fits in well with this test, and chroot tests are slow.
@@ -93,7 +100,11 @@ teardown() {
not testsudo librechroot -l "$BATS_TEST_NAME" run bash -O extglob -c 'test -e /var/cache/pacman/pkg/libretools-testpkg1-1.0-1-any.pkg.tar?(.!(sig|*.*))'
cd "$tmpdir/3"
- testsudo libremakepkg -l "$BATS_TEST_NAME" &> "$tmpdir/out" || { status=$?; tail "$tmpdir/out"|cat -v; return $status; }
+ testsudo libremakepkg -l "$BATS_TEST_NAME" &>"$tmpdir/out" || {
+ status=$?
+ tail "$tmpdir/out" | cat -v
+ return $status
+ }
not testsudo librechroot -l "$BATS_TEST_NAME" run libretools-testpkg1 'second time, fail'
}
@@ -132,9 +143,9 @@ teardown() {
cp fixtures/libremakepkg/PKGBUILD-hello "$tmpdir/PKGBUILD"
cd "$tmpdir"
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
BLACKLIST='phony://example.com'
- eot
+ eot
testsudo libremakepkg -l "$BATS_TEST_NAME" >$tmpdir/stdout 2>$tmpdir/stderr || status=$?
@@ -147,9 +158,9 @@ teardown() {
cp fixtures/libremakepkg/PKGBUILD-hello "$tmpdir/PKGBUILD"
cd "$tmpdir"
- cat >> "$XDG_CONFIG_HOME/libretools/chroot.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/chroot.conf" <<-eot
CHROOTEXTRAPKG+=(distcc-nozeroconf socat)
- eot
+ eot
testsudo librechroot -l "$BATS_TEST_NAME" install-name distcc-nozeroconf socat
# first make sure that the engine works
@@ -176,12 +187,12 @@ teardown() {
distcc_port=$(./lib/runserver "$tmpdir/distcc.pid" \
echo 'Hello, I am a distcc server')
- cat >> "$XDG_CONFIG_HOME/libretools/chroot.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/chroot.conf" <<-eot
CHROOTEXTRAPKG+=(distcc-nozeroconf socat)
- eot
- cat >> "$XDG_CONFIG_HOME/pacman/makepkg.conf" <<-eot
+ eot
+ cat >>"$XDG_CONFIG_HOME/pacman/makepkg.conf" <<-eot
DISTCC_HOSTS=127.0.0.1:${distcc_port@Q}
- eot
+ eot
cp fixtures/libremakepkg/PKGBUILD-distcc "$tmpdir/PKGBUILD"
cd "$tmpdir"
@@ -224,8 +235,8 @@ teardown() {
cp fixtures/libremakepkg/hello.sh "$tmpdir/hello.sh"
cd "$tmpdir"
gpg --detach-sign --use-agent --no-armor hello.sh
- echo 'echo pwned' >> hello.sh
- makepkg -g >> PKGBUILD
+ echo 'echo pwned' >>hello.sh
+ makepkg -g >>PKGBUILD
not testsudo libremakepkg -l "$BATS_TEST_NAME"
}
@@ -277,8 +288,8 @@ teardown() {
b_stime=$(stat -c %Y -- libretools-hello-1.0-1-any.src.tar?(.!(sig|*.*)))
b_ptime=$(stat -c %Y -- libretools-hello-1.0-1-any.pkg.tar?(.!(sig|*.*)))
- (( a_stime == b_stime ))
- (( a_ptime < b_ptime ))
- (( a_ptime > a_stime ))
- (( b_ptime > a_stime ))
+ ((a_stime == b_stime))
+ ((a_ptime < b_ptime))
+ ((a_ptime > a_stime))
+ ((b_ptime > a_stime))
}
diff --git a/test/cases/librerelease.bats b/test/cases/librerelease.bats
index a984d73..a87133f 100644
--- a/test/cases/librerelease.bats
+++ b/test/cases/librerelease.bats
@@ -15,26 +15,26 @@ setup() {
AcceptEnv _PATH LIBRETOOLS_LIBRARY_PATH _librelib_conf_sh_sysconfdir _librelib_conf_sh_pkgconfdir
AcceptEnv GPGKEY
ForceCommand HOME=\$_HOME; PATH=\$_PATH; eval "\$SSH_ORIGINAL_COMMAND"
- eot
+ eot
ssh-keygen -A -f "$tmpdir"
ssh_port=$(./lib/runserver "$tmpdir/sshd.pid" \
sshd -i \
- -f "$tmpdir/etc/ssh/sshd_config" \
- -h "$tmpdir/etc/ssh/ssh_host_ecdsa_key")
+ -f "$tmpdir/etc/ssh/sshd_config" \
+ -h "$tmpdir/etc/ssh/ssh_host_ecdsa_key")
# Configure the SSH client
mkdir -p -- "$HOME/.ssh"
ssh-keygen -N '' -f "$HOME/.ssh/id_rsa"
- ssh-keyscan -p "$ssh_port" 127.0.0.1 > "$HOME/.ssh/known_hosts"
+ ssh-keyscan -p "$ssh_port" 127.0.0.1 >"$HOME/.ssh/known_hosts"
touch -- "$HOME/.ssh/config"
# Configure libretools
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
REPODEST=ssh://${USER@Q}@127.0.0.1:${ssh_port@Q}/${tmpdir@Q}/srv-staging/
DBSCRIPTS_CONFIG=/etc/dbscripts/config.local.phony
HOOKPRERELEASE=:
HOOKPOSTRELEASE=:
- eot
+ eot
}
teardown() {
@@ -60,16 +60,20 @@ teardown() {
"$workdir/staging/repo2/file with spaces" \
"$workdir/staging/repo2/sub/subfolder"
- LC_ALL=C librerelease -l &>"$tmpdir/list" || { status=$?; cat "$tmpdir/list"; return $status; }
+ LC_ALL=C librerelease -l &>"$tmpdir/list" || {
+ status=$?
+ cat "$tmpdir/list"
+ return $status
+ }
- cat > "$tmpdir/list-correct" <<-eot
+ cat >"$tmpdir/list-correct" <<-eot
-> repo1
file1
file2
-> repo2
file with spaces
sub/subfolder
- eot
+ eot
diff "$tmpdir/list-correct" "$tmpdir/list"
}
@@ -93,9 +97,9 @@ teardown() {
}
@test "librerelease fails if DBSCRIPTS_CONFIG is not set" {
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
DBSCRIPTS_CONFIG=''
- eot
+ eot
local workdir="$tmpdir/workdir"
mkdir -p "$workdir/staging/repo1" "$workdir/staging/repo2/sub"
@@ -122,14 +126,14 @@ teardown() {
readlink -f -- "\$STAGING"
find "\$STAGING" -printf '%P\n' | LC_COLLATE=C sort
} > ${tmpdir@Q}/log.txt
- eot
+ eot
PATH=$tmpdir/bin:$PATH
# Log which directories the hooks are run in.
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
HOOKPRERELEASE='pwd > ${tmpdir@Q}/prerelease.txt'
HOOKPOSTRELEASE='pwd > ${tmpdir@Q}/postrelease.txt'
- eot
+ eot
# Make some files to stage
local workdir="$tmpdir/workdir"
@@ -144,8 +148,8 @@ teardown() {
librerelease
# Make sure everything went OK
- pwd > "$tmpdir/pwd.txt"
- cat > "$tmpdir/log-correct.txt" <<-eot
+ pwd >"$tmpdir/pwd.txt"
+ cat >"$tmpdir/log-correct.txt" <<-eot
/etc/dbscripts/config.local.phony
$(readlink -f -- "$tmpdir/srv-staging")
@@ -160,7 +164,7 @@ teardown() {
repo2/sub
repo2/sub/subfolder
repo2/sub/subfolder.sig
- eot
+ eot
diff -u "$tmpdir/log-correct.txt" "$tmpdir/log.txt"
diff -u "$tmpdir/pwd.txt" "$tmpdir/prerelease.txt"
diff -u "$tmpdir/pwd.txt" "$tmpdir/postrelease.txt"
@@ -176,18 +180,18 @@ teardown() {
readlink -f -- "\$STAGING"
find "\$STAGING" -printf '%P\n' | LC_COLLATE=C sort
} > ${tmpdir@Q}/log.txt
- eot
+ eot
install -Dm755 /dev/stdin "$tmpdir/bin/pbot-say" <<-eot
#!/bin/bash
echo "\$*" >${tmpdir@Q}/pbot.txt
- eot
+ eot
PATH=$tmpdir/bin:$PATH
# Log which directories the hooks are run in.
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
HOOKPRERELEASE='pwd > ${tmpdir@Q}/prerelease.txt'
HOOKPOSTRELEASE='pwd > ${tmpdir@Q}/postrelease.txt'
- eot
+ eot
# Make some files to stage
local workdir="$tmpdir/workdir"
@@ -202,8 +206,8 @@ teardown() {
librerelease
# Make sure everything went OK
- pwd > "$tmpdir/pwd.txt"
- cat > "$tmpdir/log-correct.txt" <<-eot
+ pwd >"$tmpdir/pwd.txt"
+ cat >"$tmpdir/log-correct.txt" <<-eot
/etc/dbscripts/config.local.phony
$(readlink -f -- "$tmpdir/srv-staging")
@@ -218,7 +222,7 @@ teardown() {
repo2/sub
repo2/sub/subfolder
repo2/sub/subfolder.sig
- eot
+ eot
diff -u "$tmpdir/log-correct.txt" "$tmpdir/log.txt"
diff -u "$tmpdir/pwd.txt" "$tmpdir/prerelease.txt"
diff -u "$tmpdir/pwd.txt" "$tmpdir/postrelease.txt"
diff --git a/test/cases/librestage.bats b/test/cases/librestage.bats
index 4551d1e..5012082 100644
--- a/test/cases/librestage.bats
+++ b/test/cases/librestage.bats
@@ -27,7 +27,8 @@ shopt -s extglob
}
@test "librestage guesses the repo" {
- nochroot=false; require network sudo || nochroot=true
+ nochroot=false
+ require network sudo || nochroot=true
mkdir -p -- "$tmpdir/reponame/libretools-hello"
cp fixtures/librestage/PKGBUILD-hello "$tmpdir/reponame/libretools-hello/PKGBUILD"
cd "$tmpdir/reponame/libretools-hello"
@@ -45,12 +46,13 @@ shopt -s extglob
}
@test "librestage stages packages without PKGDEST" {
- nochroot=false; require network sudo || nochroot=true
+ nochroot=false
+ require network sudo || nochroot=true
- cat >> "$XDG_CONFIG_HOME/pacman/makepkg.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/pacman/makepkg.conf" <<-eot
PKGDEST=''
SRCPKGDEST=''
- eot
+ eot
cp fixtures/librestage/PKGBUILD-hello "$tmpdir/PKGBUILD"
cd "$tmpdir"
diff --git a/test/cases/librexgettext.bats b/test/cases/librexgettext.bats
index 5bf9c93..87a45db 100644
--- a/test/cases/librexgettext.bats
+++ b/test/cases/librexgettext.bats
@@ -16,7 +16,7 @@ load ../lib/common
}
passcase() {
- librexgettext fixtures/librexgettext/$BATS_TEST_NAME.sh > $tmpdir/actual.pot 2>$tmpdir/stderr
+ librexgettext fixtures/librexgettext/$BATS_TEST_NAME.sh >$tmpdir/actual.pot 2>$tmpdir/stderr
empty $tmpdir/stderr
diff -u fixtures/librexgettext/$BATS_TEST_NAME.pot $tmpdir/actual.pot
}
@@ -26,18 +26,17 @@ passcase() {
@test "librexgettext handles librefetch flags" { passcase; }
@test "librexgettext fails on missing final flag description" {
- librexgettext fixtures/librexgettext/$BATS_TEST_NAME.sh > /dev/null 2>$tmpdir/stderr || status=$?
+ librexgettext fixtures/librexgettext/$BATS_TEST_NAME.sh >/dev/null 2>$tmpdir/stderr || status=$?
[[ $status != 0 ]]
- [[ "$(sed 1q $tmpdir/stderr)" = "fixtures/librexgettext/$BATS_TEST_NAME.sh:4:"* ]]
+ [[ "$(sed 1q $tmpdir/stderr)" == "fixtures/librexgettext/$BATS_TEST_NAME.sh:4:"* ]]
}
-
@test "librexgettext fails on subshell flag descriptions" {
- librexgettext fixtures/librexgettext/$BATS_TEST_NAME.sh > /dev/null 2>$tmpdir/stderr || status=$?
+ librexgettext fixtures/librexgettext/$BATS_TEST_NAME.sh >/dev/null 2>$tmpdir/stderr || status=$?
[[ $status != 0 ]]
- [[ "$(sed 1q $tmpdir/stderr)" = "fixtures/librexgettext/$BATS_TEST_NAME.sh:4-6:"* ]]
+ [[ "$(sed 1q $tmpdir/stderr)" == "fixtures/librexgettext/$BATS_TEST_NAME.sh:4-6:"* ]]
}
@test "librexgettext doesnt keep failing" {
@@ -49,7 +48,7 @@ passcase() {
}
@test "librexgettext handles multiple files" {
- librexgettext fixtures/librexgettext/combine1.sh fixtures/librexgettext/combine2.sh > $tmpdir/actual.pot 2>$tmpdir/stderr
+ librexgettext fixtures/librexgettext/combine1.sh fixtures/librexgettext/combine2.sh >$tmpdir/actual.pot 2>$tmpdir/stderr
empty $tmpdir/stderr
diff -u fixtures/librexgettext/combine.pot $tmpdir/actual.pot
}
diff --git a/test/cases/pkgbuild-check-nonfree.bats b/test/cases/pkgbuild-check-nonfree.bats
index ffd8de8..bb275a4 100644
--- a/test/cases/pkgbuild-check-nonfree.bats
+++ b/test/cases/pkgbuild-check-nonfree.bats
@@ -4,14 +4,14 @@ setup() {
common_setup
# Disable networking for blacklist.txt, and install a cached version instead
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
BLACKLIST='phony://example.com'
- eot
+ eot
install -Dm644 /dev/stdin "$XDG_CACHE_HOME/libretools/blacklist.txt" <<-eot
linux:linux-libre:nonfree blobs and firmwares
rubygemsx:rubygemsx:repackaged
skype
- eot
+ eot
}
# Make sure these match pkgbuild-check-nonfree
diff --git a/test/cases/toru-path.bats b/test/cases/toru-path.bats
index d891d3d..f559072 100644
--- a/test/cases/toru-path.bats
+++ b/test/cases/toru-path.bats
@@ -8,43 +8,43 @@ load ../lib/common
}
@test "toru-path runs" {
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
TORUPATH=${tmpdir@Q}
REPOS=(libre)
- eot
- cat >> "$HOME/.abs.conf" <<-eot
+ eot
+ cat >>"$HOME/.abs.conf" <<-eot
ABSROOT=${PWD@Q}/fixtures/toru
- eot
+ eot
toru-path
- tcamgr list "$tmpdir/paths.tch"|LC_COLLATE=C sort|while read -r key; do
+ tcamgr list "$tmpdir/paths.tch" | LC_COLLATE=C sort | while read -r key; do
val="$(tcamgr get "$tmpdir/paths.tch" "$key")"
printf '«%q» -> «%q»\n' "$key" "$val"
- done > "$tmpdir/paths-actual.txt"
+ done >"$tmpdir/paths-actual.txt"
printf '«%q» -> «%q»\n' \
- BAR "$PWD/fixtures/toru/libre/split-base" \
- BAZ "$PWD/fixtures/toru/libre/split-base" \
- FOO "$PWD/fixtures/toru/libre/split-base" \
- bar "$PWD/fixtures/toru/libre/split" \
- baz "$PWD/fixtures/toru/libre/split" \
- foo "$PWD/fixtures/toru/libre/split" \
- simple "$PWD/fixtures/toru/libre/simple" \
- split-base "$PWD/fixtures/toru/libre/split-base" \
- > "$tmpdir/paths-expected.txt"
+ BAR "$PWD/fixtures/toru/libre/split-base" \
+ BAZ "$PWD/fixtures/toru/libre/split-base" \
+ FOO "$PWD/fixtures/toru/libre/split-base" \
+ bar "$PWD/fixtures/toru/libre/split" \
+ baz "$PWD/fixtures/toru/libre/split" \
+ foo "$PWD/fixtures/toru/libre/split" \
+ simple "$PWD/fixtures/toru/libre/simple" \
+ split-base "$PWD/fixtures/toru/libre/split-base" \
+ >"$tmpdir/paths-expected.txt"
diff "$tmpdir/paths-expected.txt" "$tmpdir/paths-actual.txt"
}
@test "toru-path sets torupath" {
- cat >> "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
+ cat >>"$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot
TORUPATH=${tmpdir@Q}
REPOS=(libre)
- eot
- cat >> "$HOME/.abs.conf" <<-eot
+ eot
+ cat >>"$HOME/.abs.conf" <<-eot
ABSROOT=${PWD@Q}/fixtures/toru
- eot
+ eot
mkdir -p "$tmpdir/x"
T="$tmpdir/x" toru-path
diff --git a/test/fixtures/librechroot/PKGBUILD-arches b/test/fixtures/librechroot/PKGBUILD-arches
index 6116ad9..44589a5 100644
--- a/test/fixtures/librechroot/PKGBUILD-arches
+++ b/test/fixtures/librechroot/PKGBUILD-arches
@@ -10,13 +10,13 @@ depends_i686=('lsof')
depends_x86_64=('lsof')
build() {
- cd "$srcdir"
- echo '#!/bin/sh' > hello.sh
- echo 'echo Hello, world!' >> hello.sh
- echo 'lsof' >> hello.sh
+ cd "$srcdir"
+ echo '#!/bin/sh' >hello.sh
+ echo 'echo Hello, world!' >>hello.sh
+ echo 'lsof' >>hello.sh
}
package() {
- cd "$srcdir"
- install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
+ cd "$srcdir"
+ install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
}
diff --git a/test/fixtures/librechroot/PKGBUILD-libretools b/test/fixtures/librechroot/PKGBUILD-libretools
index dcc0f61..3f31453 100644
--- a/test/fixtures/librechroot/PKGBUILD-libretools
+++ b/test/fixtures/librechroot/PKGBUILD-libretools
@@ -8,13 +8,13 @@ arch=(any)
depends=(libretools)
build() {
- cd "$srcdir"
- echo '#!/bin/sh' > hello.sh
- echo 'echo Hello, world!' >> hello.sh
- echo 'lsof' >> hello.sh
+ cd "$srcdir"
+ echo '#!/bin/sh' >hello.sh
+ echo 'echo Hello, world!' >>hello.sh
+ echo 'lsof' >>hello.sh
}
package() {
- cd "$srcdir"
- install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
+ cd "$srcdir"
+ install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
}
diff --git a/test/fixtures/librefetch/PKGBUILD-bz2 b/test/fixtures/librefetch/PKGBUILD-bz2
index 0d688b8..0fe9a69 100644
--- a/test/fixtures/librefetch/PKGBUILD-bz2
+++ b/test/fixtures/librefetch/PKGBUILD-bz2
@@ -7,13 +7,13 @@ source=("libre://$pkgname-$pkgver.tar.bz2"{,.sig})
backup=(etc/testpkg.conf)
mksource() {
- mkdir "$srcdir/bar"
- local file
- for file in '~foo' '~a' a A; do
- touch "$srcdir/bar/$file"
- done
+ mkdir "$srcdir/bar"
+ local file
+ for file in '~foo' '~a' a A; do
+ touch "$srcdir/bar/$file"
+ done
}
package() {
- :;
+ :
}
diff --git a/test/fixtures/librefetch/PKGBUILD-mksource b/test/fixtures/librefetch/PKGBUILD-mksource
index 67f6bc3..67a7055 100644
--- a/test/fixtures/librefetch/PKGBUILD-mksource
+++ b/test/fixtures/librefetch/PKGBUILD-mksource
@@ -8,13 +8,13 @@ backup=(etc/testpkg.conf)
install=testpkg.install
mksource() {
- mkdir "$srcdir/bar"
- local file
- for file in '~foo' '~a' a A; do
- touch "$srcdir/bar/$file"
- done
+ mkdir "$srcdir/bar"
+ local file
+ for file in '~foo' '~a' a A; do
+ touch "$srcdir/bar/$file"
+ done
}
package() {
- :;
+ :
}
diff --git a/test/fixtures/librefetch/PKGBUILD-recurse b/test/fixtures/librefetch/PKGBUILD-recurse
index fad5976..c4dcd45 100644
--- a/test/fixtures/librefetch/PKGBUILD-recurse
+++ b/test/fixtures/librefetch/PKGBUILD-recurse
@@ -6,13 +6,13 @@ arch=(any)
source=("libre://$pkgname-$pkgver.tar.gz.sig")
mksource() {
- mkdir "$srcdir/bar"
- local file
- for file in '~foo' '~a' a A; do
- touch "$srcdir/bar/$file"
- done
+ mkdir "$srcdir/bar"
+ local file
+ for file in '~foo' '~a' a A; do
+ touch "$srcdir/bar/$file"
+ done
}
package() {
- :;
+ :
}
diff --git a/test/fixtures/librefetch/PKGBUILD-split b/test/fixtures/librefetch/PKGBUILD-split
index a979f08..38d5b7b 100644
--- a/test/fixtures/librefetch/PKGBUILD-split
+++ b/test/fixtures/librefetch/PKGBUILD-split
@@ -8,17 +8,17 @@ source=("libre://$pkgname-$pkgver.tar.gz"{,.sig})
backup=(etc/testpkg.conf)
mksource() {
- mkdir "$srcdir/bar"
- local file
- for file in '~foo' '~a' a A; do
- touch "$srcdir/bar/$file"
- done
+ mkdir "$srcdir/bar"
+ local file
+ for file in '~foo' '~a' a A; do
+ touch "$srcdir/bar/$file"
+ done
}
package_testpkg-split() {
- :;
+ :
}
package_testpkg-split-secondary() {
- :;
+ :
}
diff --git a/test/fixtures/librefetch/PKGBUILD-srcbuild b/test/fixtures/librefetch/PKGBUILD-srcbuild
index 40c5c79..0c149e5 100644
--- a/test/fixtures/librefetch/PKGBUILD-srcbuild
+++ b/test/fixtures/librefetch/PKGBUILD-srcbuild
@@ -6,5 +6,5 @@ arch=(any)
source=("libre://$pkgname-$pkgver.tar.gz"{,.sig})
package() {
- :;
+ :
}
diff --git a/test/fixtures/librefetch/SRCBUILD-srcbuild b/test/fixtures/librefetch/SRCBUILD-srcbuild
index 6f172c5..73d767c 100644
--- a/test/fixtures/librefetch/SRCBUILD-srcbuild
+++ b/test/fixtures/librefetch/SRCBUILD-srcbuild
@@ -9,13 +9,13 @@ PKGDEST=$SRCDEST
PKGEXT=$SRCEXT
build() {
- mkdir "$srcdir/bar"
- local file
- for file in '~foo' '~a' a A; do
- touch "$srcdir/bar/$file"
- done
+ mkdir "$srcdir/bar"
+ local file
+ for file in '~foo' '~a' a A; do
+ touch "$srcdir/bar/$file"
+ done
}
package() {
- cp -a -t "$pkgdir" "$srcdir"/*
+ cp -a -t "$pkgdir" "$srcdir"/*
}
diff --git a/test/fixtures/libremakepkg/PKGBUILD-distcc b/test/fixtures/libremakepkg/PKGBUILD-distcc
index e9f1d72..7abd79d 100644
--- a/test/fixtures/libremakepkg/PKGBUILD-distcc
+++ b/test/fixtures/libremakepkg/PKGBUILD-distcc
@@ -7,23 +7,23 @@ pkgrel=1
arch=(any)
build() (
- cd "$srcdir"
- set -x
+ cd "$srcdir"
+ set -x
- # Check that the odaemon socket exists
- [[ -S /socket ]]
+ # Check that the odaemon socket exists
+ [[ -S /socket ]]
- # ... and that it works
- printf 'GET / HTTP/1.1\r\nHost: parabola.nu\r\n\r\n' | distcc-tool client parabola.nu 80 > http.txt
- [[ "$(sed 1q http.txt)" == HTTP/* ]]
+ # ... and that it works
+ printf 'GET / HTTP/1.1\r\nHost: parabola.nu\r\n\r\n' | distcc-tool client parabola.nu 80 >http.txt
+ [[ "$(sed 1q http.txt)" == HTTP/* ]]
- # ... and that idaemon talks to it
- socat TCP-CONNECT:"${DISTCC_HOSTS}" STDIO < /dev/null > hello.txt
- [[ "$(cat hello.txt)" == 'Hello, I am a distcc server' ]]
+ # ... and that idaemon talks to it
+ socat TCP-CONNECT:"${DISTCC_HOSTS}" STDIO </dev/null >hello.txt
+ [[ "$(cat hello.txt)" == 'Hello, I am a distcc server' ]]
)
package() {
- cd "$srcdir"
- install -Dm644 hello.txt "$pkgdir"/usr/share/hello.txt
- install -Dm644 http.txt "$pkgdir"/usr/share/http.txt
+ cd "$srcdir"
+ install -Dm644 hello.txt "$pkgdir"/usr/share/hello.txt
+ install -Dm644 http.txt "$pkgdir"/usr/share/http.txt
}
diff --git a/test/fixtures/libremakepkg/PKGBUILD-hello b/test/fixtures/libremakepkg/PKGBUILD-hello
index 5f320fe..6c83f73 100644
--- a/test/fixtures/libremakepkg/PKGBUILD-hello
+++ b/test/fixtures/libremakepkg/PKGBUILD-hello
@@ -8,12 +8,12 @@ arch=(any)
depends=(sh)
build() {
- cd "$srcdir"
- echo '#!/bin/sh' > hello.sh
- echo 'echo Hello, world!' >> hello.sh
+ cd "$srcdir"
+ echo '#!/bin/sh' >hello.sh
+ echo 'echo Hello, world!' >>hello.sh
}
package() {
- cd "$srcdir"
- install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
+ cd "$srcdir"
+ install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
}
diff --git a/test/fixtures/libremakepkg/PKGBUILD-netbuild b/test/fixtures/libremakepkg/PKGBUILD-netbuild
index 4db1274..246a968 100644
--- a/test/fixtures/libremakepkg/PKGBUILD-netbuild
+++ b/test/fixtures/libremakepkg/PKGBUILD-netbuild
@@ -7,11 +7,11 @@ pkgrel=1
arch=(any)
build() {
- cd "$srcdir"
- curl https://repo.parabola.nu/ > index.html
+ cd "$srcdir"
+ curl https://repo.parabola.nu/ >index.html
}
package() {
- cd "$srcdir"
- install -Dm644 index.html "$pkgdir"/usr/share/$pkgname/index.html
+ cd "$srcdir"
+ install -Dm644 index.html "$pkgdir"/usr/share/$pkgname/index.html
}
diff --git a/test/fixtures/libremakepkg/PKGBUILD-netpackage b/test/fixtures/libremakepkg/PKGBUILD-netpackage
index 6cadcf8..c155b62 100644
--- a/test/fixtures/libremakepkg/PKGBUILD-netpackage
+++ b/test/fixtures/libremakepkg/PKGBUILD-netpackage
@@ -7,6 +7,6 @@ pkgrel=1
arch=(any)
package() {
- install -d "$pkgdir"/usr/share/$pkgname
- curl https://repo.parabola.nu/ > "$pkgdir"/usr/share/$pkgname/index.html
+ install -d "$pkgdir"/usr/share/$pkgname
+ curl https://repo.parabola.nu/ >"$pkgdir"/usr/share/$pkgname/index.html
}
diff --git a/test/fixtures/libremakepkg/PKGBUILD-netprepare b/test/fixtures/libremakepkg/PKGBUILD-netprepare
index efb7a43..fb6aeb3 100644
--- a/test/fixtures/libremakepkg/PKGBUILD-netprepare
+++ b/test/fixtures/libremakepkg/PKGBUILD-netprepare
@@ -7,11 +7,11 @@ pkgrel=1
arch=(any)
prepare() {
- cd "$srcdir"
- curl https://repo.parabola.nu/ > index.html
+ cd "$srcdir"
+ curl https://repo.parabola.nu/ >index.html
}
package() {
- cd "$srcdir"
- install -Dm644 index.html "$pkgdir"/usr/share/$pkgname/index.html
+ cd "$srcdir"
+ install -Dm644 index.html "$pkgdir"/usr/share/$pkgname/index.html
}
diff --git a/test/fixtures/libremakepkg/PKGBUILD-pkgver b/test/fixtures/libremakepkg/PKGBUILD-pkgver
index 6b92d84..4a476de 100644
--- a/test/fixtures/libremakepkg/PKGBUILD-pkgver
+++ b/test/fixtures/libremakepkg/PKGBUILD-pkgver
@@ -8,16 +8,16 @@ arch=(any)
depends=(sh)
pkgver() {
- echo 2
+ echo 2
}
build() {
- cd "$srcdir"
- echo '#!/bin/sh' > hello.sh
- echo 'echo Hello, world!' >> hello.sh
+ cd "$srcdir"
+ echo '#!/bin/sh' >hello.sh
+ echo 'echo Hello, world!' >>hello.sh
}
package() {
- cd "$srcdir"
- install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
+ cd "$srcdir"
+ install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
}
diff --git a/test/fixtures/libremakepkg/PKGBUILD-rwstartdir b/test/fixtures/libremakepkg/PKGBUILD-rwstartdir
index feadfa0..fef510a 100644
--- a/test/fixtures/libremakepkg/PKGBUILD-rwstartdir
+++ b/test/fixtures/libremakepkg/PKGBUILD-rwstartdir
@@ -7,9 +7,9 @@ pkgrel=1
arch=(any)
build() {
- echo foo >"$startdir/file"
+ echo foo >"$startdir/file"
}
package() {
- install -Dm644 "$startdir/file" "$pkgdir/etc/file"
+ install -Dm644 "$startdir/file" "$pkgdir/etc/file"
}
diff --git a/test/fixtures/libremakepkg/PKGBUILD-signed b/test/fixtures/libremakepkg/PKGBUILD-signed
index 0979a85..4f3cf28 100644
--- a/test/fixtures/libremakepkg/PKGBUILD-signed
+++ b/test/fixtures/libremakepkg/PKGBUILD-signed
@@ -5,13 +5,13 @@ url='https://parabola.nu'
source=(hello.sh{,.sig})
sha256sums=('1e70cef0dfe5ce1120ccde5e1551c7277bcddaa75a1808f49512f404e6b8aec8'
- 'SKIP')
+ 'SKIP')
pkgrel=1
arch=(any)
depends=(sh)
package() {
- cd "$srcdir"
- install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
+ cd "$srcdir"
+ install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
}
diff --git a/test/fixtures/libremakepkg/PKGBUILD-testpkg1 b/test/fixtures/libremakepkg/PKGBUILD-testpkg1
index 8da1f14..3ece3b6 100644
--- a/test/fixtures/libremakepkg/PKGBUILD-testpkg1
+++ b/test/fixtures/libremakepkg/PKGBUILD-testpkg1
@@ -8,12 +8,12 @@ arch=(any)
depends=(sh)
build() {
- cd "$srcdir"
- echo '#!/bin/sh' > testpkg1.sh
- echo 'echo testpkg1' >> testpkg1.sh
+ cd "$srcdir"
+ echo '#!/bin/sh' >testpkg1.sh
+ echo 'echo testpkg1' >>testpkg1.sh
}
package() {
- cd "$srcdir"
- install -Dm755 testpkg1.sh "$pkgdir"/usr/bin/libretools-testpkg1
+ cd "$srcdir"
+ install -Dm755 testpkg1.sh "$pkgdir"/usr/bin/libretools-testpkg1
}
diff --git a/test/fixtures/libremakepkg/PKGBUILD-testpkg2 b/test/fixtures/libremakepkg/PKGBUILD-testpkg2
index 65d558e..ac65d88 100644
--- a/test/fixtures/libremakepkg/PKGBUILD-testpkg2
+++ b/test/fixtures/libremakepkg/PKGBUILD-testpkg2
@@ -8,12 +8,12 @@ arch=(any)
depends=(sh libretools-testpkg1)
build() {
- cd "$srcdir"
- echo '#!/bin/sh' > testpkg2.sh
- echo 'libretools-testpkg1' >> testpkg2.sh
+ cd "$srcdir"
+ echo '#!/bin/sh' >testpkg2.sh
+ echo 'libretools-testpkg1' >>testpkg2.sh
}
package() {
- cd "$srcdir"
- install -Dm755 testpkg2.sh "$pkgdir"/usr/bin/libretools-testpkg2
+ cd "$srcdir"
+ install -Dm755 testpkg2.sh "$pkgdir"/usr/bin/libretools-testpkg2
}
diff --git a/test/fixtures/librestage/PKGBUILD-hello b/test/fixtures/librestage/PKGBUILD-hello
index 5f320fe..6c83f73 100644
--- a/test/fixtures/librestage/PKGBUILD-hello
+++ b/test/fixtures/librestage/PKGBUILD-hello
@@ -8,12 +8,12 @@ arch=(any)
depends=(sh)
build() {
- cd "$srcdir"
- echo '#!/bin/sh' > hello.sh
- echo 'echo Hello, world!' >> hello.sh
+ cd "$srcdir"
+ echo '#!/bin/sh' >hello.sh
+ echo 'echo Hello, world!' >>hello.sh
}
package() {
- cd "$srcdir"
- install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
+ cd "$srcdir"
+ install -Dm755 hello.sh "$pkgdir"/usr/bin/libretools-hello
}
diff --git a/test/fixtures/librexgettext/combine1.sh b/test/fixtures/librexgettext/combine1.sh
index 9946076..8e2ddea 100644
--- a/test/fixtures/librexgettext/combine1.sh
+++ b/test/fixtures/librexgettext/combine1.sh
@@ -2,4 +2,4 @@
. libremessages
flag -a 'Flag a' \
- -b 'Flag b'
+ -b 'Flag b'
diff --git a/test/fixtures/librexgettext/combine2.sh b/test/fixtures/librexgettext/combine2.sh
index 441e87a..50f54c2 100644
--- a/test/fixtures/librexgettext/combine2.sh
+++ b/test/fixtures/librexgettext/combine2.sh
@@ -2,4 +2,4 @@
. libremessages
flag -1 'Flag 1' \
- -2 'Flag 2'
+ -2 'Flag 2'
diff --git a/test/fixtures/librexgettext/test_librexgettext_fails_on_subshell_flag_descriptions.sh b/test/fixtures/librexgettext/test_librexgettext_fails_on_subshell_flag_descriptions.sh
index f6be764..ab3c286 100644
--- a/test/fixtures/librexgettext/test_librexgettext_fails_on_subshell_flag_descriptions.sh
+++ b/test/fixtures/librexgettext/test_librexgettext_fails_on_subshell_flag_descriptions.sh
@@ -2,6 +2,6 @@
. libremessages
flag '-a' \
- "$(echo foo)" \
- '-h' \
- help
+ "$(echo foo)" \
+ '-h' \
+ help
diff --git a/test/fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh b/test/fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh
index 579ca96..cf84c19 100644
--- a/test/fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh
+++ b/test/fixtures/librexgettext/test_librexgettext_handles_librefetch_flags.sh
@@ -2,14 +2,14 @@
. libremessages
flag 'Settings:' \
- "-C" "Force create mode (don't download)" \
- "-D" "Force download mode (don't create)" \
- "-p <$(_ FILE)>" "Use an alternate build script (instead of
+ "-C" "Force create mode (don't download)" \
+ "-D" "Force download mode (don't create)" \
+ "-p <$(_ FILE)>" "Use an alternate build script (instead of
'PKGBUILD'). If an SRCBUILD exists in the same
directory, it is used instead" \
- 'Alternate modes:' \
- "-g, --geninteg" "Generate integrity checks for source files" \
- "-S, --srcbuild" "Print the effective build script (SRCBUILD)" \
- "-M, --makepkg" "Generate and print the location of the
+ 'Alternate modes:' \
+ "-g, --geninteg" "Generate integrity checks for source files" \
+ "-S, --srcbuild" "Print the effective build script (SRCBUILD)" \
+ "-M, --makepkg" "Generate and print the location of the
effective makepkg script" \
- "-h, --help" "Show this message"
+ "-h, --help" "Show this message"
diff --git a/test/fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh b/test/fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh
index 3b4dcee..291c41c 100644
--- a/test/fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh
+++ b/test/fixtures/librexgettext/test_librexgettext_handles_multiple_skipped_flags.sh
@@ -2,16 +2,16 @@
. libremessages
flag "-a $(_ OPTARG)" 'Flag 1' \
- '-b' 'Flag 2' \
- "-c $(_ OPTARG)" 'Flag 3' \
- "-d $(_ OPTARG)" 'Flag 4' \
- "-e $(_ OPTARG)" 'Flag 5' \
- "-f $(_ OPTARG)" 'Flag 6' \
- "-g $(_ OPTARG)" 'Flag 7' \
- "-h $(_ OPTARG)" 'Flag 8'
+ '-b' 'Flag 2' \
+ "-c $(_ OPTARG)" 'Flag 3' \
+ "-d $(_ OPTARG)" 'Flag 4' \
+ "-e $(_ OPTARG)" 'Flag 5' \
+ "-f $(_ OPTARG)" 'Flag 6' \
+ "-g $(_ OPTARG)" 'Flag 7' \
+ "-h $(_ OPTARG)" 'Flag 8'
flag "-A $(_ OPTARG)" 'FLAG 1' \
- '-B' 'FLAG 2'
+ '-B' 'FLAG 2'
flag '-1' 'FLAG A' \
- '-2' 'FLAG B'
+ '-2' 'FLAG B'
diff --git a/test/fixtures/toru/libre/simple/PKGBUILD b/test/fixtures/toru/libre/simple/PKGBUILD
index e2d44d1..b6e2cba 100644
--- a/test/fixtures/toru/libre/simple/PKGBUILD
+++ b/test/fixtures/toru/libre/simple/PKGBUILD
@@ -7,5 +7,5 @@ pkgrel=1
arch=(any)
package() {
- :
+ :
}
diff --git a/test/fixtures/toru/libre/split-base/PKGBUILD b/test/fixtures/toru/libre/split-base/PKGBUILD
index ce547c5..12fb6d4 100644
--- a/test/fixtures/toru/libre/split-base/PKGBUILD
+++ b/test/fixtures/toru/libre/split-base/PKGBUILD
@@ -8,13 +8,13 @@ pkgrel=1
arch=(any)
package_FOO() {
- :
+ :
}
package_BAR() {
- :
+ :
}
package_BAZ() {
- :
+ :
}
diff --git a/test/fixtures/toru/libre/split/PKGBUILD b/test/fixtures/toru/libre/split/PKGBUILD
index fe25a94..73d613c 100644
--- a/test/fixtures/toru/libre/split/PKGBUILD
+++ b/test/fixtures/toru/libre/split/PKGBUILD
@@ -7,13 +7,13 @@ pkgrel=1
arch=(any)
package_foo() {
- :
+ :
}
package_bar() {
- :
+ :
}
package_baz() {
- :
+ :
}
diff --git a/test/lib/common.bash b/test/lib/common.bash
index 90b6f04..2467a38 100644
--- a/test/lib/common.bash
+++ b/test/lib/common.bash
@@ -38,7 +38,7 @@ common_setup() {
Expire-Date: 0
%no-protection
%commit
- eot
+ eot
export GPGKEY="$(gpg --quiet --list-secret-keys --with-colons | awk -F: '/^sec:/{print substr($5,9)}')"
# Configure libretools
@@ -47,19 +47,19 @@ common_setup() {
install -Dm644 /dev/stdin "$XDG_CONFIG_HOME"/libretools/libretools.conf <<-eot
WORKDIR=${tmpdir@Q}/workdir
BLACKLIST=https://git.parabola.nu/blacklist.git/plain/blacklist.txt
- eot
+ eot
install -Dm644 /dev/stdin "$XDG_CONFIG_HOME"/libretools/chroot.conf <<-eot
CHROOTDIR=${chrootdir@Q}
CHROOT=default
CHROOTEXTRAPKG=()
- eot
+ eot
install -Dm644 /dev/stdin "$XDG_CONFIG_HOME"/pacman/makepkg.conf <<-eot
PKGDEST=${tmpdir@Q}/workdir/pkgdest
SRCDEST=${tmpdir@Q}/workdir/srcdest
SRCPKGDEST=${tmpdir@Q}/workdir/srcpkgdest
LOGDEST=${tmpdir@Q}/workdir/logdest
PACKAGER='Bob Tester <tester@localhost>'
- eot
+ eot
mkdir -p -- "$tmpdir"/workdir/{pkg,src,srcpkg,log}dest
}
@@ -82,7 +82,7 @@ common_teardown() {
if [[ -d $dir && $dir != */root/ ]]; then
if [[ "$(stat -f -c %T "$dir")" == btrfs ]]; then
sudo find "$dir" -depth -inum 256 -exec \
- btrfs subvolume delete {} \; &>/dev/null
+ btrfs subvolume delete {} \; &>/dev/null
fi
sudo rm -rf -- "$dir"
fi
@@ -112,7 +112,7 @@ require() (
if libremessages in_array "btrfs" "$@" && ! [[ "$(stat -f -c %T "$chrootdir" 2>/dev/null || true)" == 'btrfs' ]]; then
missing+=('btrfs')
fi
- if (( ${#missing[@]} )); then
+ if ((${#missing[@]})); then
return 1
fi
if libremessages in_array "sudo" "$@"; then
diff --git a/test/testenv b/test/testenv
index 09fd328..b570b58 100755
--- a/test/testenv
+++ b/test/testenv
@@ -7,12 +7,27 @@
SUDO=true
while [[ $# -gt 0 ]]; do
case "$1" in
- --no-network) shift; unset NETWORK;;
- --network) shift; NETWORK=true;;
- --no-sudo) shift; unset SUDO;;
- --sudo) shift; SUDO=true;;
- --) shift; break;;
- *) break;;
+ --no-network)
+ shift
+ unset NETWORK
+ ;;
+ --network)
+ shift
+ NETWORK=true
+ ;;
+ --no-sudo)
+ shift
+ unset SUDO
+ ;;
+ --sudo)
+ shift
+ SUDO=true
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *) break ;;
esac
done
export NETWORK SUDO
@@ -30,7 +45,7 @@
if [[ $SUDO ]] && [[ -d "$TMPDIR/chroots" ]]; then
if [[ "$(stat -f -c %T "$TMPDIR/chroots")" == btrfs ]]; then
sudo find "$TMPDIR/chroots" -depth -inum 256 -exec \
- btrfs subvolume delete {} \; &>/dev/null
+ btrfs subvolume delete {} \; &>/dev/null
fi
sudo rm -rf -- "$TMPDIR/chroots"
fi
@@ -58,7 +73,7 @@
export _librelib_conf_sh_sysconfdir="$destdir/etc"
export _librelib_conf_sh_pkgconfdir="$destdir/etc/libretools.d"
sed -i 's,/usr/bin/librefetch,$(which librefetch),' \
- "${_librelib_conf_sh_sysconfdir}/makepkg.d/librefetch.conf"
+ "${_librelib_conf_sh_sysconfdir}/makepkg.d/librefetch.conf"
# Hack to respect our variables in sudo
install -Dm755 /dev/stdin "$destdir/usr/bin/testsudo" <<-'eot'
@@ -74,7 +89,7 @@
env+=("$var=${!var}")
done
sudo "${env[@]}" "$@"
- eot
+ eot
# Hack to work around GnuPG being stupid with locating gpg-agent's socket
install -Dm755 /dev/stdin "$destdir/usr/bin/gpg" <<-'eot'
#!/bin/bash
@@ -83,7 +98,7 @@
export HOME=/var/empty
fi
exec /usr/bin/gpg "$@"
- eot
+ eot
install -Dm755 /dev/stdin "$destdir/usr/bin/gpg-connect-agent" <<-'eot'
#!/bin/bash
export GNUPGHOME="${GNUPGHOME:-$HOME/.gnupg}"
@@ -91,7 +106,7 @@
export HOME=/var/empty
fi
exec /usr/bin/gpg-connect-agent "$@"
- eot
+ eot
# Hack to work around ssh ignoring HOME and instead looking the homedir in NSS
install -Dm755 /dev/stdin "$destdir/usr/bin/ssh" <<-'eot'
#!/bin/bash
@@ -109,7 +124,7 @@
-o UserKnownHostsFile="$HOME/.ssh/known_hosts" \
-F "$HOME/.ssh/config" \
"$@"
- eot
+ eot
# Run the tests
command -- "$@"