commit: 4937d2abb8b88c921fadbdcb2043a22d6572c912 Author: Joshua Kinard <kumba <AT> gentoo <DOT> org> AuthorDate: Fri Aug 13 04:51:26 2021 +0000 Commit: Joshua Kinard <kumba <AT> gentoo <DOT> org> CommitDate: Fri Aug 13 04:51:26 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4937d2ab
sys-kernel/mips-sources: LTS Updates, EAPI 8, cleanups - Updated to latest LTS versions for 4.14, 4.19, & 5.4 - Upgraded to EAPI 8 - Cleaned up various logic checks, [[ ]] instead of [ ], fixed use of $S in pkg_postinst, support USE symlink Signed-off-by: Joshua Kinard <kumba <AT> gentoo.org> Package-Manager: Portage-3.0.20, Repoman-3.0.3 sys-kernel/mips-sources/Manifest | 6 +- sys-kernel/mips-sources/metadata.xml | 12 ++- ....14.241.ebuild => mips-sources-4.14.243.ebuild} | 118 +++++++++++---------- ....19.200.ebuild => mips-sources-4.19.203.ebuild} | 111 ++++++++++--------- ...-5.4.137.ebuild => mips-sources-5.4.140.ebuild} | 111 ++++++++++--------- 5 files changed, 194 insertions(+), 164 deletions(-) diff --git a/sys-kernel/mips-sources/Manifest b/sys-kernel/mips-sources/Manifest index e90f79dd8cf..8e0b6e0f670 100644 --- a/sys-kernel/mips-sources/Manifest +++ b/sys-kernel/mips-sources/Manifest @@ -5,6 +5,6 @@ DIST mips-sources-4.14.0-patches-v3.tar.xz 287468 BLAKE2B 24212e2d6ca784986d0e3e DIST mips-sources-4.19.0-patches-v3.tar.xz 289136 BLAKE2B 9c77c641d4c4603983c0bc11cba5d83337c7373f67bc5870b8b02d6d4a537c8c02f21fe47fd64f13c5e10d37100654857d0b598be6d8c429f5fe1d7332b6b6bd SHA512 7199a20f20f9d0a4eae38279335d8c9da20940fb37f0ba38cb6b68fdd5c9d4d2e2b65efff5383065e685c0fb5ad639c6d79d74989a5b4200b987f175de7da422 DIST mips-sources-5.4-patches-v6.tar.xz 197884 BLAKE2B 08dad7c3d7ba3d04afe5a39dd0e0930894c124beebecfaa66aab6f42f3151f5271186e6735cd19344e05ea10faf11461290f62667d12379660734a63828c595a SHA512 472f44d1e212ca0bfae896dcf3ec45bbeb47fe1aa49b80060c2d0b7347b065ce8354e6b8ad009d7b5e2923d4072a9a93acf9ecbcc56575195ad5b60bef1af12e DIST mipsgit-4.14.0-20180128.diff.xz 1008 BLAKE2B 2a317ff97aab096883680c6b653e993aee31994e6caec52c52dfbbb61f1dc1f25d03ebd3182fa122923a67aeee0aa598b36e603692333e4c9ccdc741fd456d96 SHA512 378deb1bc1d10a6b4912e5e4a0d6fcab28952e2e59c35fc879601841cf8160081b318a2598ef74db225e95f0f26483f6b9a56a348811b1ee7b8934391dd271ae -DIST patch-4.14.241.xz 4387084 BLAKE2B 7d3126cbb14d1e5459689314b4a465712f66bc4b88392ad8514811cbfca5a2110c3f3c8cf577d86ac7aa5c8cd699336aed1f51368cae0a7e47f36c6ff8758393 SHA512 2f509afd824f1a924c10d763c1608b401c098c2e4084922bcc1b9a3ab558bd43ba3a62c232a99be5717666eb32baa93ca4a2b7c233b8184df567aaf1a5dc92da -DIST patch-4.19.200.xz 4167064 BLAKE2B 5216e28d2a8cb22415d94a3f397f86cb0bdb9bc8d05be5d6a679e5ef58342c188e2ec37c7469cda0a61ebed42929597a2a4175f56f2b7912494ffc801e1a5189 SHA512 c979cbc8016b5c7409494940ab652f997807a459f008225fda79000c23b46e2f3c4fffa70b746b40a8d07ee0e9654511d1ecd9fab5016c8bdd1977ae51ef5dd4 -DIST patch-5.4.137.xz 3214908 BLAKE2B de1d58f6100e89cee5c103748cab753c4dab425e730695af61000bd4fb2f1a8d4c699aaf32f1dc77c28778477466a2ca24e14b9efca882608cc4166dc51ffb02 SHA512 30da56861035f55ce11fd0db06fb4f289b51753f3f24b5e863b77f23d53dab38edb7cfe80c528d394fb70a7b46d66f47adc9e2e765feebc7b0b293e7515631a3 +DIST patch-4.14.243.xz 4395156 BLAKE2B a9a57aaf8fac8b35ecfa52f6086d20cca8593370075e23476dfa8ae1a6219d9a415df2c3e6e88d7d775927cc05ab89280a24464c0664b9485c11ac2e66f712ec SHA512 a85571c72cf814acdff0829269f5a352d2626eef367f3aae978ae86a5cb3a47e117406af5bc8bbb5c6c76d3ead8cb8d2f572ab3e3dc4ae94c17e0b1a445d3c0b +DIST patch-4.19.203.xz 4181892 BLAKE2B fd681104c226a3f7031f983e026fe5522daa3bfcf0e0ae30f71ff67e599c69974a3d556ee5bef66a6de380c2e89c282c9d8ceed35a9cd14fd30b6a116944e8fb SHA512 c75f24116e05d5e857b9200017906f3ca35f961b53e7b3966499f16209b67a8c4ad185359e4b20a3a5cb72bd9f799423c7ac65630a670f5f15837b146926b1a6 +DIST patch-5.4.140.xz 3240512 BLAKE2B ca28f6c97802d72d9ca30b9383bbb633e6dcdd1ba24643399dce781d0501b3db377d640509e71f8bf8c1fe4e113e2b6403f4b8bc50b5360b43cc4e6dfafef34b SHA512 ae2824a4f4732c8f723c97dfd80f1b104f144c827b98581f9e2eafc33b3bde881cbe90aeaaea014ce0a2b10f03406217816e7b6e9fe195c42cee88c204f66044 diff --git a/sys-kernel/mips-sources/metadata.xml b/sys-kernel/mips-sources/metadata.xml index 83fb9fad8bd..3e6ed7f33a2 100644 --- a/sys-kernel/mips-sources/metadata.xml +++ b/sys-kernel/mips-sources/metadata.xml @@ -5,13 +5,19 @@ <email>m...@gentoo.org</email> <name>Mips Team</name> </maintainer> + + <upstream> + <remote-id type="cpe">cpe:/o:linux:linux_kernel</remote-id> + </upstream> + + <longdescription> + mips-sources are based on kernel.org linux releases wth custom patches for MIPS-Based machines + </longdescription> + <use> <flag name="ip27">Enables additional support for SGI Origin (IP27)</flag> <flag name="ip28">Enables additional support for SGI Indigo2 Impact R10000 (IP28)</flag> <flag name="ip30">Enables support for SGI Octane (IP30, 'Speedracer')</flag> <flag name="experimental">Apply experimental (80xx) patches.</flag> </use> - <upstream> - <remote-id type="cpe">cpe:/o:linux:linux_kernel</remote-id> - </upstream> </pkgmetadata> diff --git a/sys-kernel/mips-sources/mips-sources-4.14.241.ebuild b/sys-kernel/mips-sources/mips-sources-4.14.243.ebuild similarity index 84% rename from sys-kernel/mips-sources/mips-sources-4.14.241.ebuild rename to sys-kernel/mips-sources/mips-sources-4.14.243.ebuild index e32d7a2792a..d94fd01dbe4 100644 --- a/sys-kernel/mips-sources/mips-sources-4.14.241.ebuild +++ b/sys-kernel/mips-sources/mips-sources-4.14.243.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # EAPI Version -EAPI="6" +EAPI="8" #//------------------------------------------------------------------------------ @@ -24,7 +24,7 @@ K_FROM_GIT="yes" ETYPE="sources" # Inherit Eclasses -inherit kernel-2 eapi7-ver +inherit kernel-2 detect_version # Version Data @@ -78,15 +78,17 @@ err_disabled_mach() { # See if this machine needs a USE passed or skip dying local has_use - [ ! -z "${m_use}" -a "${m_use}" != "skip" ] && has_use="USE=\"${m_use}\" " + [[ "${m_use}" != "skip" ]] \ + && has_use="USE=\"${m_use}\" " # Print error && (maybe) die echo -e "" - if [ "${is_test}" != "test" ]; then + if [[ "${is_test}" != "test" ]]; then eerror "${m_name} Support has been disabled in this ebuild" eerror "revision. If you wish to merge ${m_name} sources, then" eerror "run ${has_use}emerge =mips-sources-${stable_ver}" - [ "${m_use}" != "skip" ] && die "${m_name} Support disabled." + [[ "${m_use}" != "skip" ]] \ + && die "${m_name} Support disabled." else ewarn "${m_name} Support has been marked as needing testing in this" ewarn "ebuild revision. This usually means that any patches to support" @@ -110,17 +112,33 @@ err_only_one_mach_allowed() { die "Only one machine-type patchset allowed" } -pkg_postinst() { - # Symlink /usr/src/linux as appropriate - local my_ksrc="${S##*/}" +fkv_to_machtype() { + # For any machines that use external patches, we rename the source + # tree to match the machine type. + local fkv="${F_KV%-*}" + local v="${fkv}" for x in {ip27,ip28,ip30}; do - use ${x} && my_ksrc="${my_ksrc}.${x}" + use ${x} && v="${v}.${x}" && break done - if [ ! -e "${ROOT}usr/src/linux" ]; then - rm -f "${ROOT}usr/src/linux" - ln -sf "${my_ksrc}" "${ROOT}/usr/src/linux" + echo "${v}" +} + +pkg_postinst() { + if ! use symlink; then + return 0 + fi + + local kern_sym="/usr/src/linux" + + # Check that /usr/src/linux is safe to overwrite + if [[ -e "${kern_sym}" && ! -L "${kern_sym}" ]]; then + die "${kern_sym} already exists, but is not a symbolic link" fi + + # Symlink /usr/src/linux as appropriate + local kern_ver=$(fkv_to_machtype) + ln -snf "linux-${kern_ver}" "${kern_sym}" } pkg_setup() { @@ -140,35 +158,37 @@ pkg_setup() { shift # Shift the positions m_name="${*}" # Get the rest (Name) - if use ${m_ip}; then - # Fetch the value indiciating if the machine is enabled or not - m_enable="DO_${m_ip/ip/IP}" - m_enable="${!m_enable}" + if ! use ${m_ip}; then + continue + fi - # Make sure only one of these exclusive machine patches is selected - [ "${arch_is_selected}" = "no" ] \ - && arch_is_selected="yes" \ - || err_only_one_mach_allowed + # Fetch the value indiciating if the machine is enabled or not + m_enable="DO_${m_ip/ip/IP}" + m_enable="${!m_enable}" - # Is the machine support disabled or marked as needing testing? - [ "${m_enable}" = "test" ] \ - && err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" "test" - [ "${m_enable}" = "no" ] \ - && err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" + # Make sure only one of these exclusive machine patches is selected + [[ "${arch_is_selected}" = "no" ]] \ + && arch_is_selected="yes" \ + || err_only_one_mach_allowed - # Show relevant information about the machine - show_${m_ip}_info - fi + # Is the machine support disabled or marked as needing testing? + case "${m_enable}" in + "test") err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" "test" ;; + "no") err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" ;; + esac + + # Show relevant information about the machine + show_${m_ip}_info done # All other systems that don't have a USE flag go here # These systems have base-line support included in linux-mips git, so # instead of failing, if disabled, we simply warn the user - if [ "${arch_is_selected}" = "no" ]; then - [ "${DO_IP22}" = "no" ] \ + if [[ "${arch_is_selected}" = "no" ]]; then + [[ "${DO_IP22}" = "no" ]] \ && err_disabled_mach "SGI Indy/Indigo2 R4x00" "IP22" "skip" \ || show_ip22_info - [ "${DO_IP32}" = "no" ] \ + [[ "${DO_IP32}" = "no" ]] \ && err_disabled_mach "SGI O2" "IP32" "skip" \ || show_ip32_info @@ -189,10 +209,8 @@ show_ip22_info() { show_ip27_info() { echo -e "" - ewarn "Heavy disk I/O on recent kernels may randomly trigger a VM_BUG_ON_PAGE()" - ewarn "in move_freepages() in mm/page_alloc.c. The exact trigger cause is" - ewarn "unknown at this time. Please report any oops messages from this" - ewarn "bug to bugs.gentoo.org (assign to m...@gentoo.org)" + ewarn "IP27 Origin 2k/Onyx2 systems may be prone to sudden hard lockups." + ewarn "The exact trigger is unknown at this time." echo -e "" } @@ -283,9 +301,8 @@ src_unpack() { # Create a new folder called 'patch-symlinks' and create symlinks to # all mips-patches in there. If we want to exclude a patch, we'll # just delete the symlink instead of the actual patch. - local psym="patch-symlinks" - mkdir "${psym}" - cd "${psym}" + mkdir patch-symlinks + cd patch-symlinks for x in ../mips-patches-${BASE_KV}/*.patch; do ln -s "${x}" "${x##../mips-patches-*/}" done @@ -314,15 +331,13 @@ src_unpack() { do rm -f "./${x}" done - # Rename the source tree to match the linux-mips git checkout date and - # machine type. - local fkv="${F_KV%-*}" - local v="${fkv}-${GITDATE}" - for x in {ip27,ip28,ip30}; do - use ${x} && v="${v}.${x}" && break - done - mv "${WORKDIR}/linux-${fkv/_/-}" "${WORKDIR}/linux-${v}" || die - S="${WORKDIR}/linux-${v}" + # Rename the source tree, if needed. + local old="${WORKDIR}/linux-${F_KV%-*/_/-}" + local new="${WORKDIR}/linux-$(fkv_to_machtype)" + if [[ "${old}" != "${new}" ]]; then + mv "${old}" "${new}" || die + fi + S="${new}" # Set the EXTRAVERSION to linux-VERSION-mipsgit-GITDATE EXTRAVERSION="${EXTRAVERSION}-mipsgit-${GITDATE}" @@ -330,13 +345,8 @@ src_unpack() { } src_prepare() { - local psym="patch-symlinks" - - # Now go into the kernel source and patch it. - cd "${S}" - eapply "${WORKDIR}/${psym}"/ + # Apply patches to the kernel tree. + eapply "${WORKDIR}/patch-symlinks"/ eapply_user } - -#//------------------------------------------------------------------------------ diff --git a/sys-kernel/mips-sources/mips-sources-4.19.200.ebuild b/sys-kernel/mips-sources/mips-sources-4.19.203.ebuild similarity index 86% rename from sys-kernel/mips-sources/mips-sources-4.19.200.ebuild rename to sys-kernel/mips-sources/mips-sources-4.19.203.ebuild index 52f4f25547f..47378db0cbd 100644 --- a/sys-kernel/mips-sources/mips-sources-4.19.200.ebuild +++ b/sys-kernel/mips-sources/mips-sources-4.19.203.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # EAPI Version -EAPI="6" +EAPI="8" #//------------------------------------------------------------------------------ @@ -23,7 +23,7 @@ K_FROM_GIT="yes" ETYPE="sources" # Inherit Eclasses -inherit kernel-2 eapi7-ver +inherit kernel-2 detect_version # Version Data @@ -73,15 +73,17 @@ err_disabled_mach() { # See if this machine needs a USE passed or skip dying local has_use - [ ! -z "${m_use}" -a "${m_use}" != "skip" ] && has_use="USE=\"${m_use}\" " + [[ "${m_use}" != "skip" ]] \ + && has_use="USE=\"${m_use}\" " # Print error && (maybe) die echo -e "" - if [ "${is_test}" != "test" ]; then + if [[ "${is_test}" != "test" ]]; then eerror "${m_name} Support has been disabled in this ebuild" eerror "revision. If you wish to merge ${m_name} sources, then" eerror "run ${has_use}emerge =mips-sources-${stable_ver}" - [ "${m_use}" != "skip" ] && die "${m_name} Support disabled." + [[ "${m_use}" != "skip" ]] \ + && die "${m_name} Support disabled." else ewarn "${m_name} Support has been marked as needing testing in this" ewarn "ebuild revision. This usually means that any patches to support" @@ -105,17 +107,33 @@ err_only_one_mach_allowed() { die "Only one machine-type patchset allowed" } -pkg_postinst() { - # Symlink /usr/src/linux as appropriate - local my_ksrc="${S##*/}" +fkv_to_machtype() { + # For any machines that use external patches, we rename the source + # tree to match the machine type. + local fkv="${F_KV%-*}" + local v="${fkv}" for x in {ip27,ip28,ip30}; do - use ${x} && my_ksrc="${my_ksrc}.${x}" + use ${x} && v="${v}.${x}" && break done - if [ ! -e "${ROOT}usr/src/linux" ]; then - rm -f "${ROOT}usr/src/linux" - ln -sf "${my_ksrc}" "${ROOT}/usr/src/linux" + echo "${v}" +} + +pkg_postinst() { + if ! use symlink; then + return 0 + fi + + local kern_sym="/usr/src/linux" + + # Check that /usr/src/linux is safe to overwrite + if [[ -e "${kern_sym}" && ! -L "${kern_sym}" ]]; then + die "${kern_sym} already exists, but is not a symbolic link" fi + + # Symlink /usr/src/linux as appropriate + local kern_ver=$(fkv_to_machtype) + ln -snf "linux-${kern_ver}" "${kern_sym}" } pkg_setup() { @@ -135,35 +153,37 @@ pkg_setup() { shift # Shift the positions m_name="${*}" # Get the rest (Name) - if use ${m_ip}; then - # Fetch the value indiciating if the machine is enabled or not - m_enable="DO_${m_ip/ip/IP}" - m_enable="${!m_enable}" + if ! use ${m_ip}; then + continue + fi - # Make sure only one of these exclusive machine patches is selected - [ "${arch_is_selected}" = "no" ] \ - && arch_is_selected="yes" \ - || err_only_one_mach_allowed + # Fetch the value indiciating if the machine is enabled or not + m_enable="DO_${m_ip/ip/IP}" + m_enable="${!m_enable}" - # Is the machine support disabled or marked as needing testing? - [ "${m_enable}" = "test" ] \ - && err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" "test" - [ "${m_enable}" = "no" ] \ - && err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" + # Make sure only one of these exclusive machine patches is selected + [[ "${arch_is_selected}" = "no" ]] \ + && arch_is_selected="yes" \ + || err_only_one_mach_allowed - # Show relevant information about the machine - show_${m_ip}_info - fi + # Is the machine support disabled or marked as needing testing? + case "${m_enable}" in + "test") err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" "test" ;; + "no") err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" ;; + esac + + # Show relevant information about the machine + show_${m_ip}_info done # All other systems that don't have a USE flag go here # These systems have base-line support included in linux-mips git, so # instead of failing, if disabled, we simply warn the user - if [ "${arch_is_selected}" = "no" ]; then - [ "${DO_IP22}" = "no" ] \ + if [[ "${arch_is_selected}" = "no" ]]; then + [[ "${DO_IP22}" = "no" ]] \ && err_disabled_mach "SGI Indy/Indigo2 R4x00" "IP22" "skip" \ || show_ip22_info - [ "${DO_IP32}" = "no" ] \ + [[ "${DO_IP32}" = "no" ]] \ && err_disabled_mach "SGI O2" "IP32" "skip" \ || show_ip32_info @@ -276,9 +296,8 @@ src_unpack() { # Create a new folder called 'patch-symlinks' and create symlinks to # all mips-patches in there. If we want to exclude a patch, we'll # just delete the symlink instead of the actual patch. - local psym="patch-symlinks" - mkdir "${psym}" - cd "${psym}" + mkdir patch-symlinks + cd patch-symlinks for x in ../mips-patches-${BASE_KV}/*.patch; do ln -s "${x}" "${x##../mips-patches-*/}" done @@ -307,17 +326,10 @@ src_unpack() { do rm -f "./${x}" done - # Rename the source tree to match the linux-mips git checkout date and - # machine type. - local fkv="${F_KV%-*}" - local v="${fkv}" - for x in {ip27,ip28,ip30}; do - use ${x} && v="${v}.${x}" && break - done - - local old="${WORKDIR}/linux-${fkv/_/-}" - local new="${WORKDIR}/linux-${v}" - if [ "${old}" != "${new}" ]; then + # Rename the source tree, if needed. + local old="${WORKDIR}/linux-${F_KV%-*/_/-}" + local new="${WORKDIR}/linux-$(fkv_to_machtype)" + if [[ "${old}" != "${new}" ]]; then mv "${old}" "${new}" || die fi S="${new}" @@ -328,13 +340,8 @@ src_unpack() { } src_prepare() { - local psym="patch-symlinks" - - # Now go into the kernel source and patch it. - cd "${S}" - eapply "${WORKDIR}/${psym}"/ + # Apply patches to the kernel tree. + eapply "${WORKDIR}/patch-symlinks"/ eapply_user } - -#//------------------------------------------------------------------------------ diff --git a/sys-kernel/mips-sources/mips-sources-5.4.137.ebuild b/sys-kernel/mips-sources/mips-sources-5.4.140.ebuild similarity index 86% rename from sys-kernel/mips-sources/mips-sources-5.4.137.ebuild rename to sys-kernel/mips-sources/mips-sources-5.4.140.ebuild index c0810db4f52..7bf71ea9c61 100644 --- a/sys-kernel/mips-sources/mips-sources-5.4.137.ebuild +++ b/sys-kernel/mips-sources/mips-sources-5.4.140.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # EAPI Version -EAPI="6" +EAPI="8" #//------------------------------------------------------------------------------ @@ -23,7 +23,7 @@ K_FROM_GIT="yes" ETYPE="sources" # Inherit Eclasses -inherit kernel-2 eapi7-ver +inherit kernel-2 detect_version # Version Data @@ -73,15 +73,17 @@ err_disabled_mach() { # See if this machine needs a USE passed or skip dying local has_use - [ ! -z "${m_use}" -a "${m_use}" != "skip" ] && has_use="USE=\"${m_use}\" " + [[ "${m_use}" != "skip" ]] \ + && has_use="USE=\"${m_use}\" " # Print error && (maybe) die echo -e "" - if [ "${is_test}" != "test" ]; then + if [[ "${is_test}" != "test" ]]; then eerror "${m_name} Support has been disabled in this ebuild" eerror "revision. If you wish to merge ${m_name} sources, then" eerror "run ${has_use}emerge =mips-sources-${stable_ver}" - [ "${m_use}" != "skip" ] && die "${m_name} Support disabled." + [[ "${m_use}" != "skip" ]] \ + && die "${m_name} Support disabled." else ewarn "${m_name} Support has been marked as needing testing in this" ewarn "ebuild revision. This usually means that any patches to support" @@ -105,17 +107,33 @@ err_only_one_mach_allowed() { die "Only one machine-type patchset allowed" } -pkg_postinst() { - # Symlink /usr/src/linux as appropriate - local my_ksrc="${S##*/}" +fkv_to_machtype() { + # For any machines that use external patches, we rename the source + # tree to match the machine type. + local fkv="${F_KV%-*}" + local v="${fkv}" for x in {ip27,ip28,ip30}; do - use ${x} && my_ksrc="${my_ksrc}.${x}" + use ${x} && v="${v}.${x}" && break done - if [ ! -e "${ROOT}usr/src/linux" ]; then - rm -f "${ROOT}usr/src/linux" - ln -sf "${my_ksrc}" "${ROOT}/usr/src/linux" + echo "${v}" +} + +pkg_postinst() { + if ! use symlink; then + return 0 + fi + + local kern_sym="/usr/src/linux" + + # Check that /usr/src/linux is safe to overwrite + if [[ -e "${kern_sym}" && ! -L "${kern_sym}" ]]; then + die "${kern_sym} already exists, but is not a symbolic link" fi + + # Symlink /usr/src/linux as appropriate + local kern_ver=$(fkv_to_machtype) + ln -snf "linux-${kern_ver}" "${kern_sym}" } pkg_setup() { @@ -135,35 +153,37 @@ pkg_setup() { shift # Shift the positions m_name="${*}" # Get the rest (Name) - if use ${m_ip}; then - # Fetch the value indiciating if the machine is enabled or not - m_enable="DO_${m_ip/ip/IP}" - m_enable="${!m_enable}" + if ! use ${m_ip}; then + continue + fi - # Make sure only one of these exclusive machine patches is selected - [ "${arch_is_selected}" = "no" ] \ - && arch_is_selected="yes" \ - || err_only_one_mach_allowed + # Fetch the value indiciating if the machine is enabled or not + m_enable="DO_${m_ip/ip/IP}" + m_enable="${!m_enable}" - # Is the machine support disabled or marked as needing testing? - [ "${m_enable}" = "test" ] \ - && err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" "test" - [ "${m_enable}" = "no" ] \ - && err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" + # Make sure only one of these exclusive machine patches is selected + [[ "${arch_is_selected}" = "no" ]] \ + && arch_is_selected="yes" \ + || err_only_one_mach_allowed - # Show relevant information about the machine - show_${m_ip}_info - fi + # Is the machine support disabled or marked as needing testing? + case "${m_enable}" in + "test") err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" "test" ;; + "no") err_disabled_mach "${m_name}" "${m_ip/ip/IP}" "${m_ip}" ;; + esac + + # Show relevant information about the machine + show_${m_ip}_info done # All other systems that don't have a USE flag go here # These systems have base-line support included in linux-mips git, so # instead of failing, if disabled, we simply warn the user - if [ "${arch_is_selected}" = "no" ]; then - [ "${DO_IP22}" = "no" ] \ + if [[ "${arch_is_selected}" = "no" ]]; then + [[ "${DO_IP22}" = "no" ]] \ && err_disabled_mach "SGI Indy/Indigo2 R4x00" "IP22" "skip" \ || show_ip22_info - [ "${DO_IP32}" = "no" ] \ + [[ "${DO_IP32}" = "no" ]] \ && err_disabled_mach "SGI O2" "IP32" "skip" \ || show_ip32_info @@ -276,9 +296,8 @@ src_unpack() { # Create a new folder called 'patch-symlinks' and create symlinks to # all mips-patches in there. If we want to exclude a patch, we'll # just delete the symlink instead of the actual patch. - local psym="patch-symlinks" - mkdir "${psym}" - cd "${psym}" + mkdir patch-symlinks + cd patch-symlinks for x in ../mips-patches-${BASE_KV}/*.patch; do ln -s "${x}" "${x##../mips-patches-*/}" done @@ -307,17 +326,10 @@ src_unpack() { do rm -f "./${x}" done - # Rename the source tree to match the linux-mips git checkout date and - # machine type. - local fkv="${F_KV%-*}" - local v="${fkv}" - for x in {ip27,ip28,ip30}; do - use ${x} && v="${v}.${x}" && break - done - - local old="${WORKDIR}/linux-${fkv/_/-}" - local new="${WORKDIR}/linux-${v}" - if [ "${old}" != "${new}" ]; then + # Rename the source tree, if needed. + local old="${WORKDIR}/linux-${F_KV%-*/_/-}" + local new="${WORKDIR}/linux-$(fkv_to_machtype)" + if [[ "${old}" != "${new}" ]]; then mv "${old}" "${new}" || die fi S="${new}" @@ -328,13 +340,8 @@ src_unpack() { } src_prepare() { - local psym="patch-symlinks" - - # Now go into the kernel source and patch it. - cd "${S}" - eapply "${WORKDIR}/${psym}"/ + # Apply patches to the kernel tree. + eapply "${WORKDIR}/patch-symlinks"/ eapply_user } - -#//------------------------------------------------------------------------------