Gentoo Archives: gentoo-dev

From: Benda Xu <heroxbd@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: RFC: kernel-2.eclass Prefix support
Date: Sun, 12 Jun 2016 02:54:25
Message-Id: 87vb1ft8ve.fsf_-_@gentoo.org
In Reply to: Re: [gentoo-dev] RFC: kernel-2.eclass Prefix support by Zac Medico
1 Thanks Zac, Göktürk,
2
3 I have added EPREFIX logics for EAPI<3 and improved the trailing slashes
4 and quotes.
5
6 Benda
7
8 --- kernel-2.eclass 2016-02-17 22:46:25.235543840 +0900
9 +++ kernel-2.eclass 2016-06-12 11:48:19.843801138 +0900
10 @@ -105,6 +105,8 @@
11 HOMEPAGE="https://www.kernel.org/ https://www.gentoo.org/ ${HOMEPAGE}"
12 : ${LICENSE:="GPL-2"}
13
14 +has "${EAPI:-0}" 0 1 2 && ED=${D} EPREFIX= EROOT=${ROOT}
15 +
16 # This is the latest KV_PATCH of the deblob tool available from the
17 # libre-sources upstream. If you bump this, you MUST regenerate the Manifests
18 # for ALL kernel-2 consumer packages where deblob is available.
19 @@ -667,7 +669,7 @@
20
21 # autoconf.h isnt generated unless it already exists. plus, we have
22 # no guarantee that any headers are installed on the system...
23 - [[ -f ${ROOT}/usr/include/linux/autoconf.h ]] \
24 + [[ -f "${EROOT}"usr/include/linux/autoconf.h ]] \
25 || touch include/linux/autoconf.h
26
27 # if K_DEFCONFIG isn't set, force to "defconfig"
28 @@ -731,10 +733,10 @@
29 # of this crap anymore :D
30 if kernel_is ge 2 6 18 ; then
31 env_setup_xmakeopts
32 - emake headers_install INSTALL_HDR_PATH="${D}"/${ddir}/.. ${xmakeopts} || die
33 + emake headers_install INSTALL_HDR_PATH="${ED}"${ddir}/.. ${xmakeopts} || die
34
35 # let other packages install some of these headers
36 - rm -rf "${D}"/${ddir}/scsi #glibc/uclibc/etc...
37 + rm -rf "${ED}"${ddir}/scsi #glibc/uclibc/etc...
38 return 0
39 fi
40
41 @@ -742,15 +744,15 @@
42 # $S values where the cmdline to cp is too long
43 pushd "${S}" >/dev/null
44 dodir ${ddir}/linux
45 - cp -pPR "${S}"/include/linux "${D}"/${ddir}/ || die
46 - rm -rf "${D}"/${ddir}/linux/modules
47 + cp -pPR "${S}"/include/linux "${ED}"${ddir}/ || die
48 + rm -rf "${ED}"${ddir}/linux/modules
49
50 dodir ${ddir}/asm
51 - cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm
52 + cp -pPR "${S}"/include/asm/* "${ED}"${ddir}/asm
53
54 if kernel_is 2 6 ; then
55 dodir ${ddir}/asm-generic
56 - cp -pPR "${S}"/include/asm-generic/* "${D}"/${ddir}/asm-generic
57 + cp -pPR "${S}"/include/asm-generic/* "${ED}"${ddir}/asm-generic
58 fi
59
60 # clean up
61 @@ -784,7 +786,7 @@
62 > "${S}"/patches.txt
63 fi
64
65 - mv ${WORKDIR}/linux* "${D}"/usr/src
66 + mv ${WORKDIR}/linux* "${ED}"usr/src
67
68 if [[ -n "${UNIPATCH_DOCS}" ]] ; then
69 for i in ${UNIPATCH_DOCS}; do
70 @@ -797,8 +799,8 @@
71 #==============================================================
72 preinst_headers() {
73 local ddir=$(kernel_header_destdir)
74 - [[ -L ${ddir}/linux ]] && rm ${ddir}/linux
75 - [[ -L ${ddir}/asm ]] && rm ${ddir}/asm
76 + [[ -L "${EPREFIX}"${ddir}/linux ]] && rm "${EPREFIX}"${ddir}/linux
77 + [[ -L "${EPREFIX}"${ddir}/asm ]] && rm "${EPREFIX}"${ddir}/asm
78 }
79
80 # pkg_postinst functions
81 @@ -819,21 +821,21 @@
82
83 # if we are to forcably symlink, delete it if it already exists first.
84 if [[ ${K_SYMLINK} > 0 ]]; then
85 - [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux
86 + [[ -h "${EROOT}"usr/src/linux ]] && rm "${EROOT}"usr/src/linux
87 MAKELINK=1
88 fi
89
90 # if the link doesnt exist, lets create it
91 - [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1
92 + [[ ! -h "${EROOT}"usr/src/linux ]] && MAKELINK=1
93
94 if [[ ${MAKELINK} == 1 ]]; then
95 - cd "${ROOT}"usr/src
96 + cd "${EROOT}"usr/src
97 ln -sf linux-${KV_FULL} linux
98 cd ${OLDPWD}
99 fi
100
101 # Don't forget to make directory for sysfs
102 - [[ ! -d ${ROOT}sys ]] && kernel_is 2 6 && mkdir ${ROOT}sys
103 + [[ ! -d "${EROOT}"sys ]] && kernel_is 2 6 && mkdir "${EROOT}"sys
104
105 echo
106 elog "If you are upgrading from a previous kernel, you may be interested"
107 @@ -1353,11 +1355,11 @@
108 [[ ${ETYPE} == headers ]] && return 0
109
110 # If there isn't anything left behind, then don't complain.
111 - [[ -e ${ROOT}usr/src/linux-${KV_FULL} ]] || return 0
112 + [[ -e "${EROOT}"usr/src/linux-${KV_FULL} ]] || return 0
113 echo
114 ewarn "Note: Even though you have successfully unmerged "
115 ewarn "your kernel package, directories in kernel source location: "
116 - ewarn "${ROOT}usr/src/linux-${KV_FULL}"
117 + ewarn "${EROOT}usr/src/linux-${KV_FULL}"
118 ewarn "with modified files will remain behind. By design, package managers"
119 ewarn "will not remove these modified files and the directories they reside in."
120 echo

Replies

Subject Author
[gentoo-dev] Re: RFC: kernel-2.eclass Prefix support Ulrich Mueller <ulm@g.o>