From 5349fe385adf1ac4743ed872ccadc0afbaa21465 Mon Sep 17 00:00:00 2001 From: hasufell Date: Mon, 18 Jan 2016 13:31:43 +0100 Subject: [PATCH] Fetch pre-generated cache --- hooks/sync_post/01-sync_gentoo_cache.bash | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hooks/sync_post/01-sync_gentoo_cache.bash b/hooks/sync_post/01-sync_gentoo_cache.bash index d44bef3..61da2b1 100644 --- a/hooks/sync_post/01-sync_gentoo_cache.bash +++ b/hooks/sync_post/01-sync_gentoo_cache.bash @@ -7,6 +7,25 @@ if [[ ${TARGET} == gentoo ]] ; then # Number of jobs for egencache, default is number of processors. egencache_jobnum="$(nproc)" + if [[ -f ${PORTDIR}/metadata/timestamp.x ]]; then + portage_current_timestamp=$(cut -f 1 -d " " "${PORTDIR}/metadata/timestamp.x" ) + else + portage_current_timestamp=0 + fi + + ebegin "Fetching metadata timestamp for ${TARGET}" + rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/timestamp.x "${PORTDIR}"/metadata/timestamp.x + eend $? + portage_new_timestamp=$(cut -f 1 -d " " "${PORTDIR}/metadata/timestamp.x" ) + + if [[ ${portage_current_timestamp} -lt ${portage_new_timestamp} ]]; then + ebegin "Fetching pre-generated metadata cache for ${TARGET}" + rsync -aq rsync://rsync.gentoo.org/gentoo-portage/metadata/md5-cache/ "${PORTDIR}"/metadata/md5-cache/ + eend $? + else + einfo "Metadata cache for ${TARGET} already recent, no need to fetch it :-)" + fi + ebegin "Updating metadata cache for repository ${TARGET}" egencache --jobs=${egencache_jobnum} --repo=${TARGET} --update --update-use-local-desc eend $?