Attaching fixed version of the last two patches, and a complete eclass for convenience.
On Tue, 20 Sep 2011 22:32:52 +0200 Michał Górny <mgo...@gentoo.org> wrote: > 10 -- tries to migrate git.eclass clones to git-2.eclass (#383761). Fixed invalid output (PVR -> PF). > 11 -- removes old git.eclass clones to not waste diskspace. Fixed reusing old clone over and over again, and made removal triggered not only on initial clone. -- Best regards, Michał Górny
From cc027da761e37b184442003bc8d98a0b5b49411a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org> Date: Tue, 20 Sep 2011 16:37:55 +0200 Subject: [PATCH 10/11] Try to migrate git.eclass checkouts to the new eclass. Fixes: https://bugs.gentoo.org/show_bug.cgi?id=383761 --- eclass/git-2.eclass | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/eclass/git-2.eclass b/eclass/git-2.eclass index e0a5615..a72e041 100644 --- a/eclass/git-2.eclass +++ b/eclass/git-2.eclass @@ -264,6 +264,18 @@ git-2_prepare_storedir() { clone_dir=${EGIT_REPO_URI##*/} fi EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir} + + # Try to migrate from git.eclass git-src/ + if [[ ! -d ${EGIT_DIR} && ${EGIT_STORE_DIR} == */egit-src ]]; then + local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src} + local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}} + + if [[ -d ${old_location} ]]; then + elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location." + elog "It will be necessary to rebuild the package to fetch updates." + EGIT_REPO_URI="${old_location} ${EGIT_REPO_URI}" + fi + fi fi export EGIT_DIR=${EGIT_DIR} debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"." -- 1.7.6.1
From 35014dd3c02fd4e7bc93315e47f1960fdd8b7f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org> Date: Tue, 20 Sep 2011 21:36:06 +0200 Subject: [PATCH 11/11] Remove git.eclass old clones if git-2 clone succeeds. --- eclass/git-2.eclass | 36 ++++++++++++++++++++++++++---------- 1 files changed, 26 insertions(+), 10 deletions(-) diff --git a/eclass/git-2.eclass b/eclass/git-2.eclass index a72e041..9384531 100644 --- a/eclass/git-2.eclass +++ b/eclass/git-2.eclass @@ -253,6 +253,22 @@ git-2_prepare_storedir() { # allow writing into EGIT_STORE_DIR addwrite "${EGIT_STORE_DIR}" + + # calculate git.eclass store dir for data + # We will try to clone the old repository, + # and we will remove it if we don't need it anymore. + EGIT_OLD_CLONE= + if [[ ${EGIT_STORE_DIR} == */egit-src ]]; then + local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src} + local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}} + + if [[ -d ${old_location} ]]; then + EGIT_OLD_CLONE=${old_location} + # required to remove the old clone + addwrite "${old_store_dir}" + fi + fi + # calculate the proper store dir for data # If user didn't specify the EGIT_DIR, we check if he did specify # the EGIT_PROJECT or get the folder name from EGIT_REPO_URI. @@ -265,16 +281,10 @@ git-2_prepare_storedir() { fi EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir} - # Try to migrate from git.eclass git-src/ - if [[ ! -d ${EGIT_DIR} && ${EGIT_STORE_DIR} == */egit-src ]]; then - local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src} - local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}} - - if [[ -d ${old_location} ]]; then - elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location." - elog "It will be necessary to rebuild the package to fetch updates." - EGIT_REPO_URI="${old_location} ${EGIT_REPO_URI}" - fi + if [[ ${EGIT_OLD_CLONE} && ! -d ${EGIT_DIR} ]]; then + elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location." + elog "It will be necessary to rebuild the package to fetch updates." + EGIT_REPO_URI="${EGIT_OLD_CLONE} ${EGIT_REPO_URI}" fi fi export EGIT_DIR=${EGIT_DIR} @@ -414,6 +424,12 @@ git-2_fetch() { echo " branch: ${EGIT_BRANCH}" echo " storage directory: \"${EGIT_DIR}\"" echo " checkout type: ${repo_type}" + + # Cleanup after git.eclass + if [[ ${EGIT_OLD_CLONE} ]]; then + einfo "${FUNCNAME}: removing old clone in ${EGIT_OLD_CLONE}." + rm -rf "${EGIT_OLD_CLONE}" + fi } # @FUNCTION: git_bootstrap -- 1.7.6.1
git-2.eclass
Description: Binary data
signature.asc
Description: PGP signature