summaryrefslogtreecommitdiff
path: root/cron-jobs
diff options
context:
space:
mode:
Diffstat (limited to 'cron-jobs')
-rwxr-xr-xcron-jobs/check_archlinux/parse_pkgbuilds.sh22
-rwxr-xr-xcron-jobs/ftpdir-cleanup12
-rwxr-xr-xcron-jobs/integrity-check2
-rwxr-xr-xcron-jobs/repo-sanity-check57
-rwxr-xr-xcron-jobs/sourceballs35
-rwxr-xr-xcron-jobs/sourceballs262
-rwxr-xr-xcron-jobs/update-abs-tarballs7
7 files changed, 162 insertions, 35 deletions
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/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
new file mode 100755
index 0000000..8b0758f
--- /dev/null
+++ b/cron-jobs/repo-sanity-check
@@ -0,0 +1,57 @@
+#!/bin/bash
+# Solves issue165
+
+. "$(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")"
+
+done
+
+exit $?
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 2362024..d5bf54b 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
# <pkgbase|pkgname> <pkgver>-<pkgrel> <arch> <license>[ <license>]
-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,24 +49,25 @@ 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
continue
fi
+ # Commenting out, we'll sourceball everything
# Check if the license or .force file does not enforce creating a source package
- if ! ([[ -z ${ALLOWED_LICENSES[@]} ]] || chk_license ${pkglicense[@]} || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then
- 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"
@@ -82,7 +83,7 @@ for repo in ${PKGREPOS[@]}; do
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}"
+ failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}")
continue
fi
@@ -104,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
@@ -124,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}"
@@ -136,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
new file mode 100755
index 0000000..2a26e6a
--- /dev/null
+++ b/cron-jobs/sourceballs2
@@ -0,0 +1,62 @@
+#!/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 [${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"
+ 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 ${srcfile}
+
+ done # end find pkgs
+ popd >/dev/null
+
+done # end repos
diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs
new file mode 100755
index 0000000..901cc4b
--- /dev/null
+++ b/cron-jobs/update-abs-tarballs
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+. "$(dirname "$(readlink -e "$0")")/../config"
+
+rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ ${FTP_BASE}/
+
+exit $?