summaryrefslogtreecommitdiff
path: root/src/abslibre-tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/abslibre-tools')
-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
}