From b20b7b03053f94499085a4570a241428b5676ce2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 4 Nov 2013 11:23:01 -0500 Subject: normalize on "[[" instead of "[" --- src/abslibre-tools/libreaddiff | 6 +++--- src/abslibre-tools/librerelease | 6 +++--- src/chroot-tools/chcleanup | 2 +- src/fullpkg/fullpkg-build | 14 +++++++------- src/fullpkg/fullpkg-find | 10 +++++----- src/treepkg | 16 ++++++++-------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/abslibre-tools/libreaddiff b/src/abslibre-tools/libreaddiff index 9f5ae27..3855279 100755 --- a/src/abslibre-tools/libreaddiff +++ b/src/abslibre-tools/libreaddiff @@ -74,14 +74,14 @@ except StopIteration: load_PKGBUILD "$f/PKGBUILD" || continue is_here=false for arc in ${arch[@]} ; do - if [ "$arc" = "any" -o "$arc" = "$CARCH" ] ; then + if [[ "$arc" == "any" ]] || [[ "$arc" == "$CARCH" ]] ; then is_here=true break fi done - if [ "$is_here" = "true" ] ; then + if [[ "$is_here" == "true" ]] ; then for name in ${pkgname[@]} ; do - if [ -z "$epoch" ] ; then + if [[ -z "$epoch" ]] ; then echo $name-$pkgver-$pkgrel else echo $name-$epoch:$pkgver-$pkgrel diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease index adfb935..d133571 100755 --- a/src/abslibre-tools/librerelease +++ b/src/abslibre-tools/librerelease @@ -80,12 +80,12 @@ create_signature() { } sign_packages() { - if [ -z "${GPG_AGENT_INFO}" ]; then + if [[ -z "${GPG_AGENT_INFO}" ]]; then warning "It's better to use gpg-agent to sign packages in batches" fi for package in $(find "${WORKDIR}/staging/" -type f -iname '*.pkg.tar.?z'); do - if [ -f "${package}.sig" ]; then + if [[ -f "${package}.sig" ]]; then msg2 "Package signature found, verifying..." # Verify that the signature is correct, else remove for re-signing @@ -95,7 +95,7 @@ sign_packages() { fi fi - if ! [ -f "${package}.sig" ]; then + if ! [[ -f "${package}.sig" ]]; then create_signature "$package" || return 2 fi done diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup index 0c78989..2ff45f9 100755 --- a/src/chroot-tools/chcleanup +++ b/src/chroot-tools/chcleanup @@ -53,7 +53,7 @@ fi source /etc/libretools.d/chroot.conf # If we're running makepkg -if [ -f PKGBUILD ]; then +if [[ -f PKGBUILD ]]; then export CARCH="$(. /etc/makepkg.conf; printf '%s' "$CARCH")" source ./PKGBUILD CHROOTEXTRAPKG+=("${depends[@]}" diff --git a/src/fullpkg/fullpkg-build b/src/fullpkg/fullpkg-build index 8149453..e824c2e 100755 --- a/src/fullpkg/fullpkg-build +++ b/src/fullpkg/fullpkg-build @@ -45,13 +45,13 @@ remove_buildorder() { succesfull_build() { - if [ "$RUN" != "$FULLBUILDCMD" ]; then + if [[ "$RUN" != "$FULLBUILDCMD" ]]; then return 0 # Custom command or download sources fi - if source .INFO && [ -n "$repo" ]; then + if source .INFO && [[ -n "$repo" ]]; then - if [ ! -z "$HOOKLOCALRELEASE" ]; then + if [[ ! -z "$HOOKLOCALRELEASE" ]]; then "$HOOKLOCALRELEASE" "$repo" fi @@ -75,11 +75,11 @@ __build() { build_packages=($(sort -gr $buildorder | cut -d: -f2)) # greater levels must be built first - while [ ${#build_packages[@]} -ge 1 ]; do + while [[ ${#build_packages[@]} -ge 1 ]]; do pushd "$build_dir/${build_packages[0]}" >/dev/null - if [ -n "${HOOKPKGBUILDMOD}" ]; then + if [[ -n "${HOOKPKGBUILDMOD}" ]]; then ${HOOKPKGBUILDMOD} || true fi @@ -156,7 +156,7 @@ shift $(( OPTIND - 1 )) build_dir="${1:-`pwd`}" buildorder="${build_dir}/BUILDORDER" -if [ ! -e "$buildorder" ]; then +if [[ ! -e "$buildorder" ]]; then error "This is not a build_dir. Make one using fullpkg." usage exit 1 @@ -172,7 +172,7 @@ fi msg "$MESSAGE" __build -if [ "$RUN" != "$FULLBUILDCMD" ]; then +if [[ "$RUN" != "$FULLBUILDCMD" ]]; then # Used for downloading or custom command mv "$build_dir/.BUILDORDER" "$buildorder" exit 0 diff --git a/src/fullpkg/fullpkg-find b/src/fullpkg/fullpkg-find index 566605a..57819c3 100755 --- a/src/fullpkg/fullpkg-find +++ b/src/fullpkg/fullpkg-find @@ -104,7 +104,7 @@ find_deps() { # greater levels are built first echo "${LEVEL}:${pkgbase}" >>"$build_dir/BUILDORDER" # PKGBUILD is already there - if [ -d "${build_dir}/${pkgbase}" ]; then + if [[ -d "${build_dir}/${pkgbase}" ]]; then exit 0 # Copy dir to build_dir else @@ -133,7 +133,7 @@ find_deps() { # arch=any packages. local pkgdir=$(toru -p ${_dep}) || true - if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then + if [[ -n "$pkgdir" ]] && [[ -d "${pkgdir}" ]; then found=true pushd "${pkgdir}" > /dev/null @@ -193,7 +193,7 @@ while getopts 'hA:l:cmn' arg; do esac done -if [ ! -r PKGBUILD ]; then +if [[ ! -r PKGBUILD ]]; then error "This directory doesnt contain a PKGBUILD" usage exit 1 @@ -202,11 +202,11 @@ fi shift $(( OPTIND - 1 )) build_dir="${1}" -if [ "$LEVEL" -eq 0 ]; then +if [[ "$LEVEL" -eq 0 ]]; then build_dir="${1:-$(mktemp -d /tmp/fullpkg.XXXXXX)}" - if [ ! -d "$build_dir" ]; then + if [[ ! -d "$build_dir" ]]; then mkdir -p "$build_dir" elif "$CLEANFIRST"; then # Erase files already in dir diff --git a/src/treepkg b/src/treepkg index 6dc9dda..0f6d605 100755 --- a/src/treepkg +++ b/src/treepkg @@ -59,10 +59,10 @@ bury() { # If there's a depth or the package is not the root of the build tree (which # can lead to funny chicken-and-egg problems), update the depth to the current # package next-depth and rename the dir too - if [ -z "${current_depth}" ]; then return; fi - if [ -z "${current_name}" ]; then return; fi - if [ ${current_depth} -eq 0 ]; then return; fi - if [ ${current_depth} -ge $2 ]; then return; fi + if [[ -z "${current_depth}" ]]; then return; fi + if [[ -z "${current_name}" ]]; then return; fi + if [[ ${current_depth} -eq 0 ]]; then return; fi + if [[ ${current_depth} -ge $2 ]]; then return; fi ${VERBOSE} && msg "Burying ${1} from ${current_depth} to ${2}" @@ -78,7 +78,7 @@ guess_repo() { basename "$(dirname "${1}")" } -if [ ! -f PKGBUILD ]; then +if [[ ! -f PKGBUILD ]]; then error "Missing PKGBUILD (%s)" "$PWD" exit 1 fi @@ -175,7 +175,7 @@ if ! ${BUILDNOW}; then fi # Only build at the end -if [ ${DEPTH} -eq 0 ]; then +if [[ ${DEPTH} -eq 0 ]]; then ${VERBOSE} && msg "Starting build" || true if ${BUILD}; then @@ -185,9 +185,9 @@ if [ ${DEPTH} -eq 0 ]; then # The reverse order ensures we start by the deepest packages for _pkg in $(ls -r "${BUILDDIR}"); do # Ignore if there's no PKGBUILD - if [ ! -f "${BUILDDIR}/${_pkg}/PKGBUILD" ]; then continue; fi + if [[ ! -f "${BUILDDIR}/${_pkg}/PKGBUILD" ]]; then continue; fi # Skip if already built (faster than calling is_build again) - if [ -f "${BUILDDIR}/${_pkg}/built_ok" ]; then continue; fi + if [[ -f "${BUILDDIR}/${_pkg}/built_ok" ]]; then continue; fi ${VERBOSE} && msg "Building %s" "${_pkg/_/ }" || true -- cgit v1.2.3