Gentoo Archives: gentoo-dev

From: "Göktürk Yüksek" <gokturk@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: kernel-2.eclass Prefix support
Date: Sun, 12 Jun 2016 01:19:40
Message-Id: 575CB89D.20206@gentoo.org
In Reply to: [gentoo-dev] RFC: kernel-2.eclass Prefix support by Benda Xu
1 Benda Xu:
2 > Hi Fellows,
3 >
4 > This is a trivial patch for kernel-2.eclass to support Prefix. Does it
5 > look good to be commited?
6 >
7 > Thanks,
8 > Benda
9 >
10 > Bug: 478436
11 > --- kernel-2.eclass 2016-02-17 22:46:25.235543840 +0900
12 > +++ kernel-2.eclass 2016-05-24 01:14:22.246809021 +0900
13 > @@ -539,8 +522,8 @@
14 > #==============================================================
15 > kernel_header_destdir() {
16 > [[ ${CTARGET} == ${CHOST} ]] \
17 > - && echo /usr/include \
18 > - || echo /usr/${CTARGET}/usr/include
19 > + && echo "${EPREFIX}"/usr/include \
20 > + || echo "${EPREFIX}"/usr/${CTARGET}/usr/include
21 > }
22 >
23 > cross_pre_c_headers() {
24 > @@ -667,7 +650,7 @@
25 >
26 > # autoconf.h isnt generated unless it already exists. plus, we have
27 > # no guarantee that any headers are installed on the system...
28 > - [[ -f ${ROOT}/usr/include/linux/autoconf.h ]] \
29 > + [[ -f ${EROOT}/usr/include/linux/autoconf.h ]] \
30 EROOT already ends with a trailing slash.
31
32 Also there are inconsistencies in the rest of the patch w.r.t. quoting
33 EROOT and EPREFIX.
34
35 > || touch include/linux/autoconf.h
36 >
37 > # if K_DEFCONFIG isn't set, force to "defconfig"
38 > @@ -741,15 +724,15 @@
39 > # Do not use "linux/*" as that can cause problems with very long
40 > # $S values where the cmdline to cp is too long
41 > pushd "${S}" >/dev/null
42 > - dodir ${ddir}/linux
43 > + dodir ${ddir#${EPREFIX}}/linux
44 > cp -pPR "${S}"/include/linux "${D}"/${ddir}/ || die
45 > rm -rf "${D}"/${ddir}/linux/modules
46 >
47 > - dodir ${ddir}/asm
48 > - cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm
49 > + dodir ${ddir#${EPREFIX}}/asm
50 > + cp -pPR "${S}"/include/asm/* "${ED}"/${ddir}/asm
51 >
52 > if kernel_is 2 6 ; then
53 > - dodir ${ddir}/asm-generic
54 > + dodir ${ddir#${EPREFIX}}/asm-generic
55 > cp -pPR "${S}"/include/asm-generic/* "${D}"/${ddir}/asm-generic
56 > fi
57 >
58 > @@ -784,7 +767,7 @@
59 > > "${S}"/patches.txt
60 > fi
61 >
62 > - mv ${WORKDIR}/linux* "${D}"/usr/src
63 > + mv ${WORKDIR}/linux* "${ED}"/usr/src
64 >
65 > if [[ -n "${UNIPATCH_DOCS}" ]] ; then
66 > for i in ${UNIPATCH_DOCS}; do
67 > @@ -819,22 +799,22 @@
68 >
69 > # if we are to forcably symlink, delete it if it already exists first.
70 > if [[ ${K_SYMLINK} > 0 ]]; then
71 > - [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux
72 > + [[ -h ${EROOT}usr/src/linux ]] && rm ${EROOT}usr/src/linux
73 > MAKELINK=1
74 > fi
75 >
76 > # if the link doesnt exist, lets create it
77 > - [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1
78 > + [[ ! -h ${EROOT}usr/src/linux ]] && MAKELINK=1
79 >
80 > if [[ ${MAKELINK} == 1 ]]; then
81 > - cd "${ROOT}"usr/src
82 > + cd "${EROOT}"usr/src
83 > ln -sf linux-${KV_FULL} linux
84 > cd ${OLDPWD}
85 > fi
86 >
87 > # Don't forget to make directory for sysfs
88 > - [[ ! -d ${ROOT}sys ]] && kernel_is 2 6 && mkdir ${ROOT}sys
89 > + [[ ! -d ${EROOT}sys ]] && kernel_is 2 6 && mkdir ${EROOT}sys
90 >
91 > echo
92 > elog "If you are upgrading from a previous kernel, you may be interested"
93 > elog "in the following document:"
94 > @@ -1353,11 +1310,11 @@
95 > [[ ${ETYPE} == headers ]] && return 0
96 >
97 > # If there isn't anything left behind, then don't complain.
98 > - [[ -e ${ROOT}usr/src/linux-${KV_FULL} ]] || return 0
99 > + [[ -e ${EROOT}usr/src/linux-${KV_FULL} ]] || return 0
100 > echo
101 > ewarn "Note: Even though you have successfully unmerged "
102 > ewarn "your kernel package, directories in kernel source location: "
103 > - ewarn "${ROOT}usr/src/linux-${KV_FULL}"
104 > + ewarn "${EROOT}usr/src/linux-${KV_FULL}"
105 > ewarn "with modified files will remain behind. By design, package managers"
106 > ewarn "will not remove these modified files and the directories they reside in."
107 > echo
108 >