diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-01-05 22:17:01 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-01-05 22:17:01 -0500 |
commit | 8c52811113e58289daec68289a503aee29ee1380 (patch) | |
tree | 7e8b410e6856a988f04967b484b4d56cf30848f9 | |
parent | a5dadc1f833f06f5cfa655fabfa37b54b6c168db (diff) |
librefetch: handle "empty" situations better
-rwxr-xr-x | src/abslibre-tools/librerelease | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease index 70ed128..06a26e8 100755 --- a/src/abslibre-tools/librerelease +++ b/src/abslibre-tools/librerelease @@ -53,9 +53,9 @@ readonly rsync_flags=( # Functions #################################################################### -list0_files() { - find -L "${WORKDIR}/staging" -type f -print0 | xargs -0 realpath -z --relative-to="${WORKDIR}/staging" -} +list0_files() ( + cd "$WORKDIR" && find -L 'staging' -type f -print0 +) # This function is taken almost verbatim from makepkg create_signature() { @@ -111,7 +111,9 @@ clean_files() { fi msg "Removing files from local staging directory" - cd "${WORKDIR}/staging" && xargs -0 -a "$file_list" "${rmcmd[@]}" + cd "${WORKDIR}/staging" && xargs -0r -a "$file_list" "${rmcmd[@]}" + cd "${WORKDIR}/staging" && find . -mindepth 1 -type d -empty \ + -exec rmdir -p {} + 2>/dev/null } ################################################################################ @@ -221,7 +223,7 @@ release_packages() { msg "%s to upload" "$(cd "${WORKDIR}/staging" && du -hc --files0-from="$file_list" | sed -n '$s/\t.*//p')" msg "Uploading packages..." - xargs -0 -a "$file_list" dirname -z | ssh ${REPODEST%%:*} "$(printf 'mkdir -p -- %q && cd %q && xargs -0 mkdir -pv --' "${REPODEST#*:}" "${REPODEST#*:}")" + xargs -0r -a "$file_list" dirname -z | ssh ${REPODEST%%:*} "$(printf 'mkdir -p -- %q && cd %q && xargs -0r mkdir -pv --' "${REPODEST#*:}" "${REPODEST#*:}")" if ! rsync ${dryrun} "${rsync_flags[@]}" \ -0 --files-from="$file_list" \ ${WORKDIR}/staging \ |