diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-04-17 10:45:45 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-04-17 10:45:45 -0400 |
commit | a79d7c7251f4e6fd2f8b288b5c91a77a66ecff65 (patch) | |
tree | f44145d6cda8bb20070edf1ce464ad60b6bf3a04 /db-update | |
parent | f73a4a8844641b780644b8b96865372dc34936bd (diff) | |
parent | 752bd700e9da464006bfbd9877cc858dfad545ba (diff) |
Merge branch 'lukeshu/xbs' into testmerge
# Conflicts:
# test/lib/common.inc
# test/test.d/create-filelists.sh
# test/test.d/db-move.sh
# test/test.d/db-remove.sh
# test/test.d/db-repo-add.sh
# test/test.d/db-repo-remove.sh
# test/test.d/db-update.sh
# test/test.d/ftpdir-cleanup.sh
# test/test.d/sourceballs.sh
Diffstat (limited to 'db-update')
-rwxr-xr-x | db-update | 98 |
1 files changed, 64 insertions, 34 deletions
@@ -1,74 +1,79 @@ #!/bin/bash -. "$(dirname $0)/config" -. "$(dirname $0)/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" if [ $# -ge 1 ]; then - warning "Calling ${0##*/} with a specific repository is no longer supported" + warning "Calling %s with a specific repository is no longer supported" "${0##*/}" exit 1 fi # Find repos with packages to release staging_repos=($(find "${STAGING}" -mindepth 1 -type f -name "*${PKGEXT}" -printf '%h\n' | sort -u)) if [ $? -ge 1 ]; then - die "Could not read ${STAGING}" + die "Could not read %s" "${STAGING}" fi repos=() -for staging_repo in ${staging_repos[@]##*/}; do - if in_array ${staging_repo} ${PKGREPOS[@]}; then - repos+=(${staging_repo}) +for staging_repo in "${staging_repos[@]##*/}"; do + if in_array "${staging_repo}" "${PKGREPOS[@]}"; then + repos+=("${staging_repo}") fi done # TODO: this might lock too much (architectures) -for repo in ${repos[@]}; do - for pkgarch in ${ARCHES[@]}; do - repo_lock ${repo} ${pkgarch} || exit 1 +for repo in "${repos[@]}"; do + for pkgarch in "${ARCHES[@]}"; do + repo_lock "${repo}" "${pkgarch}" || exit 1 done done # check if packages are valid -for repo in ${repos[@]}; do +for repo in "${repos[@]}"; do if ! check_repo_permission "${repo}"; then - die "You don't have permission to update packages in ${repo}" + die "You don't have permission to update packages in %s" "${repo}" fi pkgs=($(getpkgfiles "${STAGING}/${repo}/"*${PKGEXT})) if [ $? -eq 0 ]; then - for pkg in ${pkgs[@]}; do + for pkg in "${pkgs[@]}"; do if [ -h "${pkg}" ]; then - die "Package ${repo}/${pkg##*/} is a symbolic link" + die "Package %s is a symbolic link" "${repo}/${pkg##*/}" fi if ! check_pkgfile "${pkg}"; then - die "Package ${repo}/${pkg##*/} is not consistent with its meta data" + die "Package %s is not consistent with its meta data" "${repo}/${pkg##*/}" fi - if ${REQUIRE_SIGNATURE} && ! pacman-key -v "${pkg}.sig" >/dev/null 2>&1; then - die "Package ${repo}/${pkg##*/} does not have a valid signature" + if "${REQUIRE_SIGNATURE}" && ! pacman-key -v "${pkg}.sig" >/dev/null 2>&1; then + die "Package %s does not have a valid signature" "${repo}/${pkg##*/}" fi - if ! check_pkgsvn "${pkg}" "${repo}"; then - die "Package ${repo}/${pkg##*/} is not consistent with svn repository" + if ! check_pkgxbs "${pkg}" "${repo}"; then + die "Package %s is not consistent with %s" "${repo}/${pkg##*/}" "$(xbs name)" fi if ! check_pkgrepos "${pkg}"; then - die "Package ${repo}/${pkg##*/} already exists in another repository" + die "Package %s already exists in another repository" "${repo}/${pkg##*/}" + fi + if ! check_packager "${pkg}"; then + die "Package ${repo}/${pkg##*/} does not have a valid packager" fi done - if ! check_splitpkgs ${repo} ${pkgs[@]}; then - die "Missing split packages for ${repo}" + if ! check_splitpkgs "${repo}" "${pkgs[@]}"; then + die "Missing split packages for %s" "${repo}" fi else - die "Could not read ${STAGING}" + die "Could not read %s" "${STAGING}" fi done -for repo in ${repos[@]}; do - msg "Updating [${repo}]..." +dirs=() +for repo in "${repos[@]}"; do + msg "Updating [%s]..." "${repo}" any_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-any${PKGEXT} 2>/dev/null)) - for pkgarch in ${ARCHES[@]}; do + for pkgarch in "${ARCHES[@]}"; do + add_dirs=() add_pkgs=() - arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-${pkgarch}${PKGEXT} 2>/dev/null)) - for pkg in ${arch_pkgs[@]} ${any_pkgs[@]}; do + arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-"${pkgarch}"${PKGEXT} 2>/dev/null)) + for pkg in "${arch_pkgs[@]}" "${any_pkgs[@]}"; do pkgfile="${pkg##*/}" - msg2 "${pkgfile} (${pkgarch})" + msg2 "%s (%s)" "${pkgfile}" "${pkgarch}" # any packages might have been moved by the previous run if [ -f "${pkg}" ]; then mv "${pkg}" "$FTP_BASE/${PKGPOOL}" @@ -81,16 +86,41 @@ for repo in ${repos[@]}; do if [ -f "$FTP_BASE/${PKGPOOL}/${pkgfile}.sig" ]; then ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "$FTP_BASE/$repo/os/${pkgarch}" fi - add_pkgs[${#add_pkgs[*]}]=${pkgfile} + add_dirs+=("${STAGING}/abslibre/$(getpkgarch "$FTP_BASE/$PKGPOOL/$pkgfile")/$repo/$(getpkgbase "$FTP_BASE/$PKGPOOL/$pkgfile")") + add_pkgs+=("${pkgfile}") + done + for add_dir in "${add_dirs[@]}"; do + (cd "${add_dir}" && xbs release-server "${repo}" "${pkgarch}") || + error 'cd %q && xbs release-server %q %q' "${add_dir}" "${repo}" "${pkgarch}" done if [ ${#add_pkgs[@]} -ge 1 ]; then - arch_repo_add "${repo}" "${pkgarch}" ${add_pkgs[@]} + arch_repo_add "${repo}" "${pkgarch}" "${add_pkgs[@]}" fi + dirs+=("${add_dirs[@]}") done done -for repo in ${repos[@]}; do - for pkgarch in ${ARCHES[@]}; do - repo_unlock ${repo} ${pkgarch} +for repo in "${repos[@]}"; do + for pkgarch in "${ARCHES[@]}"; do + repo_unlock "${repo}" "${pkgarch}" done done + +cd "${STAGING}" + +# Remove left over XBS files +rm -rf -- "${dirs[@]}" +dirname -z -- "${dirs[@]}" | + xargs -0 realpath -zm --relative-to="${STAGING}" -- | + xargs -0 rmdir -p -- 2>/dev/null + +# Stage generated source files +while read -r file; do + pub="${FTP_BASE}/${file}" + if [[ -f "$pub" ]]; then + warning "file already exists: %s" "${file}" + else + mkdir -p -- "${pub%/*}" + mv -vn "$file" "$pub" + fi +done < <(find other sources -type f 2>/dev/null) |