Commit 8d89ac1b authored by Downloader's avatar Downloader

rsync_all.sh: update

parent bd3b9bdd
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
RPMS=/var/ftp/pub/ALTLinux RPMS=/var/ftp/pub/ALTLinux
TIMEOUT=5000 TIMEOUT=5000
LISTARCH="x86_64 noarch i586 x86_64-i586" LISTARCH="x86_64 noarch i586 x86_64-i586"
BRANCHLIST="c7 c8 p8 p9" BRANCHLIST="c7 c8 p8 p9 c9f2 c10f1 c10f2 p10 p11"
DELETE="--delete-after --delete-excluded --max-delete=1000" DELETE="--delete-after --delete-excluded --max-delete=1000"
RSYNCOPTS="--fuzzy --partial"
FORCE='' FORCE=''
if [ "$1" = "--force" ] ; then if [ "$1" = "--force" ] ; then
...@@ -33,7 +33,7 @@ get_rsync_path() ...@@ -33,7 +33,7 @@ get_rsync_path()
if [ "$1" = "c6/branch" ] || [ "$1" = "c7/branch" ] ; then if [ "$1" = "c6/branch" ] || [ "$1" = "c7/branch" ] ; then
RSYNCPATH=rsync.altlinux.ru::ALTLinux RSYNCPATH=rsync.altlinux.ru::ALTLinux
#elif echo "$1" | grep -q "p8/" ; then #elif echo "$1" | grep -q "p8/" ; then
elif false ; then elif true ; then
#RSYNCPATH=rsync://ftp.basealt.ru/pub/distributions/ALTLinux #RSYNCPATH=rsync://ftp.basealt.ru/pub/distributions/ALTLinux
RSYNCPATH=rsync://ftp.basealt.ru/ALTLinux RSYNCPATH=rsync://ftp.basealt.ru/ALTLinux
...@@ -53,7 +53,7 @@ echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1" ...@@ -53,7 +53,7 @@ echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1"
# sync only if main dir is exist # sync only if main dir is exist
test -d "$RPMS/${1/\/*/}" || return 0 test -d "$RPMS/${1/\/*/}" || return 0
mkdir -p $RPMS/$1/ mkdir -p $RPMS/$1/
rsync $DELETE --fuzzy --partial --timeout=$TIMEOUT --progress $CHECKSUM --stats -vrlt --copy-links $2 \ rsync $DELETE $RSYNCOPTS --timeout=$TIMEOUT --progress $CHECKSUM --stats -vrlt --copy-links $2 \
$RSYNCPATH/$1/ $RPMS/$1/ $RSYNCPATH/$1/ $RPMS/$1/
RES=$? RES=$?
echo "rsync exit: $RES" echo "rsync exit: $RES"
...@@ -70,23 +70,29 @@ sync_file() ...@@ -70,23 +70,29 @@ sync_file()
echo echo
echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1" echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1"
rsync $DELETE --fuzzy --partial --timeout=$TIMEOUT --progress $CHECKSUM --stats -vrlt --copy-links \ rsync $DELETE --fuzzy --partial --timeout=$TIMEOUT --progress $CHECKSUM --stats -vrlt --copy-links \
--exclude "*SRPMS*" --exclude "*RPMS.debuginfo*" \ --exclude "*SRPMS*" \
$RSYNCPATH/$1 $RPMS/$1 $RSYNCPATH/$1 $RPMS/$1
} }
# p8/branch i586 classic
sync_branch() sync_branch()
{ {
local BRANCH="$1" local BRANCH="$1"
local ARCH="$2" local ARCH="$2"
local COMPONENT="$3"
[ -n "$COMPONENT" ] || fatal "sync_branch: missed COMPONENT"
RSYNCPATH=$(get_rsync_path $BRANCH) RSYNCPATH=$(get_rsync_path $BRANCH)
# 1. sync files, without delete # 1. sync files, without delete
(DELETE='' func $BRANCH/$ARCH '--exclude *SRPMS* --exclude *RPMS.debuginfo* --exclude */base/*') || return #(DELETE='' func $BRANCH/$ARCH '--exclude *SRPMS* --exclude *RPMS.debuginfo* --exclude base/') || return
# 1. sync files, this will skip delete if errors
func $BRANCH/$ARCH/RPMS.$COMPONENT || return
# 2. sync base # 2. sync base
func $BRANCH/$ARCH/base || return func $BRANCH/$ARCH/base || return
# 3. if all is ok, remove old files # 3. if all is ok, remove old files
func $BRANCH/$ARCH '--exclude *SRPMS* --exclude *RPMS.debuginfo* --exclude */base/*' || return #func $BRANCH/$ARCH '--exclude *SRPMS* --exclude *RPMS.debuginfo* --exclude base/' || return
} }
# branch component
sync_branches() sync_branches()
{ {
RSYNCPATH=$(get_rsync_path $1) RSYNCPATH=$(get_rsync_path $1)
...@@ -100,7 +106,9 @@ sync_branches() ...@@ -100,7 +106,9 @@ sync_branches()
fi fi
for i in $LISTARCH; do for i in $LISTARCH; do
sync_branch "$1" "$i" [ "$i" = "x86_64-i586" ] && [ "$2" = "debuginfo" ] && continue
[ "$i" = "noarch" ] && [ "$2" = "debuginfo" ] && continue
sync_branch "$1" "$i" "$2"
done done
} }
...@@ -135,7 +143,8 @@ if [ "$1" = "--checksum" ] ; then ...@@ -135,7 +143,8 @@ if [ "$1" = "--checksum" ] ; then
fi fi
if [ "$1" = "Sisyphus" ] ; then if [ "$1" = "Sisyphus" ] ; then
sync_branches $1 sync_branches $1 classic
sync_branches $1 debuginfo
exit exit
elif [ "$1" = "--file" ] ; then elif [ "$1" = "--file" ] ; then
shift shift
...@@ -148,7 +157,8 @@ elif [ "$1" = "--srpms" ] ; then ...@@ -148,7 +157,8 @@ elif [ "$1" = "--srpms" ] ; then
func $1/files/SRPMS func $1/files/SRPMS
exit exit
elif echo "$1" | grep -q branch ; then elif echo "$1" | grep -q branch ; then
sync_branches $1 sync_branches $1 classic
sync_branches $1 debuginfo
exit exit
elif [ -n "$1" ] ; then elif [ -n "$1" ] ; then
sync_other $1 sync_other $1
...@@ -156,13 +166,15 @@ elif [ -n "$1" ] ; then ...@@ -156,13 +166,15 @@ elif [ -n "$1" ] ; then
fi fi
for i in $BRANCHLIST; do for i in $BRANCHLIST; do
sync_branches $i/branch sync_branches $i/branch classic
sync_branches $i/branch debuginfo
done done
#sync_other p8/images #sync_other p8/images
for i in Sisyphus ; do for i in Sisyphus ; do
sync_branches $i sync_branches $i classic
sync_branches $i debuginfo
done done
date date
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment