commit:     03753887d6ea4d9cc7c511d36ff74876a70c0dba
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  3 05:19:32 2017 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Sep  3 05:19:32 2017 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=03753887

bincache: use genkernel version as cache key, to ensure rebuilding initramfs 
parts on new GK versions.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 gen_determineargs.sh | 37 +++++++++++++++----------------------
 gen_funcs.sh         |  6 +++---
 2 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 41fbe63..fe9f85b 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -152,28 +152,21 @@ determine_real_args() {
        BOOTDIR=${BOOTDIR%/}    # Remove any trailing slash
        MODPROBEDIR=${MODPROBEDIR%/}    # Remove any trailing slash
 
-       CACHE_DIR=`arch_replace "${CACHE_DIR}"`
-       BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`
-       LVM_BINCACHE=`cache_replace "${LVM_BINCACHE}"`
-       MDADM_BINCACHE=`cache_replace "${MDADM_BINCACHE}"`
-       DMRAID_BINCACHE=`cache_replace "${DMRAID_BINCACHE}"`
-       ISCSI_BINCACHE=`cache_replace "${ISCSI_BINCACHE}"`
-       BLKID_BINCACHE=`cache_replace "${BLKID_BINCACHE}"`
-       FUSE_BINCACHE=`cache_replace "${FUSE_BINCACHE}"`
-       UNIONFS_FUSE_BINCACHE=`cache_replace "${UNIONFS_FUSE_BINCACHE}"`
-       GPG_BINCACHE=`cache_replace "${GPG_BINCACHE}"`
-
-       DEFAULT_KERNEL_CONFIG=`arch_replace "${DEFAULT_KERNEL_CONFIG}"`
-       BUSYBOX_CONFIG=`arch_replace "${BUSYBOX_CONFIG}"`
-       BUSYBOX_BINCACHE=`arch_replace "${BUSYBOX_BINCACHE}"`
-       LVM_BINCACHE=`arch_replace "${LVM_BINCACHE}"`
-       MDADM_BINCACHE=`arch_replace "${MDADM_BINCACHE}"`
-       DMRAID_BINCACHE=`arch_replace "${DMRAID_BINCACHE}"`
-       ISCSI_BINCACHE=`arch_replace "${ISCSI_BINCACHE}"`
-       BLKID_BINCACHE=`arch_replace "${BLKID_BINCACHE}"`
-       FUSE_BINCACHE=`arch_replace "${FUSE_BINCACHE}"`
-       UNIONFS_FUSE_BINCACHE=`arch_replace "${UNIONFS_FUSE_BINCACHE}"`
-       GPG_BINCACHE=`arch_replace "${GPG_BINCACHE}"`
+       __VARS_BINCACHE=(
+               BLKID_BINCACHE
+               BUSYBOX_BINCACHE
+               DMRAID_BINCACHE
+               FUSE_BINCACHE
+               GPG_BINCACHE
+               ISCSI_BINCACHE
+               LVM_BINCACHE
+               MDADM_BINCACHE
+               UNIONFS_FUSE_BINCACHE
+       )
+       for v in CACHE_DIR BUSYBOX_CONFIG DEFAULT_KERNEL_CONFIG 
"${__VARS_BINCACHE[@]}"; do
+               eval "$v='$(arch_replace "${!v}")'"
+               eval "$v='$(cache_replace "${!v}")'"
+       done
 
        if [ -n "${CMD_BOOTLOADER}" ]
        then

diff --git a/gen_funcs.sh b/gen_funcs.sh
index 6234189..9c9d3d6 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -184,7 +184,7 @@ arch_replace() {
 }
 
 cache_replace() {
-  var_replace "CACHE" "${CACHE_DIR}" "${1}"
+  var_replace "CACHE" "${CACHE_DIR}/${GK_V}" "${1}"
 }
 
 clear_log() {
@@ -239,7 +239,7 @@ isBootRO()
 setup_cache_dir()
 {
 
-[ ! -d "${CACHE_DIR}" ] && mkdir -p "${CACHE_DIR}"
+[ ! -d "${CACHE_DIR}" ] && mkdir -p "${CACHE_DIR}/${GK_V}"
 
 if [ "${CLEAR_CACHE_DIR}" == 'yes' ]
 then
@@ -248,7 +248,7 @@ then
        do
                print_info 1 "   >> removing ${i}"
                rm "${i}"
-       done < <(find "${CACHE_DIR}" -maxdepth 1 -type f -name '*.tar.*' -o 
-name '*.bz2')
+       done < <(find "${CACHE_DIR}" -maxdepth 2 -type f -name '*.tar.*' -o 
-name '*.bz2')
 fi
 
 }

Reply via email to