From patchwork Wed Mar 14 01:51:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Shumaker X-Patchwork-Id: 460 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id B08BE26EBCD1 for ; Wed, 14 Mar 2018 01:53:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:53:05 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 33223967281FD; Wed, 14 Mar 2018 01:52:59 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Wed, 14 Mar 2018 01:52:38 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id E6ECC2E041; Wed, 14 Mar 2018 01:52:19 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=none Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id EFBD12E730 for ; Wed, 14 Mar 2018 01:52:16 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:16 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 4300096728113 for ; Wed, 14 Mar 2018 01:52:07 +0000 (UTC) Received: from mav.lukeshu.com (mav.lukeshu.com [104.207.138.63]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:07 +0000 (UTC) Received: from build64-par (unknown [IPv6:2601:803:202:9275:da50:e6ff:fe00:4a5b]) by mav.lukeshu.com (Postfix) with ESMTPSA id 1530E80503 for ; Tue, 13 Mar 2018 21:52:06 -0400 (EDT) From: Luke Shumaker To: arch-projects@archlinux.org Date: Tue, 13 Mar 2018 21:51:58 -0400 Message-Id: <20180314015205.20781-2-lukeshu@lukeshu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180314015205.20781-1-lukeshu@lukeshu.com> References: <20180314015205.20781-1-lukeshu@lukeshu.com> Subject: [arch-projects] [dbscripts] [PATCH 1/8] Fix quoting around variables, especially arrays. X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux projects development discussion Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" From: Luke Shumaker Other than pure quoting, this involved: - swapping */@ for array access in a few places - fiddling with printf in a pipeline - replacing `$(echo ${array[@]})` with `${array[*]}` - replacing `echo $(...)` with `...` When searching for these things, I used the command: grep -Prn --exclude-dir=.git '(?/dev/null || ret=$? + source "$pkgbuild" &>/dev/null || ret=$? # ensure $pkgname and $pkgver variables were found if [ $ret -ne 0 -o -z "$pkgname" -o -z "$pkgver" ]; then @@ -88,8 +88,8 @@ source_pkgbuild() { if [ "${#pkgname[@]}" -gt "1" ]; then pkgbase=${pkgbase:-${pkgname[0]}} - for pkg in ${pkgname[@]}; do - if [ "$(type -t package_${pkg})" != "function" ]; then + for pkg in "${pkgname[@]}"; do + if [ "$(type -t "package_${pkg}")" != "function" ]; then echo -e "%INVALID%\n$pkgbuild\n" return 1 else @@ -98,13 +98,13 @@ source_pkgbuild() { while IFS= read -r line; do var=${line%%=*} var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters - for realvar in ${variables[@]}; do + for realvar in "${variables[@]}"; do if [ "$var" == "$realvar" ]; then eval $line break fi done - done < <(type package_${pkg}) + done < <(type "package_${pkg}") print_info restore_package_variables fi @@ -124,14 +124,14 @@ find_pkgbuilds() { return fi - if [ -f $1/PKGBUILD ]; then - source_pkgbuild $1 + if [ -f "$1/PKGBUILD" ]; then + source_pkgbuild "$1" return fi empty=1 - for dir in $1/*; do - if [ -d $dir ]; then - find_pkgbuilds $dir + for dir in "$1"/*; do + if [ -d "$dir" ]; then + find_pkgbuilds "$dir" unset empty fi done @@ -147,7 +147,7 @@ fi CARCH=$1 shift for dir in "$@"; do - find_pkgbuilds $dir + find_pkgbuilds "$dir" done exit 0 diff --git a/cron-jobs/devlist-mailer b/cron-jobs/devlist-mailer index 65a5483..1c35115 100755 --- a/cron-jobs/devlist-mailer +++ b/cron-jobs/devlist-mailer @@ -23,6 +23,6 @@ echo "Subject: $SUBJECT To: $LIST From: $FROM -$stdin" | /usr/sbin/sendmail -F$FROM "$LIST" +$stdin" | /usr/sbin/sendmail -F"$FROM" "$LIST" fi diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index ff65d46..828fa58 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -1,13 +1,13 @@ #!/bin/bash -. "$(dirname $0)/../config" -. "$(dirname $0)/../db-functions" +. "$(dirname "$0")/../config" +. "$(dirname "$0")/../db-functions" clean_pkg() { local pkg local target - if ! ${CLEANUP_DRYRUN}; then + if ! "${CLEANUP_DRYRUN}"; then for pkg in "$@"; do if [[ -h $pkg ]]; then rm -f "$pkg" "$pkg.sig" @@ -24,16 +24,16 @@ clean_pkg() { script_lock -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do - repo_lock ${repo} ${arch} || exit 1 +for repo in "${PKGREPOS[@]}"; do + for arch in "${ARCHES[@]}"; do + repo_lock "${repo}" "${arch}" || exit 1 done done -${CLEANUP_DRYRUN} && warning 'dry run mode is active' +"${CLEANUP_DRYRUN}" && warning 'dry run mode is active' -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do +for repo in "${PKGREPOS[@]}"; do + for arch in "${ARCHES[@]}"; do if [[ ! -f ${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT} ]]; then continue fi @@ -49,7 +49,7 @@ for repo in ${PKGREPOS[@]}; do missing_pkgs=($(comm -13 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if (( ${#missing_pkgs[@]} >= 1 )); then error "Missing packages in [%s] (%s)..." "$repo" "$arch" - for missing_pkg in ${missing_pkgs[@]}; do + for missing_pkg in "${missing_pkgs[@]}"; do msg2 "${missing_pkg}" done fi @@ -57,7 +57,7 @@ for repo in ${PKGREPOS[@]}; do old_pkgs=($(comm -23 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if (( ${#old_pkgs[@]} >= 1 )); then msg "Removing old packages from [%s] (%s)..." "$repo" "$arch" - for old_pkg in ${old_pkgs[@]}; do + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" clean_pkg "${FTP_BASE}/${repo}/os/${arch}/${old_pkg}" done @@ -75,7 +75,7 @@ cat "${WORKDIR}"/db-* 2>/dev/null | sort -u > "${WORKDIR}/db" old_pkgs=($(comm -23 "${WORKDIR}/pool" "${WORKDIR}/db")) if (( ${#old_pkgs[@]} >= 1 )); then msg "Removing old packages from package pool..." - for old_pkg in ${old_pkgs[@]}; do + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" clean_pkg "$FTP_BASE/${PKGPOOL}/${old_pkg}" done @@ -90,18 +90,18 @@ for f in "${CLEANUP_DESTDIR}"/**/*${PKGEXTS}; do done if (( ${#old_pkgs[@]} >= 1 )); then msg "Removing old packages from the cleanup directory..." - for old_pkg in ${old_pkgs[@]}; do + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" - if ! ${CLEANUP_DRYRUN}; then + if ! "${CLEANUP_DRYRUN}"; then rm -f "${CLEANUP_DESTDIR}/${old_pkg}" rm -f "${CLEANUP_DESTDIR}/${old_pkg}.sig" fi done fi -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do - repo_unlock ${repo} ${arch} +for repo in "${PKGREPOS[@]}"; do + for arch in "${ARCHES[@]}"; do + repo_unlock "${repo}" "${arch}" done done diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index f1e75ab..a12d311 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -1,6 +1,6 @@ #!/bin/bash -dirname="$(dirname $0)" +dirname="$(dirname "$0")" . "${dirname}/../config" . "${dirname}/../db-functions" @@ -13,12 +13,12 @@ fi mailto=$1 check() { - ${dirname}/check_archlinux/check_packages.py \ + "${dirname}"/check_archlinux/check_packages.py \ --repos="${repos}" \ --abs-tree="/srv/abs/rsync/${arch},/srv/abs/rsync/any" \ --repo-dir="${FTP_BASE}" \ --arch="${arch}" \ - 2>&1 | ${dirname}/devlist-mailer "Integrity Check ${arch}: ${repos}" "${mailto}" + 2>&1 | "${dirname}"/devlist-mailer "Integrity Check ${arch}: ${repos}" "${mailto}" } repos='core,extra,community,multilib' diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 8f089b3..01d21d8 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -1,15 +1,15 @@ #!/bin/bash -dirname="$(dirname $(readlink -e $0))" +dirname="$(dirname "$(readlink -e "$0")")" . "${dirname}/../config" . "${dirname}/../db-functions" pushd "${WORKDIR}" >/dev/null script_lock -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do - repo_lock ${repo} ${arch} || exit 1 +for repo in "${PKGREPOS[@]}"; do + for arch in "${ARCHES[@]}"; do + repo_lock "${repo}" "${arch}" || exit 1 done done @@ -18,8 +18,8 @@ renice +10 -p $$ > /dev/null # Create a readable file for each repo with the following format # - [ ] -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do +for repo in "${PKGREPOS[@]}"; do + for arch in "${ARCHES[@]}"; do # Repo does not exist; skip it if [[ ! -f ${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT} ]]; then continue @@ -39,9 +39,9 @@ for repo in ${PKGREPOS[@]}; do done | sort -u > "${WORKDIR}/db-${repo}" done -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do - repo_unlock ${repo} ${arch} +for repo in "${PKGREPOS[@]}"; do + for arch in "${ARCHES[@]}"; do + repo_unlock "${repo}" "${arch}" done done @@ -53,22 +53,22 @@ for f in "${FTP_BASE}"/${SRCPOOL}/*${SRCEXT}; do done | sort -u > "${WORKDIR}/available-src-pkgs" # Check for all packages if we need to build a source package -for repo in ${PKGREPOS[@]}; do +for repo in "${PKGREPOS[@]}"; do newpkgs=() failedpkgs=() while read line; do - pkginfo=(${line}) + pkginfo=("${line}") pkgbase=${pkginfo[0]} pkgver=${pkginfo[1]} pkgarch=${pkginfo[2]} - pkglicense=(${pkginfo[@]:3}) + pkglicense=("${pkginfo[@]:3}") # Should this package be skipped? if grep -Fqx "${pkgbase}" "${dirname}/sourceballs.skip"; then continue fi # Check if the license or .force file does not enforce creating a source package - if ! ([[ -z ${ALLOWED_LICENSES[@]} ]] || chk_license ${pkglicense[@]} || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then + if ! ([[ -z ${ALLOWED_LICENSES[*]} ]] || chk_license "${pkglicense[@]}" || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then continue fi # Store the expected file name of the source package @@ -77,7 +77,7 @@ for repo in ${PKGREPOS[@]}; do # Build the source package if its not already there if ! grep -Fqx "${pkgbase}-${pkgver}${SRCEXT}" "${WORKDIR}/available-src-pkgs"; then # Check if we had failed before - if in_array "${pkgbase}-${pkgver}${SRCEXT}" ${failedpkgs[@]}; then + if in_array "${pkgbase}-${pkgver}${SRCEXT}" "${failedpkgs[@]}"; then continue fi @@ -108,13 +108,13 @@ for repo in ${PKGREPOS[@]}; do if [ ${#newpkgs[@]} -ge 1 ]; then msg "Adding source packages for [%s]..." "$repo" - for new_pkg in ${newpkgs[@]}; do + for new_pkg in "${newpkgs[@]}"; do msg2 "${new_pkg}" done fi if [ ${#failedpkgs[@]} -ge 1 ]; then msg "Failed to create source packages for [%s]..." "$repo" - for failed_pkg in ${failedpkgs[@]}; do + for failed_pkg in "${failedpkgs[@]}"; do msg2 "${failed_pkg}" done fi @@ -127,10 +127,10 @@ old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-s if (( ${#old_pkgs[@]} >= 1 )); then msg "Removing old source packages..." - ${SOURCE_CLEANUP_DRYRUN} && warning 'dry run mode is active' - for old_pkg in ${old_pkgs[@]}; do + "${SOURCE_CLEANUP_DRYRUN}" && warning 'dry run mode is active' + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" - if ! ${SOURCE_CLEANUP_DRYRUN}; then + if ! "${SOURCE_CLEANUP_DRYRUN}"; then mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" fi @@ -147,9 +147,9 @@ done if (( ${#old_pkgs[@]} >= 1 )); then msg "Removing old source packages from the cleanup directory..." - for old_pkg in ${old_pkgs[@]}; do + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" - ${SOURCE_CLEANUP_DRYRUN} || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" + "${SOURCE_CLEANUP_DRYRUN}" || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" done fi diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db index c859ce0..87e8bb0 100755 --- a/cron-jobs/update-web-db +++ b/cron-jobs/update-web-db @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/../config" -. "$(dirname $0)/../db-functions" +. "$(dirname "$0")/../config" +. "$(dirname "$0")/../db-functions" # setup paths SPATH="/srv/http/archweb" @@ -43,26 +43,26 @@ case "$cmd" in esac # Lock the repos and get a copy of the db files to work on -for repo in ${REPOS[@]}; do - for arch in ${ARCHES[@]}; do - repo_lock ${repo} ${arch} || exit 1 +for repo in "${REPOS[@]}"; do + for arch in "${ARCHES[@]}"; do + repo_lock "${repo}" "${arch}" || exit 1 dbfile="/srv/ftp/${repo}/os/${arch}/${repo}${dbfileext}" if [[ -f ${dbfile} ]]; then mkdir -p "${WORKDIR}/${repo}/${arch}" cp "${dbfile}" "${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}" fi - repo_unlock ${repo} ${arch} + repo_unlock "${repo}" "${arch}" done done # Run reporead on our db copy -pushd $SPATH >/dev/null -for repo in ${REPOS[@]}; do - for arch in ${ARCHES[@]}; do +pushd "$SPATH" >/dev/null +for repo in "${REPOS[@]}"; do + for arch in "${ARCHES[@]}"; do dbcopy="${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}" if [[ -f ${dbcopy} ]]; then echo "Updating ${repo}-${arch}" >> "${LOGOUT}" - ./manage.py reporead ${flags} ${arch} "${dbcopy}" >> "${LOGOUT}" 2>&1 + ./manage.py reporead "${flags}" "${arch}" "${dbcopy}" >> "${LOGOUT}" 2>&1 echo "" >> "${LOGOUT}" fi done diff --git a/db-functions b/db-functions index 8b71cae..59b4152 100644 --- a/db-functions +++ b/db-functions @@ -17,7 +17,7 @@ set_umask () { } restore_umask () { - umask $UMASK >/dev/null + umask "$UMASK" >/dev/null } # Proxy function to check if a file exists. Using [[ -f ... ]] directly is not @@ -50,7 +50,7 @@ REPO_MODIFIED=0 script_lock() { local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}" if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then - local _owner="$(/usr/bin/stat -c %U $LOCKDIR)" + local _owner="$(/usr/bin/stat -c %U "$LOCKDIR")" error "Script %s is already locked by %s." "${0##*/}" "$_owner" exit 1 else @@ -78,12 +78,12 @@ cleanup() { local arch trap - EXIT INT QUIT TERM - for l in ${LOCKS[@]}; do + for l in "${LOCKS[@]}"; do repo=${l%.*} arch=${l#*.} if [[ -d $TMPDIR/.repolock.$repo.$arch ]]; then msg "Removing left over lock from [%s] (%s)" "$repo" "$arch" - repo_unlock $repo $arch + repo_unlock "$repo" "$arch" fi done if [[ -d $TMPDIR/.scriptlock.${0##*/} ]]; then @@ -96,7 +96,7 @@ cleanup() { date +%s > "${FTP_BASE}/lastupdate" fi - [[ -n $1 ]] && exit $1 + [[ -n $1 ]] && exit "$1" } abort() { @@ -125,7 +125,7 @@ repo_lock () { # This is the lock file used by repo-add and repo-remove if [[ -f ${DBLOCKFILE} ]]; then - error "Repo [%s] (%s) is already locked by repo-{add,remove} process %s" "$1" "$2" "$(cat $DBLOCKFILE)" + error "Repo [%s] (%s) is already locked by repo-{add,remove} process %s" "$1" "$2" "$(cat "$DBLOCKFILE")" return 1 fi @@ -139,9 +139,9 @@ repo_lock () { fi _count=0 - while (( _count <= _trial )) || $_lockblock ; do + while (( _count <= _trial )) || "$_lockblock" ; do if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then - _owner="$(/usr/bin/stat -c %U $LOCKDIR)" + _owner="$(/usr/bin/stat -c %U "$LOCKDIR")" warning "Repo [%s] (%s) is already locked by %s." "$1" "$2" "$_owner" msg2 "Retrying in %s seconds..." "$LOCK_DELAY" else @@ -149,7 +149,7 @@ repo_lock () { set_umask return 0 fi - sleep $LOCK_DELAY + sleep "$LOCK_DELAY" let _count=$_count+1 done @@ -277,12 +277,12 @@ getpkgfile() { exit 1 fi - echo ${1} + echo "${1}" } getpkgfiles() { local f files - if [[ ! -z "$(echo ${@%\.*} | sed "s/ /\n/g" | sort | uniq -D)" ]]; then + if [[ ! -z "$(printf '%s\n' "${@%\.*}" | sort | uniq -D)" ]]; then error 'Duplicate packages found!' exit 1 fi @@ -291,17 +291,17 @@ getpkgfiles() { files+=("$(getpkgfile "$f")") || exit 1 done - echo ${files[@]} + echo "${files[@]}" } check_pkgfile() { local pkgfile=$1 - local pkgname="$(getpkgname ${pkgfile})" || return 1 - local pkgver="$(getpkgver ${pkgfile})" || return 1 - local pkgarch="$(getpkgarch ${pkgfile})" || return 1 + local pkgname="$(getpkgname "${pkgfile}")" || return 1 + local pkgver="$(getpkgver "${pkgfile}")" || return 1 + local pkgarch="$(getpkgarch "${pkgfile}")" || return 1 - in_array "${pkgarch}" ${ARCHES[@]} 'any' || return 1 + in_array "${pkgarch}" "${ARCHES[@]}" 'any' || return 1 if echo "${pkgfile##*/}" | grep -q "^${pkgname}-${pkgver}-${pkgarch}"; then return 0 @@ -312,13 +312,13 @@ check_pkgfile() { check_pkgsvn() { local pkgfile="${1}" - local _pkgbase="$(getpkgbase ${pkgfile})" || return 1 - local _pkgname="$(getpkgname ${pkgfile})" || return 1 - local _pkgver="$(getpkgver ${pkgfile})" || return 1 - local _pkgarch="$(getpkgarch ${pkgfile})" || return 1 + local _pkgbase="$(getpkgbase "${pkgfile}")" || return 1 + local _pkgname="$(getpkgname "${pkgfile}")" || return 1 + local _pkgver="$(getpkgver "${pkgfile}")" || return 1 + local _pkgarch="$(getpkgarch "${pkgfile}")" || return 1 local repo="${2}" - in_array "${repo}" ${PKGREPOS[@]} || return 1 + in_array "${repo}" "${PKGREPOS[@]}" || return 1 if [[ ! -f ${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase} ]]; then mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}" @@ -329,8 +329,8 @@ check_pkgsvn() { local svnver="$(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; get_full_version)" [[ "${svnver}" = "${_pkgver}" ]] || return 1 - local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]})) - in_array "${_pkgname}" ${svnnames[@]} || return 1 + local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo "${pkgname[@]}")) + in_array "${_pkgname}" "${svnnames[@]}" || return 1 return 0 } @@ -338,7 +338,7 @@ check_pkgsvn() { check_splitpkgs() { local repo="${1}" shift - local pkgfiles=(${@}) + local pkgfiles=("${@}") local pkgfile local pkgdir local svnname @@ -346,11 +346,11 @@ check_splitpkgs() { mkdir -p "${WORKDIR}/check_splitpkgs/" pushd "${WORKDIR}/check_splitpkgs" >/dev/null - for pkgfile in ${pkgfiles[@]}; do + for pkgfile in "${pkgfiles[@]}"; do issplitpkg "${pkgfile}" || continue - local _pkgbase="$(getpkgbase ${pkgfile})" - local _pkgname="$(getpkgname ${pkgfile})" - local _pkgarch="$(getpkgarch ${pkgfile})" + local _pkgbase="$(getpkgbase "${pkgfile}")" + local _pkgname="$(getpkgname "${pkgfile}")" + local _pkgarch="$(getpkgarch "${pkgfile}")" mkdir -p "${repo}/${_pkgarch}/${_pkgbase}" echo "${_pkgname}" >> "${repo}/${_pkgarch}/${_pkgbase}/staging" @@ -360,10 +360,8 @@ check_splitpkgs() { "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null || return 1 fi - local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]})) - for svnname in ${svnnames[@]}; do - echo "${svnname}" >> "${repo}/${_pkgarch}/${_pkgbase}/svn" - done + local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo "${pkgname[@]}")) + printf '%s\n' "${svnnames[@]}" >> "${repo}/${_pkgarch}/${_pkgbase}/svn" done popd >/dev/null @@ -382,9 +380,9 @@ check_splitpkgs() { check_pkgrepos() { local pkgfile=$1 - local pkgname="$(getpkgname ${pkgfile})" || return 1 - local pkgver="$(getpkgver ${pkgfile})" || return 1 - local pkgarch="$(getpkgarch ${pkgfile})" || return 1 + local pkgname="$(getpkgname "${pkgfile}")" || return 1 + local pkgver="$(getpkgver "${pkgfile}")" || return 1 + local pkgarch="$(getpkgarch "${pkgfile}")" || return 1 is_globfile "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXTS} && return 1 is_globfile "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXTS}.sig && return 1 @@ -398,7 +396,7 @@ check_pkgrepos() { chk_license() { local l for l in "${@}"; do - in_array ${l} ${ALLOWED_LICENSES[@]} && return 0 + in_array "${l}" "${ALLOWED_LICENSES[@]}" && return 0 done return 1 @@ -410,12 +408,12 @@ check_repo_permission() { (( ${#PKGREPOS[@]} == 0 )) && return 1 [[ -z "${PKGPOOL}" ]] && return 1 - in_array "${repo}" ${PKGREPOS[@]} || return 1 + in_array "${repo}" "${PKGREPOS[@]}" || return 1 [[ -w $FTP_BASE/${PKGPOOL} ]] || return 1 local arch - for arch in ${ARCHES[@]}; do + for arch in "${ARCHES[@]}"; do local dir="${FTP_BASE}/${repo}/os/${arch}/" [[ -w ${dir} ]] || return 1 [[ -f ${dir}${repo}${DBEXT} && ! -w ${dir}${repo}${DBEXT} ]] && return 1 @@ -433,9 +431,9 @@ set_repo_permission() { if [[ -w ${dbfile} ]]; then local group=$(/usr/bin/stat --printf='%G' "$(dirname "${dbfile}")") - chgrp $group "${dbfile}" || error "Could not change group of %s to %s" "$dbfile" "$group" - chgrp $group "${filesfile}" || error "Could not change group of %s to %s" "$filesfile" "$group" - chmod g+w "${dbfile}" || error "Could not set write permission for group %s to %s" "$group" "$dbfile" + chgrp "$group" "${dbfile}" || error "Could not change group of %s to %s" "$dbfile" "$group" + chgrp "$group" "${filesfile}" || error "Could not change group of %s to %s" "$filesfile" "$group" + chmod g+w "${dbfile}" || error "Could not set write permission for group %s to %s" "$group" "$dbfile" chmod g+w "${filesfile}" || error "Could not set write permission for group %s to %s" "$group" "$filesfile" else error "You don't have permission to change %s" "$dbfile" @@ -445,12 +443,12 @@ set_repo_permission() { arch_repo_add() { local repo=$1 local arch=$2 - local pkgs=(${@:3}) + local pkgs=("${@:3}") # package files might be relative to repo dir pushd "${FTP_BASE}/${repo}/os/${arch}" >/dev/null - /usr/bin/repo-add -q "${repo}${DBEXT}" ${pkgs[@]} \ - || error "repo-add ${repo}${DBEXT} ${pkgs[@]}" + /usr/bin/repo-add -q "${repo}${DBEXT}" "${pkgs[@]}" \ + || error "repo-add ${repo}${DBEXT} ${pkgs[*]}" popd >/dev/null set_repo_permission "${repo}" "${arch}" @@ -460,15 +458,15 @@ arch_repo_add() { arch_repo_remove() { local repo=$1 local arch=$2 - local pkgs=(${@:3}) + local pkgs=("${@:3}") local dbfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" if [[ ! -f ${dbfile} ]]; then error "No database found at '%s'" "$dbfile" return 1 fi - /usr/bin/repo-remove -q "${dbfile}" ${pkgs[@]} \ - || error "repo-remove ${dbfile} ${pkgs[@]}" + /usr/bin/repo-remove -q "${dbfile}" "${pkgs[@]}" \ + || error "repo-remove ${dbfile} ${pkgs[*]}" set_repo_permission "${repo}" "${arch}" REPO_MODIFIED=1 diff --git a/db-move b/db-move index fb7ebac..c413dc9 100755 --- a/db-move +++ b/db-move @@ -1,37 +1,37 @@ #!/bin/bash -. "$(dirname $0)/config" -. "$(dirname $0)/db-functions" +. "$(dirname "$0")/config" +. "$(dirname "$0")/db-functions" if (( $# < 3 )); then msg "usage: ${0##*/} ..." exit 1 fi -args=(${@}) +args=("${@}") repo_from="${args[0]}" repo_to="${args[1]}" ftppath_from="${FTP_BASE}/${repo_from}/os/" ftppath_to="${FTP_BASE}/${repo_to}/os/" -if ! check_repo_permission $repo_to || ! check_repo_permission $repo_from; then +if ! check_repo_permission "$repo_to" || ! check_repo_permission "$repo_from"; then die "You don't have permission to move packages from %s to %s" "$repo_from" "$repo_to" fi # TODO: this might lock too much (architectures) -for pkgarch in ${ARCHES[@]}; do - repo_lock ${repo_to} ${pkgarch} || exit 1 - repo_lock ${repo_from} ${pkgarch} || exit 1 +for pkgarch in "${ARCHES[@]}"; do + repo_lock "${repo_to}" "${pkgarch}" || exit 1 + repo_lock "${repo_from}" "${pkgarch}" || exit 1 done # check if packages to be moved exist in svn and ftp dir arch_svn checkout -q -N "${SVNREPO}" "${WORKDIR}/svn" >/dev/null -for pkgbase in ${args[@]:2}; do +for pkgbase in "${args[@]:2}"; do arch_svn up -q "${WORKDIR}/svn/${pkgbase}" >/dev/null - for pkgarch in ${ARCHES[@]} 'any'; do + for pkgarch in "${ARCHES[@]}" 'any'; do svnrepo_from="${WORKDIR}/svn/${pkgbase}/repos/${repo_from}-${pkgarch}" if [[ -r ${svnrepo_from}/PKGBUILD ]]; then - pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]})) + pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo "${pkgname[@]}")) if (( ${#pkgnames[@]} < 1 )); then die "Could not read pkgname" fi @@ -41,15 +41,15 @@ for pkgbase in ${args[@]:2}; do die "Could not read pkgver" fi - if [[ ${pkgarch} = any ]]; then - tarches=(${ARCHES[@]}) + if [[ "${pkgarch}" = any ]]; then + tarches=("${ARCHES[@]}") else tarches=("${pkgarch}") fi - for pkgname in ${pkgnames[@]}; do - for tarch in ${tarches[@]}; do - getpkgfile "${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXTS} >/dev/null + for pkgname in "${pkgnames[@]}"; do + for tarch in "${tarches[@]}"; do + getpkgfile "${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXTS} >/dev/null done done continue 2 @@ -62,20 +62,20 @@ msg "Moving packages from [%s] to [%s]..." "$repo_from" "$repo_to" declare -A add_pkgs declare -A remove_pkgs -for pkgbase in ${args[@]:2}; do +for pkgbase in "${args[@]:2}"; do tag_list="" - for pkgarch in ${ARCHES[@]} 'any'; do + for pkgarch in "${ARCHES[@]}" 'any'; do svnrepo_from="${WORKDIR}/svn/${pkgbase}/repos/${repo_from}-${pkgarch}" svnrepo_to="${WORKDIR}/svn/${pkgbase}/repos/${repo_to}-${pkgarch}" if [[ -f ${svnrepo_from}/PKGBUILD ]]; then if [[ ${pkgarch} = any ]]; then - tarches=(${ARCHES[@]}) + tarches=("${ARCHES[@]}") else tarches=("${pkgarch}") fi - msg2 "${pkgbase} ($(echo ${tarches[@]}))" - pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]})) + msg2 "${pkgbase} (${tarches[*]})" + pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo "${pkgname[@]}")) pkgver=$(. "${svnrepo_from}/PKGBUILD"; get_full_version) if [[ -d ${svnrepo_to} ]]; then @@ -93,14 +93,14 @@ for pkgbase in ${args[@]:2}; do arch_svn rm --force -q "${svnrepo_from}" tag_list+=", $pkgarch" - for pkgname in ${pkgnames[@]}; do - for tarch in ${tarches[@]}; do - pkgpath=$(getpkgfile "${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXTS}) + for pkgname in "${pkgnames[@]}"; do + for tarch in "${tarches[@]}"; do + pkgpath=$(getpkgfile "${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXTS}) pkgfile="${pkgpath##*/}" - ln -s "../../../${PKGPOOL}/${pkgfile}" ${ftppath_to}/${tarch}/ + ln -s "../../../${PKGPOOL}/${pkgfile}" "${ftppath_to}/${tarch}/" if [[ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile}.sig ]]; then - ln -s "../../../${PKGPOOL}/${pkgfile}.sig" ${ftppath_to}/${tarch}/ + ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "${ftppath_to}/${tarch}/" fi add_pkgs[${tarch}]+="${FTP_BASE}/${PKGPOOL}/${pkgfile} " remove_pkgs[${tarch}]+="${pkgname} " @@ -112,14 +112,14 @@ for pkgbase in ${args[@]:2}; do arch_svn commit -q "${WORKDIR}/svn/${pkgbase}" -m "${0##*/}: moved ${pkgbase} from [${repo_from}] to [${repo_to}] (${tag_list})" done -for tarch in ${ARCHES[@]}; do +for tarch in "${ARCHES[@]}"; do if [[ -n ${add_pkgs[${tarch}]} ]]; then arch_repo_add "${repo_to}" "${tarch}" ${add_pkgs[${tarch}]} arch_repo_remove "${repo_from}" "${tarch}" ${remove_pkgs[${tarch}]} fi done -for pkgarch in ${ARCHES[@]}; do - repo_unlock ${repo_from} ${pkgarch} - repo_unlock ${repo_to} ${pkgarch} +for pkgarch in "${ARCHES[@]}"; do + repo_unlock "${repo_from}" "${pkgarch}" + repo_unlock "${repo_to}" "${pkgarch}" done diff --git a/db-remove b/db-remove index 70502bc..2ab878c 100755 --- a/db-remove +++ b/db-remove @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/config" -. "$(dirname $0)/db-functions" +. "$(dirname "$0")/config" +. "$(dirname "$0")/db-functions" if (( $# < 3 )); then msg "usage: ${0##*/} ..." @@ -10,27 +10,27 @@ fi repo="$1" arch="$2" -pkgbases=(${@:3}) +pkgbases=("${@:3}") ftppath="$FTP_BASE/$repo/os" svnrepo="$repo-$arch" -if ! check_repo_permission $repo; then +if ! check_repo_permission "$repo"; then die "You don't have permission to remove packages from %s" "$repo" fi if [[ $arch = any ]]; then - tarches=(${ARCHES[@]}) + tarches=("${ARCHES[@]}") else tarches=("$arch") fi -for tarch in ${tarches[@]}; do - repo_lock $repo $tarch || exit 1 +for tarch in "${tarches[@]}"; do + repo_lock "$repo" "$tarch" || exit 1 done remove_pkgs=() -for pkgbase in ${pkgbases[@]}; do +for pkgbase in "${pkgbases[@]}"; do msg "Removing %s from [%s]..." "$pkgbase" "$repo" arch_svn checkout -q "${SVNREPO}/${pkgbase}" "${WORKDIR}/svn/${pkgbase}" >/dev/null @@ -46,7 +46,7 @@ for pkgbase in ${pkgbases[@]}; do fi done -for tarch in ${tarches[@]}; do - arch_repo_remove "${repo}" "${tarch}" ${remove_pkgs[@]} - repo_unlock $repo $tarch +for tarch in "${tarches[@]}"; do + arch_repo_remove "${repo}" "${tarch}" "${remove_pkgs[@]}" + repo_unlock "$repo" "$tarch" done diff --git a/db-repo-add b/db-repo-add index d7be302..04216ee 100755 --- a/db-repo-add +++ b/db-repo-add @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/config" -. "$(dirname $0)/db-functions" +. "$(dirname "$0")/config" +. "$(dirname "$0")/db-functions" if (( $# < 3 )); then msg "usage: ${0##*/} ..." @@ -10,32 +10,32 @@ fi repo="$1" arch="$2" -pkgfiles=(${@:3}) +pkgfiles=("${@:3}") ftppath="$FTP_BASE/$repo/os" -if ! check_repo_permission $repo; then +if ! check_repo_permission "$repo"; then die "You don't have permission to add packages to %s" "$repo" fi if [[ $arch = any ]]; then - tarches=(${ARCHES[@]}) + tarches=("${ARCHES[@]}") else tarches=("$arch") fi -for tarch in ${tarches[@]}; do - repo_lock $repo $tarch || exit 1 +for tarch in "${tarches[@]}"; do + repo_lock "$repo" "$tarch" || exit 1 done -for tarch in ${tarches[@]}; do - for pkgfile in ${pkgfiles[@]}; do +for tarch in "${tarches[@]}"; do + for pkgfile in "${pkgfiles[@]}"; do if [[ ! -f ${FTP_BASE}/${repo}/os/${tarch}/${pkgfile##*/} ]]; then die "Package file %s not found in %s" "${pkgfile##*/}" "${FTP_BASE}/${repo}/os/${tarch}/" else msg "Adding %s to [%s]..." "$pkgfile" "$repo" fi done - arch_repo_add "${repo}" "${tarch}" ${pkgfiles[@]} - repo_unlock $repo $tarch + arch_repo_add "${repo}" "${tarch}" "${pkgfiles[@]}" + repo_unlock "$repo" "$tarch" done diff --git a/db-repo-remove b/db-repo-remove index 32d167e..b44d33c 100755 --- a/db-repo-remove +++ b/db-repo-remove @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/config" -. "$(dirname $0)/db-functions" +. "$(dirname "$0")/config" +. "$(dirname "$0")/db-functions" if (( $# < 3 )); then msg "usage: ${0##*/} ..." @@ -10,28 +10,28 @@ fi repo="$1" arch="$2" -pkgnames=(${@:3}) +pkgnames=("${@:3}") ftppath="$FTP_BASE/$repo/os" -if ! check_repo_permission $repo; then +if ! check_repo_permission "$repo"; then die "You don't have permission to remove packages from %s" "$repo" fi if [[ $arch = any ]]; then - tarches=(${ARCHES[@]}) + tarches=("${ARCHES[@]}") else tarches=("$arch") fi -for tarch in ${tarches[@]}; do - repo_lock $repo $tarch || exit 1 +for tarch in "${tarches[@]}"; do + repo_lock "$repo" "$tarch" || exit 1 done -for tarch in ${tarches[@]}; do - for pkgname in ${pkgnames[@]}; do +for tarch in "${tarches[@]}"; do + for pkgname in "${pkgnames[@]}"; do msg "Removing %s from [%s]..." "$pkgname" "$repo" done - arch_repo_remove "${repo}" "${tarch}" ${pkgnames[@]} - repo_unlock $repo $tarch + arch_repo_remove "${repo}" "${tarch}" "${pkgnames[@]}" + repo_unlock "$repo" "$tarch" done diff --git a/db-update b/db-update index 4e17184..5df477c 100755 --- a/db-update +++ b/db-update @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/config" -. "$(dirname $0)/db-functions" +. "$(dirname "$0")/config" +. "$(dirname "$0")/db-functions" if (( $# >= 1 )); then warning "Calling %s with a specific repository is no longer supported" "${0##*/}" @@ -16,27 +16,27 @@ mapfile -t -d '' staging_repos < <( ) repos=() -for staging_repo in ${staging_repos[@]##*/}; do - if in_array ${staging_repo} ${PKGREPOS[@]}; then - repos+=(${staging_repo}) +for staging_repo in "${staging_repos[@]##*/}"; do + if in_array "${staging_repo}" "${PKGREPOS[@]}"; then + repos+=("${staging_repo}") fi done # TODO: this might lock too much (architectures) -for repo in ${repos[@]}; do - for pkgarch in ${ARCHES[@]}; do - repo_lock ${repo} ${pkgarch} || exit 1 +for repo in "${repos[@]}"; do + for pkgarch in "${ARCHES[@]}"; do + repo_lock "${repo}" "${pkgarch}" || exit 1 done done # check if packages are valid -for repo in ${repos[@]}; do +for repo in "${repos[@]}"; do if ! check_repo_permission "${repo}"; then die "You don't have permission to update packages in %s" "$repo" fi pkgs=($(getpkgfiles "${STAGING}/${repo}/"*${PKGEXTS})) if (( $? == 0 )); then - for pkg in ${pkgs[@]}; do + for pkg in "${pkgs[@]}"; do if [[ -h ${pkg} ]]; then die "Package %s is a symbolic link" "$repo/${pkg##*/}" fi @@ -62,7 +62,7 @@ for repo in ${repos[@]}; do die "Package %s was not built in a chroot" "$repo/${pkg##*/}" fi done - if ! check_splitpkgs ${repo} ${pkgs[@]}; then + if ! check_splitpkgs "${repo}" "${pkgs[@]}"; then die "Missing split packages for %s" "$repo" fi else @@ -70,13 +70,13 @@ for repo in ${repos[@]}; do fi done -for repo in ${repos[@]}; do +for repo in "${repos[@]}"; do msg "Updating [%s]..." "$repo" any_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-any${PKGEXTS} 2>/dev/null)) - for pkgarch in ${ARCHES[@]}; do + for pkgarch in "${ARCHES[@]}"; do add_pkgs=() - arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-${pkgarch}${PKGEXTS} 2>/dev/null)) - for pkg in ${arch_pkgs[@]} ${any_pkgs[@]}; do + arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-"${pkgarch}"${PKGEXTS} 2>/dev/null)) + for pkg in "${arch_pkgs[@]}" "${any_pkgs[@]}"; do pkgfile="${pkg##*/}" msg2 "${pkgfile} (${pkgarch})" # any packages might have been moved by the previous run @@ -99,8 +99,8 @@ for repo in ${repos[@]}; do done done -for repo in ${repos[@]}; do - for pkgarch in ${ARCHES[@]}; do - repo_unlock ${repo} ${pkgarch} +for repo in "${repos[@]}"; do + for pkgarch in "${ARCHES[@]}"; do + repo_unlock "${repo}" "${pkgarch}" done done diff --git a/testing2x b/testing2x index f0d77cb..2b1de17 100755 --- a/testing2x +++ b/testing2x @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/config" -. "$(dirname $0)/db-functions" +. "$(dirname "$0")/config" +. "$(dirname "$0")/db-functions" if (( $# < 1 )); then msg "usage: ${0##*/} ..." @@ -10,30 +10,30 @@ fi # Lock everything to reduce possibility of interfering task between the different repo-updates script_lock -for repo in ${TESTING_REPO} ${STABLE_REPOS[@]}; do - for pkgarch in ${ARCHES[@]}; do - repo_lock ${repo} ${pkgarch} || exit 1 +for repo in "${TESTING_REPO}" "${STABLE_REPOS[@]}"; do + for pkgarch in "${ARCHES[@]}"; do + repo_lock "${repo}" "${pkgarch}" || exit 1 done done declare -A pkgs -for pkgbase in $*; do +for pkgbase in "$@"; do if [[ ! -d ${WORKDIR}/${pkgbase} ]]; then arch_svn export -q "${SVNREPO}/${pkgbase}/repos" "${WORKDIR}/${pkgbase}" >/dev/null found_source=false - for pkgarch in ${ARCHES[@]} 'any'; do + for pkgarch in "${ARCHES[@]}" 'any'; do svnrepo_from="${WORKDIR}/${pkgbase}/${TESTING_REPO}-${pkgarch}" if [[ -r ${svnrepo_from}/PKGBUILD ]]; then found_source=true break fi done - ${found_source} || die "%s not found in [%s]" "$pkgbase" "$TESTING_REPO" + "${found_source}" || die "%s not found in [%s]" "$pkgbase" "$TESTING_REPO" found_target=false - for pkgarch in ${ARCHES[@]} 'any'; do - for repo in ${STABLE_REPOS[@]}; do + for pkgarch in "${ARCHES[@]}" 'any'; do + for repo in "${STABLE_REPOS[@]}"; do svnrepo_to="${WORKDIR}/${pkgbase}/${repo}-${pkgarch}" if [[ -r ${svnrepo_to}/PKGBUILD ]]; then found_target=true @@ -42,19 +42,19 @@ for pkgbase in $*; do fi done done - ${found_target} || die "%s not found in any of these repos: %s" "$pkgbase" "${STABLE_REPOS[*]}" + "${found_target}" || die "%s not found in any of these repos: %s" "$pkgbase" "${STABLE_REPOS[*]}" fi done -for pkgarch in ${ARCHES[@]}; do - repo_unlock ${TESTING_REPO} ${pkgarch} +for pkgarch in "${ARCHES[@]}"; do + repo_unlock "${TESTING_REPO}" "${pkgarch}" done -for repo in ${STABLE_REPOS[@]}; do - for pkgarch in ${ARCHES[@]}; do - repo_unlock ${repo} ${pkgarch} +for repo in "${STABLE_REPOS[@]}"; do + for pkgarch in "${ARCHES[@]}"; do + repo_unlock "${repo}" "${pkgarch}" done if [[ -n ${pkgs[${repo}]} ]]; then - "$(dirname $0)/db-move" ${TESTING_REPO} "${repo}" ${pkgs[${repo}]} + "$(dirname "$0")/db-move" "${TESTING_REPO}" "${repo}" ${pkgs[${repo}]} fi done From patchwork Wed Mar 14 01:51:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Shumaker X-Patchwork-Id: 455 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 9F8A026EBBD9 for ; Wed, 14 Mar 2018 01:52:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:22 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id B17A39672814B; Wed, 14 Mar 2018 01:52:17 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Wed, 14 Mar 2018 01:52:13 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id AB8D32DCA4; Wed, 14 Mar 2018 01:52:13 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=none Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id E58512DCA4 for ; Wed, 14 Mar 2018 01:52:11 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:11 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id CBA8596728114 for ; Wed, 14 Mar 2018 01:52:07 +0000 (UTC) Received: from mav.lukeshu.com (mav.lukeshu.com [IPv6:2001:19f0:5c00:8069:5400:ff:fe26:6a86]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:07 +0000 (UTC) Received: from build64-par (unknown [IPv6:2601:803:202:9275:da50:e6ff:fe00:4a5b]) by mav.lukeshu.com (Postfix) with ESMTPSA id 803AE80504 for ; Tue, 13 Mar 2018 21:52:06 -0400 (EDT) From: Luke Shumaker To: arch-projects@archlinux.org Date: Tue, 13 Mar 2018 21:51:59 -0400 Message-Id: <20180314015205.20781-3-lukeshu@lukeshu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180314015205.20781-1-lukeshu@lukeshu.com> References: <20180314015205.20781-1-lukeshu@lukeshu.com> Subject: [arch-projects] [dbscripts] [PATCH 2/8] Use printf-formatters instead of string interpolation on msg, error, etc. X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux projects development discussion Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" From: Luke Shumaker --- cron-jobs/ftpdir-cleanup | 8 ++++---- cron-jobs/integrity-check | 2 +- cron-jobs/sourceballs | 8 ++++---- db-functions | 6 +++--- db-move | 4 ++-- db-remove | 2 +- db-repo-add | 2 +- db-repo-remove | 2 +- db-update | 2 +- testing2x | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 828fa58..62a2903 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -50,7 +50,7 @@ for repo in "${PKGREPOS[@]}"; do if (( ${#missing_pkgs[@]} >= 1 )); then error "Missing packages in [%s] (%s)..." "$repo" "$arch" for missing_pkg in "${missing_pkgs[@]}"; do - msg2 "${missing_pkg}" + msg2 '%s' "${missing_pkg}" done fi @@ -58,7 +58,7 @@ for repo in "${PKGREPOS[@]}"; do if (( ${#old_pkgs[@]} >= 1 )); then msg "Removing old packages from [%s] (%s)..." "$repo" "$arch" for old_pkg in "${old_pkgs[@]}"; do - msg2 "${old_pkg}" + msg2 '%s' "${old_pkg}" clean_pkg "${FTP_BASE}/${repo}/os/${arch}/${old_pkg}" done fi @@ -76,7 +76,7 @@ old_pkgs=($(comm -23 "${WORKDIR}/pool" "${WORKDIR}/db")) if (( ${#old_pkgs[@]} >= 1 )); then msg "Removing old packages from package pool..." for old_pkg in "${old_pkgs[@]}"; do - msg2 "${old_pkg}" + msg2 '%s' "${old_pkg}" clean_pkg "$FTP_BASE/${PKGPOOL}/${old_pkg}" done fi @@ -91,7 +91,7 @@ done if (( ${#old_pkgs[@]} >= 1 )); then msg "Removing old packages from the cleanup directory..." for old_pkg in "${old_pkgs[@]}"; do - msg2 "${old_pkg}" + msg2 '%s' "${old_pkg}" if ! "${CLEANUP_DRYRUN}"; then rm -f "${CLEANUP_DESTDIR}/${old_pkg}" rm -f "${CLEANUP_DESTDIR}/${old_pkg}.sig" diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index a12d311..17153c7 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -8,7 +8,7 @@ dirname="$(dirname "$0")" script_lock if (( $# != 1 )); then - die "usage: ${0##*/} " + die "usage: %s " "${0##*/}" fi mailto=$1 diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 01d21d8..874a912 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -109,13 +109,13 @@ for repo in "${PKGREPOS[@]}"; do if [ ${#newpkgs[@]} -ge 1 ]; then msg "Adding source packages for [%s]..." "$repo" for new_pkg in "${newpkgs[@]}"; do - msg2 "${new_pkg}" + msg2 '%s' "${new_pkg}" done fi if [ ${#failedpkgs[@]} -ge 1 ]; then msg "Failed to create source packages for [%s]..." "$repo" for failed_pkg in "${failedpkgs[@]}"; do - msg2 "${failed_pkg}" + msg2 '%s' "${failed_pkg}" done fi done @@ -129,7 +129,7 @@ if (( ${#old_pkgs[@]} >= 1 )); then msg "Removing old source packages..." "${SOURCE_CLEANUP_DRYRUN}" && warning 'dry run mode is active' for old_pkg in "${old_pkgs[@]}"; do - msg2 "${old_pkg}" + msg2 '%s' "${old_pkg}" if ! "${SOURCE_CLEANUP_DRYRUN}"; then mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" @@ -148,7 +148,7 @@ done if (( ${#old_pkgs[@]} >= 1 )); then msg "Removing old source packages from the cleanup directory..." for old_pkg in "${old_pkgs[@]}"; do - msg2 "${old_pkg}" + msg2 '%s' "${old_pkg}" "${SOURCE_CLEANUP_DRYRUN}" || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" done fi diff --git a/db-functions b/db-functions index 59b4152..2703e80 100644 --- a/db-functions +++ b/db-functions @@ -273,7 +273,7 @@ getpkgfile() { error "Package %s not found!" "$1" exit 1 elif [[ ! -f ${1}.sig ]]; then - error "Package signature %s.sig not found!" "$1" + error "Package signature %s not found!" "$1.sig" exit 1 fi @@ -448,7 +448,7 @@ arch_repo_add() { # package files might be relative to repo dir pushd "${FTP_BASE}/${repo}/os/${arch}" >/dev/null /usr/bin/repo-add -q "${repo}${DBEXT}" "${pkgs[@]}" \ - || error "repo-add ${repo}${DBEXT} ${pkgs[*]}" + || error '%s' "repo-add ${repo}${DBEXT} ${pkgs[*]}" popd >/dev/null set_repo_permission "${repo}" "${arch}" @@ -466,7 +466,7 @@ arch_repo_remove() { return 1 fi /usr/bin/repo-remove -q "${dbfile}" "${pkgs[@]}" \ - || error "repo-remove ${dbfile} ${pkgs[*]}" + || error '%s' "repo-remove ${dbfile} ${pkgs[*]}" set_repo_permission "${repo}" "${arch}" REPO_MODIFIED=1 diff --git a/db-move b/db-move index c413dc9..ab05d57 100755 --- a/db-move +++ b/db-move @@ -4,7 +4,7 @@ . "$(dirname "$0")/db-functions" if (( $# < 3 )); then - msg "usage: ${0##*/} ..." + msg "usage: %s ..." "${0##*/}" exit 1 fi @@ -74,7 +74,7 @@ for pkgbase in "${args[@]:2}"; do else tarches=("${pkgarch}") fi - msg2 "${pkgbase} (${tarches[*]})" + msg2 "%s (%s)" "${pkgbase}" "${tarches[*]}" pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo "${pkgname[@]}")) pkgver=$(. "${svnrepo_from}/PKGBUILD"; get_full_version) diff --git a/db-remove b/db-remove index 2ab878c..bf19d6a 100755 --- a/db-remove +++ b/db-remove @@ -4,7 +4,7 @@ . "$(dirname "$0")/db-functions" if (( $# < 3 )); then - msg "usage: ${0##*/} ..." + msg "usage: %s ..." "${0##*/}" exit 1 fi diff --git a/db-repo-add b/db-repo-add index 04216ee..7e68221 100755 --- a/db-repo-add +++ b/db-repo-add @@ -4,7 +4,7 @@ . "$(dirname "$0")/db-functions" if (( $# < 3 )); then - msg "usage: ${0##*/} ..." + msg "usage: %s ..." "${0##*/}" exit 1 fi diff --git a/db-repo-remove b/db-repo-remove index b44d33c..87f01f8 100755 --- a/db-repo-remove +++ b/db-repo-remove @@ -4,7 +4,7 @@ . "$(dirname "$0")/db-functions" if (( $# < 3 )); then - msg "usage: ${0##*/} ..." + msg "usage: %s ..." "${0##*/}" exit 1 fi diff --git a/db-update b/db-update index 5df477c..2898b1c 100755 --- a/db-update +++ b/db-update @@ -78,7 +78,7 @@ for repo in "${repos[@]}"; do arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-"${pkgarch}"${PKGEXTS} 2>/dev/null)) for pkg in "${arch_pkgs[@]}" "${any_pkgs[@]}"; do pkgfile="${pkg##*/}" - msg2 "${pkgfile} (${pkgarch})" + msg2 "%s (%s)" "${pkgfile}" "${pkgarch}" # any packages might have been moved by the previous run if [[ -f ${pkg} ]]; then mv "${pkg}" "$FTP_BASE/${PKGPOOL}" diff --git a/testing2x b/testing2x index 2b1de17..606c003 100755 --- a/testing2x +++ b/testing2x @@ -4,7 +4,7 @@ . "$(dirname "$0")/db-functions" if (( $# < 1 )); then - msg "usage: ${0##*/} ..." + msg "usage: %s ..." "${0##*/}" exit 1 fi From patchwork Wed Mar 14 01:52:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Shumaker X-Patchwork-Id: 457 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 122F926EBC2D for ; Wed, 14 Mar 2018 01:52:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:50 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 629CF967281C8; Wed, 14 Mar 2018 01:52:43 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Wed, 14 Mar 2018 01:52:28 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 750F12CD7A; Wed, 14 Mar 2018 01:52:16 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=none Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id DB9CF2C460 for ; Wed, 14 Mar 2018 01:52:14 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:14 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id E928596728116 for ; Wed, 14 Mar 2018 01:52:07 +0000 (UTC) Received: from mav.lukeshu.com (mav.lukeshu.com [104.207.138.63]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:07 +0000 (UTC) Received: from build64-par (unknown [IPv6:2601:803:202:9275:da50:e6ff:fe00:4a5b]) by mav.lukeshu.com (Postfix) with ESMTPSA id DCAC780505 for ; Tue, 13 Mar 2018 21:52:06 -0400 (EDT) From: Luke Shumaker To: arch-projects@archlinux.org Date: Tue, 13 Mar 2018 21:52:00 -0400 Message-Id: <20180314015205.20781-4-lukeshu@lukeshu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180314015205.20781-1-lukeshu@lukeshu.com> References: <20180314015205.20781-1-lukeshu@lukeshu.com> Subject: [arch-projects] [dbscripts] [PATCH 3/8] Export TMPDIR, and use mktemp -t instead of making it part of the template X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux projects development discussion Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" From: Luke Shumaker --- config | 2 +- db-functions | 2 +- test/cases/db-update.bats | 2 +- test/lib/common.bash | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config b/config index 02ade09..2f5dbc6 100644 --- a/config +++ b/config @@ -21,7 +21,7 @@ LOCK_DELAY=10 LOCK_TIMEOUT=300 STAGING="$HOME/staging" -TMPDIR="/var/tmp" +export TMPDIR="/var/tmp" ARCHES=(x86_64) DBEXT=".db.tar.gz" FILESEXT=".files.tar.gz" diff --git a/db-functions b/db-functions index 2703e80..58b753a 100644 --- a/db-functions +++ b/db-functions @@ -38,7 +38,7 @@ mv_acl() { } # set up general environment -WORKDIR=$(mktemp -d "${TMPDIR}/${0##*/}.XXXXXXXXXX") +WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX") if [[ -n ${SVNUSER} ]]; then setfacl -m u:"${SVNUSER}":rwx "${WORKDIR}" setfacl -m d:u:"${USER}":rwx "${WORKDIR}" diff --git a/test/cases/db-update.bats b/test/cases/db-update.bats index e7e4489..2e44b91 100644 --- a/test/cases/db-update.bats +++ b/test/cases/db-update.bats @@ -222,7 +222,7 @@ load ../lib/common @test "package has to be aregular file" { local p - local target=$(mktemp -d) + local target=$(mktemp -dt) local arches=('i686' 'x86_64') releasePackage extra 'pkg-simple-a' diff --git a/test/lib/common.bash b/test/lib/common.bash index 568a541..45e4800 100644 --- a/test/lib/common.bash +++ b/test/lib/common.bash @@ -83,7 +83,7 @@ setup() { local a PKGEXT=".pkg.tar.xz" - TMP="$(mktemp -d)" + TMP="$(mktemp -dt)" export DBSCRIPTS_CONFIG=${TMP}/config.local cat < "${DBSCRIPTS_CONFIG}" From patchwork Wed Mar 14 01:52:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Shumaker X-Patchwork-Id: 454 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 53C7826EBBE4 for ; Wed, 14 Mar 2018 01:52:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:24 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 3BA8596728150; Wed, 14 Mar 2018 01:52:19 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Wed, 14 Mar 2018 01:52:15 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id E6BC42E72B; Wed, 14 Mar 2018 01:52:13 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=none Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 550982E729 for ; Wed, 14 Mar 2018 01:52:12 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:12 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 49BB796728118 for ; Wed, 14 Mar 2018 01:52:08 +0000 (UTC) Received: from mav.lukeshu.com (mav.lukeshu.com [IPv6:2001:19f0:5c00:8069:5400:ff:fe26:6a86]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:08 +0000 (UTC) Received: from build64-par (unknown [IPv6:2601:803:202:9275:da50:e6ff:fe00:4a5b]) by mav.lukeshu.com (Postfix) with ESMTPSA id 41A6080506 for ; Tue, 13 Mar 2018 21:52:07 -0400 (EDT) From: Luke Shumaker To: arch-projects@archlinux.org Date: Tue, 13 Mar 2018 21:52:01 -0400 Message-Id: <20180314015205.20781-5-lukeshu@lukeshu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180314015205.20781-1-lukeshu@lukeshu.com> References: <20180314015205.20781-1-lukeshu@lukeshu.com> Subject: [arch-projects] [dbscripts] [PATCH 4/8] Use `grep &>/dev/null` instead of `grep -q` when operating on piped stdin. X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux projects development discussion Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" From: Luke Shumaker `grep -q` may exit as soon as it finds a match; this is a good optimization for when the input is a file. However, if the input is the output of another program, then that other program will receive SIGPIPE, and further writes will fail. When this happens, it might (bsdtar does) print a message about a "write error" to stderr. Which is going to confuse and alarm the user. In one of the cases, this had already been mitigated by wrapping bsdtar in "echo "$(bsdtar ...)", as Bash builtin echo doesn't complain if it gets SIGPIPE. However, that means we're storing the entire output of bsdtar in memory, which is silly. --- db-functions | 2 +- test/lib/common.bash | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db-functions b/db-functions index 58b753a..ee390ff 100644 --- a/db-functions +++ b/db-functions @@ -303,7 +303,7 @@ check_pkgfile() { in_array "${pkgarch}" "${ARCHES[@]}" 'any' || return 1 - if echo "${pkgfile##*/}" | grep -q "^${pkgname}-${pkgver}-${pkgarch}"; then + if echo "${pkgfile##*/}" | grep "^${pkgname}-${pkgver}-${pkgarch}" &>/dev/null; then return 0 else return 1 diff --git a/test/lib/common.bash b/test/lib/common.bash index 45e4800..ab805dd 100644 --- a/test/lib/common.bash +++ b/test/lib/common.bash @@ -215,7 +215,7 @@ checkPackageDB() { for db in ${DBEXT} ${FILESEXT}; do [ -r "${FTP_BASE}/${repo}/os/${repoarch}/${repo}${db%.tar.*}" ] - bsdtar -xf "${FTP_BASE}/${repo}/os/${repoarch}/${repo}${db%.tar.*}" -O | grep -q "${pkgfile%${PKGEXT}}" + bsdtar -xf "${FTP_BASE}/${repo}/os/${repoarch}/${repo}${db%.tar.*}" -O | grep "${pkgfile%${PKGEXT}}" &>/dev/null done done done @@ -269,7 +269,7 @@ checkRemovedPackageDB() { for tarch in ${tarches[@]}; do if [ -r "${FTP_BASE}/${repo}/os/${tarch}/${repo}${db%.tar.*}" ]; then for pkgname in ${pkgnames[@]}; do - echo "$(bsdtar -xf "${FTP_BASE}/${repo}/os/${tarch}/${repo}${db%.tar.*}" -O)" | grep -qv ${pkgname} + bsdtar -xf "${FTP_BASE}/${repo}/os/${tarch}/${repo}${db%.tar.*}" -O | grep -v ${pkgname} &>/dev/null done fi done From patchwork Wed Mar 14 01:52:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Shumaker X-Patchwork-Id: 461 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id BDAC326EBCD3 for ; Wed, 14 Mar 2018 01:53:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:53:06 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 8F5D096728204; Wed, 14 Mar 2018 01:52:59 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Wed, 14 Mar 2018 01:52:38 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id B9FA82DAEE; Wed, 14 Mar 2018 01:52:19 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=none Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id BCED32E736 for ; Wed, 14 Mar 2018 01:52:17 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:17 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 7C93196728121 for ; Wed, 14 Mar 2018 01:52:12 +0000 (UTC) Received: from mav.lukeshu.com (mav.lukeshu.com [104.207.138.63]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:12 +0000 (UTC) Received: from build64-par (unknown [IPv6:2601:803:202:9275:da50:e6ff:fe00:4a5b]) by mav.lukeshu.com (Postfix) with ESMTPSA id 9EF8E80507 for ; Tue, 13 Mar 2018 21:52:07 -0400 (EDT) From: Luke Shumaker To: arch-projects@archlinux.org Date: Tue, 13 Mar 2018 21:52:02 -0400 Message-Id: <20180314015205.20781-6-lukeshu@lukeshu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180314015205.20781-1-lukeshu@lukeshu.com> References: <20180314015205.20781-1-lukeshu@lukeshu.com> Subject: [arch-projects] [dbscripts] [PATCH 5/8] Add "#!/hint/bash" to the beginning of several files. X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux projects development discussion Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" From: Luke Shumaker It is a method of notifying text-editors that a file is in Bash syntax without giving it a propper shebang (which would be confusing, as it would suggest that the file should be executable), as well as working across virtually all text-editors (unlike "-*- Mode: Bash -*-" or whatever). --- config | 2 ++ config.local.svn-community | 2 ++ config.local.svn-packages | 2 ++ db-functions | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config b/config index 2f5dbc6..d703e7b 100644 --- a/config +++ b/config @@ -1,3 +1,5 @@ +#!/hint/bash + FTP_BASE="/srv/ftp" SVNREPO='' SVNUSER='' diff --git a/config.local.svn-community b/config.local.svn-community index 105ea66..5d61b5e 100644 --- a/config.local.svn-community +++ b/config.local.svn-community @@ -1,3 +1,5 @@ +#!/hint/bash + PKGREPOS=('community' 'community-testing' 'community-staging' 'multilib' 'multilib-testing' 'multilib-staging') PKGPOOL='pool/community' SRCPOOL='sources/community' diff --git a/config.local.svn-packages b/config.local.svn-packages index 958a483..34aab35 100644 --- a/config.local.svn-packages +++ b/config.local.svn-packages @@ -1,3 +1,5 @@ +#!/hint/bash + PKGREPOS=('core' 'extra' 'testing' 'staging' 'kde-unstable' 'gnome-unstable') PKGPOOL='pool/packages' SRCPOOL='sources/packages' diff --git a/db-functions b/db-functions index ee390ff..0ac5f2d 100644 --- a/db-functions +++ b/db-functions @@ -1,4 +1,4 @@ -#!/bin/bash +#!/hint/bash . /usr/share/makepkg/util.sh From patchwork Wed Mar 14 01:52:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Shumaker X-Patchwork-Id: 458 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 1992226EBCCA for ; Wed, 14 Mar 2018 01:53:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:53:02 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id DA865967281F7; Wed, 14 Mar 2018 01:52:55 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Wed, 14 Mar 2018 01:52:37 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 47F242E741; Wed, 14 Mar 2018 01:52:20 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=none Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id CA5692DD8F for ; Wed, 14 Mar 2018 01:52:18 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:18 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 944C696728122 for ; Wed, 14 Mar 2018 01:52:12 +0000 (UTC) Received: from mav.lukeshu.com (mav.lukeshu.com [IPv6:2001:19f0:5c00:8069:5400:ff:fe26:6a86]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:12 +0000 (UTC) Received: from build64-par (unknown [IPv6:2601:803:202:9275:da50:e6ff:fe00:4a5b]) by mav.lukeshu.com (Postfix) with ESMTPSA id 095AE80508 for ; Tue, 13 Mar 2018 21:52:08 -0400 (EDT) From: Luke Shumaker To: arch-projects@archlinux.org Date: Tue, 13 Mar 2018 21:52:03 -0400 Message-Id: <20180314015205.20781-7-lukeshu@lukeshu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180314015205.20781-1-lukeshu@lukeshu.com> References: <20180314015205.20781-1-lukeshu@lukeshu.com> Subject: [arch-projects] [dbscripts] [PATCH 6/8] Consistently use "$(dirname "$(readlink -e "$0")")" X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux projects development discussion Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" From: Luke Shumaker This does correct handling of - executing a program by symlink - any weird characters in the full path - I'm sure there's another case I thought about when I originally did this. --- cron-jobs/ftpdir-cleanup | 4 ++-- cron-jobs/integrity-check | 2 +- cron-jobs/update-web-db | 4 ++-- db-move | 4 ++-- db-remove | 4 ++-- db-repo-add | 4 ++-- db-repo-remove | 4 ++-- db-update | 4 ++-- testing2x | 6 +++--- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 62a2903..548b839 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname "$0")/../config" -. "$(dirname "$0")/../db-functions" +. "$(dirname "$(readlink -e "$0")")/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" clean_pkg() { local pkg diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index 17153c7..904dfc1 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -1,6 +1,6 @@ #!/bin/bash -dirname="$(dirname "$0")" +dirname="$(dirname "$(readlink -e "$0")")" . "${dirname}/../config" . "${dirname}/../db-functions" diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db index 87e8bb0..39ed765 100755 --- a/cron-jobs/update-web-db +++ b/cron-jobs/update-web-db @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname "$0")/../config" -. "$(dirname "$0")/../db-functions" +. "$(dirname "$(readlink -e "$0")")/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" # setup paths SPATH="/srv/http/archweb" diff --git a/db-move b/db-move index ab05d57..8308cb5 100755 --- a/db-move +++ b/db-move @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname "$0")/config" -. "$(dirname "$0")/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" if (( $# < 3 )); then msg "usage: %s ..." "${0##*/}" diff --git a/db-remove b/db-remove index bf19d6a..87f41bc 100755 --- a/db-remove +++ b/db-remove @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname "$0")/config" -. "$(dirname "$0")/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" if (( $# < 3 )); then msg "usage: %s ..." "${0##*/}" diff --git a/db-repo-add b/db-repo-add index 7e68221..3ee3528 100755 --- a/db-repo-add +++ b/db-repo-add @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname "$0")/config" -. "$(dirname "$0")/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" if (( $# < 3 )); then msg "usage: %s ..." "${0##*/}" diff --git a/db-repo-remove b/db-repo-remove index 87f01f8..a0b8c1c 100755 --- a/db-repo-remove +++ b/db-repo-remove @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname "$0")/config" -. "$(dirname "$0")/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" if (( $# < 3 )); then msg "usage: %s ..." "${0##*/}" diff --git a/db-update b/db-update index 2898b1c..c7018c7 100755 --- a/db-update +++ b/db-update @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname "$0")/config" -. "$(dirname "$0")/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" if (( $# >= 1 )); then warning "Calling %s with a specific repository is no longer supported" "${0##*/}" diff --git a/testing2x b/testing2x index 606c003..d2cc9fc 100755 --- a/testing2x +++ b/testing2x @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname "$0")/config" -. "$(dirname "$0")/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" if (( $# < 1 )); then msg "usage: %s ..." "${0##*/}" @@ -54,7 +54,7 @@ for repo in "${STABLE_REPOS[@]}"; do repo_unlock "${repo}" "${pkgarch}" done if [[ -n ${pkgs[${repo}]} ]]; then - "$(dirname "$0")/db-move" "${TESTING_REPO}" "${repo}" ${pkgs[${repo}]} + "$(dirname "$(readlink -e "$0")")/db-move" "${TESTING_REPO}" "${repo}" ${pkgs[${repo}]} fi done From patchwork Wed Mar 14 01:52:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Shumaker X-Patchwork-Id: 462 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 2453D26EBCE7 for ; Wed, 14 Mar 2018 01:53:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:53:11 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 597CD96728221; Wed, 14 Mar 2018 01:53:04 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Wed, 14 Mar 2018 01:52:40 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id CF5732E753; Wed, 14 Mar 2018 01:52:22 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=none Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id D0E912E74C for ; Wed, 14 Mar 2018 01:52:20 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:20 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id CFB4696728139 for ; Wed, 14 Mar 2018 01:52:14 +0000 (UTC) Received: from mav.lukeshu.com (mav.lukeshu.com [104.207.138.63]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:12 +0000 (UTC) Received: from build64-par (unknown [IPv6:2601:803:202:9275:da50:e6ff:fe00:4a5b]) by mav.lukeshu.com (Postfix) with ESMTPSA id 64EAA80509 for ; Tue, 13 Mar 2018 21:52:08 -0400 (EDT) From: Luke Shumaker To: arch-projects@archlinux.org Date: Tue, 13 Mar 2018 21:52:04 -0400 Message-Id: <20180314015205.20781-8-lukeshu@lukeshu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180314015205.20781-1-lukeshu@lukeshu.com> References: <20180314015205.20781-1-lukeshu@lukeshu.com> Subject: [arch-projects] [dbscripts] [PATCH 7/8] Normalize to tab indent. X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux projects development discussion Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" From: Luke Shumaker --- cron-jobs/check_archlinux/parse_pkgbuilds.sh | 10 +++++----- cron-jobs/devlist-mailer | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cron-jobs/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh index c01bcd6..c6d6944 100755 --- a/cron-jobs/check_archlinux/parse_pkgbuilds.sh +++ b/cron-jobs/check_archlinux/parse_pkgbuilds.sh @@ -118,11 +118,11 @@ source_pkgbuild() { } find_pkgbuilds() { - #Skip over some dirs - local d="${1##*/}" - if [ "$d" = "CVS" -o "$d" = ".svn" ]; then - return - fi + #Skip over some dirs + local d="${1##*/}" + if [ "$d" = "CVS" -o "$d" = ".svn" ]; then + return + fi if [ -f "$1/PKGBUILD" ]; then source_pkgbuild "$1" diff --git a/cron-jobs/devlist-mailer b/cron-jobs/devlist-mailer index 1c35115..1b59cb3 100755 --- a/cron-jobs/devlist-mailer +++ b/cron-jobs/devlist-mailer @@ -8,18 +8,18 @@ FROM="repomaint@archlinux.org" SUBJECT="Repository Maintenance $(date +"%d-%m-%Y")" if (( $# >= 1 )); then - SUBJECT="$1 $(date +"%d-%m-%Y")" + SUBJECT="$1 $(date +"%d-%m-%Y")" fi if (( $# >= 2 )); then - LIST="$2" + LIST="$2" fi stdin="$(cat)" #echo used to strip whitespace for checking for actual data if [[ -n "$(echo $stdin)" ]]; then -echo "Subject: $SUBJECT + echo "Subject: $SUBJECT To: $LIST From: $FROM From patchwork Wed Mar 14 01:52:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Shumaker X-Patchwork-Id: 459 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 7090426EBCCE for ; Wed, 14 Mar 2018 01:53:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED=-2.3 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:53:04 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 02CEC967281F9; Wed, 14 Mar 2018 01:52:57 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Wed, 14 Mar 2018 01:52:38 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 916352E749; Wed, 14 Mar 2018 01:52:20 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=none Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 45F672BBEA for ; Wed, 14 Mar 2018 01:52:19 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:19 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 0300896728124 for ; Wed, 14 Mar 2018 01:52:13 +0000 (UTC) Received: from mav.lukeshu.com (mav.lukeshu.com [104.207.138.63]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Wed, 14 Mar 2018 01:52:12 +0000 (UTC) Received: from build64-par (unknown [IPv6:2601:803:202:9275:da50:e6ff:fe00:4a5b]) by mav.lukeshu.com (Postfix) with ESMTPSA id BC6E18050A for ; Tue, 13 Mar 2018 21:52:08 -0400 (EDT) From: Luke Shumaker To: arch-projects@archlinux.org Date: Tue, 13 Mar 2018 21:52:05 -0400 Message-Id: <20180314015205.20781-9-lukeshu@lukeshu.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180314015205.20781-1-lukeshu@lukeshu.com> References: <20180314015205.20781-1-lukeshu@lukeshu.com> Subject: [arch-projects] [dbscripts] [PATCH 8/8] devlist-mailer: Make LIST and FROM configurable X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux projects development discussion Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" From: Luke Shumaker --- config | 5 +++++ cron-jobs/devlist-mailer | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config b/config index d703e7b..fd79b6e 100644 --- a/config +++ b/config @@ -35,6 +35,11 @@ PKGEXTS=".pkg.tar.@(gz|bz2|xz|lzo|lrz|Z)" # Allowed licenses: get sourceballs only for licenses in this array ALLOWED_LICENSES=('GPL' 'GPL1' 'GPL2' 'GPL3' 'LGPL' 'LGPL1' 'LGPL2' 'LGPL2.1' 'LGPL3') +# Where to send error emails, and who they are from +LIST="arch-dev-public@archlinux.org" +#LIST="aaronmgriffin@gmail.com" +FROM="repomaint@archlinux.org" + # Override default config with config.local LOCAL_CONFIG=${DBSCRIPTS_CONFIG:-"$(dirname "${BASH_SOURCE[0]}")/config.local"} [[ -f "${LOCAL_CONFIG}" ]] && . "${LOCAL_CONFIG}" diff --git a/cron-jobs/devlist-mailer b/cron-jobs/devlist-mailer index 1b59cb3..578d23e 100755 --- a/cron-jobs/devlist-mailer +++ b/cron-jobs/devlist-mailer @@ -2,9 +2,8 @@ #Dummy helper to send email to arch-dev # It does nothing if no output -LIST="arch-dev-public@archlinux.org" -#LIST="aaronmgriffin@gmail.com" -FROM="repomaint@archlinux.org" +# Load $LIST and $FROM from the config file +. "$(dirname "$(readlink -e "$0")")/../config" SUBJECT="Repository Maintenance $(date +"%d-%m-%Y")" if (( $# >= 1 )); then