From 439bd2112c01bc9b185d2552aa0888d7055929e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Fri, 18 Feb 2011 20:43:56 -0300 Subject: First stab at sourceballing everything --- cron-jobs/sourceballs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index b55de05..0df007e 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -63,10 +63,11 @@ for repo in ${PKGREPOS[@]}; do if grep -Fqx "${pkgbase}" "${dirname}/sourceballs.skip"; then continue fi + # Commenting out, we'll sourceball everything # Check if the license or .force file does not enforce creating a source package - if ! (chk_license ${pkglicense[@]} || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then - continue - fi +# if ! (chk_license ${pkglicense[@]} || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then +# continue +# fi # Store the expected file name of the source package echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/expected-src-pkgs" @@ -79,8 +80,10 @@ for repo in ${PKGREPOS[@]}; do # Get the sources from svn mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}" - svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}" \ - "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1 + #svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}" \ + # "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1 + cp -r "${SVNREPO}/libre/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \ + cp -r "${SVNREPO}/libre-testing/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 if [ $? -ge 1 ]; then failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" continue -- cgit v1.2.3-2-g168b From f8c49cc2915f66b53bd9dd248b41ab6a96c1059a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sun, 20 Feb 2011 22:09:28 -0300 Subject: Changes to sourceball everything --- cron-jobs/sourceballs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 0df007e..5726484 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -21,10 +21,10 @@ renice +10 -p $$ > /dev/null 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 + if [ ! -f "${ARCH_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then continue fi - bsdtar -xOf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \ + bsdtar -xOf "${ARCH_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \ | awk '/^%NAME%/ { getline b }; /^%BASE%/ { getline b }; /^%VERSION%/ { getline v }; @@ -46,7 +46,7 @@ for repo in ${PKGREPOS[@]}; do done # Create a list of all available source package file names -find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" +find "${ARCH_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" # Check for all packages if we need to build a source package for repo in ${PKGREPOS[@]}; do @@ -59,7 +59,7 @@ for repo in ${PKGREPOS[@]}; do pkgarch=${pkginfo[2]} pkglicense=(${pkginfo[@]:3}) - # Should this package be skipped? + # Should this packages be skipped? if grep -Fqx "${pkgbase}" "${dirname}/sourceballs.skip"; then continue fi @@ -82,6 +82,9 @@ for repo in ${PKGREPOS[@]}; do mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}" #svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}" \ # "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1 + + # If it's on official repos, nor [libre], nor [libre-testing] + cp -r "${SVNREPO}/$repo/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \ cp -r "${SVNREPO}/libre/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \ cp -r "${SVNREPO}/libre-testing/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 if [ $? -ge 1 ]; then @@ -93,7 +96,7 @@ for repo in ${PKGREPOS[@]}; do pushd "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null makepkg --nocolor --allsource --ignorearch >/dev/null 2>&1 if [ $? -eq 0 ] && [ -f "${pkgbase}-${pkgver}${SRCEXT}" ]; then - mv "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}" + mv "${pkgbase}-${pkgver}${SRCEXT}" "${ARCH_BASE}/${SRCPOOL}" # Avoid creating the same source package for every arch echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" @@ -129,7 +132,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then for old_pkg in ${old_pkgs[@]}; do msg2 "${old_pkg}" if ! ${SOURCE_CLEANUP_DRYRUN}; then - mv "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" + mv "$ARCH_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" fi done -- cgit v1.2.3-2-g168b From c6516eca2803b780a01a6b2bf3e081c8bd570301 Mon Sep 17 00:00:00 2001 From: Parabola Date: Sun, 20 Feb 2011 17:10:40 -0800 Subject: sourceballs --- cron-jobs/sourceballs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 0df007e..53d43ce 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -21,10 +21,10 @@ renice +10 -p $$ > /dev/null 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 + if [ ! -f "${ARCH_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then continue fi - bsdtar -xOf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \ + bsdtar -xOf "${ARCH_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \ | awk '/^%NAME%/ { getline b }; /^%BASE%/ { getline b }; /^%VERSION%/ { getline v }; @@ -46,7 +46,7 @@ for repo in ${PKGREPOS[@]}; do done # Create a list of all available source package file names -find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" +find "${ARCH_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" # Check for all packages if we need to build a source package for repo in ${PKGREPOS[@]}; do @@ -91,9 +91,9 @@ for repo in ${PKGREPOS[@]}; do # Build the actual source package pushd "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null - makepkg --nocolor --allsource --ignorearch >/dev/null 2>&1 + makepkg --nocolor --allsource --ignorearch # >/dev/null 2>&1 if [ $? -eq 0 ] && [ -f "${pkgbase}-${pkgver}${SRCEXT}" ]; then - mv "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}" + mv "${pkgbase}-${pkgver}${SRCEXT}" "${ARCH_BASE}/${SRCPOOL}" # Avoid creating the same source package for every arch echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" @@ -129,7 +129,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then for old_pkg in ${old_pkgs[@]}; do msg2 "${old_pkg}" if ! ${SOURCE_CLEANUP_DRYRUN}; then - mv "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" + mv "$ARCH_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" fi done -- cgit v1.2.3-2-g168b From cf2baeb05af80a849bfc2192f3af1e741e50745d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sat, 5 Mar 2011 01:25:40 -0300 Subject: sourceballs2 creates sourceballs from the entire ABSLibre --- cron-jobs/sourceballs2 | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 cron-jobs/sourceballs2 (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 new file mode 100644 index 0000000..ba35298 --- /dev/null +++ b/cron-jobs/sourceballs2 @@ -0,0 +1,81 @@ +#!/bin/bash +# Steps +# Traverse ABSLibre +# Makepkg --allsource every package +# Remove the old sourceballs + +dirname="$(dirname $(readlink -e $0))" +. "${dirname}/../db-functions" +. "${dirname}/../config" +. "${MAKEPKGCONF}" + +pushd "${WORKDIR}" >/dev/null + +script_lock + +#adjust the nice level to run at a lower priority +renice +10 -p $$ > /dev/null + +# Create a list of all available source package file names +find "${ARCH_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" + +pushd "${SVNREPO}" >/dev/null + +failedpkgs=() +for repo in ${PKGREPOS[@]}; do + pushd $repo >/dev/null + find . -maxdepth 1 -type d | while read pkg; do + pushd "${SVNREPO}/$repo/$pkg" >/dev/null + + [[ ! -e PKGBUILD ]] && { + warning "$repo/$pkg is not a package" + continue + } + + unset pkgbase pkgname + source PKGBUILD + pkgbase=${pkgbase:-$pkgname} + + echo "${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" >> "${WORKDIR}/expected-src-pkgs" + + # Skip already sourceballed + [[ -e "${SRCPKGDEST}/${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" ]] && \ + continue + + makepkg --allsource --ignorearch -c + + [[ $? -ne 0 ]] && \ + failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" + + done + popd >/dev/null +done + +# Cleanup old source packages +cat "${WORKDIR}/expected-src-pkgs" | sort -u > "${WORKDIR}/expected-src-pkgs.sort" +cat "${WORKDIR}/available-src-pkgs" | sort -u > "${WORKDIR}/available-src-pkgs.sort" +old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-src-pkgs.sort")) + +if [ ${#old_pkgs[@]} -ge 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}" + if ! ${SOURCE_CLEANUP_DRYRUN}; then + mv "$ARCH_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" + touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" + fi + done +fi + +old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n')) +if [ ${#old_pkgs[@]} -ge 1 ]; then + msg "Removing old source packages from the cleanup directory..." + for old_pkg in ${old_pkgs[@]}; do + msg2 "${old_pkg}" + ${SOURCE_CLEANUP_DRYRUN} || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" + done +fi + +script_unlock + -- cgit v1.2.3-2-g168b From 229a9c504cbd733c93cf91399dc54bedf5160cc5 Mon Sep 17 00:00:00 2001 From: Parabola Date: Sun, 6 Mar 2011 15:22:21 -0800 Subject: Fixes --- cron-jobs/sourceballs2 | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 cron-jobs/sourceballs2 (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 new file mode 100755 index 0000000..452208e --- /dev/null +++ b/cron-jobs/sourceballs2 @@ -0,0 +1,87 @@ +#!/bin/bash + +dirname="$(dirname $(readlink -e $0))" +. "${dirname}/../db-functions" +. "${dirname}/../config" +. "${MAKEPKGCONF}" + +pushd "${WORKDIR}" >/dev/null + +script_lock + +#adjust the nice level to run at a lower priority +renice +10 -p $$ > /dev/null + +# Create a list of all available source package file names +find "${ARCH_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" + +# Steps +# Traverse the ABSLibre +# Makepkg --allsource every package +# Remove the old packages +pushd "${SVNREPO}" >/dev/null + +failedpkgs=() +for repo in ${PKGREPOS[@]}; do + pushd $repo >/dev/null + find . -maxdepth 1 -type d | while read pkg; do + pushd "${SVNREPO}/$repo/$pkg" >/dev/null + + [[ ! -e PKGBUILD ]] && { + warning "$repo/$pkg is not a package" + continue + } + + unset pkgbase pkgname + source PKGBUILD + pkgbase=${pkgbase:-$pkgname} + + echo "${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" >> "${WORKDIR}/expected-src-pkgs" + + # Skip already sourceballed + [[ -e "${SRCPKGDEST}/${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" ]] && \ + continue + + makepkg --allsource --ignorearch -c >/dev/null 2>&1 + + [[ $? -ne 0 ]] && \ + failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" + + done + popd >/dev/null +done + +# Cleanup old source packages +cat "${WORKDIR}/expected-src-pkgs" | sort -u > "${WORKDIR}/expected-src-pkgs.sort" +cat "${WORKDIR}/available-src-pkgs" | sort -u > "${WORKDIR}/available-src-pkgs.sort" +old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-src-pkgs.sort")) + +if [ ${#old_pkgs[@]} -ge 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}" + if ! ${SOURCE_CLEANUP_DRYRUN}; then + mv "$ARCH_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" + touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" + fi + done +fi + +old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n')) +if [ ${#old_pkgs[@]} -ge 1 ]; then + msg "Removing old source packages from the cleanup directory..." + for old_pkg in ${old_pkgs[@]}; do + msg2 "${old_pkg}" + ${SOURCE_CLEANUP_DRYRUN} || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" + done +fi + +msg "Failed" +for _fail in ${failedpkgs[@]}; do + msg2 "$_fail" +done + + +script_unlock + -- cgit v1.2.3-2-g168b From 6ce3ddee58415e052ec578e777994a60c7e4c3a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sun, 17 Apr 2011 03:11:36 -0300 Subject: sourceballs2 --- cron-jobs/sourceballs2 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index ba35298..b70f417 100644 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -21,8 +21,9 @@ find "${ARCH_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort pushd "${SVNREPO}" >/dev/null -failedpkgs=() for repo in ${PKGREPOS[@]}; do + failedpkgs=() + pushd $repo >/dev/null find . -maxdepth 1 -type d | while read pkg; do pushd "${SVNREPO}/$repo/$pkg" >/dev/null @@ -42,13 +43,23 @@ for repo in ${PKGREPOS[@]}; do [[ -e "${SRCPKGDEST}/${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" ]] && \ continue + msg2 "$pkgbase-$pkgver-$pkgrel..." makepkg --allsource --ignorearch -c - [[ $? -ne 0 ]] && \ + [[ $? -ne 0 ]] && { + warning "Failed." failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" + } done popd >/dev/null + + if [ ${#failedpkgs[@]} -ge 1 ]; then + msg "Failed to create source packages for [${repo}]..." + for failed_pkg in ${failedpkgs[@]}; do + msg2 "${failed_pkg}" + done + fi done # Cleanup old source packages -- cgit v1.2.3-2-g168b From 91210f8ae18f5651ace2273cfa0c8ad7e4dbcbdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sat, 16 Jul 2011 03:35:37 -0300 Subject: Syncs ABSLibre tarballs between ABSLibre host and repo server --- cron-jobs/update-abs-tarballs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 cron-jobs/update-abs-tarballs (limited to 'cron-jobs') diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs new file mode 100644 index 0000000..9990f20 --- /dev/null +++ b/cron-jobs/update-abs-tarballs @@ -0,0 +1,7 @@ +#!/bin/bash + +. "$(dirname $0)/../config" + +rsync -av parabolagnulinux.org::abstar/ ${FTP_BASE}/ + +exit $? -- cgit v1.2.3-2-g168b From c1858e5d04ebe2b8c2c45ff71dc8bcfb05b49dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Tue, 9 Aug 2011 21:46:24 -0300 Subject: update-abs-tarballs +x --- cron-jobs/update-abs-tarballs | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 cron-jobs/update-abs-tarballs (limited to 'cron-jobs') diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs old mode 100644 new mode 100755 -- cgit v1.2.3-2-g168b From 67c5e5b37efa306c92644922fad65adbb127a4bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Tue, 9 Aug 2011 21:49:27 -0300 Subject: Ignore staging --- cron-jobs/update-abs-tarballs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs index 9990f20..824ac34 100755 --- a/cron-jobs/update-abs-tarballs +++ b/cron-jobs/update-abs-tarballs @@ -2,6 +2,6 @@ . "$(dirname $0)/../config" -rsync -av parabolagnulinux.org::abstar/ ${FTP_BASE}/ +rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ ${FTP_BASE}/ exit $? -- cgit v1.2.3-2-g168b From 986fbe51101674c290df8f5c9d0dc3f507c172e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Thu, 11 Aug 2011 20:45:29 -0300 Subject: Script to solve issue165 --- cron-jobs/repo-sanity-check | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 cron-jobs/repo-sanity-check (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check new file mode 100644 index 0000000..a6249b5 --- /dev/null +++ b/cron-jobs/repo-sanity-check @@ -0,0 +1,46 @@ +#!/bin/bash +# Solves issue165 + +. "$(dirname $0)/../db-functions" +. "$(dirname $0)/../config" + +# Traverse all repos +for _repo in ${REPOS[@]}; do + +# Find all pkgnames on this repo's abs + on_abs=($( + find ${SVNREPO}/${_repo} -name PKGBUILD | \ + while read pkgbuild; do + source ${pkgbuild} >/dev/null 2>&1 +# cleanup to save memory + unset build package source md5sums pkgdesc pkgver pkgrel epoch \ + url license arch depends makedepends optdepends options \ + >/dev/null 2>&1 + +# also cleanup package functions + for _pkg in ${pkgname[@]}; do + unset package_${pkg} >/dev/null 2>&1 + done + +# this fills the on_abs array + echo ${pkgname[@]} + done + )) + +# Find all pkgnames on repos + on_repo=($( + find ${FTP_BASE}/${_repo} -name "*.pkg.tar.?z" -printf "%f\n" | \ + sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" + )) + +# Compares them, whatever is on repos but not on abs should be removed + remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort) \ + <(echo ${on_repo[@]} | tr ' ' "\n" | sort))) + +# Remove them from databases, ftpdir-cleanup will take care of the rest + find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -print0 | \ + xargs -0 repo-remove {} ${remove[@]} + +done + +exit $? -- cgit v1.2.3-2-g168b From d1de884ad56e0756a80d5c00bb723e7f2a56491b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Thu, 11 Aug 2011 21:37:21 -0300 Subject: Changed xargs for find -exec --- cron-jobs/repo-sanity-check | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index a6249b5..52ca33b 100644 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -38,8 +38,8 @@ for _repo in ${REPOS[@]}; do <(echo ${on_repo[@]} | tr ' ' "\n" | sort))) # Remove them from databases, ftpdir-cleanup will take care of the rest - find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -print0 | \ - xargs -0 repo-remove {} ${remove[@]} + find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ + repo-remove {} ${remove[@]} \; done -- cgit v1.2.3-2-g168b From 1d7db341d4f27f8ebd7167a8630ea8589e40c464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Thu, 11 Aug 2011 21:39:05 -0300 Subject: Forgot +x --- cron-jobs/repo-sanity-check | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 cron-jobs/repo-sanity-check (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check old mode 100644 new mode 100755 -- cgit v1.2.3-2-g168b From d2f65c340f890050c99371e203288afea03d125b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Thu, 11 Aug 2011 22:42:01 -0300 Subject: Sort unique pkgnames --- cron-jobs/repo-sanity-check | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 52ca33b..690a9f8 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -34,8 +34,8 @@ for _repo in ${REPOS[@]}; do )) # Compares them, whatever is on repos but not on abs should be removed - remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort) \ - <(echo ${on_repo[@]} | tr ' ' "\n" | sort))) + remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \ + <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u))) # Remove them from databases, ftpdir-cleanup will take care of the rest find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ -- cgit v1.2.3-2-g168b From 7d6595c750903114740c7ab726cd89cb73d6c3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Fri, 12 Aug 2011 02:37:50 -0300 Subject: Fixed unexistent REPOS array and skip removal when the ABS tree is empty. --- cron-jobs/repo-sanity-check | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 690a9f8..92b26ae 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -5,7 +5,7 @@ . "$(dirname $0)/../config" # Traverse all repos -for _repo in ${REPOS[@]}; do +for _repo in ${PKGREPOS[@]}; do # Find all pkgnames on this repo's abs on_abs=($( @@ -27,6 +27,12 @@ for _repo in ${REPOS[@]}; do done )) +# quit if abs is empty + if [ ${#on_abs[*]} -eq 0 ]; then + warning "[${_repo}]'s ABS tree is empty, skipping" + break + fi + # Find all pkgnames on repos on_repo=($( find ${FTP_BASE}/${_repo} -name "*.pkg.tar.?z" -printf "%f\n" | \ -- cgit v1.2.3-2-g168b From a032c1fad3e2d57a7a1b7cef65d90ea06a766784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sat, 13 Aug 2011 12:42:42 -0300 Subject: Cleaner sourceballs2 --- cron-jobs/sourceballs2 | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index b29b396..a43d71e 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -33,24 +33,28 @@ for repo in ${PKGREPOS[@]}; do continue } - unset pkgbase pkgname +# Unset the previous data + unset pkgbase pkgname pkgver pkgrel source PKGBUILD + + unset build package url pkgdesc source md5sums depends makedepends \ + optdepends license arch options check mksource + + for _pkg in ${pkgname[@]}; do + unset package_${_pkg} >/dev/null 2>&1 + done + pkgbase=${pkgbase:-$pkgname} + srcfile="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" - echo "${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" >> "${WORKDIR}/expected-src-pkgs" + echo "${srcfile}" >> "${WORKDIR}/expected-src-pkgs" # Skip already sourceballed - [[ -e "${SRCPKGDEST}/${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" ]] && \ - continue + [ -e "${SRCPKGDEST}/${srcfile}" ] && continue - msg2 "$pkgbase-$pkgver-$pkgrel..." - makepkg --allsource --ignorearch -c makepkg --allsource --ignorearch -c >/dev/null 2>&1 - [[ $? -ne 0 ]] && { - warning "Failed." - failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" - } + [ $? -ne 0 ] && failedpkgs+=("${srcfile}") done popd >/dev/null @@ -89,10 +93,5 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then done fi -msg "Failed" -for _fail in ${failedpkgs[@]}; do - msg2 "$_fail" -done - script_unlock -- cgit v1.2.3-2-g168b From f23d7103fec259ebe2ba796ae7f351dfbda5b705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sat, 13 Aug 2011 12:51:32 -0300 Subject: Added useful messages --- cron-jobs/repo-sanity-check | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 92b26ae..1ba90a6 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -6,6 +6,7 @@ # Traverse all repos for _repo in ${PKGREPOS[@]}; do + msg "Cleaning up [${_repo}]" # Find all pkgnames on this repo's abs on_abs=($( @@ -45,7 +46,10 @@ for _repo in ${PKGREPOS[@]}; do # Remove them from databases, ftpdir-cleanup will take care of the rest find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ - repo-remove {} ${remove[@]} \; + repo-remove {} ${remove[@]} >/dev/null 2>&1 \; + + msg2 "Removed the following packages:" + plain "$(echo ${remove[@]} | tr ' ' "\n")" done -- cgit v1.2.3-2-g168b From eac9e4d43cc33bf6671fdbd7f04e5bab387259d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sat, 13 Aug 2011 13:15:35 -0300 Subject: Failedpkgs array wasn't working --- cron-jobs/sourceballs2 | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index a43d71e..5e228fc 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -22,10 +22,10 @@ find "${ARCH_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort pushd "${SVNREPO}" >/dev/null for repo in ${PKGREPOS[@]}; do - failedpkgs=() + msg "Sourceballing [${repo}]" pushd $repo >/dev/null - find . -maxdepth 1 -type d | while read pkg; do + find -maxdepth 1 -type d | while read pkg; do pushd "${SVNREPO}/$repo/$pkg" >/dev/null [[ ! -e PKGBUILD ]] && { @@ -54,18 +54,12 @@ for repo in ${PKGREPOS[@]}; do makepkg --allsource --ignorearch -c >/dev/null 2>&1 - [ $? -ne 0 ] && failedpkgs+=("${srcfile}") + [ $? -ne 0 ] && plain ${srcfile} - done + done # end find pkgs popd >/dev/null - if [ ${#failedpkgs[@]} -ge 1 ]; then - msg "Failed to create source packages for [${repo}]..." - for failed_pkg in ${failedpkgs[@]}; do - msg2 "${failed_pkg}" - done - fi -done +done # end repos # Cleanup old source packages cat "${WORKDIR}/expected-src-pkgs" | sort -u > "${WORKDIR}/expected-src-pkgs.sort" -- cgit v1.2.3-2-g168b From 59105fccf9f5866b451cdaf90052aa8c9346e5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Reynolds?= Date: Sun, 8 Jan 2012 15:17:46 -0300 Subject: remove locks --- cron-jobs/ftpdir-cleanup | 7 ------- 1 file changed, 7 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index bb1661a..83e6e17 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -22,13 +22,6 @@ clean_pkg() { fi } -script_lock - -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' -- cgit v1.2.3-2-g168b From 33b8cb611363102e23972cf3914a03d65cb3cad8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 17 Jun 2013 23:59:15 -0600 Subject: use xbs, not svn --- cron-jobs/sourceballs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 6f75ccc..9572a30 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -77,9 +77,9 @@ for repo in ${PKGREPOS[@]}; do continue fi - # Get the sources from svn + # Get the sources from xbs mkdir -p -m0770 "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}" - arch_svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}" \ + cp -a "$(xbs releasepath "${pkgbase}" "${repo}" "${pkgarch}")" \ "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1 if [ $? -ge 1 ]; then failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" -- cgit v1.2.3-2-g168b From 761b56dcffedc6e484d38c74267810e491add951 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 16 Jun 2013 22:06:51 -0600 Subject: touch up --- cron-jobs/sourceballs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 9572a30..cd70916 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -95,7 +95,7 @@ for repo in ${PKGREPOS[@]}; do echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" else - failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" + failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") cat "${WORKDIR}/${pkgbase}.log" >> "${WORKDIR}/makepkg-fail.log" fi popd >/dev/null -- cgit v1.2.3-2-g168b From d744cae51bf5ea3e8c01d70ddbec564ad66b036c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 18 Jun 2013 00:06:38 -0600 Subject: use /etc/makepkg.conf for sourceballs --- cron-jobs/makepkg.conf | 121 ------------------------------------------------- cron-jobs/sourceballs | 2 +- 2 files changed, 1 insertion(+), 122 deletions(-) delete mode 100644 cron-jobs/makepkg.conf (limited to 'cron-jobs') diff --git a/cron-jobs/makepkg.conf b/cron-jobs/makepkg.conf deleted file mode 100644 index 603edba..0000000 --- a/cron-jobs/makepkg.conf +++ /dev/null @@ -1,121 +0,0 @@ -# -# /etc/makepkg.conf -# - -######################################################################### -# SOURCE ACQUISITION -######################################################################### -# -#-- The download utilities that makepkg should use to acquire sources -# Format: 'protocol::agent' -DLAGENTS=('ftp::/usr/bin/curl -sS -fC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u' - 'http::/usr/bin/curl -sS -fLC - --retry 3 --retry-delay 3 -o %o %u' - 'https::/usr/bin/curl -sS -fLC - --retry 3 --retry-delay 3 -o %o %u' - 'rsync::/usr/bin/rsync -q --no-motd -z %u %o' - 'scp::/usr/bin/scp -q -C %u %o') - -# Other common tools: -# /usr/bin/snarf -# /usr/bin/lftpget -c -# /usr/bin/wget - -######################################################################### -# ARCHITECTURE, COMPILE FLAGS -######################################################################### -# -CARCH="x86_64" -CHOST="x86_64-unknown-linux-gnu" - -#-- Compiler and Linker Flags -# -march (or -mcpu) builds exclusively for an architecture -# -mtune optimizes for an architecture, but builds for whole processor family -CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2" -CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2" -LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu" -#-- Make Flags: change this for DistCC/SMP systems -#MAKEFLAGS="-j2" - -######################################################################### -# BUILD ENVIRONMENT -######################################################################### -# -# Defaults: BUILDENV=(fakeroot !distcc color !ccache check !sign) -# A negated environment option will do the opposite of the comments below. -# -#-- fakeroot: Allow building packages as a non-root user -#-- distcc: Use the Distributed C/C++/ObjC compiler -#-- color: Colorize output messages -#-- ccache: Use ccache to cache compilation -#-- check: Run the check() function if present in the PKGBUILD -#-- sign: Generate PGP signature file -# -BUILDENV=(fakeroot !distcc color !ccache check !sign) -# -#-- If using DistCC, your MAKEFLAGS will also need modification. In addition, -#-- specify a space-delimited list of hosts running in the DistCC cluster. -#DISTCC_HOSTS="" -# -#-- Specify a directory for package building. -#BUILDDIR=/tmp/makepkg - -######################################################################### -# GLOBAL PACKAGE OPTIONS -# These are default values for the options=() settings -######################################################################### -# -# Default: OPTIONS=(strip docs libtool emptydirs zipman purge !upx) -# A negated option will do the opposite of the comments below. -# -#-- strip: Strip symbols from binaries/libraries -#-- docs: Save doc directories specified by DOC_DIRS -#-- libtool: Leave libtool (.la) files in packages -#-- emptydirs: Leave empty directories in packages -#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip -#-- purge: Remove files specified by PURGE_TARGETS -#-- upx: Compress binary executable files using UPX -# -OPTIONS=(strip docs libtool emptydirs zipman purge !upx) - -#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 -INTEGRITY_CHECK=(md5) -#-- Options to be used when stripping binaries. See `man strip' for details. -STRIP_BINARIES="--strip-all" -#-- Options to be used when stripping shared libraries. See `man strip' for details. -STRIP_SHARED="--strip-unneeded" -#-- Options to be used when stripping static libraries. See `man strip' for details. -STRIP_STATIC="--strip-debug" -#-- Manual (man and info) directories to compress (if zipman is specified) -MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info}) -#-- Doc directories to remove (if !docs is specified) -DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc}) -#-- Files to be removed from all packages (if purge is specified) -PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod) - -######################################################################### -# PACKAGE OUTPUT -######################################################################### -# -# Default: put built package and cached source in build directory -# -#-- Destination: specify a fixed directory where all packages will be placed -#PKGDEST=/home/packages -#-- Source cache: specify a fixed directory where source files will be cached -#SRCDEST=/home/sources -#-- Source packages: specify a fixed directory where all src packages will be placed -#SRCPKGDEST=/home/srcpackages -#-- Packager: name/email of the person or organization building packages -#PACKAGER="John Doe " -#-- Specify a key to use for package signing -#GPGKEY="" - -######################################################################### -# EXTENSION DEFAULTS -######################################################################### -# -# WARNING: Do NOT modify these variables unless you know what you are -# doing. -# -PKGEXT='.pkg.tar.xz' -SRCEXT='.src.tar.gz' - -# vim: set ft=sh ts=2 sw=2 et: diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index cd70916..34de2a6 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -88,7 +88,7 @@ for repo in ${PKGREPOS[@]}; do # Build the actual source package pushd "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null - makepkg --nocolor --allsource --ignorearch --skippgpcheck --config "${dirname}/makepkg.conf" >"${WORKDIR}/${pkgbase}.log" 2>&1 + SRCPKGDEST=. makepkg --nocolor --allsource --ignorearch --skippgpcheck >"${WORKDIR}/${pkgbase}.log" 2>&1 if [ $? -eq 0 ] && [ -f "${pkgbase}-${pkgver}${SRCEXT}" ]; then mv "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}" # Avoid creating the same source package for every arch -- cgit v1.2.3-2-g168b From 3e085d0d529a749386f826ecb2dd189df55b4833 Mon Sep 17 00:00:00 2001 From: Icarious Date: Mon, 26 Aug 2013 05:26:11 +0530 Subject: removed unnecessary code --- cron-jobs/sourceballs2 | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 5e228fc..5644268 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -60,32 +60,3 @@ for repo in ${PKGREPOS[@]}; do popd >/dev/null done # end repos - -# Cleanup old source packages -cat "${WORKDIR}/expected-src-pkgs" | sort -u > "${WORKDIR}/expected-src-pkgs.sort" -cat "${WORKDIR}/available-src-pkgs" | sort -u > "${WORKDIR}/available-src-pkgs.sort" -old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-src-pkgs.sort")) - -if [ ${#old_pkgs[@]} -ge 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}" - if ! ${SOURCE_CLEANUP_DRYRUN}; then - mv "$ARCH_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" - touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" - fi - done -fi - -old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n')) -if [ ${#old_pkgs[@]} -ge 1 ]; then - msg "Removing old source packages from the cleanup directory..." - for old_pkg in ${old_pkgs[@]}; do - msg2 "${old_pkg}" - ${SOURCE_CLEANUP_DRYRUN} || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" - done -fi - -script_unlock - -- cgit v1.2.3-2-g168b From fbce7db101feaba0d69bf185b54270c1aa6d65ab Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Tue, 19 Mar 2013 19:53:38 +0100 Subject: sourceballs: fix ACL issues on nymeria ACLs from the WORKDIR were used, leading to problems as these weren't world-readable. Fix follows ftpdir-cleanup. Signed-off-by: Jan Alexander Steffens (heftig) Signed-off-by: Pierre Schmitz --- cron-jobs/ftpdir-cleanup | 9 --------- cron-jobs/sourceballs | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index e1294bd..8f5cb3c 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -3,15 +3,6 @@ . "$(dirname $0)/../config" . "$(dirname $0)/../db-functions" -# just like mv -f, but we touch the file and then copy the content so -# default ACLs in the target dir will be applied -mv_acl() { - rm -f "$2" - touch "$2" - cat "$1" >"$2" || return 1 - rm -f "$1" -} - clean_pkg() { local pkg local target diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 6f75ccc..be66e99 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -90,7 +90,7 @@ for repo in ${PKGREPOS[@]}; do pushd "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null makepkg --nocolor --allsource --ignorearch --skippgpcheck --config "${dirname}/makepkg.conf" >"${WORKDIR}/${pkgbase}.log" 2>&1 if [ $? -eq 0 ] && [ -f "${pkgbase}-${pkgver}${SRCEXT}" ]; then - mv "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}" + mv_acl "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}/${pkgbase}-${pkgver}${SRCEXT}" # Avoid creating the same source package for every arch echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" @@ -127,7 +127,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then for old_pkg in ${old_pkgs[@]}; do msg2 "${old_pkg}" if ! ${SOURCE_CLEANUP_DRYRUN}; then - mv "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" + mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" fi done -- cgit v1.2.3-2-g168b From e6294556d3197b7d87f7659355d0e189fad613d6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 8 Dec 2013 17:33:25 -0500 Subject: `readlink -e` all "$0"s --- cron-jobs/ftpdir-cleanup | 4 ++-- cron-jobs/sourceballs | 2 +- cron-jobs/update-web-db | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 8f5cb3c..e42a1a8 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/sourceballs b/cron-jobs/sourceballs index 103898d..2362024 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -1,6 +1,6 @@ #!/bin/bash -dirname="$(dirname $(readlink -e $0))" +dirname="$(dirname "$(readlink -e "$0")")" . "${dirname}/../config" . "${dirname}/../db-functions" pushd "${WORKDIR}" >/dev/null diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db index 195d1fc..713e75e 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" -- cgit v1.2.3-2-g168b From f65c477e42f46a3e22b5fbc5da790f9561483770 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 Dec 2013 14:50:37 -0500 Subject: clean up --- cron-jobs/ftpdir-cleanup | 7 +++++++ cron-jobs/sourceballs | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index a2823d4..e42a1a8 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -22,6 +22,13 @@ clean_pkg() { fi } +script_lock + +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' diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 91bc3d6..1542499 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -21,10 +21,10 @@ renice +10 -p $$ > /dev/null for repo in ${PKGREPOS[@]}; do for arch in ${ARCHES[@]}; do # Repo does not exist; skip it - if [ ! -f "${ARCH_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then + if [ ! -f "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then continue fi - bsdtar -xOf "${ARCH_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \ + bsdtar -xOf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \ | awk '/^%NAME%/ { getline b }; /^%BASE%/ { getline b }; /^%VERSION%/ { getline v }; @@ -46,7 +46,7 @@ for repo in ${PKGREPOS[@]}; do done # Create a list of all available source package file names -find "${ARCH_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" +find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" # Check for all packages if we need to build a source package for repo in ${PKGREPOS[@]}; do @@ -59,7 +59,7 @@ for repo in ${PKGREPOS[@]}; do pkgarch=${pkginfo[2]} pkglicense=(${pkginfo[@]:3}) - # Should this packages be skipped? + # Should this package be skipped? if grep -Fqx "${pkgbase}" "${dirname}/sourceballs.skip"; then continue fi -- cgit v1.2.3-2-g168b From e210b136790f740a6eb42913b30f6d0c8557c81d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 Dec 2013 14:53:28 -0500 Subject: get rid of $ARCH_BASE --- cron-jobs/sourceballs2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 5644268..5b14d07 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -17,7 +17,7 @@ script_lock renice +10 -p $$ > /dev/null # Create a list of all available source package file names -find "${ARCH_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" +find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" pushd "${SVNREPO}" >/dev/null -- cgit v1.2.3-2-g168b From 6a093f1dc6bd5398115544dd229b520f9432e122 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 Dec 2013 15:49:06 -0500 Subject: use `readlink -e` on $0 --- cron-jobs/integrity-check | 2 +- cron-jobs/repo-sanity-check | 4 ++-- cron-jobs/sourceballs2 | 2 +- cron-jobs/update-abs-tarballs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index f6c26cf..86a8f1d 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/repo-sanity-check b/cron-jobs/repo-sanity-check index 1ba90a6..2aa7892 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -1,8 +1,8 @@ #!/bin/bash # Solves issue165 -. "$(dirname $0)/../db-functions" -. "$(dirname $0)/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" +. "$(dirname "$(readlink -e "$0")")/../config" # Traverse all repos for _repo in ${PKGREPOS[@]}; do diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 5b14d07..bbe227d 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -4,7 +4,7 @@ # Makepkg --allsource every package # Remove the old sourceballs -dirname="$(dirname $(readlink -e $0))" +dirname="$(dirname "$(readlink -e "$0")")" . "${dirname}/../db-functions" . "${dirname}/../config" . "${MAKEPKGCONF}" diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs index 824ac34..901cc4b 100755 --- a/cron-jobs/update-abs-tarballs +++ b/cron-jobs/update-abs-tarballs @@ -1,6 +1,6 @@ #!/bin/bash -. "$(dirname $0)/../config" +. "$(dirname "$(readlink -e "$0")")/../config" rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ ${FTP_BASE}/ -- cgit v1.2.3-2-g168b From e7d2dcac7cf857fdccd82bec2bfc2a7d8e6b85c6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 16:53:56 -0500 Subject: Normalize to load ./config before loading ./db-functions --- cron-jobs/repo-sanity-check | 2 +- cron-jobs/sourceballs2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 2aa7892..ee4c061 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -1,8 +1,8 @@ #!/bin/bash # Solves issue165 -. "$(dirname "$(readlink -e "$0")")/../db-functions" . "$(dirname "$(readlink -e "$0")")/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" # Traverse all repos for _repo in ${PKGREPOS[@]}; do diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index bbe227d..1432bdf 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -5,8 +5,8 @@ # Remove the old sourceballs dirname="$(dirname "$(readlink -e "$0")")" -. "${dirname}/../db-functions" . "${dirname}/../config" +. "${dirname}/../db-functions" . "${MAKEPKGCONF}" pushd "${WORKDIR}" >/dev/null -- cgit v1.2.3-2-g168b From 39fbf0d8d3cdc666912c597d41d5b6a70fc0c725 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 20:53:38 -0500 Subject: Fix some array quoting. --- cron-jobs/check_archlinux/parse_pkgbuilds.sh | 22 +++++++++++----------- cron-jobs/ftpdir-cleanup | 12 ++++++------ cron-jobs/repo-sanity-check | 4 ++-- cron-jobs/sourceballs | 26 +++++++++++++------------- cron-jobs/sourceballs2 | 4 ++-- 5 files changed, 34 insertions(+), 34 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh index 3f92169..c8d8618 100755 --- a/cron-jobs/check_archlinux/parse_pkgbuilds.sh +++ b/cron-jobs/check_archlinux/parse_pkgbuilds.sh @@ -6,18 +6,18 @@ exit() { return; } splitpkg_overrides=('depends' 'optdepends' 'provides' 'conflicts') -variables=('pkgname' 'pkgbase' 'epoch' 'pkgver' 'pkgrel' 'makedepends' 'arch' ${splitpkg_overrides[@]}) +variables=('pkgname' 'pkgbase' 'epoch' 'pkgver' 'pkgrel' 'makedepends' 'arch' "${splitpkg_overrides[@]}") readonly -a variables splitpkg_overrides backup_package_variables() { - for var in ${splitpkg_overrides[@]}; do + for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" eval "${indirect}=(\${$var[@]})" done } restore_package_variables() { - for var in ${splitpkg_overrides[@]}; do + for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then eval "${var}=(\${$indirect[@]})" @@ -42,31 +42,31 @@ print_info() { if [ -n "$arch" ]; then echo "%ARCH%" - for i in ${arch[@]}; do echo $i; done + for i in "${arch[@]}"; do echo $i; done echo "" fi if [ -n "$depends" ]; then echo "%DEPENDS%" - for i in ${depends[@]}; do + for i in "${depends[@]}"; do echo $i done echo "" fi if [ -n "$makedepends" ]; then echo "%MAKEDEPENDS%" - for i in ${makedepends[@]}; do + for i in "${makedepends[@]}"; do echo $i done echo "" fi if [ -n "$conflicts" ]; then echo "%CONFLICTS%" - for i in ${conflicts[@]}; do echo $i; done + for i in "${conflicts[@]}"; do echo $i; done echo "" fi if [ -n "$provides" ]; then echo "%PROVIDES%" - for i in ${provides[@]}; do echo $i; done + for i in "${provides[@]}"; do echo $i; done echo "" fi } @@ -75,7 +75,7 @@ source_pkgbuild() { ret=0 dir=$1 pkgbuild=$dir/PKGBUILD - for var in ${variables[@]}; do + for var in "${variables[@]}"; do unset ${var} done source $pkgbuild &>/dev/null || ret=$? @@ -88,7 +88,7 @@ source_pkgbuild() { if [ "${#pkgname[@]}" -gt "1" ]; then pkgbase=${pkgbase:-${pkgname[0]}} - for pkg in ${pkgname[@]}; do + for pkg in "${pkgname[@]}"; do if [ "$(type -t package_${pkg})" != "function" ]; then echo -e "%INVALID%\n$pkgbuild\n" return 1 @@ -98,7 +98,7 @@ 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 diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index e42a1a8..ad2e7f9 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -24,16 +24,16 @@ clean_pkg() { script_lock -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do +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' -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 @@ -87,8 +87,8 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then done fi -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do +for repo in "${PKGREPOS[@]}"; do + for arch in "${ARCHES[@]}"; do repo_unlock ${repo} ${arch} done done diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index ee4c061..9d351df 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -5,7 +5,7 @@ . "$(dirname "$(readlink -e "$0")")/../db-functions" # Traverse all repos -for _repo in ${PKGREPOS[@]}; do +for _repo in "${PKGREPOS[@]}"; do msg "Cleaning up [${_repo}]" # Find all pkgnames on this repo's abs @@ -19,7 +19,7 @@ for _repo in ${PKGREPOS[@]}; do >/dev/null 2>&1 # also cleanup package functions - for _pkg in ${pkgname[@]}; do + for _pkg in "${pkgname[@]}"; do unset package_${pkg} >/dev/null 2>&1 done diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 1542499..329e135 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -7,8 +7,8 @@ pushd "${WORKDIR}" >/dev/null script_lock -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do +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,8 +39,8 @@ for repo in ${PKGREPOS[@]}; do done | sort -u > "${WORKDIR}/db-${repo}" done -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do +for repo in "${PKGREPOS[@]}"; do + for arch in "${ARCHES[@]}"; do repo_unlock ${repo} ${arch} done done @@ -49,15 +49,15 @@ done find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | 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 @@ -105,13 +105,13 @@ for repo in ${PKGREPOS[@]}; do if [ ${#newpkgs[@]} -ge 1 ]; then msg "Adding source packages for [${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 [${repo}]..." - for failed_pkg in ${failedpkgs[@]}; do + for failed_pkg in "${failedpkgs[@]}"; do msg2 "${failed_pkg}" done fi @@ -125,7 +125,7 @@ old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-s if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old source packages..." ${SOURCE_CLEANUP_DRYRUN} && warning 'dry run mode is active' - for old_pkg in ${old_pkgs[@]}; do + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" if ! ${SOURCE_CLEANUP_DRYRUN}; then mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" @@ -137,7 +137,7 @@ fi old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n')) if [ ${#old_pkgs[@]} -ge 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}" done diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 1432bdf..2a26e6a 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -21,7 +21,7 @@ find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort pushd "${SVNREPO}" >/dev/null -for repo in ${PKGREPOS[@]}; do +for repo in "${PKGREPOS[@]}"; do msg "Sourceballing [${repo}]" pushd $repo >/dev/null @@ -40,7 +40,7 @@ for repo in ${PKGREPOS[@]}; do unset build package url pkgdesc source md5sums depends makedepends \ optdepends license arch options check mksource - for _pkg in ${pkgname[@]}; do + for _pkg in "${pkgname[@]}"; do unset package_${_pkg} >/dev/null 2>&1 done -- cgit v1.2.3-2-g168b From cad2d8b7075cb255f76e79c12c23acee94074514 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 21:02:13 -0500 Subject: repo-sanity-check: take advantage of printf --- cron-jobs/repo-sanity-check | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 9d351df..8b0758f 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -41,8 +41,9 @@ for _repo in "${PKGREPOS[@]}"; do )) # Compares them, whatever is on repos but not on abs should be removed - remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \ - <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u))) + remove=($(comm -13 \ + <(printf '%s\n' "${on_abs[@]}" | sort -u) \ + <(printf '%s\n' "${on_repo[@]}" | sort -u) )) # Remove them from databases, ftpdir-cleanup will take care of the rest find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ -- cgit v1.2.3-2-g168b From b6e8ebd66d22abf5439485985a7851e768c71e8a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 21:04:43 -0500 Subject: Be very careful about using $0. --- cron-jobs/ftpdir-cleanup | 4 ++-- cron-jobs/integrity-check | 4 ++-- cron-jobs/repo-sanity-check | 4 ++-- cron-jobs/sourceballs | 2 +- cron-jobs/sourceballs2 | 2 +- cron-jobs/update-abs-tarballs | 2 +- cron-jobs/update-web-db | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 83e6e17..8d691b5 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/../db-functions" -. "$(dirname $0)/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" +. "$(dirname "$(readlink -e "$0")")/../config" clean_pkg() { local pkg diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index d4f9694..05a56a5 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}/../db-functions" . "${dirname}/../config" @@ -8,7 +8,7 @@ dirname="$(dirname $0)" script_lock if [ $# -ne 1 ]; then - die "usage: $(basename $0) " + die "usage: ${0##*/} " fi mailto=$1 diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 1ba90a6..2aa7892 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -1,8 +1,8 @@ #!/bin/bash # Solves issue165 -. "$(dirname $0)/../db-functions" -. "$(dirname $0)/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" +. "$(dirname "$(readlink -e "$0")")/../config" # Traverse all repos for _repo in ${PKGREPOS[@]}; do diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index ee074bd..73d8432 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -1,6 +1,6 @@ #!/bin/bash -dirname="$(dirname $(readlink -e $0))" +dirname="$(dirname "$(readlink -e "$0")")" . "${dirname}/../db-functions" . "${dirname}/../config" pushd "${WORKDIR}" >/dev/null diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 5644268..eb46579 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -4,7 +4,7 @@ # Makepkg --allsource every package # Remove the old sourceballs -dirname="$(dirname $(readlink -e $0))" +dirname="$(dirname "$(readlink -e "$0")")" . "${dirname}/../db-functions" . "${dirname}/../config" . "${MAKEPKGCONF}" diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs index 824ac34..901cc4b 100755 --- a/cron-jobs/update-abs-tarballs +++ b/cron-jobs/update-abs-tarballs @@ -1,6 +1,6 @@ #!/bin/bash -. "$(dirname $0)/../config" +. "$(dirname "$(readlink -e "$0")")/../config" rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ ${FTP_BASE}/ diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db index 6ced4c1..825eea6 100755 --- a/cron-jobs/update-web-db +++ b/cron-jobs/update-web-db @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/../db-functions" -. "$(dirname $0)/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" +. "$(dirname "$(readlink -e "$0")")/../config" # setup paths SPATH="/srv/http/archweb" @@ -14,7 +14,7 @@ REPOS=('community-testing' 'multilib-testing' 'multilib' 'community' 'extra' 'te LOGOUT="/tmp/archweb_update.log" # figure out what operation to perform -cmd="$(basename $0)" +cmd="${0##*/}" if [[ $cmd != "update-web-db" && $cmd != "update-web-files-db" ]]; then die "Invalid command name '$cmd' specified!" fi -- cgit v1.2.3-2-g168b From 8650ad4fdef09b1244ba138531b6a1e2bbd0975b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 18:00:12 -0500 Subject: Get rid of $ARCH_BASE; these days it is the same as $FTP_BASE --- cron-jobs/sourceballs | 10 +++++----- cron-jobs/sourceballs2 | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 73d8432..4debcee 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -21,10 +21,10 @@ renice +10 -p $$ > /dev/null for repo in ${PKGREPOS[@]}; do for arch in ${ARCHES[@]}; do # Repo does not exist; skip it - if [ ! -f "${ARCH_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then + if [ ! -f "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then continue fi - bsdtar -xOf "${ARCH_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \ + bsdtar -xOf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \ | awk '/^%NAME%/ { getline b }; /^%BASE%/ { getline b }; /^%VERSION%/ { getline v }; @@ -46,7 +46,7 @@ for repo in ${PKGREPOS[@]}; do done # Create a list of all available source package file names -find "${ARCH_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" +find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" # Check for all packages if we need to build a source package for repo in ${PKGREPOS[@]}; do @@ -96,7 +96,7 @@ for repo in ${PKGREPOS[@]}; do pushd "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null makepkg --nocolor --allsource --ignorearch # >/dev/null 2>&1 if [ $? -eq 0 ] && [ -f "${pkgbase}-${pkgver}${SRCEXT}" ]; then - mv "${pkgbase}-${pkgver}${SRCEXT}" "${ARCH_BASE}/${SRCPOOL}" + mv "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}" # Avoid creating the same source package for every arch echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" @@ -132,7 +132,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then for old_pkg in ${old_pkgs[@]}; do msg2 "${old_pkg}" if ! ${SOURCE_CLEANUP_DRYRUN}; then - mv "$ARCH_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" + mv "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" fi done diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index eb46579..bbe227d 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -17,7 +17,7 @@ script_lock renice +10 -p $$ > /dev/null # Create a list of all available source package file names -find "${ARCH_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" +find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" pushd "${SVNREPO}" >/dev/null -- cgit v1.2.3-2-g168b From 62142bcbac5f457b2172c7311741f90fedf0c776 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 15:20:16 -0500 Subject: fix comments, indentation --- cron-jobs/sourceballs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 4debcee..6393472 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -59,11 +59,11 @@ for repo in ${PKGREPOS[@]}; do pkgarch=${pkginfo[2]} pkglicense=(${pkginfo[@]:3}) - # Should this packages be skipped? + # Should this package be skipped? if grep -Fqx "${pkgbase}" "${dirname}/sourceballs.skip"; then continue fi - # Commenting out, we'll sourceball everything + # Commenting out, we'll sourceball everything # Check if the license or .force file does not enforce creating a source package # if ! (chk_license ${pkglicense[@]} || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then # continue @@ -83,10 +83,10 @@ for repo in ${PKGREPOS[@]}; do #svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}" \ # "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1 - # If it's on official repos, nor [libre], nor [libre-testing] - cp -r "${SVNREPO}/$repo/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \ - cp -r "${SVNREPO}/libre/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \ - cp -r "${SVNREPO}/libre-testing/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 + # If it's on official repos, nor [libre], nor [libre-testing] + cp -r "${SVNREPO}/$repo/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \ + cp -r "${SVNREPO}/libre/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \ + cp -r "${SVNREPO}/libre-testing/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 if [ $? -ge 1 ]; then failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" continue -- cgit v1.2.3-2-g168b From eefb787983d2608511214bcd682f3d8271bac60c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 16:44:51 -0500 Subject: Normalize to load config then local_config then db-functions --- cron-jobs/ftpdir-cleanup | 2 +- cron-jobs/integrity-check | 2 +- cron-jobs/repo-sanity-check | 2 +- cron-jobs/sourceballs | 2 +- cron-jobs/sourceballs2 | 2 +- cron-jobs/update-web-db | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 8d691b5..b290138 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname "$(readlink -e "$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 05a56a5..86a8f1d 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -2,8 +2,8 @@ dirname="$(dirname "$(readlink -e "$0")")" -. "${dirname}/../db-functions" . "${dirname}/../config" +. "${dirname}/../db-functions" script_lock diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 2aa7892..ee4c061 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -1,8 +1,8 @@ #!/bin/bash # Solves issue165 -. "$(dirname "$(readlink -e "$0")")/../db-functions" . "$(dirname "$(readlink -e "$0")")/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" # Traverse all repos for _repo in ${PKGREPOS[@]}; do diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 6393472..c9aadba 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -1,8 +1,8 @@ #!/bin/bash dirname="$(dirname "$(readlink -e "$0")")" -. "${dirname}/../db-functions" . "${dirname}/../config" +. "${dirname}/../db-functions" pushd "${WORKDIR}" >/dev/null script_lock diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index bbe227d..1432bdf 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -5,8 +5,8 @@ # Remove the old sourceballs dirname="$(dirname "$(readlink -e "$0")")" -. "${dirname}/../db-functions" . "${dirname}/../config" +. "${dirname}/../db-functions" . "${MAKEPKGCONF}" pushd "${WORKDIR}" >/dev/null diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db index 825eea6..713e75e 100755 --- a/cron-jobs/update-web-db +++ b/cron-jobs/update-web-db @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname "$(readlink -e "$0")")/../db-functions" . "$(dirname "$(readlink -e "$0")")/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" # setup paths SPATH="/srv/http/archweb" -- cgit v1.2.3-2-g168b From 9d9116bd23720cf6c5b27aa39e5cc4c71de1fb26 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 21:27:07 -0500 Subject: Fix some array quoting. --- cron-jobs/check_archlinux/parse_pkgbuilds.sh | 22 +++++++++++----------- cron-jobs/ftpdir-cleanup | 10 +++++----- cron-jobs/repo-sanity-check | 4 ++-- cron-jobs/sourceballs | 28 ++++++++++++++-------------- cron-jobs/sourceballs2 | 4 ++-- 5 files changed, 34 insertions(+), 34 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh index 3f92169..c8d8618 100755 --- a/cron-jobs/check_archlinux/parse_pkgbuilds.sh +++ b/cron-jobs/check_archlinux/parse_pkgbuilds.sh @@ -6,18 +6,18 @@ exit() { return; } splitpkg_overrides=('depends' 'optdepends' 'provides' 'conflicts') -variables=('pkgname' 'pkgbase' 'epoch' 'pkgver' 'pkgrel' 'makedepends' 'arch' ${splitpkg_overrides[@]}) +variables=('pkgname' 'pkgbase' 'epoch' 'pkgver' 'pkgrel' 'makedepends' 'arch' "${splitpkg_overrides[@]}") readonly -a variables splitpkg_overrides backup_package_variables() { - for var in ${splitpkg_overrides[@]}; do + for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" eval "${indirect}=(\${$var[@]})" done } restore_package_variables() { - for var in ${splitpkg_overrides[@]}; do + for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then eval "${var}=(\${$indirect[@]})" @@ -42,31 +42,31 @@ print_info() { if [ -n "$arch" ]; then echo "%ARCH%" - for i in ${arch[@]}; do echo $i; done + for i in "${arch[@]}"; do echo $i; done echo "" fi if [ -n "$depends" ]; then echo "%DEPENDS%" - for i in ${depends[@]}; do + for i in "${depends[@]}"; do echo $i done echo "" fi if [ -n "$makedepends" ]; then echo "%MAKEDEPENDS%" - for i in ${makedepends[@]}; do + for i in "${makedepends[@]}"; do echo $i done echo "" fi if [ -n "$conflicts" ]; then echo "%CONFLICTS%" - for i in ${conflicts[@]}; do echo $i; done + for i in "${conflicts[@]}"; do echo $i; done echo "" fi if [ -n "$provides" ]; then echo "%PROVIDES%" - for i in ${provides[@]}; do echo $i; done + for i in "${provides[@]}"; do echo $i; done echo "" fi } @@ -75,7 +75,7 @@ source_pkgbuild() { ret=0 dir=$1 pkgbuild=$dir/PKGBUILD - for var in ${variables[@]}; do + for var in "${variables[@]}"; do unset ${var} done source $pkgbuild &>/dev/null || ret=$? @@ -88,7 +88,7 @@ source_pkgbuild() { if [ "${#pkgname[@]}" -gt "1" ]; then pkgbase=${pkgbase:-${pkgname[0]}} - for pkg in ${pkgname[@]}; do + for pkg in "${pkgname[@]}"; do if [ "$(type -t package_${pkg})" != "function" ]; then echo -e "%INVALID%\n$pkgbuild\n" return 1 @@ -98,7 +98,7 @@ 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 diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index b290138..6455ed7 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -25,8 +25,8 @@ clean_pkg() { ${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 @@ -69,7 +69,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then fi # cleanup of legacy $repo/os/any directories -for repo in ${PKGREPOS[@]}; do +for repo in "${PKGREPOS[@]}"; do if [ ! -d "${FTP_BASE}/${repo}/os/any" ]; then continue fi @@ -103,8 +103,8 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then done fi -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do +for repo in "${PKGREPOS[@]}"; do + for arch in "${ARCHES[@]}"; do repo_unlock ${repo} ${arch} done done diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index ee4c061..9d351df 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -5,7 +5,7 @@ . "$(dirname "$(readlink -e "$0")")/../db-functions" # Traverse all repos -for _repo in ${PKGREPOS[@]}; do +for _repo in "${PKGREPOS[@]}"; do msg "Cleaning up [${_repo}]" # Find all pkgnames on this repo's abs @@ -19,7 +19,7 @@ for _repo in ${PKGREPOS[@]}; do >/dev/null 2>&1 # also cleanup package functions - for _pkg in ${pkgname[@]}; do + for _pkg in "${pkgname[@]}"; do unset package_${pkg} >/dev/null 2>&1 done diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index c9aadba..8171980 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -7,8 +7,8 @@ pushd "${WORKDIR}" >/dev/null script_lock -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do +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,8 +39,8 @@ for repo in ${PKGREPOS[@]}; do done | sort -u > "${WORKDIR}/db-${repo}" done -for repo in ${PKGREPOS[@]}; do - for arch in ${ARCHES[@]}; do +for repo in "${PKGREPOS[@]}"; do + for arch in "${ARCHES[@]}"; do repo_unlock ${repo} ${arch} done done @@ -49,15 +49,15 @@ done find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | 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 @@ -88,7 +88,7 @@ for repo in ${PKGREPOS[@]}; do cp -r "${SVNREPO}/libre/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \ cp -r "${SVNREPO}/libre-testing/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 if [ $? -ge 1 ]; then - failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" + failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") continue fi @@ -109,13 +109,13 @@ for repo in ${PKGREPOS[@]}; do if [ ${#newpkgs[@]} -ge 1 ]; then msg "Adding source packages for [${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 [${repo}]..." - for failed_pkg in ${failedpkgs[@]}; do + for failed_pkg in "${failedpkgs[@]}"; do msg2 "${failed_pkg}" done fi @@ -129,7 +129,7 @@ old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-s if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old source packages..." ${SOURCE_CLEANUP_DRYRUN} && warning 'dry run mode is active' - for old_pkg in ${old_pkgs[@]}; do + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" if ! ${SOURCE_CLEANUP_DRYRUN}; then mv "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" @@ -141,7 +141,7 @@ fi old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n')) if [ ${#old_pkgs[@]} -ge 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}" done diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 1432bdf..2a26e6a 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -21,7 +21,7 @@ find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort pushd "${SVNREPO}" >/dev/null -for repo in ${PKGREPOS[@]}; do +for repo in "${PKGREPOS[@]}"; do msg "Sourceballing [${repo}]" pushd $repo >/dev/null @@ -40,7 +40,7 @@ for repo in ${PKGREPOS[@]}; do unset build package url pkgdesc source md5sums depends makedepends \ optdepends license arch options check mksource - for _pkg in ${pkgname[@]}; do + for _pkg in "${pkgname[@]}"; do unset package_${_pkg} >/dev/null 2>&1 done -- cgit v1.2.3-2-g168b From d3afe9bb766bbdfaab1474d21fd5e28f0a356039 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 20:49:48 -0500 Subject: Avoid using $(basename $var) , use ${var##*/} instead --- cron-jobs/ftpdir-cleanup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 6455ed7..cb14382 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -16,7 +16,7 @@ clean_pkg() { if [ -e "$pkg.sig" ]; then mv -f "$pkg.sig" "$CLEANUP_DESTDIR" fi - touch "${CLEANUP_DESTDIR}/$(basename ${pkg})" + touch "${CLEANUP_DESTDIR}/${pkg##*/}" fi done fi -- cgit v1.2.3-2-g168b From c9ad9623c80ddf2db2a734b4a7914ab9eebd84fb Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Sun, 1 Jun 2014 16:04:55 +0100 Subject: Added the script `make_repo_torrents' which makes torrents for all the packages. --- cron-jobs/make_repo_torrents | 81 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 cron-jobs/make_repo_torrents (limited to 'cron-jobs') diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents new file mode 100644 index 0000000..d3c3df6 --- /dev/null +++ b/cron-jobs/make_repo_torrents @@ -0,0 +1,81 @@ +#! /bin/bash +# Copyright (C) 2014 Joseph Graham +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This script depends on `mktorrent' + +username=$( id -un ) + +case "${username}" in + repo | root ) + true + ;; + * ) + echo "This script must be run as repo user or root user." + echo "ByeBye!" + exit 1 + ;; +esac + +# pacman doesn't support multiple different packages of the same name, +# so it's OK to just stuff all the torrents into a single directory. +torrent_location='/srv/http/repo/public/torrents/' +public_location='/srv/http/repo/public/' + +# Tracker announce URL +tracker='http://t67.eu:6969/announce' # t67.eu is run by Xylon + +# All mirrors go here +declare -a url_prefixes=('http://repo.parabolagnulinux.org/' 'https://parabola.goodgnus.com.ar/' 'http://mirror.yandex.ru/mirrors/parabola/' 'http://alfplayer.com/parabola/') + +cd "${torrent_location}" + +find "${public_location}" -name 'os' -type 'd' | +while read dir +do + find "${dir}" -name '*\.pkg\.tar\.xz' | + while read pkg + do + pkg_name="${pkg##*/}" + + if [[ -h "${pkg}" ]] # check if it's a symbolic link + then + # We get the target of the symlink + pkg=$( readlink -f "${pkg}" ) + fi + + if ! [[ -f "${torrent_location}${pkg_name}.torrent" ]] + then + # We need to make a comma seperated list of webseeds (this is passed + # as a single argument to mktorrent) + webseeds='' + + for prefix in "${url_prefixes[@]}" + do + webseeds+="${prefix}${pkg#${public_location}}," + done + + # There should not be a random comma at the end of the webseeds + webseeds="${webseeds%,}" + + mktorrent -a "${tracker}" "${pkg}" -w "${webseeds}" # "${torrent_location}" + fi + done +done + +if [[ "${username}" == root ]] +then + chown repo * +fi -- cgit v1.2.3-2-g168b From ee8da885dc5062001861e4355602a39ae972c32c Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Mon, 2 Jun 2014 12:48:47 +0100 Subject: Made it randomize the order of the webseed list for every torrent. --- cron-jobs/make_repo_torrents | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index d3c3df6..dffd0dc 100644 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -38,7 +38,25 @@ public_location='/srv/http/repo/public/' tracker='http://t67.eu:6969/announce' # t67.eu is run by Xylon # All mirrors go here -declare -a url_prefixes=('http://repo.parabolagnulinux.org/' 'https://parabola.goodgnus.com.ar/' 'http://mirror.yandex.ru/mirrors/parabola/' 'http://alfplayer.com/parabola/') +declare -a array=('http://repo.parabolagnulinux.org/' 'https://parabola.goodgnus.com.ar/' 'http://mirror.yandex.ru/mirrors/parabola/' 'http://alfplayer.com/parabola/') + +# I got this function from http://mywiki.wooledge.org/BashFAQ/026 . It +# shuffles an array. Uses a global array variable. Must be compact +# (not a sparse array). The array must be called `array'. +shuffle() { + local i tmp size max rand + + # $RANDOM % (i+1) is biased because of the limited range of $RANDOM + # Compensate by using a range which is a multiple of the array size. + size=${#array[*]} + max=$(( 32768 / size * size )) + + for ((i=size-1; i>0; i--)); do + while (( (rand=$RANDOM) >= max )); do :; done + rand=$(( rand % (i+1) )) + tmp=${array[i]} array[i]=${array[rand]} array[rand]=$tmp + done +} cd "${torrent_location}" @@ -62,7 +80,12 @@ do # as a single argument to mktorrent) webseeds='' - for prefix in "${url_prefixes[@]}" + # Randomize the order of the list of webseeds because I + # don't know if transmission might always use the one at + # the top otherwize. + shuffle + + for prefix in "${array[@]}" do webseeds+="${prefix}${pkg#${public_location}}," done -- cgit v1.2.3-2-g168b From 6979cf5d1e4a599fbabaed4fe643e9db0f0f871c Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Mon, 2 Jun 2014 12:54:47 +0100 Subject: Added encyclomundi's mirror to the webseeds array. --- cron-jobs/make_repo_torrents | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index dffd0dc..246264d 100644 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -38,7 +38,7 @@ public_location='/srv/http/repo/public/' tracker='http://t67.eu:6969/announce' # t67.eu is run by Xylon # All mirrors go here -declare -a array=('http://repo.parabolagnulinux.org/' 'https://parabola.goodgnus.com.ar/' 'http://mirror.yandex.ru/mirrors/parabola/' 'http://alfplayer.com/parabola/') +declare -a array=('http://repo.parabolagnulinux.org/' 'https://parabola.goodgnus.com.ar/' 'http://mirror.yandex.ru/mirrors/parabola/' 'http://alfplayer.com/parabola/' 'http://mirror.parlementum.net/') # I got this function from http://mywiki.wooledge.org/BashFAQ/026 . It # shuffles an array. Uses a global array variable. Must be compact -- cgit v1.2.3-2-g168b From ad79659b3057fd5afac3629e9dd53ea3b93fb58e Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Fri, 6 Jun 2014 12:29:21 +0100 Subject: Made it only give output on an error. --- cron-jobs/make_repo_torrents | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index 246264d..797142e 100644 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -93,7 +93,8 @@ do # There should not be a random comma at the end of the webseeds webseeds="${webseeds%,}" - mktorrent -a "${tracker}" "${pkg}" -w "${webseeds}" # "${torrent_location}" + mktorrent -a "${tracker}" "${pkg}" -w "${webseeds}" >/dev/null || + echo "Error making torrent for \"${pkg}\"" fi done done -- cgit v1.2.3-2-g168b From c121ead116f26ed2b36247247fdf4a0d19f063f2 Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Mon, 16 Jun 2014 14:09:50 +0100 Subject: removed all mirrors but one since pacman2pacman now re-writes the webseeds list to just point to the user's chosen mirror. --- cron-jobs/make_repo_torrents | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index 797142e..0798a5e 100644 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -38,7 +38,11 @@ public_location='/srv/http/repo/public/' tracker='http://t67.eu:6969/announce' # t67.eu is run by Xylon # All mirrors go here -declare -a array=('http://repo.parabolagnulinux.org/' 'https://parabola.goodgnus.com.ar/' 'http://mirror.yandex.ru/mirrors/parabola/' 'http://alfplayer.com/parabola/' 'http://mirror.parlementum.net/') +#declare -a array=('http://repo.parabolagnulinux.org/' 'https://parabola.goodgnus.com.ar/' 'http://mirror.yandex.ru/mirrors/parabola/' 'http://alfplayer.com/parabola/' 'http://mirror.parlementum.net/') + +# I'm removing all mirrors but one since pacman2pacman now re-writes +# the webseeds list to just point to the user's chosen mirror +declare -a array=('http://repo.parabolagnulinux.org/') # I got this function from http://mywiki.wooledge.org/BashFAQ/026 . It # shuffles an array. Uses a global array variable. Must be compact -- cgit v1.2.3-2-g168b From ad922cd1ea67945d538036b021d8ccf8f8b475b6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 Jun 2014 22:11:19 -0400 Subject: cron-jobs/ftpdir-cleanup: remove old /any/ cleanup code --- cron-jobs/ftpdir-cleanup | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index cb14382..f2d8b33 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -68,29 +68,6 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then done fi -# cleanup of legacy $repo/os/any directories -for repo in "${PKGREPOS[@]}"; do - if [ ! -d "${FTP_BASE}/${repo}/os/any" ]; then - continue - fi - if [ -n "$(find "${FTP_BASE}/${repo}/os/any" -type d -empty)" ]; then - msg "Removing empty legacy directory ${repo}/os/any" - ${CLEANUP_DRYRUN} || rmdir "${FTP_BASE}/${repo}/os/any" - continue - fi - find "${FTP_BASE}/${repo}/os/any" -name "*${PKGEXT}" -printf '%f\n' | sort > "${WORKDIR}/any-${repo}" - cat "${WORKDIR}/db-${repo}-"* | sort -u > "${WORKDIR}/all-${repo}" - - old_pkgs=($(comm -23 "${WORKDIR}/any-${repo}" "${WORKDIR}/all-${repo}")) - if [ ${#old_pkgs[@]} -ge 1 ]; then - msg "Removing old packages from [${repo}] (any)..." - for old_pkg in ${old_pkgs[@]}; do - msg2 "${old_pkg}" - clean_pkg "${FTP_BASE}/${repo}/os/any/${old_pkg}" - done - fi -done - old_pkgs=($(find ${CLEANUP_DESTDIR} -type f -name "*${PKGEXT}" -mtime +${CLEANUP_KEEP} -printf '%f\n')) if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old packages from the cleanup directory..." -- cgit v1.2.3-2-g168b From 4143e0fe34e549e34e1bfb0efe3111430017046a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 Jun 2014 22:53:54 -0400 Subject: sourceballs2, db-check-nonfree: quote and tab-indent --- cron-jobs/sourceballs2 | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 2a26e6a..64bae4a 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -13,7 +13,7 @@ pushd "${WORKDIR}" >/dev/null script_lock -#adjust the nice level to run at a lower priority +# Adjust the nice level to run at a lower priority renice +10 -p $$ > /dev/null # Create a list of all available source package file names @@ -22,41 +22,41 @@ find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort pushd "${SVNREPO}" >/dev/null for repo in "${PKGREPOS[@]}"; do - msg "Sourceballing [${repo}]" + msg "Sourceballing [${repo}]" - pushd $repo >/dev/null - find -maxdepth 1 -type d | while read pkg; do - pushd "${SVNREPO}/$repo/$pkg" >/dev/null + pushd "$repo" >/dev/null + find -maxdepth 1 -type d | while read pkg; do + pushd "${SVNREPO}/$repo/$pkg" >/dev/null - [[ ! -e PKGBUILD ]] && { - warning "$repo/$pkg is not a package" - continue - } + [[ ! -e ./PKGBUILD ]] && { + warning "$repo/$pkg is not a package" + continue + } -# Unset the previous data - unset pkgbase pkgname pkgver pkgrel - source PKGBUILD + # Unset the previous data + unset pkgbase pkgname pkgver pkgrel + source PKGBUILD - unset build package url pkgdesc source md5sums depends makedepends \ - optdepends license arch options check mksource + unset build package url pkgdesc source md5sums depends makedepends \ + optdepends license arch options check mksource - for _pkg in "${pkgname[@]}"; do - unset package_${_pkg} >/dev/null 2>&1 - done + for _pkg in "${pkgname[@]}"; do + unset "package_${_pkg}" >/dev/null 2>&1 + done - pkgbase=${pkgbase:-$pkgname} - srcfile="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" + pkgbase=${pkgbase:-$pkgname} + srcfile="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" echo "${srcfile}" >> "${WORKDIR}/expected-src-pkgs" - # Skip already sourceballed - [ -e "${SRCPKGDEST}/${srcfile}" ] && continue + # Skip already sourceballed + [[ -e "${SRCPKGDEST}/${srcfile}" ]] && continue - makepkg --allsource --ignorearch -c >/dev/null 2>&1 + makepkg --allsource --ignorearch -c >/dev/null 2>&1 - [ $? -ne 0 ] && plain ${srcfile} + [[ $? -ne 0 ]] && plain "${srcfile}" - done # end find pkgs - popd >/dev/null + done # end find pkgs + popd >/dev/null done # end repos -- cgit v1.2.3-2-g168b From 6ce6d9f136122c8b8d6cf152216996de083328d4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 Jun 2014 22:54:15 -0400 Subject: touch up a bunch of quoting --- cron-jobs/check_archlinux/parse_pkgbuilds.sh | 36 ++++++++++++++-------------- cron-jobs/devlist-mailer | 2 +- cron-jobs/ftpdir-cleanup | 18 +++++++------- cron-jobs/integrity-check | 4 ++-- cron-jobs/sourceballs | 14 +++++------ cron-jobs/update-web-db | 16 ++++++------- 6 files changed, 45 insertions(+), 45 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh index c8d8618..38af179 100755 --- a/cron-jobs/check_archlinux/parse_pkgbuilds.sh +++ b/cron-jobs/check_archlinux/parse_pkgbuilds.sh @@ -12,7 +12,7 @@ readonly -a variables splitpkg_overrides backup_package_variables() { for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done } @@ -20,9 +20,9 @@ restore_package_variables() { for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else - unset ${var} + unset "${var}" fi done } @@ -42,31 +42,31 @@ print_info() { if [ -n "$arch" ]; then echo "%ARCH%" - for i in "${arch[@]}"; do echo $i; done + for i in "${arch[@]}"; do echo "$i"; done echo "" fi if [ -n "$depends" ]; then echo "%DEPENDS%" for i in "${depends[@]}"; do - echo $i + echo "$i" done echo "" fi if [ -n "$makedepends" ]; then echo "%MAKEDEPENDS%" for i in "${makedepends[@]}"; do - echo $i + echo "$i" done echo "" fi if [ -n "$conflicts" ]; then echo "%CONFLICTS%" - for i in "${conflicts[@]}"; do echo $i; done + for i in "${conflicts[@]}"; do echo "$i"; done echo "" fi if [ -n "$provides" ]; then echo "%PROVIDES%" - for i in "${provides[@]}"; do echo $i; done + for i in "${provides[@]}"; do echo "$i"; done echo "" fi } @@ -76,9 +76,9 @@ source_pkgbuild() { dir=$1 pkgbuild=$dir/PKGBUILD for var in "${variables[@]}"; do - unset ${var} + unset "${var}" done - source $pkgbuild &>/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 @@ -89,7 +89,7 @@ source_pkgbuild() { if [ "${#pkgname[@]}" -gt "1" ]; then pkgbase=${pkgbase:-${pkgname[0]}} for pkg in "${pkgname[@]}"; do - if [ "$(type -t package_${pkg})" != "function" ]; then + if [ "$(type -t "package_${pkg}")" != "function" ]; then echo -e "%INVALID%\n$pkgbuild\n" return 1 else @@ -104,7 +104,7 @@ source_pkgbuild() { 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 ca2e46b..61cd32c 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 ad2e7f9..292952b 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -7,7 +7,7 @@ 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" @@ -26,11 +26,11 @@ script_lock for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_lock ${repo} ${arch} || exit 1 + 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 @@ -45,7 +45,7 @@ for repo in "${PKGREPOS[@]}"; do missing_pkgs=($(comm -13 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if [ ${#missing_pkgs[@]} -ge 1 ]; then error "Missing packages in [${repo}] (${arch})..." - for missing_pkg in ${missing_pkgs[@]}; do + for missing_pkg in "${missing_pkgs[@]}"; do msg2 "${missing_pkg}" done fi @@ -69,18 +69,18 @@ cat "${WORKDIR}/db-"* | sort -u > "${WORKDIR}/db" old_pkgs=($(comm -23 "${WORKDIR}/pool" "${WORKDIR}/db")) if [ ${#old_pkgs[@]} -ge 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 fi -old_pkgs=($(find ${CLEANUP_DESTDIR} -type f -name "*${PKGEXT}" -mtime +${CLEANUP_KEEP} -printf '%f\n')) +old_pkgs=($(find "${CLEANUP_DESTDIR}" -type f -name "*${PKGEXT}" -mtime +"${CLEANUP_KEEP}" -printf '%f\n')) if [ ${#old_pkgs[@]} -ge 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 @@ -89,7 +89,7 @@ fi for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${arch} + repo_unlock "${repo}" "${arch}" done done diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index 86a8f1d..33a4eb6 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -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' diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index d5bf54b..2c11de2 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -9,7 +9,7 @@ script_lock for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_lock ${repo} ${arch} || exit 1 + repo_lock "${repo}" "${arch}" || exit 1 done done @@ -41,7 +41,7 @@ done for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${arch} + repo_unlock "${repo}" "${arch}" done done @@ -74,7 +74,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 @@ -124,22 +124,22 @@ old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-s if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old source packages..." - ${SOURCE_CLEANUP_DRYRUN} && warning 'dry run mode is active' + "${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 done fi -old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n')) +old_pkgs=($(find "${SOURCE_CLEANUP_DESTDIR}" -type f -name "*${SRCEXT}" -mtime +"${SOURCE_CLEANUP_KEEP}" -printf '%f\n')) if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old source packages from the cleanup directory..." 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 713e75e..ec9d255 100755 --- a/cron-jobs/update-web-db +++ b/cron-jobs/update-web-db @@ -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 -- cgit v1.2.3-2-g168b From b1ac233691ac28645cb729d7d5e7c7b51fc899bd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 Jun 2014 23:11:44 -0400 Subject: cron-jobs/repo-sanity-check: clean up --- cron-jobs/repo-sanity-check | 95 ++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 49 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 8b0758f..73ec171 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -1,57 +1,54 @@ #!/bin/bash -# Solves issue165 +# Solves issue165... on the old flyspray install. I have no idea what issue that was. . "$(dirname "$(readlink -e "$0")")/../config" . "$(dirname "$(readlink -e "$0")")/../db-functions" # Traverse all repos for _repo in "${PKGREPOS[@]}"; do - msg "Cleaning up [${_repo}]" - -# Find all pkgnames on this repo's abs - on_abs=($( - find ${SVNREPO}/${_repo} -name PKGBUILD | \ - while read pkgbuild; do - source ${pkgbuild} >/dev/null 2>&1 -# cleanup to save memory - unset build package source md5sums pkgdesc pkgver pkgrel epoch \ - url license arch depends makedepends optdepends options \ - >/dev/null 2>&1 - -# also cleanup package functions - for _pkg in "${pkgname[@]}"; do - unset package_${pkg} >/dev/null 2>&1 - done - -# this fills the on_abs array - echo ${pkgname[@]} - done - )) - -# quit if abs is empty - if [ ${#on_abs[*]} -eq 0 ]; then - warning "[${_repo}]'s ABS tree is empty, skipping" - break - fi - -# Find all pkgnames on repos - on_repo=($( - find ${FTP_BASE}/${_repo} -name "*.pkg.tar.?z" -printf "%f\n" | \ - sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" - )) - -# Compares them, whatever is on repos but not on abs should be removed - remove=($(comm -13 \ - <(printf '%s\n' "${on_abs[@]}" | sort -u) \ - <(printf '%s\n' "${on_repo[@]}" | sort -u) )) - -# Remove them from databases, ftpdir-cleanup will take care of the rest - find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ - repo-remove {} ${remove[@]} >/dev/null 2>&1 \; - - msg2 "Removed the following packages:" - plain "$(echo ${remove[@]} | tr ' ' "\n")" - + msg "Cleaning up [${_repo}]" + + # Find all pkgnames on this repo's abs + on_abs=($( + find "${SVNREPO}/${_repo}" -name PKGBUILD | \ + while read pkgbuild; do + source "${pkgbuild}" >/dev/null 2>&1 + # cleanup to save memory + unset build package source md5sums pkgdesc pkgver pkgrel epoch \ + url license arch depends makedepends optdepends options \ + >/dev/null 2>&1 + + # also cleanup package functions + for _pkg in "${pkgname[@]}"; do + unset "package_${pkg}" >/dev/null 2>&1 + done + + # this fills the on_abs array + printf '%q ' "${pkgname[@]}" + done + )) + + # quit if abs is empty + if [ ${#on_abs[*]} -eq 0 ]; then + warning "[%s]'s ABS tree is empty, skipping" "${_repo}" + break + fi + + # Find all pkgnames on repos + on_repo=($( + find "${FTP_BASE}/${_repo}" -name "*.pkg.tar.?z" \ + -printf "%f\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" + )) + + # Compares them, whatever is on repos but not on abs should be removed + remove=($(comm -13 \ + <(printf '%s\n' "${on_abs[@]}" | sort -u) \ + <(printf '%s\n' "${on_repo[@]}" | sort -u) )) + + # Remove them from databases, ftpdir-cleanup will take care of the rest + find "${FTP_BASE}/${_repo}" -name "*.db.tar.?z" \ + -exec repo-remove {} "${remove[@]}" \; >/dev/null 2>&1 + + msg2 "Removed the following packages:" + plain '%s' "${remove[@]}" done - -exit $? -- cgit v1.2.3-2-g168b From c54e53593927e5469cfe13bacd29d25168235606 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 Jun 2014 23:23:31 -0400 Subject: more quoting fixes --- cron-jobs/ftpdir-cleanup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 292952b..77d90d2 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -53,7 +53,7 @@ for repo in "${PKGREPOS[@]}"; do old_pkgs=($(comm -23 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old packages from [${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 -- cgit v1.2.3-2-g168b From 63381988ae8a0f4e0c8eaede88b43a5f685ec80f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 Jun 2014 23:25:11 -0400 Subject: remove more scripts that I know to be obsolete --- cron-jobs/update-web-db | 78 ------------------------------------------- cron-jobs/update-web-files-db | 1 - 2 files changed, 79 deletions(-) delete mode 100755 cron-jobs/update-web-db delete mode 120000 cron-jobs/update-web-files-db (limited to 'cron-jobs') diff --git a/cron-jobs/update-web-db b/cron-jobs/update-web-db deleted file mode 100755 index 713e75e..0000000 --- a/cron-jobs/update-web-db +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash - -. "$(dirname "$(readlink -e "$0")")/../config" -. "$(dirname "$(readlink -e "$0")")/../db-functions" - -# setup paths -SPATH="/srv/http/archweb" -ENVPATH="/srv/http/archweb-env/bin/activate" - -# having "more important repos" last should make [core] trickle to the top of -# the updates list each hour rather than being overwhelmed by big [extra] and -# [community] updates -REPOS=('community-testing' 'multilib-testing' 'multilib' 'community' 'extra' 'testing' 'core') -LOGOUT="/tmp/archweb_update.log" - -# figure out what operation to perform -cmd="${0##*/}" -if [[ $cmd != "update-web-db" && $cmd != "update-web-files-db" ]]; then - die "Invalid command name '$cmd' specified!" -fi - -script_lock - -# run at nice 5. it can churn quite a bit of cpu after all. -renice +5 -p $$ > /dev/null - -echo "$cmd: Updating DB at $(date)" >> "${LOGOUT}" - -# source our virtualenv if it exists -if [ -f "$ENVPATH" ]; then - . "$ENVPATH" -fi - -case "$cmd" in - update-web-db) - dbfileext="${DBEXT}" - flags="" - ;; - update-web-files-db) - dbfileext="${FILESEXT}" - flags="--filesonly" - ;; -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 - 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} - done -done - -# Run reporead on our db copy -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 - echo "" >> "${LOGOUT}" - fi - done -done -popd >/dev/null -echo "" >> "${LOGOUT}" - -# rotate the file if it is getting big (> 10M), overwriting any old backup -if [[ $(stat -c%s "${LOGOUT}") -gt 10485760 ]]; then - mv "${LOGOUT}" "${LOGOUT}.old" -fi - -script_unlock diff --git a/cron-jobs/update-web-files-db b/cron-jobs/update-web-files-db deleted file mode 120000 index 0c2c4fa..0000000 --- a/cron-jobs/update-web-files-db +++ /dev/null @@ -1 +0,0 @@ -update-web-db \ No newline at end of file -- cgit v1.2.3-2-g168b From 878a9afd8fe40fa4263c5af04491ff91c8f0c09a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 00:10:08 -0400 Subject: Use printf-formatters when possible (incomplete) --- cron-jobs/ftpdir-cleanup | 2 +- cron-jobs/integrity-check | 2 +- cron-jobs/sourceballs | 8 ++++---- cron-jobs/sourceballs2 | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 77d90d2..af56aac 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -44,7 +44,7 @@ for repo in "${PKGREPOS[@]}"; do missing_pkgs=($(comm -13 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if [ ${#missing_pkgs[@]} -ge 1 ]; then - error "Missing packages in [${repo}] (${arch})..." + error "Missing packages in [%s] (%s)..." "${repo}" "${arch}" for missing_pkg in "${missing_pkgs[@]}"; do msg2 "${missing_pkg}" done diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index 33a4eb6..7459380 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -8,7 +8,7 @@ dirname="$(dirname "$(readlink -e "$0")")" script_lock if [ $# -ne 1 ]; then - die "usage: ${0##*/} " + die "usage: %s " "${0##*/}" fi mailto=$1 diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 2c11de2..2fc09d5 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -104,15 +104,15 @@ for repo in "${PKGREPOS[@]}"; do done < "${WORKDIR}/db-${repo}" if [ ${#newpkgs[@]} -ge 1 ]; then - msg "Adding source packages for [${repo}]..." + 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 [${repo}]..." + 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 diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 64bae4a..02ed04c 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -22,14 +22,14 @@ find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort pushd "${SVNREPO}" >/dev/null for repo in "${PKGREPOS[@]}"; do - msg "Sourceballing [${repo}]" + msg "Sourceballing [%s]" "${repo}" pushd "$repo" >/dev/null find -maxdepth 1 -type d | while read pkg; do pushd "${SVNREPO}/$repo/$pkg" >/dev/null [[ ! -e ./PKGBUILD ]] && { - warning "$repo/$pkg is not a package" + warning "%s is not a package" "$repo/$pkg" continue } -- cgit v1.2.3-2-g168b From 5e84c1596d3ae2a66bd859f1fac2490025946fbb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 00:13:55 -0400 Subject: use += when possible --- cron-jobs/sourceballs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 2fc09d5..44492ef 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -94,7 +94,7 @@ for repo in "${PKGREPOS[@]}"; do mv_acl "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}/${pkgbase}-${pkgver}${SRCEXT}" # Avoid creating the same source package for every arch echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" - newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" + newpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") else failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") cat "${WORKDIR}/${pkgbase}.log" >> "${WORKDIR}/makepkg-fail.log" -- cgit v1.2.3-2-g168b From 426c14d9a8364193dec631a389470fb4465ef9ce Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 00:12:25 -0400 Subject: cron-jobs/update-abs-tarbals: quote, remove unnescessary exit --- cron-jobs/update-abs-tarballs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs index 901cc4b..e710f7c 100755 --- a/cron-jobs/update-abs-tarballs +++ b/cron-jobs/update-abs-tarballs @@ -2,6 +2,4 @@ . "$(dirname "$(readlink -e "$0")")/../config" -rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ ${FTP_BASE}/ - -exit $? +rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ "${FTP_BASE}/" -- cgit v1.2.3-2-g168b From e8f411803648f64b386dd2970b024b9ba15ba682 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 11:12:18 -0400 Subject: The eval+printf %q thing wasn't worth the hard-to-read code --- cron-jobs/repo-sanity-check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 73ec171..fadb248 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -24,7 +24,7 @@ for _repo in "${PKGREPOS[@]}"; do done # this fills the on_abs array - printf '%q ' "${pkgname[@]}" + echo "${pkgname[@]}" done )) -- cgit v1.2.3-2-g168b From 457e2b0ab0870e19bcf9bdcdd88a2c338cc3bfd3 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 12:27:35 -0400 Subject: use tab indent --- cron-jobs/check_archlinux/parse_pkgbuilds.sh | 10 +++++----- cron-jobs/devlist-mailer | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh index 38af179..b857ac8 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 61cd32c..1a05521 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 [ $# -ge 1 ]; then - SUBJECT="$1 $(date +"%d-%m-%Y")" + SUBJECT="$1 $(date +"%d-%m-%Y")" fi if [ $# -ge 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 -- cgit v1.2.3-2-g168b From df49c9b89e56b6c8d2d20cdcc9e03dc80996fcdd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 12:36:33 -0400 Subject: use tab indent --- cron-jobs/check_archlinux/parse_pkgbuilds.sh | 10 ++-- cron-jobs/devlist-mailer | 6 +- cron-jobs/repo-sanity-check | 88 ++++++++++++++-------------- cron-jobs/sourceballs2 | 48 +++++++-------- 4 files changed, 76 insertions(+), 76 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh index c8d8618..9b26f1e 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 ca2e46b..32896f7 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 [ $# -ge 1 ]; then - SUBJECT="$1 $(date +"%d-%m-%Y")" + SUBJECT="$1 $(date +"%d-%m-%Y")" fi if [ $# -ge 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 diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 9d351df..f5f80c8 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -6,50 +6,50 @@ # Traverse all repos for _repo in "${PKGREPOS[@]}"; do - msg "Cleaning up [${_repo}]" - -# Find all pkgnames on this repo's abs - on_abs=($( - find ${SVNREPO}/${_repo} -name PKGBUILD | \ - while read pkgbuild; do - source ${pkgbuild} >/dev/null 2>&1 -# cleanup to save memory - unset build package source md5sums pkgdesc pkgver pkgrel epoch \ - url license arch depends makedepends optdepends options \ - >/dev/null 2>&1 - -# also cleanup package functions - for _pkg in "${pkgname[@]}"; do - unset package_${pkg} >/dev/null 2>&1 - done - -# this fills the on_abs array - echo ${pkgname[@]} - done - )) - -# quit if abs is empty - if [ ${#on_abs[*]} -eq 0 ]; then - warning "[${_repo}]'s ABS tree is empty, skipping" - break - fi - -# Find all pkgnames on repos - on_repo=($( - find ${FTP_BASE}/${_repo} -name "*.pkg.tar.?z" -printf "%f\n" | \ - sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" - )) - -# Compares them, whatever is on repos but not on abs should be removed - remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \ - <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u))) - -# Remove them from databases, ftpdir-cleanup will take care of the rest - find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ - repo-remove {} ${remove[@]} >/dev/null 2>&1 \; - - msg2 "Removed the following packages:" - plain "$(echo ${remove[@]} | tr ' ' "\n")" + msg "Cleaning up [${_repo}]" + + # Find all pkgnames on this repo's abs + on_abs=($( + find ${SVNREPO}/${_repo} -name PKGBUILD | \ + while read pkgbuild; do + source ${pkgbuild} >/dev/null 2>&1 + # cleanup to save memory + unset build package source md5sums pkgdesc pkgver pkgrel epoch \ + url license arch depends makedepends optdepends options \ + >/dev/null 2>&1 + + # also cleanup package functions + for _pkg in "${pkgname[@]}"; do + unset package_${pkg} >/dev/null 2>&1 + done + + # this fills the on_abs array + echo ${pkgname[@]} + done + )) + + # quit if abs is empty + if [ ${#on_abs[*]} -eq 0 ]; then + warning "[${_repo}]'s ABS tree is empty, skipping" + break + fi + + # Find all pkgnames on repos + on_repo=($( + find ${FTP_BASE}/${_repo} -name "*.pkg.tar.?z" -printf "%f\n" | \ + sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" + )) + + # Compares them, whatever is on repos but not on abs should be removed + remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \ + <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u))) + + # Remove them from databases, ftpdir-cleanup will take care of the rest + find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ + repo-remove {} ${remove[@]} >/dev/null 2>&1 \; + + msg2 "Removed the following packages:" + plain "$(echo ${remove[@]} | tr ' ' "\n")" done diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 2a26e6a..49a2dac 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -22,41 +22,41 @@ find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort pushd "${SVNREPO}" >/dev/null for repo in "${PKGREPOS[@]}"; do - msg "Sourceballing [${repo}]" + msg "Sourceballing [${repo}]" - pushd $repo >/dev/null - find -maxdepth 1 -type d | while read pkg; do - pushd "${SVNREPO}/$repo/$pkg" >/dev/null + pushd $repo >/dev/null + find -maxdepth 1 -type d | while read pkg; do + pushd "${SVNREPO}/$repo/$pkg" >/dev/null - [[ ! -e PKGBUILD ]] && { - warning "$repo/$pkg is not a package" - continue - } + [[ ! -e PKGBUILD ]] && { + warning "$repo/$pkg is not a package" + continue + } -# Unset the previous data - unset pkgbase pkgname pkgver pkgrel - source PKGBUILD + # Unset the previous data + unset pkgbase pkgname pkgver pkgrel + source PKGBUILD - unset build package url pkgdesc source md5sums depends makedepends \ - optdepends license arch options check mksource + unset build package url pkgdesc source md5sums depends makedepends \ + optdepends license arch options check mksource - for _pkg in "${pkgname[@]}"; do - unset package_${_pkg} >/dev/null 2>&1 - done + for _pkg in "${pkgname[@]}"; do + unset package_${_pkg} >/dev/null 2>&1 + done - pkgbase=${pkgbase:-$pkgname} - srcfile="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" + pkgbase=${pkgbase:-$pkgname} + srcfile="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" echo "${srcfile}" >> "${WORKDIR}/expected-src-pkgs" - # Skip already sourceballed - [ -e "${SRCPKGDEST}/${srcfile}" ] && continue + # Skip already sourceballed + [ -e "${SRCPKGDEST}/${srcfile}" ] && continue - makepkg --allsource --ignorearch -c >/dev/null 2>&1 + makepkg --allsource --ignorearch -c >/dev/null 2>&1 - [ $? -ne 0 ] && plain ${srcfile} + [ $? -ne 0 ] && plain ${srcfile} - done # end find pkgs - popd >/dev/null + done # end find pkgs + popd >/dev/null done # end repos -- cgit v1.2.3-2-g168b From 46510e1fc48f37ce76c2bf5f19f885bba8d5d098 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 13:05:12 -0400 Subject: Clean up quoting. --- cron-jobs/check_archlinux/parse_pkgbuilds.sh | 36 ++++++++++++++-------------- cron-jobs/devlist-mailer | 2 +- cron-jobs/ftpdir-cleanup | 19 +++++++-------- cron-jobs/integrity-check | 4 ++-- cron-jobs/repo-sanity-check | 23 +++++++++--------- cron-jobs/sourceballs | 18 +++++++------- cron-jobs/sourceballs2 | 8 +++---- cron-jobs/update-abs-tarballs | 4 +--- 8 files changed, 56 insertions(+), 58 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh index 9b26f1e..b857ac8 100755 --- a/cron-jobs/check_archlinux/parse_pkgbuilds.sh +++ b/cron-jobs/check_archlinux/parse_pkgbuilds.sh @@ -12,7 +12,7 @@ readonly -a variables splitpkg_overrides backup_package_variables() { for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done } @@ -20,9 +20,9 @@ restore_package_variables() { for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else - unset ${var} + unset "${var}" fi done } @@ -42,31 +42,31 @@ print_info() { if [ -n "$arch" ]; then echo "%ARCH%" - for i in "${arch[@]}"; do echo $i; done + for i in "${arch[@]}"; do echo "$i"; done echo "" fi if [ -n "$depends" ]; then echo "%DEPENDS%" for i in "${depends[@]}"; do - echo $i + echo "$i" done echo "" fi if [ -n "$makedepends" ]; then echo "%MAKEDEPENDS%" for i in "${makedepends[@]}"; do - echo $i + echo "$i" done echo "" fi if [ -n "$conflicts" ]; then echo "%CONFLICTS%" - for i in "${conflicts[@]}"; do echo $i; done + for i in "${conflicts[@]}"; do echo "$i"; done echo "" fi if [ -n "$provides" ]; then echo "%PROVIDES%" - for i in "${provides[@]}"; do echo $i; done + for i in "${provides[@]}"; do echo "$i"; done echo "" fi } @@ -76,9 +76,9 @@ source_pkgbuild() { dir=$1 pkgbuild=$dir/PKGBUILD for var in "${variables[@]}"; do - unset ${var} + unset "${var}" done - source $pkgbuild &>/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 @@ -89,7 +89,7 @@ source_pkgbuild() { if [ "${#pkgname[@]}" -gt "1" ]; then pkgbase=${pkgbase:-${pkgname[0]}} for pkg in "${pkgname[@]}"; do - if [ "$(type -t package_${pkg})" != "function" ]; then + if [ "$(type -t "package_${pkg}")" != "function" ]; then echo -e "%INVALID%\n$pkgbuild\n" return 1 else @@ -104,7 +104,7 @@ source_pkgbuild() { 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 32896f7..1a05521 100755 --- a/cron-jobs/devlist-mailer +++ b/cron-jobs/devlist-mailer @@ -23,6 +23,6 @@ if [ -n "$(echo $stdin)" ]; then 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 f2d8b33..d5a277b 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -7,7 +7,7 @@ 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" @@ -22,8 +22,7 @@ clean_pkg() { fi } - -${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 @@ -38,7 +37,7 @@ for repo in "${PKGREPOS[@]}"; do missing_pkgs=($(comm -13 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if [ ${#missing_pkgs[@]} -ge 1 ]; then error "Missing packages in [${repo}] (${arch})..." - for missing_pkg in ${missing_pkgs[@]}; do + for missing_pkg in "${missing_pkgs[@]}"; do msg2 "${missing_pkg}" done fi @@ -46,7 +45,7 @@ for repo in "${PKGREPOS[@]}"; do old_pkgs=($(comm -23 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old packages from [${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 @@ -62,18 +61,18 @@ cat "${WORKDIR}/db-"* | sort -u > "${WORKDIR}/db" old_pkgs=($(comm -23 "${WORKDIR}/pool" "${WORKDIR}/db")) if [ ${#old_pkgs[@]} -ge 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 fi -old_pkgs=($(find ${CLEANUP_DESTDIR} -type f -name "*${PKGEXT}" -mtime +${CLEANUP_KEEP} -printf '%f\n')) +old_pkgs=($(find "${CLEANUP_DESTDIR}" -type f -name "*${PKGEXT}" -mtime +"${CLEANUP_KEEP}" -printf '%f\n')) if [ ${#old_pkgs[@]} -ge 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 @@ -82,7 +81,7 @@ fi for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${arch} + repo_unlock "${repo}" "${arch}" done done diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index 86a8f1d..33a4eb6 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -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' diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index f5f80c8..105bac4 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -10,9 +10,9 @@ for _repo in "${PKGREPOS[@]}"; do # Find all pkgnames on this repo's abs on_abs=($( - find ${SVNREPO}/${_repo} -name PKGBUILD | \ + find "${SVNREPO}/${_repo}" -name PKGBUILD | \ while read pkgbuild; do - source ${pkgbuild} >/dev/null 2>&1 + source "${pkgbuild}" >/dev/null 2>&1 # cleanup to save memory unset build package source md5sums pkgdesc pkgver pkgrel epoch \ url license arch depends makedepends optdepends options \ @@ -20,11 +20,11 @@ for _repo in "${PKGREPOS[@]}"; do # also cleanup package functions for _pkg in "${pkgname[@]}"; do - unset package_${pkg} >/dev/null 2>&1 + unset "package_${pkg}" >/dev/null 2>&1 done # this fills the on_abs array - echo ${pkgname[@]} + echo "${pkgname[@]}" done )) @@ -36,20 +36,21 @@ for _repo in "${PKGREPOS[@]}"; do # Find all pkgnames on repos on_repo=($( - find ${FTP_BASE}/${_repo} -name "*.pkg.tar.?z" -printf "%f\n" | \ - sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" + find "${FTP_BASE}/${_repo}" -name "*.pkg.tar.?z" \ + -printf "%f\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" )) # Compares them, whatever is on repos but not on abs should be removed - remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \ - <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u))) + remove=($(comm -13 \ + <(printf '%s\n' "${on_abs[@]}" | sort -u) \ + <(printf '%s\n' "${on_repo[@]}" | sort -u) )) # Remove them from databases, ftpdir-cleanup will take care of the rest - find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ - repo-remove {} ${remove[@]} >/dev/null 2>&1 \; + find "${FTP_BASE}/${_repo}" -name "*.db.tar.?z" -exec \ + repo-remove {} "${remove[@]}" >/dev/null 2>&1 \; msg2 "Removed the following packages:" - plain "$(echo ${remove[@]} | tr ' ' "\n")" + plain '%s' "${remove[@]}" done diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 8171980..9c07c22 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -9,7 +9,7 @@ script_lock for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_lock ${repo} ${arch} || exit 1 + repo_lock "${repo}" "${arch}" || exit 1 done done @@ -41,7 +41,7 @@ done for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${arch} + repo_unlock "${repo}" "${arch}" done done @@ -74,7 +74,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 @@ -99,9 +99,9 @@ for repo in "${PKGREPOS[@]}"; do mv "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}" # Avoid creating the same source package for every arch echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" - newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" + newpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") else - failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" + failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") fi popd >/dev/null fi @@ -128,22 +128,22 @@ old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-s if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old source packages..." - ${SOURCE_CLEANUP_DRYRUN} && warning 'dry run mode is active' + "${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 "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" fi done fi -old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n')) +old_pkgs=($(find "${SOURCE_CLEANUP_DESTDIR}" -type f -name "*${SRCEXT}" -mtime +"${SOURCE_CLEANUP_KEEP}" -printf '%f\n')) if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old source packages from the cleanup directory..." 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/sourceballs2 b/cron-jobs/sourceballs2 index 49a2dac..f7b3779 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -24,11 +24,11 @@ pushd "${SVNREPO}" >/dev/null for repo in "${PKGREPOS[@]}"; do msg "Sourceballing [${repo}]" - pushd $repo >/dev/null + pushd "$repo" >/dev/null find -maxdepth 1 -type d | while read pkg; do pushd "${SVNREPO}/$repo/$pkg" >/dev/null - [[ ! -e PKGBUILD ]] && { + [[ ! -e ./PKGBUILD ]] && { warning "$repo/$pkg is not a package" continue } @@ -41,7 +41,7 @@ for repo in "${PKGREPOS[@]}"; do optdepends license arch options check mksource for _pkg in "${pkgname[@]}"; do - unset package_${_pkg} >/dev/null 2>&1 + unset "package_${_pkg}" >/dev/null 2>&1 done pkgbase=${pkgbase:-$pkgname} @@ -54,7 +54,7 @@ for repo in "${PKGREPOS[@]}"; do makepkg --allsource --ignorearch -c >/dev/null 2>&1 - [ $? -ne 0 ] && plain ${srcfile} + [ $? -ne 0 ] && plain '%s' "${srcfile}" done # end find pkgs popd >/dev/null diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs index 901cc4b..e710f7c 100755 --- a/cron-jobs/update-abs-tarballs +++ b/cron-jobs/update-abs-tarballs @@ -2,6 +2,4 @@ . "$(dirname "$(readlink -e "$0")")/../config" -rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ ${FTP_BASE}/ - -exit $? +rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ "${FTP_BASE}/" -- cgit v1.2.3-2-g168b From 386c2d00249eb244bbcc9a173a64f9435b70180a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 13:45:10 -0400 Subject: Use printf formatters instead of string interpolation. I used this command to find them: egrep -r --exclude-dir={test,.git} '(plain|msg|msg2|warning|error|stat_busy|stat_done|abort|die)\s+"?[^"]*\$' --- cron-jobs/ftpdir-cleanup | 12 ++++++------ cron-jobs/integrity-check | 2 +- cron-jobs/repo-sanity-check | 4 ++-- cron-jobs/sourceballs | 12 ++++++------ cron-jobs/sourceballs2 | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index d5a277b..04ca6c9 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -36,17 +36,17 @@ for repo in "${PKGREPOS[@]}"; do missing_pkgs=($(comm -13 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if [ ${#missing_pkgs[@]} -ge 1 ]; then - error "Missing packages in [${repo}] (${arch})..." + error "Missing packages in [%s] (%s)..." "${repo}" "${arch}" for missing_pkg in "${missing_pkgs[@]}"; do - msg2 "${missing_pkg}" + msg2 '%s' "${missing_pkg}" done fi old_pkgs=($(comm -23 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if [ ${#old_pkgs[@]} -ge 1 ]; then - msg "Removing old packages from [${repo}] (${arch})..." + 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 @@ -62,7 +62,7 @@ old_pkgs=($(comm -23 "${WORKDIR}/pool" "${WORKDIR}/db")) if [ ${#old_pkgs[@]} -ge 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 @@ -71,7 +71,7 @@ old_pkgs=($(find "${CLEANUP_DESTDIR}" -type f -name "*${PKGEXT}" -mtime +"${CLEA if [ ${#old_pkgs[@]} -ge 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 33a4eb6..7459380 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -8,7 +8,7 @@ dirname="$(dirname "$(readlink -e "$0")")" script_lock if [ $# -ne 1 ]; then - die "usage: ${0##*/} " + die "usage: %s " "${0##*/}" fi mailto=$1 diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 105bac4..012b544 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -6,7 +6,7 @@ # Traverse all repos for _repo in "${PKGREPOS[@]}"; do - msg "Cleaning up [${_repo}]" + msg "Cleaning up [%s]" "${_repo}" # Find all pkgnames on this repo's abs on_abs=($( @@ -30,7 +30,7 @@ for _repo in "${PKGREPOS[@]}"; do # quit if abs is empty if [ ${#on_abs[*]} -eq 0 ]; then - warning "[${_repo}]'s ABS tree is empty, skipping" + warning "[%s]'s ABS tree is empty, skipping" "${_repo}" break fi diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 9c07c22..5ce7cfd 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -108,15 +108,15 @@ for repo in "${PKGREPOS[@]}"; do done < "${WORKDIR}/db-${repo}" if [ ${#newpkgs[@]} -ge 1 ]; then - msg "Adding source packages for [${repo}]..." + 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 [${repo}]..." + 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 @@ -130,7 +130,7 @@ if [ ${#old_pkgs[@]} -ge 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 "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" @@ -142,7 +142,7 @@ old_pkgs=($(find "${SOURCE_CLEANUP_DESTDIR}" -type f -name "*${SRCEXT}" -mtime + if [ ${#old_pkgs[@]} -ge 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/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index f7b3779..c431e9f 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -22,14 +22,14 @@ find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort pushd "${SVNREPO}" >/dev/null for repo in "${PKGREPOS[@]}"; do - msg "Sourceballing [${repo}]" + msg "Sourceballing [%s]" "${repo}" pushd "$repo" >/dev/null find -maxdepth 1 -type d | while read pkg; do pushd "${SVNREPO}/$repo/$pkg" >/dev/null [[ ! -e ./PKGBUILD ]] && { - warning "$repo/$pkg is not a package" + warning "%s is not a package" "$repo/$pkg" continue } -- cgit v1.2.3-2-g168b From b2abcf95b33fc3c24855da83bc71112098e849b4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 14:19:49 -0400 Subject: use mv_acl --- cron-jobs/ftpdir-cleanup | 4 ++-- cron-jobs/sourceballs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 04ca6c9..4a2b418 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -12,9 +12,9 @@ clean_pkg() { if [ -h "$pkg" ]; then rm -f "$pkg" "$pkg.sig" else - mv -f "$pkg" "$CLEANUP_DESTDIR" + mv_acl "$pkg" "$CLEANUP_DESTDIR/${pkg##*/}" if [ -e "$pkg.sig" ]; then - mv -f "$pkg.sig" "$CLEANUP_DESTDIR" + mv_acl "$pkg.sig" "$CLEANUP_DESTDIR/${pkg##*/}.sig" fi touch "${CLEANUP_DESTDIR}/${pkg##*/}" fi diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 5ce7cfd..b172685 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -96,7 +96,7 @@ for repo in "${PKGREPOS[@]}"; do pushd "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null makepkg --nocolor --allsource --ignorearch # >/dev/null 2>&1 if [ $? -eq 0 ] && [ -f "${pkgbase}-${pkgver}${SRCEXT}" ]; then - mv "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}" + mv_acl "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}/${pkgbase}-${pkgver}${SRCEXT}" # Avoid creating the same source package for every arch echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" newpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") @@ -132,7 +132,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then for old_pkg in "${old_pkgs[@]}"; do msg2 '%s' "${old_pkg}" if ! "${SOURCE_CLEANUP_DRYRUN}"; then - mv "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" + mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" fi done -- cgit v1.2.3-2-g168b From b3c27405fb9e2686d3db9ee23ca616dc6b93b1f3 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 14:20:35 -0400 Subject: silly whitespace and similar fidling --- cron-jobs/repo-sanity-check | 8 +++----- cron-jobs/sourceballs2 | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 012b544..86f9629 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -1,5 +1,5 @@ #!/bin/bash -# Solves issue165 +# Solves issue165... on the old flyspray install. I have no idea what issue that was. . "$(dirname "$(readlink -e "$0")")/../config" . "$(dirname "$(readlink -e "$0")")/../db-functions" @@ -46,12 +46,10 @@ for _repo in "${PKGREPOS[@]}"; do <(printf '%s\n' "${on_repo[@]}" | sort -u) )) # Remove them from databases, ftpdir-cleanup will take care of the rest - find "${FTP_BASE}/${_repo}" -name "*.db.tar.?z" -exec \ - repo-remove {} "${remove[@]}" >/dev/null 2>&1 \; + find "${FTP_BASE}/${_repo}" -name "*.db.tar.?z" \ + -exec repo-remove {} "${remove[@]}" >/dev/null 2>&1 \; msg2 "Removed the following packages:" plain '%s' "${remove[@]}" done - -exit $? diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index c431e9f..e935f86 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -13,7 +13,7 @@ pushd "${WORKDIR}" >/dev/null script_lock -#adjust the nice level to run at a lower priority +# Adjust the nice level to run at a lower priority renice +10 -p $$ > /dev/null # Create a list of all available source package file names -- cgit v1.2.3-2-g168b From 67e03640968bba58e40f22945f21e220425d6909 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 14:33:36 -0400 Subject: cron-jobs/repo-sanity-check: re-arrange redirectorys to be more clear --- cron-jobs/repo-sanity-check | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 86f9629..c7ee377 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -22,7 +22,7 @@ for _repo in "${PKGREPOS[@]}"; do for _pkg in "${pkgname[@]}"; do unset "package_${pkg}" >/dev/null 2>&1 done - + # this fills the on_abs array echo "${pkgname[@]}" done @@ -47,7 +47,7 @@ for _repo in "${PKGREPOS[@]}"; do # Remove them from databases, ftpdir-cleanup will take care of the rest find "${FTP_BASE}/${_repo}" -name "*.db.tar.?z" \ - -exec repo-remove {} "${remove[@]}" >/dev/null 2>&1 \; + -exec repo-remove {} "${remove[@]}" \; >/dev/null 2>&1 msg2 "Removed the following packages:" plain '%s' "${remove[@]}" -- cgit v1.2.3-2-g168b From e0c3d7b0ba452d75a478f2c8505c9b46dabe29b5 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 14:34:09 -0400 Subject: sourceballs: (from Arch): create the workdir with mode 0770 --- cron-jobs/sourceballs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index b172685..2895725 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -79,7 +79,7 @@ for repo in "${PKGREPOS[@]}"; do fi # Get the sources from svn - mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}" + mkdir -p -m0770 "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}" #svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}" \ # "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1 -- cgit v1.2.3-2-g168b From 441f81329e9b20775402aa7778f8ab1141cc4a62 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 19:33:37 -0400 Subject: remove extra whitespace --- cron-jobs/repo-sanity-check | 1 - 1 file changed, 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index c7ee377..bd89240 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -51,5 +51,4 @@ for _repo in "${PKGREPOS[@]}"; do msg2 "Removed the following packages:" plain '%s' "${remove[@]}" - done -- cgit v1.2.3-2-g168b From 906544cad702b9b8816717c8ba00d40bfe10a471 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 19:34:09 -0400 Subject: sourceballs: Only show makepkg output on errors. Also, set SRCPKGDEST. --- cron-jobs/sourceballs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 2895725..a9addc3 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -94,7 +94,7 @@ for repo in "${PKGREPOS[@]}"; do # Build the actual source package pushd "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null - makepkg --nocolor --allsource --ignorearch # >/dev/null 2>&1 + SRCPKGDEST=. makepkg --nocolor --allsource --ignorearch --skippgpcheck >"${WORKDIR}/${pkgbase}.log" 2>&1 if [ $? -eq 0 ] && [ -f "${pkgbase}-${pkgver}${SRCEXT}" ]; then mv_acl "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}/${pkgbase}-${pkgver}${SRCEXT}" # Avoid creating the same source package for every arch @@ -102,6 +102,7 @@ for repo in "${PKGREPOS[@]}"; do newpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") else failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") + cat "${WORKDIR}/${pkgbase}.log" >> "${WORKDIR}/makepkg-fail.log" fi popd >/dev/null fi @@ -147,4 +148,9 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then done fi +if [ -f "${WORKDIR}/makepkg-fail.log" ]; then + msg "Log of failed packages" + cat "${WORKDIR}/makepkg-fail.log" +fi + script_unlock -- cgit v1.2.3-2-g168b From c8c524bd20f3fc9e65af55b17e1bb2a8548a574a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 20:29:42 -0400 Subject: clean up cron-jobs/sourceballs* --- cron-jobs/sourceballs | 7 +++--- cron-jobs/sourceballs2 | 62 -------------------------------------------------- 2 files changed, 3 insertions(+), 66 deletions(-) delete mode 100755 cron-jobs/sourceballs2 (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index c12a128..3722449 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -63,11 +63,10 @@ for repo in "${PKGREPOS[@]}"; do if grep -Fqx "${pkgbase}" "${dirname}/sourceballs.skip"; then continue fi - # Commenting out, we'll sourceball everything # Check if the license or .force file does not enforce creating a source package -# if ! (chk_license ${pkglicense[@]} || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then -# continue -# fi + if ! ([[ ${#ALLOWED_LICENSES[@]} -eq 0 ]] || chk_license ${pkglicense[@]} || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then + continue + fi # Store the expected file name of the source package echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/expected-src-pkgs" diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 deleted file mode 100755 index e935f86..0000000 --- a/cron-jobs/sourceballs2 +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# Steps -# Traverse ABSLibre -# Makepkg --allsource every package -# Remove the old sourceballs - -dirname="$(dirname "$(readlink -e "$0")")" -. "${dirname}/../config" -. "${dirname}/../db-functions" -. "${MAKEPKGCONF}" - -pushd "${WORKDIR}" >/dev/null - -script_lock - -# Adjust the nice level to run at a lower priority -renice +10 -p $$ > /dev/null - -# Create a list of all available source package file names -find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" - -pushd "${SVNREPO}" >/dev/null - -for repo in "${PKGREPOS[@]}"; do - msg "Sourceballing [%s]" "${repo}" - - pushd "$repo" >/dev/null - find -maxdepth 1 -type d | while read pkg; do - pushd "${SVNREPO}/$repo/$pkg" >/dev/null - - [[ ! -e ./PKGBUILD ]] && { - warning "%s is not a package" "$repo/$pkg" - continue - } - - # Unset the previous data - unset pkgbase pkgname pkgver pkgrel - source PKGBUILD - - unset build package url pkgdesc source md5sums depends makedepends \ - optdepends license arch options check mksource - - for _pkg in "${pkgname[@]}"; do - unset "package_${_pkg}" >/dev/null 2>&1 - done - - pkgbase=${pkgbase:-$pkgname} - srcfile="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" - - echo "${srcfile}" >> "${WORKDIR}/expected-src-pkgs" - - # Skip already sourceballed - [ -e "${SRCPKGDEST}/${srcfile}" ] && continue - - makepkg --allsource --ignorearch -c >/dev/null 2>&1 - - [ $? -ne 0 ] && plain '%s' "${srcfile}" - - done # end find pkgs - popd >/dev/null - -done # end repos -- cgit v1.2.3-2-g168b From b82fbfc8761fda2a682e4037d08cf1a9730eebf8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 20:31:31 -0400 Subject: rm cron-jobs/repo-sanity-check This was the last program using SVNREPO. Also, I want to do better than this. --- cron-jobs/repo-sanity-check | 54 --------------------------------------------- 1 file changed, 54 deletions(-) delete mode 100755 cron-jobs/repo-sanity-check (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check deleted file mode 100755 index bd89240..0000000 --- a/cron-jobs/repo-sanity-check +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Solves issue165... on the old flyspray install. I have no idea what issue that was. - -. "$(dirname "$(readlink -e "$0")")/../config" -. "$(dirname "$(readlink -e "$0")")/../db-functions" - -# Traverse all repos -for _repo in "${PKGREPOS[@]}"; do - msg "Cleaning up [%s]" "${_repo}" - - # Find all pkgnames on this repo's abs - on_abs=($( - find "${SVNREPO}/${_repo}" -name PKGBUILD | \ - while read pkgbuild; do - source "${pkgbuild}" >/dev/null 2>&1 - # cleanup to save memory - unset build package source md5sums pkgdesc pkgver pkgrel epoch \ - url license arch depends makedepends optdepends options \ - >/dev/null 2>&1 - - # also cleanup package functions - for _pkg in "${pkgname[@]}"; do - unset "package_${pkg}" >/dev/null 2>&1 - done - - # this fills the on_abs array - echo "${pkgname[@]}" - done - )) - - # quit if abs is empty - if [ ${#on_abs[*]} -eq 0 ]; then - warning "[%s]'s ABS tree is empty, skipping" "${_repo}" - break - fi - - # Find all pkgnames on repos - on_repo=($( - find "${FTP_BASE}/${_repo}" -name "*.pkg.tar.?z" \ - -printf "%f\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" - )) - - # Compares them, whatever is on repos but not on abs should be removed - remove=($(comm -13 \ - <(printf '%s\n' "${on_abs[@]}" | sort -u) \ - <(printf '%s\n' "${on_repo[@]}" | sort -u) )) - - # Remove them from databases, ftpdir-cleanup will take care of the rest - find "${FTP_BASE}/${_repo}" -name "*.db.tar.?z" \ - -exec repo-remove {} "${remove[@]}" \; >/dev/null 2>&1 - - msg2 "Removed the following packages:" - plain '%s' "${remove[@]}" -done -- cgit v1.2.3-2-g168b From 4b9ab7834a9f0bff173a40932f681ac149049408 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 20:55:24 -0400 Subject: sourceballs: fix quoted array --- cron-jobs/sourceballs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 3722449..b657813 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -64,7 +64,7 @@ for repo in "${PKGREPOS[@]}"; do continue fi # Check if the license or .force file does not enforce creating a source package - if ! ([[ ${#ALLOWED_LICENSES[@]} -eq 0 ]] || chk_license ${pkglicense[@]} || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then + if ! ([[ ${#ALLOWED_LICENSES[@]} -eq 0 ]] || chk_license "${pkglicense[@]}" || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then continue fi # Store the expected file name of the source package -- cgit v1.2.3-2-g168b From f6b561c1ef3fd1ec0c0abba0e426ef769e14d0a0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 20:58:51 -0400 Subject: clean up config --- cron-jobs/devlist-mailer | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/devlist-mailer b/cron-jobs/devlist-mailer index 1a05521..cede4fc 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 +source "$(dirname "$(readlink -e "$0")")/../config" SUBJECT="Repository Maintenance $(date +"%d-%m-%Y")" if [ $# -ge 1 ]; then -- cgit v1.2.3-2-g168b From b4ddeae83daca2e29d9b978abd50f49d2e6692ef Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 24 Jun 2014 22:43:54 -0400 Subject: foo --- cron-jobs/update-abs-tarballs | 5 ----- 1 file changed, 5 deletions(-) delete mode 100755 cron-jobs/update-abs-tarballs (limited to 'cron-jobs') diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs deleted file mode 100755 index e710f7c..0000000 --- a/cron-jobs/update-abs-tarballs +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -. "$(dirname "$(readlink -e "$0")")/../config" - -rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ "${FTP_BASE}/" -- cgit v1.2.3-2-g168b From ee08c7abc25647e8ad038df03ac35144401b6091 Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Sun, 29 Jun 2014 15:34:37 +0100 Subject: Added an additional tracker. --- cron-jobs/make_repo_torrents | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index 0798a5e..b5c6749 100644 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -34,8 +34,8 @@ esac torrent_location='/srv/http/repo/public/torrents/' public_location='/srv/http/repo/public/' -# Tracker announce URL -tracker='http://t67.eu:6969/announce' # t67.eu is run by Xylon +# Tracker announce URLs, comma seperated +tracker='http://t67.eu:6969/announce,http://tracker.hackcoop.com.ar/announce' # t67.eu is run by Xylon # All mirrors go here #declare -a array=('http://repo.parabolagnulinux.org/' 'https://parabola.goodgnus.com.ar/' 'http://mirror.yandex.ru/mirrors/parabola/' 'http://alfplayer.com/parabola/' 'http://mirror.parlementum.net/') -- cgit v1.2.3-2-g168b From 5fad74e56b72810c9d7f86956236ff45654fb684 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 26 Jul 2014 20:20:33 -0400 Subject: make_repo_torrents: load the location from the common config file --- cron-jobs/make_repo_torrents | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) mode change 100644 => 100755 cron-jobs/make_repo_torrents (limited to 'cron-jobs') diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents old mode 100644 new mode 100755 index b5c6749..faee191 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -31,8 +31,9 @@ esac # pacman doesn't support multiple different packages of the same name, # so it's OK to just stuff all the torrents into a single directory. -torrent_location='/srv/http/repo/public/torrents/' -public_location='/srv/http/repo/public/' +. "$(dirname "$(readlink -e "$0")")/../config" +public_location="$FTP_BASE/" +torrent_location="$FTP_BASE/torrents/" # Tracker announce URLs, comma seperated tracker='http://t67.eu:6969/announce,http://tracker.hackcoop.com.ar/announce' # t67.eu is run by Xylon -- cgit v1.2.3-2-g168b From b2a763cee1f67751065c39800a59c431ec872bfa Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Sun, 27 Jul 2014 11:55:01 +0100 Subject: Dividing make_repo_torrents into two scripts, one to make the actual torrent and a wrapper to find any updated packages and call the first script for each... --- cron-jobs/make_repo_torrents | 57 ++++++-------------------------------------- 1 file changed, 7 insertions(+), 50 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index faee191..c94d073 100755 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -14,7 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# This script depends on `mktorrent' +# This script finds any updated packages and makes calls +# `make_indivudual_torrent' for each of them. username=$( id -un ) @@ -35,71 +36,27 @@ esac public_location="$FTP_BASE/" torrent_location="$FTP_BASE/torrents/" -# Tracker announce URLs, comma seperated -tracker='http://t67.eu:6969/announce,http://tracker.hackcoop.com.ar/announce' # t67.eu is run by Xylon - -# All mirrors go here -#declare -a array=('http://repo.parabolagnulinux.org/' 'https://parabola.goodgnus.com.ar/' 'http://mirror.yandex.ru/mirrors/parabola/' 'http://alfplayer.com/parabola/' 'http://mirror.parlementum.net/') - -# I'm removing all mirrors but one since pacman2pacman now re-writes -# the webseeds list to just point to the user's chosen mirror -declare -a array=('http://repo.parabolagnulinux.org/') - -# I got this function from http://mywiki.wooledge.org/BashFAQ/026 . It -# shuffles an array. Uses a global array variable. Must be compact -# (not a sparse array). The array must be called `array'. -shuffle() { - local i tmp size max rand - - # $RANDOM % (i+1) is biased because of the limited range of $RANDOM - # Compensate by using a range which is a multiple of the array size. - size=${#array[*]} - max=$(( 32768 / size * size )) - - for ((i=size-1; i>0; i--)); do - while (( (rand=$RANDOM) >= max )); do :; done - rand=$(( rand % (i+1) )) - tmp=${array[i]} array[i]=${array[rand]} array[rand]=$tmp - done -} - cd "${torrent_location}" +# Find any directories that might have packages in then find "${public_location}" -name 'os' -type 'd' | while read dir do + # Find any packages find "${dir}" -name '*\.pkg\.tar\.xz' | while read pkg do - pkg_name="${pkg##*/}" - if [[ -h "${pkg}" ]] # check if it's a symbolic link then # We get the target of the symlink pkg=$( readlink -f "${pkg}" ) fi + # If a .torrent file does not already exist for this package, we call + # `make_individual_torrent' to make it. if ! [[ -f "${torrent_location}${pkg_name}.torrent" ]] then - # We need to make a comma seperated list of webseeds (this is passed - # as a single argument to mktorrent) - webseeds='' - - # Randomize the order of the list of webseeds because I - # don't know if transmission might always use the one at - # the top otherwize. - shuffle - - for prefix in "${array[@]}" - do - webseeds+="${prefix}${pkg#${public_location}}," - done - - # There should not be a random comma at the end of the webseeds - webseeds="${webseeds%,}" - - mktorrent -a "${tracker}" "${pkg}" -w "${webseeds}" >/dev/null || - echo "Error making torrent for \"${pkg}\"" + /srv/http/repo/dbscripts/make_individual_torrent "${pkg}" fi done done -- cgit v1.2.3-2-g168b From 6790ac43f2f79fea6adcfef2a10d3c4105574216 Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Sun, 27 Jul 2014 12:07:06 +0100 Subject: fixed loads of mistakes I make --- cron-jobs/make_repo_torrents | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index c94d073..a5d72a5 100755 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -46,6 +46,8 @@ do find "${dir}" -name '*\.pkg\.tar\.xz' | while read pkg do + pkg_name="${pkg##*/}" + if [[ -h "${pkg}" ]] # check if it's a symbolic link then # We get the target of the symlink @@ -56,7 +58,7 @@ do # `make_individual_torrent' to make it. if ! [[ -f "${torrent_location}${pkg_name}.torrent" ]] then - /srv/http/repo/dbscripts/make_individual_torrent "${pkg}" + /srv/http/repo/dbscripts/make_individual_torrent "${pkg}" "${public_location}" fi done done -- cgit v1.2.3-2-g168b From 5e9c23a6cc430138358c97544b1a9219d643b6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Tue, 30 Sep 2014 21:18:41 +0200 Subject: Fix make_repo_torrents for the new server. --- cron-jobs/make_repo_torrents | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index a5d72a5..fec4698 100755 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -32,6 +32,7 @@ esac # pacman doesn't support multiple different packages of the same name, # so it's OK to just stuff all the torrents into a single directory. +script_directory="$(dirname "$(readlink -e "$0")")/.." . "$(dirname "$(readlink -e "$0")")/../config" public_location="$FTP_BASE/" torrent_location="$FTP_BASE/torrents/" @@ -58,7 +59,7 @@ do # `make_individual_torrent' to make it. if ! [[ -f "${torrent_location}${pkg_name}.torrent" ]] then - /srv/http/repo/dbscripts/make_individual_torrent "${pkg}" "${public_location}" + "$script_directory/make_individual_torrent" "${pkg}" "${public_location}" fi done done -- cgit v1.2.3-2-g168b From 724674000a5c4ac1ce87db0b5f86b51d1d070a41 Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Fri, 3 Oct 2014 22:21:44 +0100 Subject: Fixed typo in comments --- cron-jobs/make_repo_torrents | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index fec4698..fc723f1 100755 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# This script finds any updated packages and makes calls +# This script finds any updated packages and calls # `make_indivudual_torrent' for each of them. username=$( id -un ) -- cgit v1.2.3-2-g168b From 2b25f7944ef903ede14d573b2ea5e7c9d736017e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 24 May 2015 16:28:46 -0600 Subject: cron-jobs/update-abs-tarballs: Remove; everything is on the same server now. It just ran `rsync` to sync things between servers. --- cron-jobs/update-abs-tarballs | 5 ----- 1 file changed, 5 deletions(-) delete mode 100755 cron-jobs/update-abs-tarballs (limited to 'cron-jobs') diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs deleted file mode 100755 index e710f7c..0000000 --- a/cron-jobs/update-abs-tarballs +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -. "$(dirname "$(readlink -e "$0")")/../config" - -rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ "${FTP_BASE}/" -- cgit v1.2.3-2-g168b From 70a3f4fb4d6994e73b5ad19b4218bde609150249 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 24 May 2015 16:29:07 -0600 Subject: repo-sanity-check: expand on the comment at the top. --- cron-jobs/repo-sanity-check | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cron-jobs') diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index bd89240..239f042 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -1,5 +1,8 @@ #!/bin/bash -# Solves issue165... on the old flyspray install. I have no idea what issue that was. +# Solves issue165... on the old roundup install. From the database +# backups, the title was "Older/deprecated packages never leave the +# repo", I don't know how the body of the issue is stored in the DB, +# but the title says enough, I think. . "$(dirname "$(readlink -e "$0")")/../config" . "$(dirname "$(readlink -e "$0")")/../db-functions" -- cgit v1.2.3-2-g168b From d0834f7e6bd53ea729374eab138bb38a36c73996 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 20 May 2015 20:41:17 -0600 Subject: Clean up shebangs --- cron-jobs/check_archlinux/check_packages.py | 2 +- cron-jobs/make_repo_torrents | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/check_archlinux/check_packages.py b/cron-jobs/check_archlinux/check_packages.py index d233bf6..ac0194f 100755 --- a/cron-jobs/check_archlinux/check_packages.py +++ b/cron-jobs/check_archlinux/check_packages.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/env python2 # # check_archlinux.py # diff --git a/cron-jobs/make_repo_torrents b/cron-jobs/make_repo_torrents index fc723f1..2eb0978 100755 --- a/cron-jobs/make_repo_torrents +++ b/cron-jobs/make_repo_torrents @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/bash # Copyright (C) 2014 Joseph Graham # # This program is free software: you can redistribute it and/or modify -- cgit v1.2.3-2-g168b From 148bfaf36c04106e4ff1043dff2c5f6c3d75149e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 25 May 2015 01:08:20 -0600 Subject: Handle empty things (from Arch Linux) --- cron-jobs/ftpdir-cleanup | 2 +- cron-jobs/sourceballs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 560689a..4063c09 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -64,7 +64,7 @@ done # get a list of all available packages in the pacakge pool find "$FTP_BASE/${PKGPOOL}" -name "*${PKGEXT}" -printf '%f\n' | sort > "${WORKDIR}/pool" # create a list of packages in our db -cat "${WORKDIR}/db-"* | sort -u > "${WORKDIR}/db" +find "${WORKDIR}" -maxdepth 1 -type f -name 'db-*' -exec cat {} \; | sort -u > "${WORKDIR}/db" old_pkgs=($(comm -23 "${WORKDIR}/pool" "${WORKDIR}/db")) if [ ${#old_pkgs[@]} -ge 1 ]; then diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index b657813..b696dd4 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -117,8 +117,8 @@ for repo in "${PKGREPOS[@]}"; do done # Cleanup old source packages -cat "${WORKDIR}/expected-src-pkgs" | sort -u > "${WORKDIR}/expected-src-pkgs.sort" -cat "${WORKDIR}/available-src-pkgs" | sort -u > "${WORKDIR}/available-src-pkgs.sort" +find "${WORKDIR}" -maxdepth 1 -type f -name 'expected-src-pkgs' -exec cat {} \; | sort -u > "${WORKDIR}/expected-src-pkgs.sort" +find "${WORKDIR}" -maxdepth 1 -type f -name 'available-src-pkgs' -exec cat {} \; | sort -u > "${WORKDIR}/available-src-pkgs.sort" old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-src-pkgs.sort")) if [ ${#old_pkgs[@]} -ge 1 ]; then -- cgit v1.2.3-2-g168b From f1fa54c8637f00587193879f13ab2060d4e7afbb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 25 May 2015 01:08:36 -0600 Subject: Remove pointless differences from Arch Linux --- cron-jobs/devlist-mailer | 2 +- cron-jobs/sourceballs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/devlist-mailer b/cron-jobs/devlist-mailer index cede4fc..7f298b9 100755 --- a/cron-jobs/devlist-mailer +++ b/cron-jobs/devlist-mailer @@ -3,7 +3,7 @@ # It does nothing if no output # Load $LIST and $FROM from the config file -source "$(dirname "$(readlink -e "$0")")/../config" +. "$(dirname "$(readlink -e "$0")")/../config" SUBJECT="Repository Maintenance $(date +"%d-%m-%Y")" if [ $# -ge 1 ]; then diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index b696dd4..c02912a 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -64,7 +64,7 @@ for repo in "${PKGREPOS[@]}"; do continue fi # Check if the license or .force file does not enforce creating a source package - if ! ([[ ${#ALLOWED_LICENSES[@]} -eq 0 ]] || 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 -- cgit v1.2.3-2-g168b