summaryrefslogtreecommitdiff
path: root/src/abslibre-tools/librestage
diff options
context:
space:
mode:
Diffstat (limited to 'src/abslibre-tools/librestage')
-rwxr-xr-xsrc/abslibre-tools/librestage52
1 files changed, 45 insertions, 7 deletions
diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage
index 6bbe80e..1e208c9 100755
--- a/src/abslibre-tools/librestage
+++ b/src/abslibre-tools/librestage
@@ -2,8 +2,11 @@
# LibreStage
# Prepares packages for upload
-# Copyright 2010-2011 Nicolás Reynolds
-# Copyright 2013 Luke Shumaker
+# Copyright (C) 2010-2012 Nicolás Reynolds <fauno@parabola.nu>
+# Copyright (C) 2011 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com>
+# Copyright (C) 2013-2014 Luke Shumaker <lukeshu@sbcglobal.net>
+#
+# License: GNU GPLv3+
#
# This file is part of Parabola.
#
@@ -42,12 +45,12 @@ main() {
while getopts 'h' arg; do
case $arg in
h) usage; return 0;;
- *) usage >/dev/stderr; return 1;;
+ *) usage >&2; return 1;;
esac
done
repos=("$@")
if [[ ${#repos[@]} -eq 0 ]]; then
- usage >>/dev/stderr
+ usage >&2
return 1;
fi
@@ -59,7 +62,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 +83,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 +105,44 @@ 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"
+ dest="${WORKDIR}/staging/other/${srcurl##"$mirror"}"
+ mkdir -p -- "${dest%/*}"
+ if cp "$srcpath" "$dest"; 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
}