1 |
zmedico 13/07/30 06:53:05 |
2 |
|
3 |
Modified: ChangeLog |
4 |
Added: portage-2.1.13.2.ebuild |
5 |
Log: |
6 |
2.1.13.2 version bump. This fixes bug #477728 (export GPG_TTY for git |
7 |
signatures with repoman), bug #478188 (fix || dep handling to pull in |
8 |
vala updates correctly), bug #478544 (fix duplicate repo name warning |
9 |
involving /usr/portage), and bug #478726 (skip /etc/portage/repos.conf |
10 |
generation if the file exists). |
11 |
Bug #472632 tracks all bugs fixed since portage-2.1.12.2. |
12 |
|
13 |
(Portage version: 2.2.0_alpha191/cvs/Linux i686, signed Manifest commit with key 0xFDE8EF85AE5719A3) |
14 |
|
15 |
Revision Changes Path |
16 |
1.1324 sys-apps/portage/ChangeLog |
17 |
|
18 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/ChangeLog?rev=1.1324&view=markup |
19 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/ChangeLog?rev=1.1324&content-type=text/plain |
20 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/ChangeLog?r1=1.1323&r2=1.1324 |
21 |
|
22 |
Index: ChangeLog |
23 |
=================================================================== |
24 |
RCS file: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v |
25 |
retrieving revision 1.1323 |
26 |
retrieving revision 1.1324 |
27 |
diff -u -r1.1323 -r1.1324 |
28 |
--- ChangeLog 29 Jul 2013 17:53:18 -0000 1.1323 |
29 |
+++ ChangeLog 30 Jul 2013 06:53:05 -0000 1.1324 |
30 |
@@ -1,6 +1,15 @@ |
31 |
# ChangeLog for sys-apps/portage |
32 |
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 |
33 |
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.1323 2013/07/29 17:53:18 zmedico Exp $ |
34 |
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.1324 2013/07/30 06:53:05 zmedico Exp $ |
35 |
+ |
36 |
+*portage-2.1.13.2 (30 Jul 2013) |
37 |
+ |
38 |
+ 30 Jul 2013; Zac Medico <zmedico@g.o> +portage-2.1.13.2.ebuild: |
39 |
+ 2.1.13.2 version bump. This fixes bug #477728 (export GPG_TTY for git |
40 |
+ signatures with repoman), bug #478188 (fix || dep handling to pull in vala |
41 |
+ updates correctly), bug #478544 (fix duplicate repo name warning involving |
42 |
+ /usr/portage), and bug #478726 (skip /etc/portage/repos.conf generation if the |
43 |
+ file exists). Bug #472632 tracks all bugs fixed since portage-2.1.12.2. |
44 |
|
45 |
29 Jul 2013; Zac Medico <zmedico@g.o> portage-2.1.13.1.ebuild, |
46 |
portage-2.2.0_alpha190.ebuild: |
47 |
|
48 |
|
49 |
|
50 |
1.1 sys-apps/portage/portage-2.1.13.2.ebuild |
51 |
|
52 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-2.1.13.2.ebuild?rev=1.1&view=markup |
53 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-2.1.13.2.ebuild?rev=1.1&content-type=text/plain |
54 |
|
55 |
Index: portage-2.1.13.2.ebuild |
56 |
=================================================================== |
57 |
# Copyright 1999-2013 Gentoo Foundation |
58 |
# Distributed under the terms of the GNU General Public License v2 |
59 |
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.13.2.ebuild,v 1.1 2013/07/30 06:53:05 zmedico Exp $ |
60 |
|
61 |
# Require EAPI 2 since we now require at least python-2.6 (for python 3 |
62 |
# syntax support) which also requires EAPI 2. |
63 |
EAPI=2 |
64 |
PYTHON_COMPAT=( |
65 |
pypy1_9 pypy2_0 |
66 |
python3_1 python3_2 python3_3 python3_4 |
67 |
python2_6 python2_7 |
68 |
) |
69 |
inherit eutils multilib |
70 |
|
71 |
DESCRIPTION="Portage is the package management and distribution system for Gentoo" |
72 |
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml" |
73 |
LICENSE="GPL-2" |
74 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" |
75 |
SLOT="0" |
76 |
IUSE="build doc epydoc +ipc linguas_ru pypy2_0 python2 python3 selinux xattr" |
77 |
|
78 |
for _pyimpl in ${PYTHON_COMPAT[@]} ; do |
79 |
IUSE+=" python_targets_${_pyimpl}" |
80 |
done |
81 |
unset _pyimpl |
82 |
|
83 |
# Import of the io module in python-2.6 raises ImportError for the |
84 |
# thread module if threading is disabled. |
85 |
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] ) |
86 |
!pypy2_0? ( !python2? ( !python3? ( |
87 |
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] ) |
88 |
) ) ) |
89 |
pypy2_0? ( !python2? ( !python3? ( virtual/pypy:2.0[bzip2] ) ) ) |
90 |
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )" |
91 |
python_dep="${python_dep_ssl//\[ssl\]}" |
92 |
python_dep="${python_dep//,ssl}" |
93 |
python_dep="${python_dep//ssl,}" |
94 |
|
95 |
python_dep="${python_dep} |
96 |
python_targets_pypy1_9? ( virtual/pypy:1.9 ) |
97 |
python_targets_pypy2_0? ( virtual/pypy:2.0 ) |
98 |
python_targets_python2_6? ( dev-lang/python:2.6 ) |
99 |
python_targets_python2_7? ( dev-lang/python:2.7 ) |
100 |
python_targets_python3_1? ( dev-lang/python:3.1 ) |
101 |
python_targets_python3_2? ( dev-lang/python:3.2 ) |
102 |
python_targets_python3_3? ( dev-lang/python:3.3 ) |
103 |
python_targets_python3_4? ( dev-lang/python:3.4 ) |
104 |
" |
105 |
|
106 |
# The pysqlite blocker is for bug #282760. |
107 |
# make-3.82 is for bug #455858 |
108 |
DEPEND="${python_dep} |
109 |
>=sys-devel/make-3.82 |
110 |
>=sys-apps/sed-4.0.5 sys-devel/patch |
111 |
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 ) |
112 |
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )" |
113 |
# Require sandbox-2.2 for bug #288863. |
114 |
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's |
115 |
# quite slow, so it's not considered in the dependencies as an alternative to |
116 |
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so |
117 |
# for now, don't pull in xattr deps for other kernels. |
118 |
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046). |
119 |
# For compgen, require bash[readline] (bug #445576). |
120 |
RDEPEND="${python_dep} |
121 |
!build? ( >=sys-apps/sed-4.0.5 |
122 |
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) ) |
123 |
>=app-admin/eselect-1.2 |
124 |
|| ( ${python_dep_ssl} dev-python/python-mhash ) |
125 |
) |
126 |
elibc_FreeBSD? ( sys-freebsd/freebsd-bin ) |
127 |
elibc_glibc? ( >=sys-apps/sandbox-2.2 ) |
128 |
elibc_uclibc? ( >=sys-apps/sandbox-2.2 ) |
129 |
>=app-misc/pax-utils-0.1.17 |
130 |
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) ) |
131 |
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) ) |
132 |
!<app-shells/bash-3.2_p17 |
133 |
!<app-admin/logrotate-3.8.0" |
134 |
PDEPEND=" |
135 |
!build? ( |
136 |
>=net-misc/rsync-2.6.4 |
137 |
userland_GNU? ( >=sys-apps/coreutils-6.4 ) |
138 |
)" |
139 |
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532 |
140 |
# NOTE: FEATURES=installsources requires debugedit and rsync |
141 |
|
142 |
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives" |
143 |
|
144 |
prefix_src_archives() { |
145 |
local x y |
146 |
for x in ${@}; do |
147 |
for y in ${SRC_ARCHIVES}; do |
148 |
echo ${y}/${x} |
149 |
done |
150 |
done |
151 |
} |
152 |
|
153 |
PV_PL="2.1.2" |
154 |
PATCHVER_PL="" |
155 |
TARBALL_PV=$PV |
156 |
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2 |
157 |
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)" |
158 |
|
159 |
PATCHVER= |
160 |
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV |
161 |
if [ -n "${PATCHVER}" ]; then |
162 |
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2 |
163 |
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)" |
164 |
fi |
165 |
|
166 |
S="${WORKDIR}"/${PN}-${TARBALL_PV} |
167 |
S_PL="${WORKDIR}"/${PN}-${PV_PL} |
168 |
|
169 |
compatible_python_is_selected() { |
170 |
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]] |
171 |
} |
172 |
|
173 |
current_python_has_xattr() { |
174 |
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' |
175 |
local PYTHON=/usr/bin/${EPYTHON} |
176 |
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \ |
177 |
"${PYTHON}" -c 'import xattr' 2>/dev/null |
178 |
} |
179 |
|
180 |
call_with_python_impl() { |
181 |
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' |
182 |
env EPYTHON=${EPYTHON} "$@" |
183 |
} |
184 |
|
185 |
get_python_interpreter() { |
186 |
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*" |
187 |
local impl=$1 python |
188 |
case "${impl}" in |
189 |
python*) |
190 |
python=${impl/_/.} |
191 |
;; |
192 |
pypy*) |
193 |
python=${impl/_/.} |
194 |
python=${python/pypy/pypy-c} |
195 |
;; |
196 |
*) |
197 |
die "Unrecognized python target: ${impl}" |
198 |
esac |
199 |
echo ${python} |
200 |
} |
201 |
|
202 |
get_python_sitedir() { |
203 |
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*" |
204 |
local impl=$1 |
205 |
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages |
206 |
[[ -d ${ROOT}${site_dir} ]] || \ |
207 |
ewarn "site-packages dir missing for ${impl}: ${ROOT}${site_dir}" |
208 |
echo "${site_dir}" |
209 |
} |
210 |
|
211 |
python_compileall() { |
212 |
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' |
213 |
local d=$1 PYTHON=/usr/bin/${EPYTHON} |
214 |
local d_image=${D}${d#/} |
215 |
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}" |
216 |
case "${EPYTHON}" in |
217 |
python*) |
218 |
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die |
219 |
# Note: Using -OO breaks emaint, since it requires __doc__, |
220 |
# and __doc__ is None when -OO is used. |
221 |
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die |
222 |
;; |
223 |
pypy*) |
224 |
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die |
225 |
;; |
226 |
*) |
227 |
die "Unrecognized EPYTHON value: ${EPYTHON}" |
228 |
esac |
229 |
} |
230 |
|
231 |
pkg_setup() { |
232 |
if use python2 && use python3 ; then |
233 |
ewarn "Both python2 and python3 USE flags are enabled, but only one" |
234 |
ewarn "can be in the shebangs. Using python3." |
235 |
fi |
236 |
if use pypy2_0 && use python3 ; then |
237 |
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one" |
238 |
ewarn "can be in the shebangs. Using python3." |
239 |
fi |
240 |
if use pypy2_0 && use python2 ; then |
241 |
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one" |
242 |
ewarn "can be in the shebangs. Using python2" |
243 |
fi |
244 |
if ! use pypy2_0 && ! use python2 && ! use python3 && \ |
245 |
! compatible_python_is_selected ; then |
246 |
ewarn "Attempting to select a compatible default python interpreter" |
247 |
local x success=0 |
248 |
for x in /usr/bin/python2.* ; do |
249 |
x=${x#/usr/bin/python2.} |
250 |
if [[ $x -ge 6 ]] 2>/dev/null ; then |
251 |
eselect python set python2.$x |
252 |
if compatible_python_is_selected ; then |
253 |
elog "Default python interpreter is now set to python-2.$x" |
254 |
success=1 |
255 |
break |
256 |
fi |
257 |
fi |
258 |
done |
259 |
if [ $success != 1 ] ; then |
260 |
eerror "Unable to select a compatible default python interpreter!" |
261 |
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)." |
262 |
fi |
263 |
fi |
264 |
|
265 |
# We use EPYTHON to designate the active python interpreter, |
266 |
# but we only export when needed, via call_with_python_impl. |
267 |
EPYTHON=python |
268 |
export -n EPYTHON |
269 |
if use python3; then |
270 |
EPYTHON=python3 |
271 |
elif use python2; then |
272 |
EPYTHON=python2 |
273 |
elif use pypy2_0; then |
274 |
EPYTHON=pypy-c2.0 |
275 |
fi |
276 |
} |
277 |
|
278 |
src_prepare() { |
279 |
if [ -n "${PATCHVER}" ] ; then |
280 |
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then |
281 |
rm "$S/bin/ebuild-helpers/portageq" \ |
282 |
|| die "failed to remove portageq helper symlink" |
283 |
fi |
284 |
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch" |
285 |
fi |
286 |
einfo "Setting portage.VERSION to ${PVR} ..." |
287 |
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \ |
288 |
die "Failed to patch portage.VERSION" |
289 |
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \ |
290 |
die "Failed to patch VERSION in doc/fragment/version" |
291 |
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \ |
292 |
die "Failed to patch VERSION in man page headers" |
293 |
|
294 |
if ! use ipc ; then |
295 |
einfo "Disabling ipc..." |
296 |
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \ |
297 |
-i pym/_emerge/AbstractEbuildProcess.py || \ |
298 |
die "failed to patch AbstractEbuildProcess.py" |
299 |
fi |
300 |
|
301 |
if use xattr && use kernel_linux ; then |
302 |
einfo "Adding FEATURES=xattr to make.globals ..." |
303 |
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \ |
304 |
|| die "failed to append to make.globals" |
305 |
fi |
306 |
|
307 |
local set_shebang= |
308 |
if use python3; then |
309 |
set_shebang=python3 |
310 |
elif use python2; then |
311 |
set_shebang=python2 |
312 |
elif use pypy2_0; then |
313 |
set_shebang=pypy-c2.0 |
314 |
fi |
315 |
if [[ -n ${set_shebang} ]] ; then |
316 |
einfo "Converting shebangs for ${set_shebang}..." |
317 |
while read -r -d $'\0' ; do |
318 |
local shebang=$(head -n1 "$REPLY") |
319 |
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then |
320 |
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \ |
321 |
die "sed failed" |
322 |
fi |
323 |
done < <(find . -type f -print0) |
324 |
fi |
325 |
|
326 |
cd "${S}/cnf" || die |
327 |
if [ -f "make.conf.example.${ARCH}".diff ]; then |
328 |
patch make.conf.example "make.conf.example.${ARCH}".diff || \ |
329 |
die "Failed to patch make.conf.example" |
330 |
else |
331 |
eerror "" |
332 |
eerror "Portage does not have an arch-specific configuration for this arch." |
333 |
eerror "Please notify the arch maintainer about this issue. Using generic." |
334 |
eerror "" |
335 |
fi |
336 |
} |
337 |
|
338 |
src_compile() { |
339 |
if use doc; then |
340 |
call_with_python_impl \ |
341 |
emake docbook || die |
342 |
fi |
343 |
|
344 |
if use epydoc; then |
345 |
einfo "Generating api docs" |
346 |
call_with_python_impl \ |
347 |
emake epydoc || die |
348 |
fi |
349 |
} |
350 |
|
351 |
src_test() { |
352 |
call_with_python_impl \ |
353 |
emake test || die |
354 |
} |
355 |
|
356 |
src_install() { |
357 |
call_with_python_impl \ |
358 |
emake DESTDIR="${D}" \ |
359 |
sysconfdir="/etc" \ |
360 |
prefix="/usr" \ |
361 |
install || die |
362 |
|
363 |
# Extended set config is currently disabled in portage-2.1.x. |
364 |
rm -rf "${D}/usr/share/portage/config/sets" || die |
365 |
|
366 |
# Use dodoc for compression, since the Makefile doesn't do that. |
367 |
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die |
368 |
|
369 |
# Allow external portage API consumers to import portage python modules |
370 |
# (this used to be done with PYTHONPATH setting in /etc/env.d). |
371 |
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in |
372 |
# site-packages, and compile with the corresponding interpreter. |
373 |
local impl files mod_dir dest_mod_dir python relative_path x |
374 |
for impl in "${PYTHON_COMPAT[@]}" ; do |
375 |
use "python_targets_${impl}" || continue |
376 |
if use build && [[ ${ROOT} == / && |
377 |
! -x /usr/bin/$(get_python_interpreter ${impl}) ]] ; then |
378 |
# Tolerate --nodeps at beginning of stage1 for catalyst |
379 |
ewarn "skipping python_targets_${impl}, interpreter not found" |
380 |
continue |
381 |
fi |
382 |
while read -r mod_dir ; do |
383 |
cd "${D}/usr/lib/portage/pym/${mod_dir}" || die |
384 |
files=$(echo *.py) |
385 |
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then |
386 |
# __pycache__ directories contain no py files |
387 |
continue |
388 |
fi |
389 |
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir} |
390 |
dodir "${dest_mod_dir}" || die |
391 |
relative_path=../../../lib/portage/pym/${mod_dir} |
392 |
x=/${mod_dir} |
393 |
while [ -n "${x}" ] ; do |
394 |
relative_path=../${relative_path} |
395 |
x=${x%/*} |
396 |
done |
397 |
for x in ${files} ; do |
398 |
dosym "${relative_path}/${x}" \ |
399 |
"${dest_mod_dir}/${x}" || die |
400 |
done |
401 |
done < <(cd "${D}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*") |
402 |
cd "${S}" || die |
403 |
EPYTHON=$(get_python_interpreter ${impl}) \ |
404 |
python_compileall "$(get_python_sitedir ${impl})" |
405 |
done |
406 |
|
407 |
# Compile /usr/lib/portage/pym with the active interpreter, since portage |
408 |
# internal commands force this directory to the beginning of sys.path. |
409 |
python_compileall /usr/lib/portage/pym |
410 |
} |
411 |
|
412 |
pkg_preinst() { |
413 |
if [[ $ROOT == / ]] ; then |
414 |
# Run some minimal tests as a sanity check. |
415 |
local test_runner=$(find "$D" -name runTests) |
416 |
if [[ -n $test_runner && -x $test_runner ]] ; then |
417 |
einfo "Running preinst sanity tests..." |
418 |
"$test_runner" || die "preinst sanity tests failed" |
419 |
fi |
420 |
fi |
421 |
|
422 |
if use xattr && ! current_python_has_xattr ; then |
423 |
ewarn "For optimal performance in xattr handling, install" |
424 |
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and" |
425 |
ewarn "enable USE=python3 for $CATEGORY/$PN." |
426 |
fi |
427 |
|
428 |
# elog dir must exist to avoid logrotate error for bug #415911. |
429 |
# This code runs in preinst in order to bypass the mapping of |
430 |
# portage:portage to root:root which happens after src_install. |
431 |
keepdir /var/log/portage/elog |
432 |
# This is allowed to fail if the user/group are invalid for prefix users. |
433 |
if chown portage:portage "${D}"var/log/portage{,/elog} 2>/dev/null ; then |
434 |
chmod g+s,ug+rwx "${D}"var/log/portage{,/elog} |
435 |
fi |
436 |
|
437 |
if [[ -d ${ROOT}var/log/portage && \ |
438 |
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \ |
439 |
has_version '<sys-apps/portage-2.1.10.11' ; then |
440 |
# Initialize permissions for bug #378451 and bug #377177, since older |
441 |
# portage does not create /var/log/portage with the desired default |
442 |
# permissions. |
443 |
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451" |
444 |
chown portage:portage "${ROOT}var/log/portage" |
445 |
chmod g+ws "${ROOT}var/log/portage" |
446 |
fi |
447 |
|
448 |
if has_version '<sys-apps/portage-2.1.10.61' ; then |
449 |
ewarn "FEATURES=config-protect-if-modified is now enabled by default." |
450 |
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for" |
451 |
ewarn "files that have not been modified since they were installed." |
452 |
fi |
453 |
|
454 |
# If portage-2.1.6 is installed and the preserved_libs_registry exists, |
455 |
# assume that the NEEDED.ELF.2 files have already been generated. |
456 |
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \ |
457 |
! { [ -e "${ROOT}"var/lib/portage/preserved_libs_registry ] && \ |
458 |
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ; } \ |
459 |
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false |
460 |
|
461 |
if has_version "<${CATEGORY}/${PN}-2.1.13" ; then |
462 |
USERPRIV_UPGRADE=true |
463 |
USERSYNC_UPGRADE=true |
464 |
REPOS_CONF_UPGRADE=true |
465 |
REPOS_CONF_SYNC= |
466 |
type portageq >/dev/null 2>&1 && \ |
467 |
REPOS_CONF_SYNC=$(portageq envvar SYNC) |
468 |
else |
469 |
USERPRIV_UPGRADE=false |
470 |
USERSYNC_UPGRADE=false |
471 |
REPOS_CONF_UPGRADE=false |
472 |
fi |
473 |
} |
474 |
|
475 |
get_ownership() { |
476 |
case ${USERLAND} in |
477 |
BSD) |
478 |
stat -f '%Su:%Sg' "${1}" |
479 |
;; |
480 |
*) |
481 |
stat -c '%U:%G' "${1}" |
482 |
;; |
483 |
esac |
484 |
} |
485 |
|
486 |
new_config_protect() { |
487 |
# Generate a ._cfg file even if the target file |
488 |
# does not exist, ensuring that the user will |
489 |
# notice the config change. |
490 |
local basename=${1##*/} |
491 |
local dirname=${1%/*} |
492 |
local i=0 |
493 |
while true ; do |
494 |
local filename=$( |
495 |
echo -n "${dirname}/._cfg" |
496 |
printf "%04d" ${i} |
497 |
echo -n "_${basename}" |
498 |
) |
499 |
[[ -e ${filename} ]] || break |
500 |
(( i++ )) |
501 |
done |
502 |
echo "${filename}" |
503 |
} |
504 |
|
505 |
pkg_postinst() { |
506 |
|
507 |
if ${REPOS_CONF_UPGRADE} ; then |
508 |
einfo "Generating repos.conf" |
509 |
local repo_name= |
510 |
[[ -f ${PORTDIR}/profiles/repo_name ]] && \ |
511 |
repo_name=$(< "${PORTDIR}/profiles/repo_name") |
512 |
if [[ -z ${REPOS_CONF_SYNC} ]] ; then |
513 |
REPOS_CONF_SYNC=$(grep "^sync-uri =" "${ROOT}/usr/share/portage/config/repos.conf") |
514 |
REPOS_CONF_SYNC=${REPOS_CONF_SYNC##* } |
515 |
fi |
516 |
cat <<-EOF > "${T}/repos.conf" |
517 |
[DEFAULT] |
518 |
main-repo = ${repo_name:-gentoo} |
519 |
|
520 |
[${repo_name:-gentoo}] |
521 |
location = ${PORTDIR:-/usr/portage} |
522 |
sync-type = rsync |
523 |
sync-uri = ${REPOS_CONF_SYNC} |
524 |
EOF |
525 |
local dest=${ROOT}/etc/portage/repos.conf |
526 |
if [[ ! -f ${dest} ]] && mkdir -p "${dest}" 2>/dev/null ; then |
527 |
dest=${ROOT}/etc/portage/repos.conf/${repo_name:-gentoo}.conf |
528 |
fi |
529 |
# Don't install the config update if the file exists, since |
530 |
# users may accept it blindly (bug #478726). |
531 |
[[ -e ${dest} ]] || \ |
532 |
mv "${T}/repos.conf" "$(new_config_protect "${dest}")" |
533 |
fi |
534 |
|
535 |
if ${NEEDED_REBUILD_UPGRADE} ; then |
536 |
einfo "rebuilding NEEDED.ELF.2 files" |
537 |
local cpv filename line newline |
538 |
for cpv in "${ROOT}/var/db/pkg"/*/*; do |
539 |
[[ -f "${cpv}/NEEDED" && ! -f "${cpv}/NEEDED.ELF.2" ]] || continue |
540 |
while read -r line; do |
541 |
filename=${line% *} |
542 |
newline=$(scanelf -BF "%a;%F;%S;%r;%n" "${ROOT%/}${filename}") |
543 |
newline=${newline// - } |
544 |
[[ ${#ROOT} -gt 1 ]] && newline=${newline/${ROOT%/}} |
545 |
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2" |
546 |
done < "${cpv}/NEEDED" |
547 |
done |
548 |
fi |
549 |
|
550 |
local distdir=${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}} |
551 |
|
552 |
if ${USERSYNC_UPGRADE} && \ |
553 |
[[ -d ${PORTDIR} && -w ${PORTDIR} ]] ; then |
554 |
local ownership=$(get_ownership "${PORTDIR}") |
555 |
if [[ -n ${ownership} ]] ; then |
556 |
einfo "Adjusting PORTDIR permissions for usersync" |
557 |
find "${PORTDIR}" -path "${distdir%/}" -prune -o \ |
558 |
! \( -user "${ownership%:*}" -a -group "${ownership#*:}" \) \ |
559 |
-exec chown "${ownership}" {} + |
560 |
fi |
561 |
fi |
562 |
|
563 |
# Do this last, since it could take a long time if there |
564 |
# are lots of live sources, and the user may be tempted |
565 |
# to kill emerge while it is running. |
566 |
if ${USERPRIV_UPGRADE} && \ |
567 |
[[ -d ${distdir} && -w ${distdir} ]] ; then |
568 |
local ownership=$(get_ownership "${distdir}") |
569 |
if [[ ${ownership#*:} == portage ]] ; then |
570 |
einfo "Adjusting DISTDIR permissions for userpriv" |
571 |
find "${distdir}" -maxdepth 1 -type d -uid 0 \ |
572 |
-exec chown -R portage:portage {} + |
573 |
fi |
574 |
fi |
575 |
} |