FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Development

 
 
LinkBack Thread Tools
 
Old 04-01-2011, 09:35 PM
Dan McGee
 
Default commitpkg: upload all files at the same time

Batch them up using a bash array and then pass them all to a single
invocation of rsync.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
Demo of what this should be doing:

$ touch /tmp/foobar /tmp/foobaz '/tmp/file with spaces'
$ uploads+=('/tmp/foobar')
$ uploads+=('/tmp/foobaz')
$ uploads+=('/tmp/file with spaces')
$ echo ${uploads[@]}
/tmp/foobar /tmp/foobaz /tmp/file with spaces
$ rsync -e ssh -p -c -h -L --progress "${uploads[@]}" gerolde.archlinux.org:staging/extra/
file with spaces
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=2/3)
foobar
0 100% 0.00kB/s 0:00:00 (xfer#2, to-check=1/3)
foobaz
0 100% 0.00kB/s 0:00:00 (xfer#3, to-check=0/3)

sent 224 bytes received 69 bytes 195.33 bytes/sec
total size is 0 speedup is 0.00

commitpkg | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/commitpkg b/commitpkg
index 413161c..ed2254c 100755
--- a/commitpkg
+++ b/commitpkg
@@ -112,6 +112,8 @@ else
fi
echo 'done'

+declare -a uploads
+
for _arch in ${arch[@]}; do
for _pkgname in ${pkgname[@]}; do
fullver=$(get_full_version ${epoch:-0} $pkgver $pkgrel)
@@ -126,13 +128,16 @@ for _arch in ${arch[@]}; do
echo "skipping ${_arch}"
continue 2
fi
-
- echo -n 'uploading '
- rsync $rsyncopts "${pkgfile}" "$server:staging/$repo/${pkgfile##*/}" || abort
+ uploads+=("$pkgfile")
done
archrelease $repo-${_arch} || abort
done

+if [[ ${#uploads[*]} -gt 0 ]]; then
+ echo 'uploading all package files'
+ rsync $rsyncopts "${uploads[@]}" "$server:staging/$repo/" || abort
+fi
+
if [ "${arch[*]}" == 'any' ]; then
if [ -d ../repos/$repo-i686 -a -d ../repos/$repo-x86_64 ]; then
pushd ../repos/ >/dev/null
--
1.7.4.2
 

Thread Tools




All times are GMT. The time now is 01:23 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org