index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | commitpkg.in | 47 |
diff --git a/commitpkg.in b/commitpkg.in index d31f6ba..53b6612 100644 --- a/commitpkg.in +++ b/commitpkg.in @@ -5,14 +5,19 @@ 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!' fi # Source user-specific makepkg.conf overrides -if [[ -r ~/.makepkg.conf ]]; then - . ~/.makepkg.conf +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 cmd=${0##*/} @@ -21,6 +26,8 @@ if [[ ! -f PKGBUILD ]]; then die 'No PKGBUILD file' fi +source=() +# shellcheck source=PKGBUILD.proto . ./PKGBUILD pkgbase=${pkgbase:-$pkgname} @@ -48,7 +55,7 @@ done for i in 'changelog' 'install'; do while read -r file; do # evaluate any bash variables used - eval file=\"$(sed "s/^\(['\"]\)\(.*\)\1\$/\2/" <<< "$file")\" + eval "file=\"$(sed "s/^\(['\"]\)\(.*\)\1\$/\2/" <<< "$file")\"" needsversioning+=("$file") done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) done @@ -62,7 +69,7 @@ if (( ${#needsversioning[*]} )); then (( ${#unversioned[*]} )) && die "%s is not under version control" "${unversioned[@]}" fi -rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y) +rsyncopts=(-e ssh -p '--chmod=ug=rw,o=r' -c -h -L --progress --partial -y) archreleaseopts=() while getopts ':l:a:s:f' flag; do case $flag in @@ -77,12 +84,12 @@ done shift $(( OPTIND - 1 )) # check packages have the packager field set -for _arch in ${arch[@]}; do +for _arch in "${arch[@]}"; do if [[ -n $commit_arch && ${_arch} != "$commit_arch" ]]; then continue fi - for _pkgname in ${pkgname[@]}; do - fullver=$(get_full_version $_pkgname) + for _pkgname in "${pkgname[@]}"; do + fullver=$(get_full_version "$_pkgname") if pkgfile=$(find_cached_package "$_pkgname" "$_arch" "$fullver"); then if grep -q "packager = Unknown Packager" <(bsdtar -xOqf "$pkgfile" .PKGINFO); then @@ -126,18 +133,18 @@ declare -a uploads declare -a commit_arches declare -a skip_arches -for _arch in ${arch[@]}; do +for _arch in "${arch[@]}"; do if [[ -n $commit_arch && ${_arch} != "$commit_arch" ]]; then - skip_arches+=($_arch) + skip_arches+=("$_arch") continue fi - for _pkgname in ${pkgname[@]}; do - fullver=$(get_full_version $_pkgname) + for _pkgname in "${pkgname[@]}"; do + fullver=$(get_full_version "$_pkgname") if ! pkgfile=$(find_cached_package "$_pkgname" "$fullver" "${_arch}"); then warning "Skipping %s: failed to locate package file" "$_pkgname-$fullver-$_arch" - skip_arches+=($_arch) + skip_arches+=("$_arch") continue 2 fi uploads+=("$pkgfile") @@ -146,9 +153,9 @@ for _arch in ${arch[@]}; do if [[ ! -f $sigfile ]]; then msg "Signing package %s..." "${pkgfile}" if [[ -n $GPGKEY ]]; then - SIGNWITHKEY="-u ${GPGKEY}" + SIGNWITHKEY=(-u "${GPGKEY}") fi - gpg --detach-sign --use-agent --no-armor ${SIGNWITHKEY} "${pkgfile}" || die + gpg --detach-sign --use-agent --no-armor "${SIGNWITHKEY[@]}" "${pkgfile}" || die fi if ! gpg --verify "$sigfile" >/dev/null 2>&1; then die "Signature %s.sig is incorrect!" "$pkgfile" @@ -157,9 +164,9 @@ for _arch in ${arch[@]}; do done done -for _arch in ${arch[@]}; do - if ! in_array $_arch ${skip_arches[@]}; then - commit_arches+=($_arch) +for _arch in "${arch[@]}"; do + if ! in_array "$_arch" "${skip_arches[@]}"; then + commit_arches+=("$_arch") fi done @@ -185,8 +192,8 @@ if [[ "${arch[*]}" == 'any' ]]; then if [[ -d ../repos/$repo-i686 && -d ../repos/$repo-x86_64 ]]; then pushd ../repos/ >/dev/null stat_busy "Removing %s and %s" "$repo-i686" "$repo-x86_64" - svn rm -q $repo-i686 - svn rm -q $repo-x86_64 + svn rm -q "$repo-i686" + svn rm -q "$repo-x86_64" svn commit -q -m "Removed $repo-i686 and $repo-x86_64 for $pkgname" stat_done popd >/dev/null @@ -195,7 +202,7 @@ else if [[ -d ../repos/$repo-any ]]; then pushd ../repos/ >/dev/null stat_busy "Removing %s" "$repo-any" - svn rm -q $repo-any + svn rm -q "$repo-any" svn commit -q -m "Removed $repo-any for $pkgname" stat_done popd >/dev/null |