/[gentoo-x86]/sys-apps/portage/portage-2.1.10.65.ebuild
Gentoo

Contents of /sys-apps/portage/portage-2.1.10.65.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Fri Jun 22 11:03:21 2012 UTC (2 years, 2 months ago) by ago
Branch: MAIN
Changes since 1.2: +2 -2 lines
Stable for amd64, wrt bug #422721

(Portage version: 2.1.10.65/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.10.65.ebuild,v 1.2 2012/06/13 06:11:55 zmedico Exp $
4
5 # Require EAPI 2 since we now require at least python-2.6 (for python 3
6 # syntax support) which also requires EAPI 2.
7 EAPI=2
8 inherit eutils multilib python
9
10 DESCRIPTION="Portage is the package management and distribution system for Gentoo"
11 HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
12 LICENSE="GPL-2"
13 KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
14 SLOT="0"
15 IUSE="build doc epydoc +ipc linguas_pl pypy1_9 python2 python3 selinux xattr"
16
17 # Import of the io module in python-2.6 raises ImportError for the
18 # thread module if threading is disabled.
19 python_dep="python3? ( =dev-lang/python-3* )
20 !pypy1_9? ( !python2? ( !python3? (
21 || ( >=dev-lang/python-2.7 dev-lang/python:2.6[threads] )
22 ) ) )
23 pypy1_9? ( !python2? ( !python3? ( dev-python/pypy:1.9[bzip2] ) ) )
24 python2? ( !python3? ( || ( dev-lang/python:2.7 dev-lang/python:2.6[threads] ) ) )"
25
26 # The pysqlite blocker is for bug #282760.
27 DEPEND="${python_dep}
28 !build? ( >=sys-apps/sed-4.0.5 )
29 doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
30 epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
31 # Require sandbox-2.2 for bug #288863.
32 # For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
33 # quite slow, so it's not considered in the dependencies as an alternative to
34 # to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
35 # for now, don't pull in xattr deps for other kernels.
36 RDEPEND="${python_dep}
37 !build? ( >=sys-apps/sed-4.0.5
38 >=app-shells/bash-3.2_p17
39 >=app-admin/eselect-1.2 )
40 elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
41 elibc_glibc? ( >=sys-apps/sandbox-2.2 )
42 elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
43 >=app-misc/pax-utils-0.1.17
44 xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
45 selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
46 !<app-shells/bash-3.2_p17
47 !<app-admin/logrotate-3.8.0"
48 PDEPEND="
49 !build? (
50 >=net-misc/rsync-2.6.4
51 userland_GNU? ( >=sys-apps/coreutils-6.4 )
52 )"
53 # coreutils-6.4 rdep is for date format in emerge-webrsync #164532
54 # NOTE: FEATURES=install-sources requires debugedit and rsync
55
56 SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
57
58 prefix_src_archives() {
59 local x y
60 for x in ${@}; do
61 for y in ${SRC_ARCHIVES}; do
62 echo ${y}/${x}
63 done
64 done
65 }
66
67 PV_PL="2.1.2"
68 PATCHVER_PL=""
69 TARBALL_PV=$PV
70 SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
71 $(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
72 linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
73 $(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
74
75 PATCHVER=
76 [[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
77 if [ -n "${PATCHVER}" ]; then
78 SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
79 $(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
80 fi
81
82 S="${WORKDIR}"/${PN}-${TARBALL_PV}
83 S_PL="${WORKDIR}"/${PN}-${PV_PL}
84
85 compatible_python_is_selected() {
86 [[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
87 }
88
89 current_python_has_xattr() {
90 [[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
91 /usr/bin/python -c 'import xattr' 2>/dev/null
92 }
93
94 pkg_setup() {
95 # Bug #359731 - Die early if get_libdir fails.
96 [[ -z $(get_libdir) ]] && \
97 die "get_libdir returned an empty string"
98
99 if use python2 && use python3 ; then
100 ewarn "Both python2 and python3 USE flags are enabled, but only one"
101 ewarn "can be in the shebangs. Using python3."
102 fi
103 if use pypy1_9 && use python3 ; then
104 ewarn "Both pypy1_9 and python3 USE flags are enabled, but only one"
105 ewarn "can be in the shebangs. Using python3."
106 fi
107 if use pypy1_9 && use python2 ; then
108 ewarn "Both pypy1_9 and python2 USE flags are enabled, but only one"
109 ewarn "can be in the shebangs. Using python2"
110 fi
111 if ! use pypy1_9 && ! use python2 && ! use python3 && \
112 ! compatible_python_is_selected ; then
113 ewarn "Attempting to select a compatible default python interpreter"
114 local x success=0
115 for x in /usr/bin/python2.* ; do
116 x=${x#/usr/bin/python2.}
117 if [[ $x -ge 6 ]] 2>/dev/null ; then
118 eselect python set python2.$x
119 if compatible_python_is_selected ; then
120 elog "Default python interpreter is now set to python-2.$x"
121 success=1
122 break
123 fi
124 fi
125 done
126 if [ $success != 1 ] ; then
127 eerror "Unable to select a compatible default python interpreter!"
128 die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
129 fi
130 fi
131
132 if use python3; then
133 python_set_active_version 3
134 elif use python2; then
135 python_set_active_version 2
136 elif use pypy1_9; then
137 python_set_active_version 2.7-pypy-1.9
138 fi
139 }
140
141 src_prepare() {
142 if [ -n "${PATCHVER}" ] ; then
143 if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
144 rm "$S/bin/ebuild-helpers/portageq" \
145 || die "failed to remove portageq helper symlink"
146 fi
147 epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
148 fi
149 einfo "Setting portage.VERSION to ${PVR} ..."
150 sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
151 die "Failed to patch portage.VERSION"
152 sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
153 die "Failed to patch VERSION in doc/fragment/version"
154 sed -e "1s/VERSION/${PVR}/" -i man/* || \
155 die "Failed to patch VERSION in man page headers"
156
157 if ! use ipc ; then
158 einfo "Disabling ipc..."
159 sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
160 -i pym/_emerge/AbstractEbuildProcess.py || \
161 die "failed to patch AbstractEbuildProcess.py"
162 fi
163
164 if use xattr && use kernel_linux ; then
165 einfo "Adding FEATURES=xattr to make.globals ..."
166 echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
167 || die "failed to append to make.globals"
168 fi
169
170 if use python3; then
171 einfo "Converting shebangs for python3..."
172 python_convert_shebangs -r 3 .
173 elif use python2; then
174 einfo "Converting shebangs for python2..."
175 python_convert_shebangs -r 2 .
176 elif use pypy1_9; then
177 einfo "Converting shebangs for pypy-c1.9..."
178 python_convert_shebangs -r 2.7-pypy-1.9 .
179 fi
180
181 cd "${S}/cnf" || die
182 if [ -f "make.conf.${ARCH}".diff ]; then
183 patch make.conf "make.conf.${ARCH}".diff || \
184 die "Failed to patch make.conf.example"
185 else
186 eerror ""
187 eerror "Portage does not have an arch-specific configuration for this arch."
188 eerror "Please notify the arch maintainer about this issue. Using generic."
189 eerror ""
190 fi
191
192 # BSD and OSX need a sed wrapper so that find/xargs work properly
193 if use userland_GNU; then
194 rm -f "${S}"/bin/ebuild-helpers/sed || \
195 die "Failed to remove sed wrapper"
196 fi
197 }
198
199 src_compile() {
200 if use doc; then
201 emake docbook || die
202 fi
203
204 if use epydoc; then
205 einfo "Generating api docs"
206 emake epydoc || die
207 fi
208 }
209
210 src_test() {
211 emake test || die
212 }
213
214 src_install() {
215 emake DESTDIR="${D}" \
216 sysconfdir="/etc" \
217 prefix="/usr" \
218 libdir="/usr/$(get_libdir)" \
219 install || die
220
221 # Use dodoc for compression, since the Makefile doesn't do that.
222 dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
223
224 if use linguas_pl; then
225 doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
226 doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
227 fi
228 }
229
230 pkg_preinst() {
231 if [[ $ROOT == / ]] ; then
232 # Run some minimal tests as a sanity check.
233 local test_runner=$(find "$D" -name runTests)
234 if [[ -n $test_runner && -x $test_runner ]] ; then
235 einfo "Running preinst sanity tests..."
236 "$test_runner" || die "preinst sanity tests failed"
237 fi
238 fi
239
240 if use xattr && ! current_python_has_xattr ; then
241 ewarn "For optimal performance in xattr handling, install"
242 ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
243 ewarn "enable USE=python3 for $CATEGORY/$PN."
244 fi
245
246 if ! use build && ! has_version dev-python/pycrypto && \
247 ! has_version '>=dev-lang/python-2.6[ssl]' ; then
248 ewarn "If you are an ebuild developer and you plan to commit ebuilds"
249 ewarn "with this system then please install dev-python/pycrypto or"
250 ewarn "enable the ssl USE flag for >=dev-lang/python-2.6 in order"
251 ewarn "to enable RMD160 hash support."
252 ewarn "See bug #198398 for more information."
253 fi
254 if [ -f "${ROOT}/etc/make.globals" ]; then
255 rm "${ROOT}/etc/make.globals"
256 fi
257
258 if [[ -d ${ROOT}var/log/portage && \
259 $(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
260 has_version '<sys-apps/portage-2.1.10.11' ; then
261 # Initialize permissions for bug #378451 and bug #377177, since older
262 # portage does not create /var/log/portage with the desired default
263 # permissions.
264 einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
265 chown portage:portage "${ROOT}var/log/portage"
266 chmod g+ws "${ROOT}var/log/portage"
267 fi
268
269 [[ -n $PORTDIR_OVERLAY ]] && has_version "<${CATEGORY}/${PN}-2.1.6.12" \
270 && REPO_LAYOUT_CONF_WARN=true || REPO_LAYOUT_CONF_WARN=false
271
272 if has_version '<sys-apps/portage-2.1.10.61' ; then
273 ewarn "FEATURES=config-protect-if-modified is now enabled by default."
274 ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
275 ewarn "files that have not been modified since they were installed."
276 fi
277 }
278
279 pkg_postinst() {
280 # Compile all source files recursively. Any orphans
281 # will be identified and removed in postrm.
282 python_mod_optimize /usr/$(get_libdir)/portage/pym
283
284 if $REPO_LAYOUT_CONF_WARN ; then
285 ewarn
286 echo "If you want overlay eclasses to override eclasses from" \
287 "other repos then see the portage(5) man page" \
288 "for information about the new layout.conf and repos.conf" \
289 "configuration files." \
290 | fmt -w 75 | while read -r ; do ewarn "$REPLY" ; done
291 ewarn
292 fi
293 }
294
295 pkg_postrm() {
296 python_mod_cleanup /usr/$(get_libdir)/portage/pym
297 }

  ViewVC Help
Powered by ViewVC 1.1.20