blob: ff79034f46eec09120fd519b37ebdd1b94aa1699 [file] [log] [blame]
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# We changed the distfile download dirs to a combined one, so move the old
# content up to the common location.
# Delete the old symlinks.
sudo rm -f /var/lib/portage/distfiles /var/lib/portage/distfiles-target
# Merge the content.
echo "Merging old distfiles paths"
cd /var/cache/distfiles
for srcdir in target host; do
if [[ ! -d "${srcdir}" ]]; then
continue
fi
echo " ${srcdir} ..."
# Merge the two git subdirs.
for gitdir in egit-src git3-src; do
mkdir -p "${gitdir}"
if [[ -d "${srcdir}/${gitdir}" ]]; then
for d in $(find "${srcdir}/${gitdir}/" -mindepth 1 -maxdepth 1 -type d \
-printf '%f\n'); do
if [[ ! -d "${gitdir}/${d}" ]]; then
mv "${srcdir}/${gitdir}/${d}" "${gitdir}/" || exit 1
fi
done
fi
done
# Clear all the subdirs now that they're migrated.
sudo rm -rf "${srcdir}"/*/
# Merge the files.
rm -f "${srcdir}"/*._checksum_failure_.*
for f in "${srcdir}"/*; do
if [[ -e "${f}" && ! -e "${f##*/}" ]]; then
mv "${f}" ./ || exit 1
fi
done
# Delete the dir.
sudo rm -rf "${srcdir}" || exit 1
done