Delete old Packages files before fetching

Partial mirroring builds Packages, Packages[gz, bz2] files for
partial repo. Those files cause problems if after partial mirroring
start full mirror creation.
This patch adds deleting Packages, Packages[gz, bz2] before fetching
those from mirrors.

Change-Id: Ic40a25c0aeae5e899c42553b1bc63ca97f19379d
Closes-Bug: #1510274
This commit is contained in:
Rodion Tikunov 2016-05-11 14:23:34 +03:00
parent 20f88c67c4
commit 26aeef185e
1 changed files with 8 additions and 0 deletions

View File

@ -248,6 +248,14 @@ for dist in "${DISTs[@]}"; do
to_fetch+=( `rsync_ls "$arch_path/Packages.diff/*"` )
fi
# Delete old Packages files if those exist before fetching
for tf in ${to_fetch[@]}; do
if [ -f ${LOCAL_DIR}/$tf ]; then
debug "Deleting ${LOCAL_DIR}/${tf}"
rm -f "${LOCAL_DIR}/${tf}"
fi
done
# Download files in our wishlist and get names of actually
# downloaded files
fetched_files=`fetch_all "$LOCAL_DIR" ${to_fetch[@]}`