From 8e670c23359134af39b1c97173895c09948c2acb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 24 Jun 2014 22:51:14 -0400 Subject: db-update: get the list of repos the same way as upstream Arch The largest advantage of this is that it implicitly ignores directories we don't want to consider repos. --- db-update | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'db-update') diff --git a/db-update b/db-update index 4d2cace..a0a3e39 100755 --- a/db-update +++ b/db-update @@ -11,11 +11,18 @@ if [ $# -ge 1 ]; then fi # Find repos with packages to release -repos=($(find "${STAGING}" -mindepth 1 -maxdepth 1 -type d ! -empty -printf '%f ' 2>/dev/null)) +staging_repos=($(find "${STAGING}" -mindepth 1 -type f -name "*${PKGEXT}" -printf '%h\n' | sort -u)) if [ $? -ge 1 ]; then 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}") + fi +done + # TODO: this might lock too much (architectures) for repo in "${repos[@]}"; do for pkgarch in "${ARCHES[@]}"; do -- cgit v1.2.3-2-g168b From b85f896c2cb614ac22b11c14bd9e7994773309eb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 4 Jul 2014 22:51:46 -0400 Subject: Fix having a flexible PKGEXT --- db-update | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'db-update') diff --git a/db-update b/db-update index a0a3e39..3c06f63 100755 --- a/db-update +++ b/db-update @@ -3,7 +3,10 @@ . "$(dirname "$(readlink -e "$0")")/config" . "$(dirname "$(readlink -e "$0")")/db-functions" -shopt -s nullglob +if [[ $STAGING = *luke* ]]; then + set -x + PKGEXT='.pkg.tar.?z' +fi if [ $# -ge 1 ]; then warning "Calling %s with a specific repository is no longer supported" "${0##*/}" @@ -32,11 +35,11 @@ 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 %s" "${repo}" + fi pkgs=($(getpkgfiles "${STAGING}/${repo}/"*${PKGEXT})) if [ $? -eq 0 ]; then - if [ ${#pkgs[@]} -gt 0 ] && ! check_repo_permission "${repo}"; then - die "You don't have permission to update packages in %s" "${repo}" - fi for pkg in "${pkgs[@]}"; do if [ -h "${pkg}" ]; then die "Package %s is a symbolic link" "${repo}/${pkg##*/}" @@ -95,10 +98,10 @@ done cd "${STAGING}" while read -r file; do pub="${FTP_BASE}/${file}" - if [[ -f $pub ]]; then + 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) +done < <(find other sources -type f 2>/dev/null) -- cgit v1.2.3-2-g168b