From 7d7556e3afb934b69b99f7a7b1960c7be3d04be2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 4 Jan 2014 22:27:52 -0500 Subject: librestage: stage files generated by librefetch --- src/abslibre-tools/librestage | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage index 6bbe80e..aa7f600 100755 --- a/src/abslibre-tools/librestage +++ b/src/abslibre-tools/librestage @@ -59,7 +59,8 @@ main() { # Load configuration load_files libretools check_vars libretools WORKDIR ARCHES || return 1 - load_files makepkg # for PKGDEST, which is optional + load_files makepkg # for PKGDEST and SRCDEST, which are optional + load_files librefetch # for MIRRORS, which is optional # Load the PKGBUILD load_PKGBUILD @@ -79,7 +80,7 @@ main() { pkgpath="$(readlink -f "$pkgpath")" fi - msg 'Found %s' "${pkgfile}" + msg 'Found package: %s' "${pkgfile}" canonical="" # is empty for the first iteration, set after that for repo in "${repos[@]}"; do @@ -101,10 +102,42 @@ main() { done done + for netfile in "${source[@]}"; do + for mirror in "${MIRRORS[@]}"; do + srcurl=${netfile#*::} + if [[ "$srcurl" == "$mirror"* ]]; then + if [[ $netfile = *::* ]]; then + srcname=${netfile%%::*} + else + srcname=${netfile##*/} + fi + + srcpath='' + for path in "./$srcname" "${SRCDEST:-.}/$srcname"; do + if [[ -f "path" ]]; then + srcpath="$path" + break + fi + done + if [[ -n "$srcpath" ]]; then + msg "Found generated source file: %s" "$srcname" + if cp "$srcpath" "${WORKDIR}/staging/other/${srcurl##"$mirror"}"; then + msg2 "%s staged on [%s]" "$srcname" other + staged=true + else + error "Can't put %s on [%s]" "$srcname" other + return 1 + fi + fi + break + fi + done + done + if $staged ; then return 0 else - error "No package was staged" + error "Nothing was staged" return 1 fi } -- cgit v1.2.2