From 88da5e02855f31c940dca40c8d84e9eb1d16241b Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Tue, 15 Nov 2011 21:34:52 +0100 Subject: [PATCH] [repo] update gcc profile setup function, make it able to detect the latest installed version --- .../sabayon-limbo/packages.db.post_upgrade.sh | 21 ++++++++------- .../packages.db.post_upgrade.sh | 27 +++++++++++-------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/conf/intel/repo/sabayon-limbo/packages.db.post_upgrade.sh b/conf/intel/repo/sabayon-limbo/packages.db.post_upgrade.sh index 86e4362..c1090d0 100644 --- a/conf/intel/repo/sabayon-limbo/packages.db.post_upgrade.sh +++ b/conf/intel/repo/sabayon-limbo/packages.db.post_upgrade.sh @@ -31,7 +31,6 @@ echo -e " ### CUT HERE ### fix_lib64_symlinks() { - if [ -L ${ROOT}/lib64 ] ; then echo "removing /lib64 symlink and moving lib to lib64..." echo "dont hit ctrl-c until this is done" @@ -57,10 +56,15 @@ fix_lib64_symlinks() { ln -s lib64 ${ROOT}/usr/X11R6/lib echo "fixed broken lib64/lib symlink in ${ROOT}/usr/X11R6" fi - } -function three_four_to_five() { +latest_gcc_profile() { + local gcc_dir="/etc/env.d/gcc" + local latest=$(ls -1 ${gcc_dir}/$(uname -m)* | sort | tail -n 1 2> /dev/null) + [[ -n "${latest}" ]] && echo $(basename "${latest}") +} + +three_four_to_five() { local rc=0 @@ -82,16 +86,15 @@ function three_four_to_five() { rc=1 fi - ## sys-devel/gcc:4.5 must be forced using + ## sys-devel/base-gcc:LATEST must be forced using ## packages.db.system_mask inside repository db dir - c_profile=$(gcc-config -l | grep "\-4.5" | cut -d"[" -f 2 | cut -d"]" -f 1) - [[ "${?}" != "0" ]] && echo "gcc-config script error" && exit 1 - if [[ ${c_profile} =~ ^[0-9]+$ ]]; then - gcc-config ${c_profile} + c_profile=$(latest_gcc_profile) + if [ -n "${c_profile}" ]; then + gcc-config "${c_profile}" # update env env-update else - echo "gcc-config unable to set new profile:" ${c_profile} + echo "gcc-config unable to set new profile: not detected" rc=1 fi diff --git a/conf/intel/repo/sabayonlinux.org/packages.db.post_upgrade.sh b/conf/intel/repo/sabayonlinux.org/packages.db.post_upgrade.sh index f2bf7d2..c1090d0 100644 --- a/conf/intel/repo/sabayonlinux.org/packages.db.post_upgrade.sh +++ b/conf/intel/repo/sabayonlinux.org/packages.db.post_upgrade.sh @@ -10,7 +10,7 @@ NEW_BRANCH=$4 echo -e " >> requirements for this branch: app-admin/eselect-python - sys-devel/gcc:4.5 + sys-devel/base-gcc:4.6 >> Entropy post-upgrade migration script >> Repository: "${REPO_ID}" >> Root: "${ROOT}" @@ -31,7 +31,6 @@ echo -e " ### CUT HERE ### fix_lib64_symlinks() { - if [ -L ${ROOT}/lib64 ] ; then echo "removing /lib64 symlink and moving lib to lib64..." echo "dont hit ctrl-c until this is done" @@ -57,10 +56,15 @@ fix_lib64_symlinks() { ln -s lib64 ${ROOT}/usr/X11R6/lib echo "fixed broken lib64/lib symlink in ${ROOT}/usr/X11R6" fi - } -function three_four_to_five() { +latest_gcc_profile() { + local gcc_dir="/etc/env.d/gcc" + local latest=$(ls -1 ${gcc_dir}/$(uname -m)* | sort | tail -n 1 2> /dev/null) + [[ -n "${latest}" ]] && echo $(basename "${latest}") +} + +three_four_to_five() { local rc=0 @@ -82,16 +86,15 @@ function three_four_to_five() { rc=1 fi - ## sys-devel/gcc:4.5 must be forced using + ## sys-devel/base-gcc:LATEST must be forced using ## packages.db.system_mask inside repository db dir - c_profile=$(gcc-config -l | grep "\-4.5" | cut -d"[" -f 2 | cut -d"]" -f 1) - [[ "${?}" != "0" ]] && echo "gcc-config script error" && exit 1 - if [[ ${c_profile} =~ ^[0-9]+$ ]]; then - gcc-config ${c_profile} + c_profile=$(latest_gcc_profile) + if [ -n "${c_profile}" ]; then + gcc-config "${c_profile}" # update env env-update else - echo "gcc-config unable to set new profile:" ${c_profile} + echo "gcc-config unable to set new profile: not detected" rc=1 fi @@ -133,7 +136,9 @@ function three_four_to_five() { } # run this in any case, it will fix symlinks setup -fix_lib64_symlinks +if [ "$(uname -m)" = "x86_64" ]; then + fix_lib64_symlinks +fi # migration script from branch 4 to 5 [[ "${OLD_BRANCH}" = "4" ]] && [[ "${NEW_BRANCH}" = "5" ]] && three_four_to_five