Gentoo Archives: gentoo-dev

From: Benda Xu <heroxbd@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: RFC: kernel-2.eclass Prefix support
Date: Sun, 12 Jun 2016 09:02:34
Message-Id: 87r3c2u6ef.fsf@gentoo.org
In Reply to: [gentoo-dev] Re: RFC: kernel-2.eclass Prefix support by Ulrich Mueller
1 Hi Ulrich,
2
3 Ulrich Mueller <ulm@g.o> writes:
4
5 >> I have added EPREFIX logics for EAPI<3 and improved the trailing
6 >> slashes and quotes.
7 >
8 >> - [[ -f ${ROOT}/usr/include/linux/autoconf.h ]] \
9 >> + [[ -f "${EROOT}"usr/include/linux/autoconf.h ]] \
10 >
11 > Inside [[ ]] quotes are generally not needed. (There are several other
12 > instances of this.)
13
14 I thought so too, but with an experiment:
15
16 bash --version
17 GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
18
19 bash -l
20 $ [[ -f a b ]] && echo hi
21 bash: syntax error in conditional expression
22 bash: syntax error near `b'
23 $ [[ -f "a b" ]] && echo hi
24 hi
25
26 So it seems that [[ ]] does need quotes.
27
28 >> - mv ${WORKDIR}/linux* "${D}"/usr/src
29 >> + mv ${WORKDIR}/linux* "${ED}"usr/src
30 >
31 > It was like that before your patch, but still ${WORKDIR} should be
32 > quoted here.
33
34 Yeah, updated.
35
36 Benda
37
38 --- /home/heroxbd/dev/repo/eclass/kernel-2.eclass 2016-02-17 22:46:25.235543840 +0900
39 +++ kernel-2.eclass 2016-06-12 17:58:55.971551222 +0900
40 @@ -105,6 +105,8 @@
41 HOMEPAGE="https://www.kernel.org/ https://www.gentoo.org/ ${HOMEPAGE}"
42 : ${LICENSE:="GPL-2"}
43
44 +has "${EAPI:-0}" 0 1 2 && ED=${D} EPREFIX= EROOT=${ROOT}
45 +
46 # This is the latest KV_PATCH of the deblob tool available from the
47 # libre-sources upstream. If you bump this, you MUST regenerate the Manifests
48 # for ALL kernel-2 consumer packages where deblob is available.
49 @@ -345,7 +347,7 @@
50 KV_FULL=${OKV}${EXTRAVERSION}
51
52 # we will set this for backwards compatibility.
53 - S=${WORKDIR}/linux-${KV_FULL}
54 + S="${WORKDIR}"/linux-${KV_FULL}
55 KV=${KV_FULL}
56
57 # -rc-git pulls can be achieved by specifying CKV
58 @@ -667,7 +669,7 @@
59
60 # autoconf.h isnt generated unless it already exists. plus, we have
61 # no guarantee that any headers are installed on the system...
62 - [[ -f ${ROOT}/usr/include/linux/autoconf.h ]] \
63 + [[ -f "${EROOT}"usr/include/linux/autoconf.h ]] \
64 || touch include/linux/autoconf.h
65
66 # if K_DEFCONFIG isn't set, force to "defconfig"
67 @@ -731,10 +733,10 @@
68 # of this crap anymore :D
69 if kernel_is ge 2 6 18 ; then
70 env_setup_xmakeopts
71 - emake headers_install INSTALL_HDR_PATH="${D}"/${ddir}/.. ${xmakeopts} || die
72 + emake headers_install INSTALL_HDR_PATH="${ED}"${ddir}/.. ${xmakeopts} || die
73
74 # let other packages install some of these headers
75 - rm -rf "${D}"/${ddir}/scsi #glibc/uclibc/etc...
76 + rm -rf "${ED}"${ddir}/scsi #glibc/uclibc/etc...
77 return 0
78 fi
79
80 @@ -742,15 +744,15 @@
81 # $S values where the cmdline to cp is too long
82 pushd "${S}" >/dev/null
83 dodir ${ddir}/linux
84 - cp -pPR "${S}"/include/linux "${D}"/${ddir}/ || die
85 - rm -rf "${D}"/${ddir}/linux/modules
86 + cp -pPR "${S}"/include/linux "${ED}"${ddir}/ || die
87 + rm -rf "${ED}"${ddir}/linux/modules
88
89 dodir ${ddir}/asm
90 - cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm
91 + cp -pPR "${S}"/include/asm/* "${ED}"${ddir}/asm
92
93 if kernel_is 2 6 ; then
94 dodir ${ddir}/asm-generic
95 - cp -pPR "${S}"/include/asm-generic/* "${D}"/${ddir}/asm-generic
96 + cp -pPR "${S}"/include/asm-generic/* "${ED}"${ddir}/asm-generic
97 fi
98
99 # clean up
100 @@ -784,7 +786,7 @@
101 > "${S}"/patches.txt
102 fi
103
104 - mv ${WORKDIR}/linux* "${D}"/usr/src
105 + mv "${WORKDIR}"/linux* "${ED}"usr/src
106
107 if [[ -n "${UNIPATCH_DOCS}" ]] ; then
108 for i in ${UNIPATCH_DOCS}; do
109 @@ -797,8 +799,8 @@
110 #==============================================================
111 preinst_headers() {
112 local ddir=$(kernel_header_destdir)
113 - [[ -L ${ddir}/linux ]] && rm ${ddir}/linux
114 - [[ -L ${ddir}/asm ]] && rm ${ddir}/asm
115 + [[ -L "${EPREFIX}"${ddir}/linux ]] && rm "${EPREFIX}"${ddir}/linux
116 + [[ -L "${EPREFIX}"${ddir}/asm ]] && rm "${EPREFIX}"${ddir}/asm
117 }
118
119 # pkg_postinst functions
120 @@ -819,21 +821,21 @@
121
122 # if we are to forcably symlink, delete it if it already exists first.
123 if [[ ${K_SYMLINK} > 0 ]]; then
124 - [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux
125 + [[ -h "${EROOT}"usr/src/linux ]] && rm "${EROOT}"usr/src/linux
126 MAKELINK=1
127 fi
128
129 # if the link doesnt exist, lets create it
130 - [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1
131 + [[ ! -h "${EROOT}"usr/src/linux ]] && MAKELINK=1
132
133 if [[ ${MAKELINK} == 1 ]]; then
134 - cd "${ROOT}"usr/src
135 + cd "${EROOT}"usr/src
136 ln -sf linux-${KV_FULL} linux
137 cd ${OLDPWD}
138 fi
139
140 # Don't forget to make directory for sysfs
141 - [[ ! -d ${ROOT}sys ]] && kernel_is 2 6 && mkdir ${ROOT}sys
142 + [[ ! -d "${EROOT}"sys ]] && kernel_is 2 6 && mkdir "${EROOT}"sys
143
144 echo
145 elog "If you are upgrading from a previous kernel, you may be interested"
146 @@ -1353,11 +1355,11 @@
147 [[ ${ETYPE} == headers ]] && return 0
148
149 # If there isn't anything left behind, then don't complain.
150 - [[ -e ${ROOT}usr/src/linux-${KV_FULL} ]] || return 0
151 + [[ -e "${EROOT}"usr/src/linux-${KV_FULL} ]] || return 0
152 echo
153 ewarn "Note: Even though you have successfully unmerged "
154 ewarn "your kernel package, directories in kernel source location: "
155 - ewarn "${ROOT}usr/src/linux-${KV_FULL}"
156 + ewarn "${EROOT}usr/src/linux-${KV_FULL}"
157 ewarn "with modified files will remain behind. By design, package managers"
158 ewarn "will not remove these modified files and the directories they reside in."
159 echo

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies