Benda Xu:
> Hi Fellows,
>
> This is a trivial patch for kernel-2.eclass to support Prefix. Does it
> look good to be commited?
>
> Thanks,
> Benda
>
> Bug: 478436
> --- kernel-2.eclass 2016-02-17 22:46:25.235543840 +0900
> +++ kernel-2.eclass 2016-05-24 01:14:22.246809021 +0900
> @@ -539,8 +522,8 @@
> #==============================================================
> kernel_header_destdir() {
> [[ ${CTARGET} == ${CHOST} ]] \
> - && echo /usr/include \
> - || echo /usr/${CTARGET}/usr/include
> + && echo "${EPREFIX}"/usr/include \
> + || echo "${EPREFIX}"/usr/${CTARGET}/usr/include
> }
>
> cross_pre_c_headers() {
> @@ -667,7 +650,7 @@
>
> # autoconf.h isnt generated unless it already exists. plus, we
> have
> # no guarantee that any headers are installed on the system...
> - [[ -f ${ROOT}/usr/include/linux/autoconf.h ]] \
> + [[ -f ${EROOT}/usr/include/linux/autoconf.h ]] \
EROOT already ends with a trailing slash.
Also there are inconsistencies in the rest of the patch w.r.t. quoting
EROOT and EPREFIX.
> || touch include/linux/autoconf.h
>
> # if K_DEFCONFIG isn't set, force to "defconfig"
> @@ -741,15 +724,15 @@
> # Do not use "linux/*" as that can cause problems with very long
> # $S values where the cmdline to cp is too long
> pushd "${S}" >/dev/null
> - dodir ${ddir}/linux
> + dodir ${ddir#${EPREFIX}}/linux
> cp -pPR "${S}"/include/linux "${D}"/${ddir}/ || die
> rm -rf "${D}"/${ddir}/linux/modules
>
> - dodir ${ddir}/asm
> - cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm
> + dodir ${ddir#${EPREFIX}}/asm
> + cp -pPR "${S}"/include/asm/* "${ED}"/${ddir}/asm
>
> if kernel_is 2 6 ; then
> - dodir ${ddir}/asm-generic
> + dodir ${ddir#${EPREFIX}}/asm-generic
> cp -pPR "${S}"/include/asm-generic/* "${D}"/${ddir}/asm-generic
> fi
>
> @@ -784,7 +767,7 @@
> > "${S}"/patches.txt
> fi
>
> - mv ${WORKDIR}/linux* "${D}"/usr/src
> + mv ${WORKDIR}/linux* "${ED}"/usr/src
>
> if [[ -n "${UNIPATCH_DOCS}" ]] ; then
> for i in ${UNIPATCH_DOCS}; do
> @@ -819,22 +799,22 @@
>
> # if we are to forcably symlink, delete it if it already exists first.
> if [[ ${K_SYMLINK} > 0 ]]; then
> - [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux
> + [[ -h ${EROOT}usr/src/linux ]] && rm ${EROOT}usr/src/linux
> MAKELINK=1
> fi
>
> # if the link doesnt exist, lets create it
> - [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1
> + [[ ! -h ${EROOT}usr/src/linux ]] && MAKELINK=1
>
> if [[ ${MAKELINK} == 1 ]]; then
> - cd "${ROOT}"usr/src
> + cd "${EROOT}"usr/src
> ln -sf linux-${KV_FULL} linux
> cd ${OLDPWD}
> fi
>
> # Don't forget to make directory for sysfs
> - [[ ! -d ${ROOT}sys ]] && kernel_is 2 6 && mkdir ${ROOT}sys
> + [[ ! -d ${EROOT}sys ]] && kernel_is 2 6 && mkdir ${EROOT}sys
>
> echo
> elog "If you are upgrading from a previous kernel, you may be
> interested"
> elog "in the following document:"
> @@ -1353,11 +1310,11 @@
> [[ ${ETYPE} == headers ]] && return 0
>
> # If there isn't anything left behind, then don't complain.
> - [[ -e ${ROOT}usr/src/linux-${KV_FULL} ]] || return 0
> + [[ -e ${EROOT}usr/src/linux-${KV_FULL} ]] || return 0
> echo
> ewarn "Note: Even though you have successfully unmerged "
> ewarn "your kernel package, directories in kernel source location: "
> - ewarn "${ROOT}usr/src/linux-${KV_FULL}"
> + ewarn "${EROOT}usr/src/linux-${KV_FULL}"
> ewarn "with modified files will remain behind. By design, package
> managers"
> ewarn "will not remove these modified files and the directories they
> reside in."
> echo
>