summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-01-04 22:27:52 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-01-04 22:27:52 -0500
commit7d7556e3afb934b69b99f7a7b1960c7be3d04be2 (patch)
treef9b5ac568666cae8781c2714d3c908052414a574 /src
parent811df5ff79f76b8128380715ac5ae127cd76be56 (diff)
librestage: stage files generated by librefetch
Diffstat (limited to 'src')
-rwxr-xr-xsrc/abslibre-tools/librestage39
1 files 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
}