1 |
Zac Medico <zmedico@g.o> writes: |
2 |
|
3 |
> However, it behaves differently when you have a variable with "a b" as |
4 |
> its content. |
5 |
> |
6 |
> foo="a b" |
7 |
> [[ -f ${foo} ]] && echo hi |
8 |
|
9 |
Yeah, that's correct. My mistake. |
10 |
|
11 |
--- kernel-2.eclass 2016-02-17 22:46:25.235543840 +0900 |
12 |
+++ kernel-2.eclass 2016-06-12 18:17:15.983538859 +0900 |
13 |
@@ -105,6 +105,8 @@ |
14 |
HOMEPAGE="https://www.kernel.org/ https://www.gentoo.org/ ${HOMEPAGE}" |
15 |
: ${LICENSE:="GPL-2"} |
16 |
|
17 |
+has "${EAPI:-0}" 0 1 2 && ED=${D} EPREFIX= EROOT=${ROOT} |
18 |
+ |
19 |
# This is the latest KV_PATCH of the deblob tool available from the |
20 |
# libre-sources upstream. If you bump this, you MUST regenerate the Manifests |
21 |
# for ALL kernel-2 consumer packages where deblob is available. |
22 |
@@ -345,7 +347,7 @@ |
23 |
KV_FULL=${OKV}${EXTRAVERSION} |
24 |
|
25 |
# we will set this for backwards compatibility. |
26 |
- S=${WORKDIR}/linux-${KV_FULL} |
27 |
+ S="${WORKDIR}"/linux-${KV_FULL} |
28 |
KV=${KV_FULL} |
29 |
|
30 |
# -rc-git pulls can be achieved by specifying CKV |
31 |
@@ -667,7 +669,7 @@ |
32 |
|
33 |
# autoconf.h isnt generated unless it already exists. plus, we have |
34 |
# no guarantee that any headers are installed on the system... |
35 |
- [[ -f ${ROOT}/usr/include/linux/autoconf.h ]] \ |
36 |
+ [[ -f ${EROOT}usr/include/linux/autoconf.h ]] \ |
37 |
|| touch include/linux/autoconf.h |
38 |
|
39 |
# if K_DEFCONFIG isn't set, force to "defconfig" |
40 |
@@ -731,10 +733,10 @@ |
41 |
# of this crap anymore :D |
42 |
if kernel_is ge 2 6 18 ; then |
43 |
env_setup_xmakeopts |
44 |
- emake headers_install INSTALL_HDR_PATH="${D}"/${ddir}/.. ${xmakeopts} || die |
45 |
+ emake headers_install INSTALL_HDR_PATH="${ED}"${ddir}/.. ${xmakeopts} || die |
46 |
|
47 |
# let other packages install some of these headers |
48 |
- rm -rf "${D}"/${ddir}/scsi #glibc/uclibc/etc... |
49 |
+ rm -rf "${ED}"${ddir}/scsi #glibc/uclibc/etc... |
50 |
return 0 |
51 |
fi |
52 |
|
53 |
@@ -742,15 +744,15 @@ |
54 |
# $S values where the cmdline to cp is too long |
55 |
pushd "${S}" >/dev/null |
56 |
dodir ${ddir}/linux |
57 |
- cp -pPR "${S}"/include/linux "${D}"/${ddir}/ || die |
58 |
- rm -rf "${D}"/${ddir}/linux/modules |
59 |
+ cp -pPR "${S}"/include/linux "${ED}"${ddir}/ || die |
60 |
+ rm -rf "${ED}"${ddir}/linux/modules |
61 |
|
62 |
dodir ${ddir}/asm |
63 |
- cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm |
64 |
+ cp -pPR "${S}"/include/asm/* "${ED}"${ddir}/asm |
65 |
|
66 |
if kernel_is 2 6 ; then |
67 |
dodir ${ddir}/asm-generic |
68 |
- cp -pPR "${S}"/include/asm-generic/* "${D}"/${ddir}/asm-generic |
69 |
+ cp -pPR "${S}"/include/asm-generic/* "${ED}"${ddir}/asm-generic |
70 |
fi |
71 |
|
72 |
# clean up |
73 |
@@ -784,7 +786,7 @@ |
74 |
> "${S}"/patches.txt |
75 |
fi |
76 |
|
77 |
- mv ${WORKDIR}/linux* "${D}"/usr/src |
78 |
+ mv "${WORKDIR}"/linux* "${ED}"usr/src |
79 |
|
80 |
if [[ -n "${UNIPATCH_DOCS}" ]] ; then |
81 |
for i in ${UNIPATCH_DOCS}; do |
82 |
@@ -797,8 +799,8 @@ |
83 |
#============================================================== |
84 |
preinst_headers() { |
85 |
local ddir=$(kernel_header_destdir) |
86 |
- [[ -L ${ddir}/linux ]] && rm ${ddir}/linux |
87 |
- [[ -L ${ddir}/asm ]] && rm ${ddir}/asm |
88 |
+ [[ -L ${EPREFIX}${ddir}/linux ]] && rm "${EPREFIX}"${ddir}/linux |
89 |
+ [[ -L ${EPREFIX}${ddir}/asm ]] && rm "${EPREFIX}"${ddir}/asm |
90 |
} |
91 |
|
92 |
# pkg_postinst functions |
93 |
@@ -819,21 +821,21 @@ |
94 |
|
95 |
# if we are to forcably symlink, delete it if it already exists first. |
96 |
if [[ ${K_SYMLINK} > 0 ]]; then |
97 |
- [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux |
98 |
+ [[ -h ${EROOT}usr/src/linux ]] && rm "${EROOT}"usr/src/linux |
99 |
MAKELINK=1 |
100 |
fi |
101 |
|
102 |
# if the link doesnt exist, lets create it |
103 |
- [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1 |
104 |
+ [[ ! -h ${EROOT}usr/src/linux ]] && MAKELINK=1 |
105 |
|
106 |
if [[ ${MAKELINK} == 1 ]]; then |
107 |
- cd "${ROOT}"usr/src |
108 |
+ cd "${EROOT}"usr/src |
109 |
ln -sf linux-${KV_FULL} linux |
110 |
cd ${OLDPWD} |
111 |
fi |
112 |
|
113 |
# Don't forget to make directory for sysfs |
114 |
- [[ ! -d ${ROOT}sys ]] && kernel_is 2 6 && mkdir ${ROOT}sys |
115 |
+ [[ ! -d ${EROOT}sys ]] && kernel_is 2 6 && mkdir "${EROOT}"sys |
116 |
|
117 |
echo |
118 |
elog "If you are upgrading from a previous kernel, you may be interested" |
119 |
@@ -1153,7 +1155,7 @@ |
120 |
local tmp |
121 |
for x in ${KPATCH_DIR}; do |
122 |
for i in ${UNIPATCH_DOCS}; do |
123 |
- if [[ -f "${x}/${i}" ]] ; then |
124 |
+ if [[ -f ${x}/${i} ]] ; then |
125 |
tmp="${tmp} ${i}" |
126 |
cp -f "${x}/${i}" "${T}"/ |
127 |
fi |
128 |
@@ -1353,11 +1355,11 @@ |
129 |
[[ ${ETYPE} == headers ]] && return 0 |
130 |
|
131 |
# If there isn't anything left behind, then don't complain. |
132 |
- [[ -e ${ROOT}usr/src/linux-${KV_FULL} ]] || return 0 |
133 |
+ [[ -e ${EROOT}usr/src/linux-${KV_FULL} ]] || return 0 |
134 |
echo |
135 |
ewarn "Note: Even though you have successfully unmerged " |
136 |
ewarn "your kernel package, directories in kernel source location: " |
137 |
- ewarn "${ROOT}usr/src/linux-${KV_FULL}" |
138 |
+ ewarn "${EROOT}usr/src/linux-${KV_FULL}" |
139 |
ewarn "with modified files will remain behind. By design, package managers" |
140 |
ewarn "will not remove these modified files and the directories they reside in." |
141 |
echo |