Commit 34a8ab71 authored by Simon McVittie's avatar Simon McVittie
Browse files

scripts: Add and fix shellcheck warnings


Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent b6838391
......@@ -59,11 +59,15 @@ in_chroot () {
}
list_packages_ignore_arch () {
# ${} here is interpreted by dpkg-query
# shellcheck disable=SC2016
in_chroot dpkg-query --show -f '${Package}\n' | LC_ALL=C sort -u
}
is_installed () {
local status
# ${} here is interpreted by dpkg-query
# shellcheck disable=SC2016
if ! status="$(in_chroot dpkg-query --show -f '${Status}\n' "$@")"; then
return 1
fi
......
......@@ -29,7 +29,6 @@ set -u
set -o pipefail
me="$(basename "$0")"
NULL=
if [ "$#" != 0 ] || [ "x$(id -u)" != x0 ]; then
echo "$me: Usage:" >&2
......
......@@ -29,7 +29,6 @@ set -u
set -o pipefail
me="$(basename "$0")"
NULL=
if [ "$#" != 0 ] || [ "x$(id -u)" != x0 ]; then
echo "$me: Usage:" >&2
......
......@@ -103,18 +103,23 @@ exec 3>"$sysroot/usr/manifest.dpkg"
printf '#Package[:Architecture]\t#Version\t#Source\t#Installed-Size\n' >&3
# ${} escapes here are for dpkg-query, not sh
# shellcheck disable=SC2016
dpkg_version="$(in_chroot dpkg-query -W -f '${Version}' dpkg)"
if in_chroot dpkg --compare-versions "$dpkg_version" ge 1.16.2; then
# shellcheck disable=SC2016
in_chroot dpkg-query -W -f \
'${binary:Package}\t${Version}\t${Source}\t${Installed-Size}\n' \
| LC_ALL=C sort -u >&3
# shellcheck disable=SC2016
in_chroot dpkg-query -W -f '${binary:Package}\n' \
| LC_ALL=C sort -u \
| in_chroot xargs -d '\n' dpkg-query -s \
| gzip -9nc \
> "$sysroot/usr/manifest.deb822.gz"
else
# shellcheck disable=SC2016
in_chroot dpkg-query -W -f \
'${Package}:${Architecture}\t${Version}\t${Source}\t${Installed-Size}\n' \
| LC_ALL=C sort -u >&3
......@@ -124,6 +129,7 @@ exec 3>"$sysroot/usr/manifest.dpkg.built-using"
printf '#Built-Binary\t#Built-Using-Source\t#Built-Using-Version\n' >&3
# shellcheck disable=SC2016
in_chroot dpkg-query -W -f '$Package\t${Built-Using}\n' | perl -ne '
chomp;
next unless /^\S+\t.+$/;
......
......@@ -11,7 +11,7 @@ export MYPYPATH="${PYTHONPATH:=$(pwd)}"
i=0
for script in \
*.py \
./*.py \
; do
i=$((i + 1))
if [ "x${MYPY:="$(command -v mypy || echo false)"}" = xfalse ]; then
......@@ -20,7 +20,7 @@ for script in \
--python-executable="${PYTHON:=python3}" \
--follow-imports=skip \
--ignore-missing-imports \
$script; then
"$script"; then
echo "ok $i - $script"
else
echo "not ok $i - $script # TODO mypy issues reported"
......
......@@ -11,7 +11,7 @@ if [ "x${PYCODESTYLE:=pycodestyle}" = xfalse ] || \
[ -z "$(command -v "$PYCODESTYLE")" ]; then
echo "1..0 # SKIP pycodestyle not found"
elif "${PYCODESTYLE}" \
*.py \
./*.py \
>&2; then
echo "1..1"
echo "ok 1 - $PYCODESTYLE reported no issues"
......
......@@ -11,7 +11,7 @@ if [ "x${PYFLAKES:=pyflakes3}" = xfalse ] || \
[ -z "$(command -v "$PYFLAKES")" ]; then
echo "1..0 # SKIP pyflakes3 not found"
elif "${PYFLAKES}" \
*.py \
./*.py \
>&2; then
echo "1..1"
echo "ok 1 - $PYFLAKES reported no issues"
......
#!/bin/sh
#
# Copyright © 2018-2019 Collabora Ltd
#
# SPDX-License-Identifier: MIT
set -e
set -u
if ! command -v shellcheck >/dev/null 2>&1; then
echo "1..0 # SKIP shellcheck not available"
exit 0
fi
n=0
for shell_script in \
deb-buildapi/configure \
flatdeb/add-foreign-architectures \
flatdeb/clean-up-base \
flatdeb/clean-up-before-pack \
flatdeb/disable-services \
flatdeb/make-flatpak-friendly \
flatdeb/platformize \
flatdeb/prepare-runtime \
flatdeb/put-ldconfig-in-path \
flatdeb/symlink-alternatives \
flatdeb/usrmerge \
flatdeb/write-manifest \
run-in-fakemachine \
t/*.sh \
; do
n=$((n + 1))
# Ignore SC2039: we assume a Debian-style shell that has 'local'.
if shellcheck --exclude=SC2039 "$shell_script"; then
echo "ok $n - $shell_script"
else
echo "not ok $n # TODO - $shell_script"
fi
done
echo "1..$n"
# vim:set sw=4 sts=4 et ft=sh:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment