summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-05-05 18:41:10 -0400
committerJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2017-07-05 18:21:56 +0200
commita9dab9533498577cd0196939bd9346310a7552e0 (patch)
treedc2cce471d545cf602a2ba4315e24bf12a08f267
parenta396a6908110a860a89a1e640153bac1e0da2a57 (diff)
Add `# shellcheck` directives to quiet shellcheck, add PKGBUILD.proto
The added PKGBUILD.proto file is so that shellcheck can know know what to expect that a PKGBUILD sets.
-rw-r--r--Makefile2
-rw-r--r--PKGBUILD.proto48
-rw-r--r--arch-nspawn.in2
-rw-r--r--checkpkg.in4
-rw-r--r--commitpkg.in5
-rw-r--r--crossrepomove.in4
-rw-r--r--finddeps.in1
-rw-r--r--lib/archroot.sh2
-rw-r--r--lib/common.sh7
-rw-r--r--lib/valid-tags.sh3
-rw-r--r--makechrootpkg.in1
-rw-r--r--makepkg-i686.conf3
-rw-r--r--makepkg-x86_64.conf3
-rw-r--r--rebuildpkgs.in4
14 files changed, 88 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 39614a4..9549569 100644
--- a/Makefile
+++ b/Makefile
@@ -114,7 +114,7 @@ dist:
upload:
scp devtools-$(V).tar.gz devtools-$(V).tar.gz.sig repos.archlinux.org:/srv/ftp/other/devtools/
-check: $(BINPROGS) bash_completion makepkg-x86_64.conf
+check: $(BINPROGS) bash_completion makepkg-x86_64.conf PKGBUILD.proto
shellcheck $^
.PHONY: all clean install uninstall dist upload check
diff --git a/PKGBUILD.proto b/PKGBUILD.proto
new file mode 100644
index 0000000..e8690e4
--- /dev/null
+++ b/PKGBUILD.proto
@@ -0,0 +1,48 @@
+#!/hint/bash
+# shellcheck disable=2034
+
+# This is an example PKGBUILD file, so that shellcheck can know what
+# variables to expect be set after including a PKGBUILD.
+
+# Maintainer: Your Name <youremail@domain.com>
+pkgname=NAME
+pkgver=VERSION
+pkgrel=1
+epoch=
+pkgdesc=""
+arch=()
+url=""
+license=('GPL')
+groups=()
+depends=()
+makedepends=()
+checkdepends=()
+optdepends=()
+provides=()
+conflicts=()
+replaces=()
+backup=()
+options=()
+install=
+changelog=
+source=("$pkgname-$pkgver.tar.gz"
+ "$pkgname-$pkgver.patch")
+noextract=()
+md5sums=()
+validpgpkeys=()
+
+prepare() {
+ :
+}
+
+build() {
+ :
+}
+
+check() {
+ :
+}
+
+package() {
+ :
+}
diff --git a/arch-nspawn.in b/arch-nspawn.in
index 2d42e3a..c21b2ce 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -58,7 +58,9 @@ else
cache_dirs=("$cache_dir")
fi
+# shellcheck disable=2016
host_mirror=$(pacman --cachedir /doesnt/exist -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
+# shellcheck disable=2016
[[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
# {{{ functions
diff --git a/checkpkg.in b/checkpkg.in
index 20920be..e0e1f83 100644
--- a/checkpkg.in
+++ b/checkpkg.in
@@ -7,6 +7,7 @@ m4_include(lib/common.sh)
# Source makepkg.conf; fail if it is not found
if [[ -r '/etc/makepkg.conf' ]]; then
+ # shellcheck source=makepkg-x86_64.conf
source '/etc/makepkg.conf'
else
die '/etc/makepkg.conf not found!'
@@ -14,8 +15,10 @@ fi
# Source user-specific makepkg.conf overrides
if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
+ # shellcheck source=/dev/null
source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
elif [[ -r "$HOME/.makepkg.conf" ]]; then
+ # shellcheck source=/dev/null
source "$HOME/.makepkg.conf"
fi
@@ -23,6 +26,7 @@ if [[ ! -f PKGBUILD ]]; then
die 'This must be run in the directory of a built package.'
fi
+# shellcheck source=PKGBUILD.proto
. ./PKGBUILD
if [[ ${arch[0]} == 'any' ]]; then
CARCH='any'
diff --git a/commitpkg.in b/commitpkg.in
index 90210e5..53b6612 100644
--- a/commitpkg.in
+++ b/commitpkg.in
@@ -5,6 +5,7 @@ m4_include(lib/common.sh)
# Source makepkg.conf; fail if it is not found
if [[ -r '/etc/makepkg.conf' ]]; then
+ # shellcheck source=makepkg-x86_64.conf
source '/etc/makepkg.conf'
else
die '/etc/makepkg.conf not found!'
@@ -12,8 +13,10 @@ fi
# Source user-specific makepkg.conf overrides
if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
+ # shellcheck source=/dev/null
source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
elif [[ -r "$HOME/.makepkg.conf" ]]; then
+ # shellcheck source=/dev/null
source "$HOME/.makepkg.conf"
fi
@@ -23,6 +26,8 @@ if [[ ! -f PKGBUILD ]]; then
die 'No PKGBUILD file'
fi
+source=()
+# shellcheck source=PKGBUILD.proto
. ./PKGBUILD
pkgbase=${pkgbase:-$pkgname}
diff --git a/crossrepomove.in b/crossrepomove.in
index ffc4507..b45b8ae 100644
--- a/crossrepomove.in
+++ b/crossrepomove.in
@@ -44,6 +44,7 @@ msg "Downloading sources for %s" "${pkgbase}"
svn -q checkout -N "${target_svn}" target_checkout
mkdir -p "target_checkout/${pkgbase}/repos"
svn -q export "${source_svn}/${pkgbase}/trunk" "target_checkout/${pkgbase}/trunk" || die
+# shellcheck source=PKGBUILD.proto
. "target_checkout/${pkgbase}/trunk/PKGBUILD"
msg "Downloading packages for %s" "${pkgbase}"
@@ -56,6 +57,7 @@ for _arch in "${arch[@]}"; do
for _pkgname in "${pkgname[@]}"; do
fullver=$(get_full_version "$_pkgname")
pkgpath="/srv/ftp/$source_repo/os/$repo_arch/$_pkgname-$fullver-${_arch}.pkg.tar.*"
+ # shellcheck disable=2029
ssh "$server" "cp $pkgpath staging/$target_repo" || die
done
done
@@ -68,10 +70,12 @@ pushd "target_checkout/${pkgbase}/trunk" >/dev/null
archrelease "${arch[@]/#/$target_repo-}" || die
popd >/dev/null
+# shellcheck disable=2029
ssh "${server}" "${target_dbscripts}/db-update" || die
msg "Removing %s from %s" "${pkgbase}" "${source_repo}"
for _arch in "${arch[@]}"; do
+ # shellcheck disable=2029
ssh "${server}" "${source_dbscripts}/db-remove ${source_repo} ${_arch} ${pkgbase}"
done
svn -q checkout -N "${source_svn}" source_checkout
diff --git a/finddeps.in b/finddeps.in
index 80774bb..2a085e5 100644
--- a/finddeps.in
+++ b/finddeps.in
@@ -20,6 +20,7 @@ fi
find . -type d | while read -r d; do
if [[ -f "$d/PKGBUILD" ]]; then
pkgname=() depends=() makedepends=() optdepends=()
+ # shellcheck source=PKGBUILD.proto
. "$d/PKGBUILD"
for dep in "${depends[@]}"; do
# lose the version comparator, if any
diff --git a/lib/archroot.sh b/lib/archroot.sh
index 3a1023e..98fd2cf 100644
--- a/lib/archroot.sh
+++ b/lib/archroot.sh
@@ -1,6 +1,8 @@
#!/hint/bash
# License: Unspecified
+:
+# shellcheck disable=2034
CHROOT_VERSION='v4'
##
diff --git a/lib/common.sh b/lib/common.sh
index ad6194d..0fb93d9 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -35,35 +35,42 @@ readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
plain() {
local mesg=$1; shift
+ # shellcheck disable=2059
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
msg() {
local mesg=$1; shift
+ # shellcheck disable=2059
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
msg2() {
local mesg=$1; shift
+ # shellcheck disable=2059
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
warning() {
local mesg=$1; shift
+ # shellcheck disable=2059
printf "${YELLOW}==> WARNING:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
error() {
local mesg=$1; shift
+ # shellcheck disable=2059
printf "${RED}==> ERROR:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
stat_busy() {
local mesg=$1; shift
+ # shellcheck disable=2059
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" "$@" >&2
}
stat_done() {
+ # shellcheck disable=2059
printf "${BOLD}done${ALL_OFF}\n" >&2
}
diff --git a/lib/valid-tags.sh b/lib/valid-tags.sh
index e0a3b7c..2916dc7 100644
--- a/lib/valid-tags.sh
+++ b/lib/valid-tags.sh
@@ -1,12 +1,15 @@
#!/hint/bash
# License: Unspecified
+:
+# shellcheck disable=2034
_arch=(
i686
x86_64
any
)
+# shellcheck disable=2034
_tags=(
core-i686 core-x86_64 core-any
extra-i686 extra-x86_64 extra-any
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 2dd160a..ffe6e42 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -241,6 +241,7 @@ EOF
# These functions aren't run in makechrootpkg,
# so no global variables
_chrootbuild() {
+ # shellcheck source=/dev/null
. /etc/profile
# Beware, there are some stupid arbitrary rules on how you can
# use "$" in arguments to commands with "sudo -i". ${foo} or
diff --git a/makepkg-i686.conf b/makepkg-i686.conf
index e57988f..f7ea2c2 100644
--- a/makepkg-i686.conf
+++ b/makepkg-i686.conf
@@ -1,3 +1,6 @@
+#!/hint/bash
+# shellcheck disable=2034
+
#
# /etc/makepkg.conf
#
diff --git a/makepkg-x86_64.conf b/makepkg-x86_64.conf
index 7aa192e..67cb200 100644
--- a/makepkg-x86_64.conf
+++ b/makepkg-x86_64.conf
@@ -1,3 +1,6 @@
+#!/hint/bash
+# shellcheck disable=2034
+
#
# /etc/makepkg.conf
#
diff --git a/rebuildpkgs.in b/rebuildpkgs.in
index a0e8250..4f4f98b 100644
--- a/rebuildpkgs.in
+++ b/rebuildpkgs.in
@@ -21,6 +21,7 @@ fi
# Source makepkg.conf; fail if it is not found
if [[ -r '/etc/makepkg.conf' ]]; then
+ # shellcheck source=makepkg-x86_64.conf
source '/etc/makepkg.conf'
else
die '/etc/makepkg.conf not found!'
@@ -28,8 +29,10 @@ fi
# Source user-specific makepkg.conf overrides
if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
+ # shellcheck source=/dev/null
source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
elif [[ -r "$HOME/.makepkg.conf" ]]; then
+ # shellcheck source=/dev/null
source "$HOME/.makepkg.conf"
fi
@@ -50,6 +53,7 @@ bump_pkgrel() {
pkg_from_pkgbuild() {
# we want the sourcing to be done in a subshell so we don't pollute our current namespace
export CARCH PKGEXT
+ # shellcheck source=PKGBUILD.proto
(source PKGBUILD; echo "$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT")
}