From 64effec1bf3c96fb75fe1aa6ddefa5a43db3e230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Ismael=20Haase=20Hern=C3=A1ndez?= Date: Sat, 16 Apr 2011 11:11:51 -0700 Subject: Using own db-update and ftpdir-cleanup --- db-update | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100755 db-update (limited to 'db-update') diff --git a/db-update b/db-update new file mode 100755 index 0000000..4740809 --- /dev/null +++ b/db-update @@ -0,0 +1,76 @@ +#!/bin/bash + +. "$(dirname $0)/db-functions" +. "$(dirname $0)/config" + +if [ $# -ge 1 ]; then + warning "Calling $(basename $0) with a specific repository is no longer supported" + exit 1 +fi + +# Find repos with packages to release +repos=($(find "${STAGING}" -mindepth 1 -type d ! -empty -printf '%f ' 2>/dev/null)) +if [ $? -ge 1 ]; then + die "Could not read ${STAGING}" +fi + +# TODO: this might lock too much (architectures) +for repo in ${repos[@]}; do + for pkgarch in ${ARCHES[@]}; do + repo_lock ${repo} ${pkgarch} || exit 1 + done +done + +# check if packages are valid +for repo in ${repos[@]}; do + if ! check_repo_permission "${repo}"; then + die "You don't have permission to update packages in ${repo}" + fi + pkgs=($(getpkgfiles "${STAGING}/${repo}/"*${PKGEXT})) + if [ $? -eq 0 ]; then + for pkg in ${pkgs[@]}; do + if [ -h "${pkg}" ]; then + die "Package ${repo}/$(basename ${pkg}) is a symbolic link" + fi + if ! check_pkgfile "${pkg}"; then + die "Package ${repo}/$(basename ${pkg}) is not consistent with its meta data" + fi + #if ! check_pkgrepos "${pkg}"; then + # die "Package ${repo}/$(basename ${pkg}) already exists in another repository" + #fi + done + if ! check_splitpkgs ${repo} ${pkgs[@]}; then + die "Missing split packages for ${repo}" + fi + else + die "Could not read ${STAGING}" + fi +done + +for repo in ${repos[@]}; do + msg "Updating [${repo}]..." + any_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-any${PKGEXT} 2>/dev/null)) + for pkgarch in ${ARCHES[@]}; do + add_pkgs=() + arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-${pkgarch}${PKGEXT} 2>/dev/null)) + for pkg in ${arch_pkgs[@]} ${any_pkgs[@]}; do + pkgfile="$(basename ${pkg})" + msg2 "${pkgfile} (${pkgarch})" + # any packages might have been moved by the previous run + if [ -f "${pkg}" ]; then + mv "${pkg}" "$FTP_BASE/${PKGPOOL}" + fi + ln -s "../../../${PKGPOOL}/${pkgfile}" "$FTP_BASE/$repo/os/${pkgarch}" + add_pkgs[${#add_pkgs[*]}]=${pkgfile} + done + if [ ${#add_pkgs[@]} -ge 1 ]; then + arch_repo_add "${repo}" "${pkgarch}" ${add_pkgs[@]} + fi + done +done + +for repo in ${repos[@]}; do + for pkgarch in ${ARCHES[@]}; do + repo_unlock ${repo} ${pkgarch} + done +done -- cgit v1.2.3-2-g168b