bump(sys-apps/portage): bump to latest

This commit is contained in:
Brandon Philips 2013-05-27 13:16:33 -07:00
parent 9a2d155182
commit f2db2b892d
29 changed files with 12621 additions and 0 deletions

View File

@ -0,0 +1,636 @@
# ChangeLog for sys-apps/portage
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.1269 2013/05/19 00:14:30 zmedico Exp $
*portage-2.2.0_alpha176 (19 May 2013)
19 May 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha176.ebuild,
-portage-2.2.0_alpha174.ebuild:
2.2.0_alpha176 version bump. This includes all of the fixes in 2.1.12.1. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.12.1 (19 May 2013)
19 May 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.12.1.ebuild,
-portage-2.1.11.63.ebuild:
2.1.12.1 version bump. This fixes bug #469332 (clarify RESTRICT=test build log
message), bug #470002 (support PORTAGE_SSH_OPTS), bug #470152 (document ssh
protocol usage for SYNC variable), bug #470154 (update docs to refer to
metadata/md5-cache), bug #470224 (trigger QA notice for gcc -Wsizeof-pointer-
memaccess warnings), bug #470238 (fix emerge --fetch interaction with
--digest), and bug #470258 (fix tigetstr for pypy-2.0_beta2). Bug #468524
tracks all bugs fixed since portage-2.1.11.62.
16 May 2013; Zac Medico <zmedico@gentoo.org> portage-9999.ebuild:
Eliminate subshell in boolean expression.
*portage-2.2.0_alpha175 (16 May 2013)
16 May 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha175.ebuild,
portage-9999.ebuild:
2.2.0_alpha175 version bump. This includes all of the fixes in 2.1.12. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.12 (16 May 2013)
16 May 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.12.ebuild:
2.1.12 version bump. This fixes bug #469338 (use safe cwd for python-based
ebuild helpers) and bug #469888 (use FETCHCOMMAND for proper validation of ssl
certs for https binhosts). This release also enables FEATURES=preserve-libs by
default (see the make.conf man page). Bug #468524 tracks all bugs fixed since
portage-2.1.11.62.
12 May 2013; Zac Medico <zmedico@gentoo.org> portage-2.1.6.7_p1.ebuild:
Remove obsolete python-selinux dep for bug #469520.
06 May 2013; Zac Medico <zmedico@gentoo.org> portage-2.1.11.55.ebuild,
portage-2.1.11.62.ebuild, portage-2.1.11.63.ebuild,
portage-2.2.0_alpha173.ebuild, portage-2.2.0_alpha174.ebuild,
portage-9999.ebuild:
Install /var/log/portage/elog for bug #415911.
*portage-2.2.0_alpha174 (03 May 2013)
03 May 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha174.ebuild:
2.2.0_alpha174 version bump. This includes all of the fixes in 2.1.11.63. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.63 (03 May 2013)
03 May 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.63.ebuild:
2.1.11.63 version bump. This fixes bug #364427 (RESTRICT=preserve-libs
support), bug #466116 (add repoman --include-arches option), bug #466844
(preserve SHELL variable setting by ebuilds), bug #467622 (ACCEPT_RESTRICT
support), bug #467886 (normalize slashes in ${D}/${D} QA message), and bug
#467896 (non-greedy library consumer search for @preserved-rebuild). Bug
#468524 tracks all bugs fixed since portage-2.1.11.62.
28 Apr 2013; Zac Medico <zmedico@gentoo.org> portage-2.1.11.55.ebuild,
portage-2.1.6.7_p1.ebuild:
Migrate off of python.eclass.
27 Apr 2013; Zac Medico <zmedico@gentoo.org> -portage-2.1.11.52.ebuild,
-portage-2.2.0_alpha166.ebuild:
Remove old versions.
25 Apr 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.62.ebuild:
Stable for sparc, wrt bug #467144
25 Apr 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.62.ebuild:
Stable for s390, wrt bug #467144
25 Apr 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.62.ebuild:
Stable for ppc, wrt bug #467144
25 Apr 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.62.ebuild:
Stable for arm, wrt bug #467144
25 Apr 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.62.ebuild:
Stable for alpha, wrt bug #467144
25 Apr 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.62.ebuild:
Stable for x86, wrt bug #467144
25 Apr 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.62.ebuild:
Stable for amd64, wrt bug #467144
25 Apr 2013; Jeroen Roovers <jer@gentoo.org> portage-2.1.11.62.ebuild:
Stable for HPPA (bug #467144).
20 Apr 2013; Zac Medico <zmedico@gentoo.org> -portage-2.1.11.60.ebuild,
-portage-2.1.11.61.ebuild, -portage-2.2.0_alpha171.ebuild,
-portage-2.2.0_alpha172.ebuild:
Remove old versions.
*portage-2.2.0_alpha173 (12 Apr 2013)
12 Apr 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha173.ebuild:
2.2.0_alpha172 version bump. This includes all of the fixes in 2.1.11.62. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.62 (12 Apr 2013)
12 Apr 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.62.ebuild:
2.1.11.62 version bump. This fixes a repoman bug which randomly triggered
incorrect package.use.stable.* handling. Bug #462382 tracks all bugs fixed
since portage-2.1.11.55.
*portage-2.2.0_alpha172 (11 Apr 2013)
11 Apr 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha172.ebuild:
2.2.0_alpha172 version bump. This includes all of the fixes in 2.1.11.61. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.61 (11 Apr 2013)
11 Apr 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.61.ebuild:
2.1.11.61 version bump. This fixes bug #161236 (document emerge --digest), bug
#465562 (remove restrictive systemd.eclass QA warning), and bug #465356
(libpng update triggers blockers + slot-operator slot conflict). Bug #462382
tracks all bugs fixed since portage-2.1.11.55.
04 Apr 2013; Zac Medico <zmedico@gentoo.org> portage-2.1.11.60.ebuild,
portage-2.2.0_alpha171.ebuild, portage-9999.ebuild:
Tolerate --nodeps at beginning of stage1 for catalyst.
04 Apr 2013; Zac Medico <zmedico@gentoo.org> -portage-2.1.11.59.ebuild,
-portage-2.2.0_alpha170.ebuild:
Remove old versions.
*portage-2.2.0_alpha171 (01 Apr 2013)
01 Apr 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha171.ebuild:
2.2.0_alpha171 version bump. This includes all of the fixes in 2.1.11.60. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.60 (01 Apr 2013)
01 Apr 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.60.ebuild:
2.1.11.60 version bump. This fixes bug #433561 (allow repo-name setting in
metadata/layout.conf) and bug #462936 (fix automatic manpage decompression
code and related broken man page symlinks). Bug #462382 tracks all bugs fixed
since portage-2.1.11.55.
31 Mar 2013; Zac Medico <zmedico@gentoo.org> -portage-2.1.11.58.ebuild,
-portage-2.2.0_alpha169.ebuild:
Remove old versions.
28 Mar 2013; Joseph Jezak <josejx@gentoo.org> portage-2.1.11.55.ebuild:
Marked ppc/ppc64 stable for bug #462134.
*portage-2.2.0_alpha170 (27 Mar 2013)
27 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha170.ebuild:
2.2.0_alpha170 version bump. This includes all of the fixes in 2.1.11.59. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.59 (27 Mar 2013)
27 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.59.ebuild:
2.1.11.59 version bump. This fixes bug #461868 (don't try to preserve security
labels when copying xattrs), bug #462694 (handle ENOLCK for NFS), bug #462802
(fix ebuild.sh path in man pages), bug #456296 (don't use FD_CLOEXEC for
stdout on Darwin), bug #463266 (support make.conf as directory), and bug
#463394 (make autounmask respect keywords when unmasking package.mask if
possible). Bug #462382 tracks all bugs fixed since portage-2.1.11.55.
26 Mar 2013; Zac Medico <zmedico@gentoo.org> portage-2.1.11.58.ebuild,
portage-2.2.0_alpha169.ebuild, portage-9999.ebuild:
Stop using python.eclass, since it seems like overkill for our simple needs.
25 Mar 2013; Zac Medico <zmedico@gentoo.org> portage-2.1.11.58.ebuild,
portage-2.2.0_alpha169.ebuild, portage-9999.ebuild:
Don't use -OO for compiling modules, since it breaks emaint.
25 Mar 2013; Zac Medico <zmedico@gentoo.org> portage-2.1.11.58.ebuild,
portage-2.2.0_alpha169.ebuild, portage-9999.ebuild:
Compile /usr/lib/portage/pym with the active interpreter, since portage
internal commands force this directory to the beginning of sys.path.
24 Mar 2013; Markus Meier <maekke@gentoo.org> portage-2.1.11.55.ebuild:
arm stable, bug #462134
23 Mar 2013; Zac Medico <zmedico@gentoo.org> -portage-2.1.11.50.ebuild,
-portage-2.1.11.57.ebuild, -portage-2.2.0_alpha163.ebuild,
-portage-2.2.0_alpha168.ebuild:
Remove old versions.
*portage-2.2.0_alpha169 (22 Mar 2013)
22 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha169.ebuild:
2.2.0_alpha169 version bump. This includes all of the fixes in 2.1.11.58. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.58 (22 Mar 2013)
22 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.58.ebuild:
2.1.11.58 version bump. This fixes bug #462528 (emerge AttributeError during
merge list display when PORTDIR is missing) and also adds support for
PYTHON_TARGETS (instead of PYTHONPATH setting via env.d). Bug #462382 tracks
all bugs fixed since portage-2.1.11.55.
21 Mar 2013; Zac Medico <zmedico@gentoo.org> portage-9999.ebuild:
Add experimental PYTHON_TARGETS support (instead of setting PYTHONPATH via
/etc/env.d).
20 Mar 2013; Jeroen Roovers <jer@gentoo.org> portage-2.1.11.55.ebuild:
Stable for HPPA (bug #462134).
*portage-2.2.0_alpha168 (20 Mar 2013)
20 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha168.ebuild,
-portage-2.2.0_alpha167.ebuild:
2.2.0_alpha168 version bump. This includes all of the fixes in 2.1.11.57. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.57 (20 Mar 2013)
20 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.57.ebuild,
-portage-2.1.11.56.ebuild:
2.1.11.57 version bump. This fixes bug #462412 (regression in 2.1.11.56 and
2.2.0_alpha167 which removed the portageq envvar -v option, breaking things
like etc-update and emerge-webrsync). Bug #462382 tracks all bugs fixed since
portage-2.1.11.55.
*portage-2.2.0_alpha167 (19 Mar 2013)
19 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha167.ebuild:
2.2.0_alpha167 version bump. This includes all of the fixes in 2.1.11.56. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.56 (19 Mar 2013)
19 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.56.ebuild:
2.1.11.56 version bump. This fixes bug #460510 (splitdebug build-id newlines
with glibc-2.17), bug #461412 (display emerge spinner while looking up file
owners), bug #461464 (trigger autounmask as necessary for rebuilds involving
subslots), bug #461908 (distiguish preserved consumers in preserve-libs
display), bug #461944 (exempt multilib-minimal from repoman get_libdir check),
bug #461948 (allow ::repo atoms in overlay package.mask if eapi allows), and
bug #462362 (make repoman honor PORTAGE_GPG_DIR for git signed commits). Bug
#462382 tracks all bugs fixed since portage-2.1.11.55.
19 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.55.ebuild:
Stable for x86, wrt bug #462134
19 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.55.ebuild:
Stable for amd64, wrt bug #462134
09 Mar 2013; Zac Medico <zmedico@gentoo.org> -portage-2.1.11.54.ebuild,
-portage-2.2.0_alpha165.ebuild:
Remove old versions.
*portage-2.2.0_alpha166 (05 Mar 2013)
05 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha166.ebuild:
2.2.0_alpha166 version bump. This includes all of the fixes in 2.1.11.55. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.55 (05 Mar 2013)
05 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.55.ebuild:
2.1.11.55 version bump. This fixes bug #460304 (spurious networkmanager
rebuilds triggered by thee wimax USE flag). Bug #459934 tracks all bugs fixed
since portage-2.1.11.52.
*portage-2.2.0_alpha165 (03 Mar 2013)
03 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha165.ebuild,
-portage-2.2.0_alpha164.ebuild:
2.2.0_alpha165 version bump. This includes all of the fixes in 2.1.11.54. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.54 (03 Mar 2013)
03 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.54.ebuild,
-portage-2.1.11.53.ebuild:
2.1.11.54 version bump. This fixes a repoman regression in 2.1.11.53 and
2.2.0_alpha164 which affected metadata.xml validation with python 2.6 and
python 3.1 (related to bug #328113). Bug #459934 tracks all bugs fixed since
portage-2.1.11.52.
*portage-2.2.0_alpha164 (02 Mar 2013)
02 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha164.ebuild,
-portage-2.2.0_alpha161.ebuild:
2.2.0_alpha164 version bump. This includes all of the fixes in 2.1.11.53. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.53 (02 Mar 2013)
02 Mar 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.53.ebuild,
-portage-2.1.11.31.ebuild:
2.1.11.53 version bump. This fixes bug #102297 (remove deprecated preplib
helper), bug #225821 (clarify python api docs for abssymlink function), bug
#328113 (repoman validation of metadata.xml doctype), bug #368297 (remove
useless 'Starting parallel fetch' message), bug #451326 (add workaround for
compatibility with epoll implementation in qemu-user), bug #457508 (support
quoted args in EXTRA_ECONF), bug #458730 (fix emerge --help docs to indicate
that --verbose does not change output of --help), bug #459350 (unset LIGUAS in
ebuild env when appropriate), and bug #459832 (incorrect emerge handling of
broken slot-operator deps). Bug #459934 tracks all bugs fixed since
portage-2.1.11.52.
01 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.52.ebuild:
Stable for sparc, wrt bug #459748
01 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.52.ebuild:
Stable for sh, wrt bug #459748
01 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.52.ebuild:
Stable for s390, wrt bug #459748
01 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.52.ebuild:
Stable for ia64, wrt bug #459748
01 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.52.ebuild:
Stable for hppa, wrt bug #459748
01 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.52.ebuild:
Stable for arm, wrt bug #459748
01 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.52.ebuild:
Stable for ppc64, wrt bug #459748
01 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.52.ebuild:
Stable for ppc, wrt bug #459748
01 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.52.ebuild:
Stable for alpha, wrt bug #459748
01 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.52.ebuild:
Stable for x86, wrt bug #459748
01 Mar 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.52.ebuild:
Stable for amd64, wrt bug #459748
17 Feb 2013; Zac Medico <zmedico@gentoo.org> -portage-2.1.11.51.ebuild,
-portage-2.2.0_alpha142.ebuild, -portage-2.2.0_alpha162.ebuild:
Remove old versions.
*portage-2.2.0_alpha163 (14 Feb 2013)
14 Feb 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha163.ebuild:
2.2.0_alpha163 version bump. This includes all of the fixes in 2.1.11.52. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.52 (14 Feb 2013)
14 Feb 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.52.ebuild:
2.1.11.52 version bump. This fixes bug #457142 (regression in 2.1.11.51 and
2.2.0_alpha162 which triggers slot conflicts involving built slot-operator
dependencies) and bug #457034 (repoman warning if FEATURES=sign is not enabled
for commit. Bug #456888 tracks all bugs fixed since portage-2.1.11.50.
*portage-2.2.0_alpha162 (12 Feb 2013)
12 Feb 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha162.ebuild:
2.2.0_alpha162 version bump. This includes all of the fixes in 2.1.11.51. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.51 (12 Feb 2013)
12 Feb 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.51.ebuild:
2.1.11.51 version bump. This fixes bug #456340 (unsatisfied slot-operator
message hides other dependency problems), bug #456830 (hide IUSE QA warning
for API consumers like Entropy), bug #455606 (QA warning for
lib*/udev/rules.d), bug #456342 (repoman use.stable handling), bug #456208
(trigger rebuild for sub-slot change without revbump), bug #456236 (restore
compatibility with python-2.6.4), bug #455946 (prompt to add packages to world
only when needed), bug #440304 (preserve configure timestamp when patching it
for CONFIG_SHELL), bug #273272 (make RESTRICT=test mask USE=test), bug #454904
(sample slot-operator rebuild output for emerge man page). bug #454880
(OSError in tests triggered by missing ccache or distcc), bug #454400
(KeyError when updating installed CONTENTS of blocked packages), bug #454050
(tweak die message for FEATURES=fail-clean), and bug #454060 (allow
suppression of errror for missing portage group). Bug #456888 tracks all bugs
fixed since portage-2.1.11.50.
09 Feb 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.50.ebuild:
Stable for ia64, wrt bug #455930
09 Feb 2013; Zac Medico <zmedico@gentoo.org> portage-2.1.11.50.ebuild,
portage-2.2.0_alpha161.ebuild:
Require >=python-2.6.5 for bug #456236.
08 Feb 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.50.ebuild:
Stable for sh, wrt bug #455930
08 Feb 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.50.ebuild:
Stable for alpha, wrt bug #455930
08 Feb 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.50.ebuild:
Stable for s390, wrt bug #455930
08 Feb 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.50.ebuild:
Stable for sparc, wrt bug #455930
08 Feb 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.50.ebuild:
Stable for arm, wrt bug #455930
08 Feb 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.50.ebuild:
Stable for ppc64, wrt bug #455930
08 Feb 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.50.ebuild:
Stable for ppc, wrt bug #455930
08 Feb 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.50.ebuild:
Stable for x86, wrt bug #455930
08 Feb 2013; Agostino Sarubbo <ago@gentoo.org> portage-2.1.11.50.ebuild:
Stable for amd64, wrt bug #455930
07 Feb 2013; Jeroen Roovers <jer@gentoo.org> portage-2.1.11.50.ebuild:
Stable for HPPA (bug #455930).
06 Feb 2013; Zac Medico <zmedico@gentoo.org> portage-2.1.11.31.ebuild,
portage-2.1.11.50.ebuild, portage-2.2.0_alpha142.ebuild,
portage-2.2.0_alpha161.ebuild, portage-9999.ebuild:
DEPEND on make-3.82 for bug #282760.
27 Jan 2013; Zac Medico <zmedico@gentoo.org> portage-2.1.11.31.ebuild,
portage-2.1.11.50.ebuild, portage-2.2.0_alpha142.ebuild,
portage-2.2.0_alpha161.ebuild, portage-9999.ebuild:
Remove obsolete warning about RMD160 hash support.
*portage-2.2.0_alpha161 (24 Jan 2013)
24 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha161.ebuild,
-portage-2.2.0_alpha159.ebuild, -portage-2.2.0_alpha160.ebuild:
2.2.0_alpha161 version bump. This includes all of the fixes in 2.1.11.50. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.50 (24 Jan 2013)
24 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.50.ebuild,
-portage-2.1.11.48.ebuild, -portage-2.1.11.49.ebuild:
2.1.11.50 version bump. This fixes bug #453892 ('TypeError: must be char, not
unicode' exception with Python 2 when renaming files during merge), a
regression since 2.1.11.44 and 2.2.0_alpha155. Bug #445274 tracks all bugs
fixed since portage-2.1.11.31.
*portage-2.2.0_alpha160 (24 Jan 2013)
24 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha160.ebuild,
-portage-2.2.0_alpha158.ebuild:
2.2.0_alpha160 version bump. This includes all of the fixes in 2.1.11.49. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.49 (24 Jan 2013)
24 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.49.ebuild,
-portage-2.1.11.47.ebuild:
2.1.11.49 version bump. This fixes some more potential cases that are related
to bug #453400 (AttributeError triggered by slot conflict involving default
USE deps and implicit IUSE). Bug #445274 tracks all bugs fixed since
portage-2.1.11.31.
*portage-2.2.0_alpha159 (21 Jan 2013)
21 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha159.ebuild,
-portage-2.2.0_alpha155.ebuild:
2.2.0_alpha159 version bump. This includes all of the fixes in 2.1.11.48. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.48 (21 Jan 2013)
21 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.48.ebuild,
-portage-2.1.11.44.ebuild:
2.1.11.48 version bump. This fixes bug #453358 (better examples for
ACCEPT_LICENSE in make.conf man page) and bug #453400 (AttributeError
triggered by slot conflict involving default USE deps and implicit IUSE). Bug
#445274 tracks all bugs fixed since portage-2.1.11.31.
*portage-2.2.0_alpha158 (20 Jan 2013)
20 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha158.ebuild,
-portage-2.2.0_alpha157.ebuild:
2.2.0_alpha158 version bump. This includes all of the fixes in 2.1.11.47. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.47 (20 Jan 2013)
20 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.47.ebuild,
-portage-2.1.11.46.ebuild:
2.1.11.47 version bump. This fixes repoman 'TypeError: must be char, not
unicode' exception with Python 2 when downloading metadata.dtd (regression
since 2.1.11.44 and 2.2.0_alpha155). Bug #445274 tracks all bugs fixed since
portage-2.1.11.31.
*portage-2.2.0_alpha157 (20 Jan 2013)
20 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha157.ebuild,
-portage-2.2.0_alpha156.ebuild:
2.2.0_alpha157 version bump. This includes all of the fixes in 2.1.11.46. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.46 (20 Jan 2013)
20 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.46.ebuild,
-portage-2.1.11.45.ebuild:
2.1.11.46 version bump. This fixes serious bugs in repoman code from the
previous release. Bug #445274 tracks all bugs fixed since portage-2.1.11.31.
*portage-2.2.0_alpha156 (20 Jan 2013)
20 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha156.ebuild,
-portage-2.2.0_alpha154.ebuild:
2.2.0_alpha156 version bump. This includes all of the fixes in 2.1.11.45. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.45 (20 Jan 2013)
20 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.45.ebuild,
-portage-2.1.11.43.ebuild:
2.1.11.45 version bump. This fixes a repoman bug which cause it handle stable
use force/mask incorrectly. Bug #445274 tracks all bugs fixed since
portage-2.1.11.31.
*portage-2.2.0_alpha155 (19 Jan 2013)
19 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha155.ebuild,
-portage-2.2.0_alpha153.ebuild:
2.2.0_alpha155 version bump. This includes all of the fixes in 2.1.11.44. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.44 (19 Jan 2013)
19 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.44.ebuild,
-portage-2.1.11.42.ebuild:
2.1.11.44 version bump. This adds support for the @security package set, which
installs GLSA security updates (like glsa-check from gentoolkit). Bug #445274
tracks all bugs fixed since portage-2.1.11.31.
*portage-2.2.0_alpha154 (16 Jan 2013)
16 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha154.ebuild,
-portage-2.2.0_alpha151.ebuild:
2.2.0_alpha154 version bump. This includes all of the fixes in 2.1.11.43. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.43 (16 Jan 2013)
16 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.43.ebuild,
-portage-2.1.11.40.ebuild:
2.1.11.43 version bump. This fixes bug #451048 (show free ram/swap in emerge
--info output). This also fixes random 'Bad file descriptor' errors for PyPy,
by avoiding file descriptor interference via dup2(). Bug #445274 tracks all
bugs fixed since portage-2.1.11.31.
*portage-2.2.0_alpha153 (15 Jan 2013)
15 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha153.ebuild,
-portage-2.2.0_alpha152.ebuild:
2.2.0_alpha153 version bump. This includes all of the fixes in 2.1.11.42. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.42 (15 Jan 2013)
15 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.42.ebuild,
-portage-2.1.11.41.ebuild:
2.1.11.42 version bump. This fixes bug #452030 (prevent duplicate test runs
with test-fail-continue) and bug #452176 (warn about deprecated /etc/make.*
files). This also fixes a random KeyError which can occur when checking binary
package digests (regression since 2.1.11.39 and 2.2.0_alpha150). Bug #445274
tracks all bugs fixed since portage-2.1.11.31.
14 Jan 2013; Zac Medico <zmedico@gentoo.org> portage-9999.ebuild:
Remove LINGUAS loop which is handled by the Makefile now.
*portage-2.2.0_alpha152 (14 Jan 2013)
14 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha152.ebuild,
-portage-2.2.0_alpha149.ebuild:
2.2.0_alpha152 version bump. This includes all of the fixes in 2.1.11.41. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.41 (14 Jan 2013)
14 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.41.ebuild,
-portage-2.1.11.38.ebuild:
2.1.11.41 version bump. This fixes bug #430488 (python3 support for selinux)
and bug #451386 (handle non-shell-script in /etc/init.d). Bug #445274 tracks
all bugs fixed since portage-2.1.11.31.
14 Jan 2013; Zac Medico <zmedico@gentoo.org> portage-9999.ebuild:
Add linguas_ru for bug #450372.
*portage-2.2.0_alpha151 (11 Jan 2013)
11 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha151.ebuild,
-portage-2.2.0_alpha150.ebuild:
2.2.0_alpha150 version bump. This includes all of the fixes in 2.1.11.40. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.40 (11 Jan 2013)
11 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.40.ebuild,
-portage-2.1.11.39.ebuild:
2.1.11.40 version bump. This fixes bug #451344 (spawn_nofetch portage
NameError, a regression in 2.1.11.39 and 2.2.0_alpha150). Bug #445274 tracks
all bugs fixed since portage-2.1.11.31.
*portage-2.2.0_alpha150 (10 Jan 2013)
10 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.2.0_alpha150.ebuild:
2.2.0_alpha150 version bump. This includes all of the fixes in 2.1.11.39. Bug
#210077 tracks all bugs fixed since portage-2.1.x.
*portage-2.1.11.39 (10 Jan 2013)
10 Jan 2013; Zac Medico <zmedico@gentoo.org> +portage-2.1.11.39.ebuild:
2.1.11.39 version bump. This fixes bug #243192 (update quickpkg man page), bug
#298298 (include packages from nested package sets in emerge --depclean
summary), bug #446610 (handle syncfs return value), bug #446662 (add
QA_CONFIGURE_OPTIONS), bug #448176 (fix emerge --keep-going to avoid dropping
packages), bug #448858 (relocation error triggered by glibc upgrade), bug
#449678 (silence repoman warning about usex for EAPI 5), bug #449708 (make
use() fatal when called with unknown flags in EAPI 5), bug #450278 (add
QA_AM_MAINTAINER_MODE), bug #450960 (mention relavant file names in autounmask
messages), and bug #451118 (fix make.conf.5 formatting of compress-index
docs). Bug #445274 tracks all bugs fixed since portage-2.1.11.31.
01 Jan 2013; Andreas K. Huettel <dilfridge@gentoo.org> +ChangeLog-2012:
Split ChangeLog.
For previous entries, please see ChangeLog-2012.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
AUX README.RESCUE 137 SHA256 69bea0c755eab59b6b4d90838b8551744f0b0c8eeac170b1cd13a71ee83f9ac4 SHA512 dba0f0d6d4cd140e636cc70dfb7bdb298e2f2fb040bc07b0874cac994bdbabd26bfd9361d85a0f8b9a92a185281e4901606b9e4f563afdc8867341bbe6af1cb0 WHIRLPOOL 713fcc790442999d56e13efaf536fec9954dadeda680b3642d0358311332096ddedf8b55697bd1ca620d84f0dc7d025ff7931e086c74c1f5032be72dca2ff8f5
DIST portage-2.1.11.55.tar.bz2 906931 SHA256 555aeaa2e69a6655650a145d149827de24e668a2f199111bdd31a8144f33a3aa SHA512 2605058e2fcf4fc3fd0e30261d19d67518dd03b8050c1022e224738886179bae8ce8c80e391c97026cc7dc3d6e7a5bb7f7df2b0cf3572d7ac629528cd21d92e2 WHIRLPOOL 99e1008d818484a7da15bb656979b5af6935db1c4a3e4bf6cd3309ff984ed70bf36441c85a08b38523481ee5b2625bfbc08f4fa23d53a8caede6512f36c21c14
DIST portage-2.1.11.62.tar.bz2 916085 SHA256 894bd50830264d222210f5417448263355830d5d8d2de446c1b6b3a4c7a14bfb SHA512 1a969c5164871ce12cc87014f69d44fc54c11a2c58d472fc0dfaa82e9561fbfeac442a3b8a0d5cccd39b117f762acfc0e7abcc00c2e16719940e93746a7c4ba7 WHIRLPOOL b681b290e98162ba7f770b4e5d63d5b42398ecd325629a166b158a6e3becd15de5bae8b4a5808612a5a9529683e544473f33d030f20838fb03086501b7e89cc2
DIST portage-2.1.12.1.tar.bz2 868139 SHA256 13fb5316c361082af0ad1fd816797e4ec061ad73ce9c22f5f20ce9d0384672c9 SHA512 063a7449e2d8651b0ce7d054e0be3d79e4e954e5a64cd02f36097b0f5bdabae830df57a0295b180a668d2d9989c5d87a366ed9a2f32c29e98815e13da0c2b9aa WHIRLPOOL 94253e046a63e4868d28f2035cc97c37f9e8262ffb910d1d494dd7ed23613bcf9c99b67c2b3a502fd71ef2f4171d277af2b6322584235664e5697b984b8cfc52
DIST portage-2.1.12.tar.bz2 866443 SHA256 6b71844f760e79966c96c439ca48ea1a614ce35bf316f4b653eb313c9618a09a SHA512 545d14f12a647fa3edd5a76f45bf0c0d97dbc275bdbcdadfc8e8da347eebe08b7f88148adce7a3c94c4ad68f0e889609bfc90b6e485beae1e8874dd730cd8705 WHIRLPOOL cce46a03b6ff8e11a54b52cf590b281ecfddb7f1f64af78c2c6a88c04bd8949b82e63eb8ba3a7c7debdee2eb5035245b57714765d95f537a38be60939f72508f
DIST portage-2.1.6.7.patch.bz2 50118 SHA256 5f0605b51a24d23703330b040d2f7154322284db3e0cefa7499002ff1fa733c0 SHA512 dd2acc1d436cad77cfc83c4dec79316763c1fb88d61b7702e8e47e6f31b2b9fe49e8a4cf4a947614a2acd6db2ef080ed8b4ae5fce9d9be29d7e218a0ec1576c0 WHIRLPOOL 050f923249fde7c4774a2a8a944889e4270a89b00441f1923c01ab0be38f107503e018d7ab7a7f42615e7e375f0f6c0eb3bdbf3ff4ce1ce226957238a729b1ee
DIST portage-2.1.6.7_p1.patch.bz2 4741 SHA256 ddaae2ad8c01e6477bfe22e23a4da57eb9d079a27a17a08385d56fe2c49eec30 SHA512 39058d815827b340787d813515ed4fb8c52c4fb0caa12ae70c8a9a97b9ba16c2bf4177190cb7d1c508055ce8a7aaa390ba9b31642c7d74bfb4a14d729e720617 WHIRLPOOL 8eab9574ed2e6cabac593d93f8b6ff71465c01376e7eec4cf357c336b5ed3d4f3fb3521991148ba4e34ba00c56bec5534c98311167c03866812277a8d88b0494
DIST portage-2.1.6.tar.bz2 518771 SHA256 b1c507445b3858449c861568f477e1cfab8b2326ded906b852c5193fb3839647 SHA512 d035f84601802ecaea3c0edea037a783fec743733bd40895eb5bb8a220449eb24cf1e2623cbca2e378197caba63a833d8cc54f1e49d886266307288b0adcfbdc WHIRLPOOL 25b6a6e3810f428c630ec7a6dc3cf2cfbe6bfdf276553786e1436b2630532ab442186e427bc75f249a224c5171b508a92303ce352b07be1a8a4d805c568ec10f
DIST portage-2.2.0_alpha170.tar.bz2 913726 SHA256 4b08d9c5369a14655cb4236d2ed0c4a2396e7b35f0bfb9447e9ecf741cca56a6 SHA512 4bfd6c5ddf46546bbd7f59dfd1f284682de8f72b20781e78334ebf83d1940f5e29d0f5d2f92a2784b3c21135ebeaadfaf847e3dbe73fa1ed8159026dcea5800e WHIRLPOOL ad245518ee685a5233dc01de9b215ce58bc0f22490383e144ec75e30388e7dc180b99975f00a25aabdfcf956707fe7f057353aa610ec9f37db24d30519430511
DIST portage-2.2.0_alpha173.patch.bz2 6958 SHA256 1c7fe7108e86387fbeb566c2277ca5fa28412820bf31148eee5efca028446007 SHA512 f21d2ae221bee21ee6120e3a1e804712f27ad874b1aa631be9bb4d7fcc8466a4fc158051567d91b1810cd77a5c350a90bb5bd7cf553f96769b7f9c1b2b96e982 WHIRLPOOL bd22135defd36703a0d14267d3265e9c9ea69e20114d2ef220e64841e7b4d6937d5063423306988e695ff450f71c4ed0f9ef9eb0e99db5f5d433cf3481c0875a
DIST portage-2.2.0_alpha175.tar.bz2 866662 SHA256 97976729bbdac82e790ec0691ccd15313a761db09cde2ae9d3504c4e925581c1 SHA512 278d9589e28c14d05c8ac139d5a822e0f7ae1ea068834450b3bcaf65e52af688833635a4bbf3bb279dc0af7f2c1706449d1d3b989722ac00b9f3d202fef1b8f0 WHIRLPOOL cc19445dd9368cb3ad2f37f23025b94117371eac00807337953d31e8deb299a933c3fc7a78c7f010a074ef6d6c01fbc0d53976b4ad9c23e7480873490851fd7e
DIST portage-2.2.0_alpha176.patch.bz2 8723 SHA256 a5031eef8c02da52fe9ed07f3f2873eaab9ccfda48a1685fb0d8fcd9ebd5a9bd SHA512 59d542358aea5af91e78843e8c785bef220e44c21c976d2666951ce16881723ddd226ed5655be1a175aa18c8851bef81a36609de39bcb5b44c9c14cc722d965c WHIRLPOOL b7765c1969a76062695d05ea7ef09685f4712aa8a78a543ed3d98b09bb4d7aa82963fa00c056c9dacb4c7c15d66f3a991bcac67c9284bb1f8dfb13a3fb684e46
DIST portage-man-pl-2.1.2.tar.bz2 53893 SHA256 960eaa7c6f3a2af44bdc665266a8e884628a562373cc477d301597ecc5ef961f SHA512 5f5c8dd1559048546633b1e7291ff8c0f5d637595f1a4c98405424b08c30c089fc9359e0214f78fbe358754f20d327794f4692b9b67639585c29b755975ee853 WHIRLPOOL 756e267b84077501d976f46fa448cda5368cd52aeca6ec43d109c81fe8e2364e0cd0f35630d68a4186c70e3b440b7c870b86ac7ef83cc0afa43e10f9f8e1f422
EBUILD portage-2.1.11.55.ebuild 10989 SHA256 686afe1b6f528ded33f914828b637ed0dec1983b3f7ed72485c918c0362af8c4 SHA512 1f815b9fc7bccec376065309455f63dd704b2388de996c1d36de15626c2f5e8e6c235cc9fcf8eb2eb0c8199f8a4d8b0a2e1ab17f2daa59da202eed22c129c950 WHIRLPOOL 8fed2d305ad930b345071149e901482d0210b0bcb9818773e3077a142f4f708ee3e704d0f00e49e4b7bc66333b22d1c16bb7ea60a78c26eec12939c683338d29
EBUILD portage-2.1.11.62.ebuild 13593 SHA256 04e9222038bd66b61ea43e1b31a033d8de541cb5f55ca6fd0b093e378278c010 SHA512 dcce3640c68f2e7d76c6f3467b3ff79b30711e60346728c2eed04fdf351ce7d6c3ea6ea7a67ea5a395b0bd4b378720161f3c5a20fd883b15b7f6f477cf62792b WHIRLPOOL a71351363a0505780d353e8a82b048916fe5dd4aa57df79fc9d5b87fe3927e65a02560150393811794abf49f7f024701ef5b98e2c25e28156b2b2d8be8d09ce4
EBUILD portage-2.1.12.1.ebuild 14508 SHA256 2dc46c39e4c1331eb2561717abf6a3aaa3171dfff3bdbaee91a4a8712306e16c SHA512 e11652627a3d48309423fca7c3cfb6c534a40c3b2932bb4cffc270c03ce63448fccf557aa2b9635de1ce64dcbde6b0554d179163cba7740accbeba98ad9cb61b WHIRLPOOL a23038417f22287cf6398900429bdea5652ef4fd4074dedcd50091eb4558bb97b6d5ece53e070902053927035524eb20423edb8f65f6b46059af5c8ad5233ed8
EBUILD portage-2.1.12.ebuild 14506 SHA256 ba2d0fa057d2410e03a01646a4132ee43c31bb333dd9f823b5d20067ded9857c SHA512 878a9facbb92cc0aba656bcd4996fc9ac651fd97a6f2d011fe5c641c123b22299b8c2bb86be9d9f661d0ca13bb3b29ef66cb05eefab1969a1868981e185481f8 WHIRLPOOL b5ff25926819536a44d0e47c944b32aed49c5a9076c45d4c2e4da8f018624a258b35f2929c7aec3d611e3415f45557ac34a0c4270ed0209dc06e3f5217ae9be2
EBUILD portage-2.1.6.7_p1.ebuild 8307 SHA256 d43a972b7100062b95b23cf6c2d26ac240799622e04f915c0df98beb51f33108 SHA512 79362e2a742d978f5636b25cbfe818c22d4b2926ca2092ee1624c23da4256a008048bc8aa1ba641b85e2dcb9cd7d80e6b3f0558a446aff4355065e41607d74ef WHIRLPOOL 8783d9d9a9a13333d3bd581ab84df36154ee1c4050494b46414603d65b7c50c2087a9a53a8dbcad99e626d69fe54f008e23eba8e649e269313d093be2dffac9a
EBUILD portage-2.2.0_alpha173.ebuild 15757 SHA256 bfed439e5e9ac00da13284eba8457e6a7dc2ecc4783bbeb753e509c0bde5fa1b SHA512 d86f4d9e2d6a20b8a6e418d7fa88dcd3d8b7db163cf9c10b28cf1f564031770b98f973bb1bb09bc4089041ddf14439af983248709e1e80d0bf8a019a0fef6eb3 WHIRLPOOL 6c3486077b4ff2b0e154146e7c32b76832adf24906266d1be146e0fa3ccb5d0de24e1e7c269521d59ffae43507336cf88bf1cdea2838d7dfde3aa2ae03c70d9b
EBUILD portage-2.2.0_alpha175.ebuild 15628 SHA256 e884be0f35d718b9a0931370867203bc8f9a535babfc4df689bb9a544c353e17 SHA512 dcd66401caf509cd07c3ad59239153bdca15cdb8224c8f269558c7c1079799fb96b199e88042e5e637bba87b7a5df124fbe037e6ce288a7e3f23ad5817dfd367 WHIRLPOOL 7d1754dc461bdd798cbca47198bcd0ebc56d7493aca0e895517c8670b03a29339dde4374840bc29fb45cd0e38d133145335801f64531f58c5a6c01baefa17405
EBUILD portage-2.2.0_alpha176.ebuild 15628 SHA256 dd8d4f231e4bbf241d54c386e12c33fa2e433fb67d94d23f25618989a5b85387 SHA512 64391747774c1bdd1e895dea64b377fc6391f05d199324ebf8f0d14e53b24f29b343acd8133399731491f3e10cfcba5d451fa986cd8c6f8267b08782c7b5bb29 WHIRLPOOL 4c699af5f779a5937e4362fdaa160e58db6c86b63d6c90af62abd8bd24a18d4983dcc57994f0527967061e6b240dc00fa5a7ca67758b333928e5ee6bccbc95bd
EBUILD portage-9999.ebuild 14860 SHA256 fa10372f49d0c73de513db773167c7b31f1863c5db2b65ec413e3b7c0981fa6f SHA512 ff406024ea90fc8256607c061bc467aafc6d0632b470f3ff1c667189813e85cd1a018b4638727419d04654201189a989c6721e011b8cc727e30cd2ae5e1a40cf WHIRLPOOL 95955aa90cf55613e54e87aa169e834f54db2c3228455caf6f0e69080256f7701f8b7cad2223ad584137dc6a98e18b3216f56087a8808833067a709bf993e2da
MISC ChangeLog 28013 SHA256 dcc31bac9721f2ad2ab0b81adc06281efe66ce58acf9bc6be8b844029e615390 SHA512 e9bf3e19c3d19f1ad09bfd7950a282393fb4ae0a57dd17df9893baa6890c67b2dc6ffe9e130980df6b9c58415d1de73e2cc33737a4202f054c59d9462a47a634 WHIRLPOOL 04afdee9ef45c1ba613b844f5abb69b64774297bd2b5b4688b2403609a18767e65540350336a9fd11a506dd1f486c7f5385b2eebaaac1ca6cc540b5265637d98
MISC ChangeLog-2012 133873 SHA256 157a7eb13d4cf2e2c94bfcb7e91f218af1ea88f5ff20c24a50546950a9839c94 SHA512 1241f4ccd7b31bdd340649417257b0e95202992feb66e0cd4d41fc2d35bf0baeac19680f34a831d2fefce0c0fec03aa6e7a191f783e59cf9b93aaf266f010a3f WHIRLPOOL b027bdba0f5ccc1b3a2dc18df92d82b473af5e55536816b7177071c1ae1a89e4d50d42c2093fa1bbe28b92a42014fbefbfc9e7daa4e6426ebecbd5bffc3d479f
MISC metadata.xml 926 SHA256 8736b6884463a876892a4fd45f6239a123c1229d2372ce47d5dff719f0eba2b9 SHA512 38d3c969b49012a94bfadecd1d48936513391a305eee5e5e55eb6c4a6b82e05b6ebf1dd6dfe6fbb5a96ba5fffc33fddcfda8d41f3d367ff4ad030859a655ef8b WHIRLPOOL 6f9afcacb628f75f84d03e812ed93b4e3613fcfc4e1180bcb0551c1c8025050ebd3b21fcdef79358aaad3606558345fcd6f914928eb62155e5b9a50bde0d3bf4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
iEYEAREIAAYFAlGYGWcACgkQ/ejvha5XGaOhBQCgx+iydv0UgT/YCaFmTO5D/K7h
CuQAoJT11xR+gh0XB4184jAEPAuMNGEl
=QJWj
-----END PGP SIGNATURE-----

View File

@ -0,0 +1,2 @@
Please see http://www.gentoo.org/proj/en/portage/doc/manually-fixing-portage.xml
for a recovery guide for a broken portage installation.

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<upstream>
<bugs-to>mailto:dev-portage@gentoo.org</bugs-to>
<changelog>http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=blob_plain;f=RELEASE-NOTES</changelog>
<doc>http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3</doc>
</upstream>
<maintainer><email>dev-portage@gentoo.org</email></maintainer>
<use>
<flag name="epydoc">Build html API documentation with epydoc.</flag>
<flag name="ipc">Use inter-process communication between portage and running ebuilds.</flag>
<flag name="less">Pull in sys-apps/less as default pager for etc-update.</flag>
<flag name="pypy2_0">Use pypy-c2.0 as Python interpreter.</flag>
<flag name="python2">Use python2 as Python interpreter.</flag>
<flag name="python3">Use python3 as Python interpreter.</flag>
</use>
</pkgmetadata>

View File

@ -0,0 +1,278 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.31.ebuild,v 1.12 2013/01/27 22:04:14 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=2
inherit eutils python
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl pypy2_0 python2 python3 selinux xattr"
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
# The pysqlite blocker is for bug #282760.
DEPEND="${python_dep}
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=$PV
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
/usr/bin/python -c 'import xattr' 2>/dev/null
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
if use python3; then
python_set_active_version 3
elif use python2; then
python_set_active_version 2
elif use pypy2_0; then
python_set_active_version 2.7-pypy-2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i man/* || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
if use python3; then
einfo "Converting shebangs for python3..."
python_convert_shebangs -r 3 .
elif use python2; then
einfo "Converting shebangs for python2..."
python_convert_shebangs -r 2 .
elif use pypy2_0; then
einfo "Converting shebangs for pypy-c2.0..."
python_convert_shebangs -r 2.7-pypy-2.0 .
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
emake epydoc || die
fi
}
src_test() {
emake test || die
}
src_install() {
emake DESTDIR="${D}" \
sysconfdir="/etc" \
prefix="/usr" \
install || die
# Extended set config is currently disabled in portage-2.1.x.
rm -rf "${D}/usr/share/portage/config/sets" || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Set PYTHONPATH for portage API consumers. This way we don't have
# to rely on patched python having the correct path, since it has
# been known to incorrectly add /usr/libx32/portage/pym to sys.path.
echo "PYTHONPATH=\"/usr/lib/portage/pym\"" > \
"${T}/05portage" || die
doenvd "${T}/05portage" || die
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$D" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
if [[ -d ${ROOT}var/log/portage && \
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
has_version '<sys-apps/portage-2.1.10.11' ; then
# Initialize permissions for bug #378451 and bug #377177, since older
# portage does not create /var/log/portage with the desired default
# permissions.
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
chown portage:portage "${ROOT}var/log/portage"
chmod g+ws "${ROOT}var/log/portage"
fi
if has_version '<sys-apps/portage-2.1.10.61' ; then
ewarn "FEATURES=config-protect-if-modified is now enabled by default."
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
ewarn "files that have not been modified since they were installed."
fi
}
pkg_postinst() {
# Compile all source files recursively. Any orphans
# will be identified and removed in postrm.
python_mod_optimize /usr/lib/portage/pym
}
pkg_postrm() {
python_mod_cleanup /usr/lib/portage/pym
}

View File

@ -0,0 +1,281 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.50.ebuild,v 1.15 2013/02/09 18:06:18 ago Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=2
inherit eutils python
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
# >=python-2.6.5 for bug #456236
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] >=dev-lang/python-2.6.5:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] >=dev-lang/python-2.6.5:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=$PV
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
/usr/bin/python -c 'import xattr' 2>/dev/null
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
if use python3; then
python_set_active_version 3
elif use python2; then
python_set_active_version 2
elif use pypy2_0; then
python_set_active_version 2.7-pypy-2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
if use python3; then
einfo "Converting shebangs for python3..."
python_convert_shebangs -r 3 .
elif use python2; then
einfo "Converting shebangs for python2..."
python_convert_shebangs -r 2 .
elif use pypy2_0; then
einfo "Converting shebangs for pypy-c2.0..."
python_convert_shebangs -r 2.7-pypy-2.0 .
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
emake epydoc || die
fi
}
src_test() {
emake test || die
}
src_install() {
emake DESTDIR="${D}" \
sysconfdir="/etc" \
prefix="/usr" \
install || die
# Extended set config is currently disabled in portage-2.1.x.
rm -rf "${D}/usr/share/portage/config/sets" || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Set PYTHONPATH for portage API consumers. This way we don't have
# to rely on patched python having the correct path, since it has
# been known to incorrectly add /usr/libx32/portage/pym to sys.path.
echo "PYTHONPATH=\"/usr/lib/portage/pym\"" > \
"${T}/05portage" || die
doenvd "${T}/05portage" || die
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$D" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
if [[ -d ${ROOT}var/log/portage && \
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
has_version '<sys-apps/portage-2.1.10.11' ; then
# Initialize permissions for bug #378451 and bug #377177, since older
# portage does not create /var/log/portage with the desired default
# permissions.
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
chown portage:portage "${ROOT}var/log/portage"
chmod g+ws "${ROOT}var/log/portage"
fi
if has_version '<sys-apps/portage-2.1.10.61' ; then
ewarn "FEATURES=config-protect-if-modified is now enabled by default."
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
ewarn "files that have not been modified since they were installed."
fi
}
pkg_postinst() {
# Compile all source files recursively. Any orphans
# will be identified and removed in postrm.
python_mod_optimize /usr/lib/portage/pym
}
pkg_postrm() {
python_mod_cleanup /usr/lib/portage/pym
}

View File

@ -0,0 +1,280 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.52.ebuild,v 1.12 2013/03/01 10:02:48 ago Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=2
inherit eutils python
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=$PV
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
/usr/bin/python -c 'import xattr' 2>/dev/null
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
if use python3; then
python_set_active_version 3
elif use python2; then
python_set_active_version 2
elif use pypy2_0; then
python_set_active_version 2.7-pypy-2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
if use python3; then
einfo "Converting shebangs for python3..."
python_convert_shebangs -r 3 .
elif use python2; then
einfo "Converting shebangs for python2..."
python_convert_shebangs -r 2 .
elif use pypy2_0; then
einfo "Converting shebangs for pypy-c2.0..."
python_convert_shebangs -r 2.7-pypy-2.0 .
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
emake epydoc || die
fi
}
src_test() {
emake test || die
}
src_install() {
emake DESTDIR="${D}" \
sysconfdir="/etc" \
prefix="/usr" \
install || die
# Extended set config is currently disabled in portage-2.1.x.
rm -rf "${D}/usr/share/portage/config/sets" || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Set PYTHONPATH for portage API consumers. This way we don't have
# to rely on patched python having the correct path, since it has
# been known to incorrectly add /usr/libx32/portage/pym to sys.path.
echo "PYTHONPATH=\"/usr/lib/portage/pym\"" > \
"${T}/05portage" || die
doenvd "${T}/05portage" || die
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$D" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
if [[ -d ${ROOT}var/log/portage && \
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
has_version '<sys-apps/portage-2.1.10.11' ; then
# Initialize permissions for bug #378451 and bug #377177, since older
# portage does not create /var/log/portage with the desired default
# permissions.
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
chown portage:portage "${ROOT}var/log/portage"
chmod g+ws "${ROOT}var/log/portage"
fi
if has_version '<sys-apps/portage-2.1.10.61' ; then
ewarn "FEATURES=config-protect-if-modified is now enabled by default."
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
ewarn "files that have not been modified since they were installed."
fi
}
pkg_postinst() {
# Compile all source files recursively. Any orphans
# will be identified and removed in postrm.
python_mod_optimize /usr/lib/portage/pym
}
pkg_postrm() {
python_mod_cleanup /usr/lib/portage/pym
}

View File

@ -0,0 +1,322 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.55.ebuild,v 1.8 2013/05/06 21:42:24 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=2
inherit eutils
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~alpha amd64 arm hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc x86 ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=$PV
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
/usr/bin/python -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=$1 PYTHON=/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="/etc" \
prefix="/usr" \
install || die
# Extended set config is currently disabled in portage-2.1.x.
rm -rf "${D}/usr/share/portage/config/sets" || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Set PYTHONPATH for portage API consumers. This way we don't have
# to rely on patched python having the correct path, since it has
# been known to incorrectly add /usr/libx32/portage/pym to sys.path.
echo "PYTHONPATH=\"/usr/lib/portage/pym\"" > \
"${T}/05portage" || die
doenvd "${T}/05portage" || die
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$D" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${D}"var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${D}"var/log/portage{,/elog}
fi
if [[ -d ${ROOT}var/log/portage && \
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
has_version '<sys-apps/portage-2.1.10.11' ; then
# Initialize permissions for bug #378451 and bug #377177, since older
# portage does not create /var/log/portage with the desired default
# permissions.
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
chown portage:portage "${ROOT}var/log/portage"
chmod g+ws "${ROOT}var/log/portage"
fi
if has_version '<sys-apps/portage-2.1.10.61' ; then
ewarn "FEATURES=config-protect-if-modified is now enabled by default."
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
ewarn "files that have not been modified since they were installed."
fi
}

View File

@ -0,0 +1,280 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.57.ebuild,v 1.1 2013/03/20 03:52:03 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=2
inherit eutils python
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=$PV
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
/usr/bin/python -c 'import xattr' 2>/dev/null
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
if use python3; then
python_set_active_version 3
elif use python2; then
python_set_active_version 2
elif use pypy2_0; then
python_set_active_version 2.7-pypy-2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
if use python3; then
einfo "Converting shebangs for python3..."
python_convert_shebangs -r 3 .
elif use python2; then
einfo "Converting shebangs for python2..."
python_convert_shebangs -r 2 .
elif use pypy2_0; then
einfo "Converting shebangs for pypy-c2.0..."
python_convert_shebangs -r 2.7-pypy-2.0 .
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
emake epydoc || die
fi
}
src_test() {
emake test || die
}
src_install() {
emake DESTDIR="${D}" \
sysconfdir="/etc" \
prefix="/usr" \
install || die
# Extended set config is currently disabled in portage-2.1.x.
rm -rf "${D}/usr/share/portage/config/sets" || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Set PYTHONPATH for portage API consumers. This way we don't have
# to rely on patched python having the correct path, since it has
# been known to incorrectly add /usr/libx32/portage/pym to sys.path.
echo "PYTHONPATH=\"/usr/lib/portage/pym\"" > \
"${T}/05portage" || die
doenvd "${T}/05portage" || die
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$D" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
if [[ -d ${ROOT}var/log/portage && \
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
has_version '<sys-apps/portage-2.1.10.11' ; then
# Initialize permissions for bug #378451 and bug #377177, since older
# portage does not create /var/log/portage with the desired default
# permissions.
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
chown portage:portage "${ROOT}var/log/portage"
chmod g+ws "${ROOT}var/log/portage"
fi
if has_version '<sys-apps/portage-2.1.10.61' ; then
ewarn "FEATURES=config-protect-if-modified is now enabled by default."
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
ewarn "files that have not been modified since they were installed."
fi
}
pkg_postinst() {
# Compile all source files recursively. Any orphans
# will be identified and removed in postrm.
python_mod_optimize /usr/lib/portage/pym
}
pkg_postrm() {
python_mod_cleanup /usr/lib/portage/pym
}

View File

@ -0,0 +1,389 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.58.ebuild,v 1.4 2013/03/26 05:17:45 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=2
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=$PV
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${ROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${ROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=$1 PYTHON=/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="/etc" \
prefix="/usr" \
install || die
# Extended set config is currently disabled in portage-2.1.x.
rm -rf "${D}/usr/share/portage/config/sets" || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
while read -r mod_dir ; do
cd "${D}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${D}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$D" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
if [[ -d ${ROOT}var/log/portage && \
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
has_version '<sys-apps/portage-2.1.10.11' ; then
# Initialize permissions for bug #378451 and bug #377177, since older
# portage does not create /var/log/portage with the desired default
# permissions.
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
chown portage:portage "${ROOT}var/log/portage"
chmod g+ws "${ROOT}var/log/portage"
fi
if has_version '<sys-apps/portage-2.1.10.61' ; then
ewarn "FEATURES=config-protect-if-modified is now enabled by default."
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
ewarn "files that have not been modified since they were installed."
fi
}

View File

@ -0,0 +1,395 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.60.ebuild,v 1.2 2013/04/04 17:45:27 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=2
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=$PV
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${ROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${ROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=$1 PYTHON=/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="/etc" \
prefix="/usr" \
install || die
# Extended set config is currently disabled in portage-2.1.x.
rm -rf "${D}/usr/share/portage/config/sets" || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
if use build && [[ ${ROOT} == / &&
! -x /usr/bin/$(get_python_interpreter ${impl}) ]] ; then
# Tolerate --nodeps at beginning of stage1 for catalyst
ewarn "skipping python_targets_${impl}, interpreter not found"
continue
fi
while read -r mod_dir ; do
cd "${D}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${D}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$D" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
if [[ -d ${ROOT}var/log/portage && \
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
has_version '<sys-apps/portage-2.1.10.11' ; then
# Initialize permissions for bug #378451 and bug #377177, since older
# portage does not create /var/log/portage with the desired default
# permissions.
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
chown portage:portage "${ROOT}var/log/portage"
chmod g+ws "${ROOT}var/log/portage"
fi
if has_version '<sys-apps/portage-2.1.10.61' ; then
ewarn "FEATURES=config-protect-if-modified is now enabled by default."
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
ewarn "files that have not been modified since they were installed."
fi
}

View File

@ -0,0 +1,404 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.62.ebuild,v 1.10 2013/05/06 21:42:24 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=2
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=$PV
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${ROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${ROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=$1 PYTHON=/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="/etc" \
prefix="/usr" \
install || die
# Extended set config is currently disabled in portage-2.1.x.
rm -rf "${D}/usr/share/portage/config/sets" || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
if use build && [[ ${ROOT} == / &&
! -x /usr/bin/$(get_python_interpreter ${impl}) ]] ; then
# Tolerate --nodeps at beginning of stage1 for catalyst
ewarn "skipping python_targets_${impl}, interpreter not found"
continue
fi
while read -r mod_dir ; do
cd "${D}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${D}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$D" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${D}"var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${D}"var/log/portage{,/elog}
fi
if [[ -d ${ROOT}var/log/portage && \
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
has_version '<sys-apps/portage-2.1.10.11' ; then
# Initialize permissions for bug #378451 and bug #377177, since older
# portage does not create /var/log/portage with the desired default
# permissions.
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
chown portage:portage "${ROOT}var/log/portage"
chmod g+ws "${ROOT}var/log/portage"
fi
if has_version '<sys-apps/portage-2.1.10.61' ; then
ewarn "FEATURES=config-protect-if-modified is now enabled by default."
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
ewarn "files that have not been modified since they were installed."
fi
}

View File

@ -0,0 +1,404 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.63.ebuild,v 1.2 2013/05/06 21:42:24 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=2
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=$PV
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${ROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${ROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=$1 PYTHON=/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="/etc" \
prefix="/usr" \
install || die
# Extended set config is currently disabled in portage-2.1.x.
rm -rf "${D}/usr/share/portage/config/sets" || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
if use build && [[ ${ROOT} == / &&
! -x /usr/bin/$(get_python_interpreter ${impl}) ]] ; then
# Tolerate --nodeps at beginning of stage1 for catalyst
ewarn "skipping python_targets_${impl}, interpreter not found"
continue
fi
while read -r mod_dir ; do
cd "${D}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${D}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$D" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${D}"var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${D}"var/log/portage{,/elog}
fi
if [[ -d ${ROOT}var/log/portage && \
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
has_version '<sys-apps/portage-2.1.10.11' ; then
# Initialize permissions for bug #378451 and bug #377177, since older
# portage does not create /var/log/portage with the desired default
# permissions.
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
chown portage:portage "${ROOT}var/log/portage"
chmod g+ws "${ROOT}var/log/portage"
fi
if has_version '<sys-apps/portage-2.1.10.61' ; then
ewarn "FEATURES=config-protect-if-modified is now enabled by default."
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
ewarn "files that have not been modified since they were installed."
fi
}

View File

@ -0,0 +1,428 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.12.1.ebuild,v 1.1 2013/05/19 00:12:51 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=2
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=$PV
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${ROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${ROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=$1 PYTHON=/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="/etc" \
prefix="/usr" \
install || die
# Extended set config is currently disabled in portage-2.1.x.
rm -rf "${D}/usr/share/portage/config/sets" || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
if use build && [[ ${ROOT} == / &&
! -x /usr/bin/$(get_python_interpreter ${impl}) ]] ; then
# Tolerate --nodeps at beginning of stage1 for catalyst
ewarn "skipping python_targets_${impl}, interpreter not found"
continue
fi
while read -r mod_dir ; do
cd "${D}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${D}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$D" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${D}"var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${D}"var/log/portage{,/elog}
fi
if [[ -d ${ROOT}var/log/portage && \
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
has_version '<sys-apps/portage-2.1.10.11' ; then
# Initialize permissions for bug #378451 and bug #377177, since older
# portage does not create /var/log/portage with the desired default
# permissions.
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
chown portage:portage "${ROOT}var/log/portage"
chmod g+ws "${ROOT}var/log/portage"
fi
if has_version '<sys-apps/portage-2.1.10.61' ; then
ewarn "FEATURES=config-protect-if-modified is now enabled by default."
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
ewarn "files that have not been modified since they were installed."
fi
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! { [ -e "${ROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ; } \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
if ${NEEDED_REBUILD_UPGRADE} ; then
einfo "rebuilding NEEDED.ELF.2 files"
local cpv filename line newline
for cpv in "${ROOT}/var/db/pkg"/*/*; do
[[ -f "${cpv}/NEEDED" && ! -f "${cpv}/NEEDED.ELF.2" ]] || continue
while read -r line; do
filename=${line% *}
newline=$(scanelf -BF "%a;%F;%S;%r;%n" "${ROOT%/}${filename}")
newline=${newline// - }
[[ ${#ROOT} -gt 1 ]] && newline=${newline/${ROOT%/}}
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
done
fi
}

View File

@ -0,0 +1,428 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.12.ebuild,v 1.1 2013/05/16 00:25:31 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=2
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=$PV
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${ROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${ROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=$1 PYTHON=/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="/etc" \
prefix="/usr" \
install || die
# Extended set config is currently disabled in portage-2.1.x.
rm -rf "${D}/usr/share/portage/config/sets" || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
if use build && [[ ${ROOT} == / &&
! -x /usr/bin/$(get_python_interpreter ${impl}) ]] ; then
# Tolerate --nodeps at beginning of stage1 for catalyst
ewarn "skipping python_targets_${impl}, interpreter not found"
continue
fi
while read -r mod_dir ; do
cd "${D}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${D}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$D" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${D}"var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${D}"var/log/portage{,/elog}
fi
if [[ -d ${ROOT}var/log/portage && \
$(ls -ld "${ROOT}var/log/portage") != *" portage portage "* ]] && \
has_version '<sys-apps/portage-2.1.10.11' ; then
# Initialize permissions for bug #378451 and bug #377177, since older
# portage does not create /var/log/portage with the desired default
# permissions.
einfo "Applying portage group permission to ${ROOT}var/log/portage for bug #378451"
chown portage:portage "${ROOT}var/log/portage"
chmod g+ws "${ROOT}var/log/portage"
fi
if has_version '<sys-apps/portage-2.1.10.61' ; then
ewarn "FEATURES=config-protect-if-modified is now enabled by default."
ewarn "This causes the CONFIG_PROTECT behavior to be skipped for"
ewarn "files that have not been modified since they were installed."
fi
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! { [ -e "${ROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ; } \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
if ${NEEDED_REBUILD_UPGRADE} ; then
einfo "rebuilding NEEDED.ELF.2 files"
local cpv filename line newline
for cpv in "${ROOT}/var/db/pkg"/*/*; do
[[ -f "${cpv}/NEEDED" && ! -f "${cpv}/NEEDED.ELF.2" ]] || continue
while read -r line; do
filename=${line% *}
newline=$(scanelf -BF "%a;%F;%S;%r;%n" "${ROOT%/}${filename}")
newline=${newline// - }
[[ ${#ROOT} -gt 1 ]] && newline=${newline/${ROOT%/}}
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
done
fi
}

View File

@ -0,0 +1,257 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.6.7_p1.ebuild,v 1.8 2013/05/12 09:38:08 zmedico Exp $
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc less linguas_pl"
python_dep=">=dev-lang/python-2.4 <dev-lang/python-3"
DEPEND="${python_dep}
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 )"
# the debugedit blocker is for bug #289967
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
>=app-shells/bash-3.2_p17
>=app-admin/eselect-1.2 )
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-1.2.17 !mips? ( >=sys-apps/sandbox-1.2.18.1-r2 ) )
elibc_uclibc? ( >=sys-apps/sandbox-1.2.17 !mips? ( >=sys-apps/sandbox-1.2.18.1-r2 ) )
>=app-misc/pax-utils-0.1.17
!>=dev-util/debugedit-4.4.6-r2"
PDEPEND="
!build? (
less? ( sys-apps/less )
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.1.6
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
for PATCHVER in 2.1.6.7 ${PV} ; do
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
done
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
pkg_setup() {
# Bug #359731 - Die early if get_libdir fails.
[[ -z $(get_libdir) ]] && \
die "get_libdir returned an empty string"
}
src_unpack() {
unpack ${A}
cd "${S}"
for PATCHVER in 2.1.6.7 ${PV} ; do
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
done
einfo "Setting portage.VERSION to ${PVR} ..."
sed -i "s/^VERSION=.*/VERSION=\"${PVR}\"/" pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
}
src_compile() {
if use doc; then
cd "${S}"/doc
touch fragment/date
# Workaround for bug #272063, remove in 2.1.6.14.
sed 's:^XMLTO_FLAGS =:XMLTO_FLAGS = --skip-validation:' -i Makefile
make xhtml xhtml-nochunks || die "failed to make docs"
fi
if use epydoc; then
einfo "Generating api docs"
mkdir "${WORKDIR}"/api
local my_modules epydoc_opts=""
# A name collision between the portage.dbapi class and the
# module with the same name triggers an epydoc crash unless
# portage.dbapi is excluded from introspection.
ROOT=/ has_version '>=dev-python/epydoc-3_pre0' && \
epydoc_opts='--exclude-introspect portage\.dbapi'
my_modules="$(find "${S}/pym" -name "*.py" \
| sed -e 's:/__init__.py$::' -e 's:\.py$::' -e "s:^${S}/pym/::" \
-e 's:/:.:g' | sort)" || die "error listing modules"
# workaround for bug 282760
> "$S/pym/pysqlite2.py"
PYTHONPATH="${S}/pym:${PYTHONPATH}" epydoc -o "${WORKDIR}"/api \
-qqqqq --no-frames --show-imports $epydoc_opts \
--name "${PN}" --url "${HOMEPAGE}" \
${my_modules} || die "epydoc failed"
rm "$S/pym/pysqlite2.py"
fi
}
src_test() {
./pym/portage/tests/runTests || \
die "test(s) failed"
}
src_install() {
local libdir=$(get_libdir)
local portage_base="/usr/${libdir}/portage"
local portage_share_config=/usr/share/portage/config
cd "${S}"/cnf
insinto /etc
doins etc-update.conf dispatch-conf.conf
dodir "${portage_share_config}"
insinto "${portage_share_config}"
doins "${S}/cnf/"make.globals
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
newins make.conf make.conf.example
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
newins make.conf make.conf.example
fi
dosym ..${portage_share_config}/make.globals /etc/make.globals
insinto /etc/logrotate.d
doins "${S}"/cnf/logrotate.d/elog-save-summary
dodir ${portage_base}/bin
exeinto ${portage_base}/bin
# BSD and OSX need a sed wrapper so that find/xargs work properly
if use userland_GNU; then
rm "${S}"/bin/sed || die "Failed to remove sed wrapper"
fi
cd "${S}"/bin
doexe *
dosym newins ${portage_base}/bin/donewins
local symlinks
for mydir in $(find "${S}"/pym -type d | sed -e "s:^${S}/::") ; do
dodir ${portage_base}/${mydir}
insinto ${portage_base}/${mydir}
cd "${S}"/${mydir}
doins *.py
symlinks=$(find . -mindepth 1 -maxdepth 1 -type l)
[ -n "${symlinks}" ] && cp -P ${symlinks} "${D}${portage_base}/${mydir}"
done
# Symlinks to directories cause up/downgrade issues and the use of these
# modules outside of portage is probably negligible.
for x in "${D}${portage_base}/pym/"{cache,elog_modules} ; do
[ ! -L "${x}" ] && continue
die "symlink to directory will cause upgrade/downgrade issues: '${x}'"
done
exeinto ${portage_base}/pym/portage/tests
doexe "${S}"/pym/portage/tests/runTests
doman "${S}"/man/*.[0-9]
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9]
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9]
fi
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES}
use doc && dohtml -r "${S}"/doc/*
use epydoc && dohtml -r "${WORKDIR}"/api
dodir /usr/bin
for x in ebuild emerge portageq repoman xpak; do
dosym ../${libdir}/portage/bin/${x} /usr/bin/${x}
done
dodir /usr/sbin
local x
for x in archive-conf dispatch-conf emaint emerge-webrsync env-update \
etc-update fixpackages quickpkg regenworld ; do
dosym ../${libdir}/portage/bin/${x} /usr/sbin/${x}
done
dosym env-update /usr/sbin/update-env
dosym etc-update /usr/sbin/update-etc
dodir /etc/portage
keepdir /etc/portage
/usr/bin/python -m compileall -q -f -d "${portage_base}/pym" "${D%/}${portage_base}/pym" || die
/usr/bin/python -O -m compileall -q -f -d "${portage_base}/pym" "${D%/}${portage_base}/pym" || die
}
pkg_preinst() {
if [ -f "${ROOT}/etc/make.globals" ]; then
rm "${ROOT}/etc/make.globals"
fi
has_version ">=${CATEGORY}/${PN}-2.2_pre"
DOWNGRADE_FROM_2_2=$?
has_version "<${CATEGORY}/${PN}-2.1.6_pre"
UPGRADE_FROM_2_1=$?
}
pkg_postinst() {
local warning_shown=0
if [ $DOWNGRADE_FROM_2_2 = 0 ] ; then
ewarn
echo "Since you have downgraded from portage-2.2, do not forget to" \
"use revdep-rebuild when appropriate, since the @preserved-rebuild" \
"package set is only supported with portage-2.2." | fmt -w 70 | \
while read ; do ewarn "$REPLY" ; done
warning_shown=1
fi
if [ $UPGRADE_FROM_2_1 = 0 ] ; then
ewarn
echo "In portage-2.1.6, the default behavior has changed for" \
"\`emerge world\` and \`emerge system\` commands. These commands" \
"will reinstall all packages from the given set unless an option" \
"such as --noreplace, --update, or --newuse is specified." \
| fmt -w 70 | while read ; do ewarn "$REPLY" ; done
ewarn
echo "File collision protection is now enabled by default via" \
"make.globals with FEATURES=protect-owned. If you want to" \
"disable collision protection completely (not recommended), then" \
"you need to ensure that neither protect-owned nor collision-protect" \
"are enabled." | fmt -w 70 | while read ; do ewarn "$REPLY" ; done
ewarn
echo "If you have overridden FETCHCOMMAND or RESUMECOMMAND variables," \
"for compatibility with EAPI 2, you must ensure that these variables" \
"are written such that the downloaded file will be placed at" \
"\"\${DISTDIR}/\${FILE}\". Refer to make.conf(5) for" \
"information about FETCHCOMMAND and RESUMECOMMAND." | \
fmt -w 70 | while read ; do ewarn "$REPLY" ; done
warning_shown=1
fi
if [ $warning_shown = 1 ] ; then
ewarn # for symmetry
fi
}

View File

@ -0,0 +1,332 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha142.ebuild,v 1.6 2013/01/27 22:04:14 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=3
inherit eutils python
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl pypy2_0 python2 python3 selinux xattr"
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
# The pysqlite blocker is for bug #282760.
DEPEND="${python_dep}
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.2.0_alpha142
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${EPREFIX}/usr/bin/python" -c 'import xattr' 2>/dev/null
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
if use python3; then
python_set_active_version 3
elif use python2; then
python_set_active_version 2
elif use pypy2_0; then
python_set_active_version 2.7-pypy-2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i man/* || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
if use python3; then
einfo "Converting shebangs for python3..."
python_convert_shebangs -r 3 .
elif use python2; then
einfo "Converting shebangs for python2..."
python_convert_shebangs -r 2 .
elif use pypy2_0; then
einfo "Converting shebangs for pypy-c2.0..."
python_convert_shebangs -r 2.7-pypy-2.0 .
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
find . -type f -print0 | \
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
echo -e '\nFEATURES="${FEATURES} preserve-libs"' >> cnf/make.globals \
|| die "failed to append to make.globals"
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
emake epydoc || die
fi
}
src_test() {
# make files executable, in case they were created by patch
find bin -type f | xargs chmod +x
emake test || die
}
src_install() {
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Set PYTHONPATH for portage API consumers. This way we don't have
# to rely on patched python having the correct path, since it has
# been known to incorrectly add /usr/libx32/portage/pym to sys.path.
echo "PYTHONPATH=\"${EPREFIX}/usr/lib/portage/pym\"" > \
"${T}/05portage" || die
doenvd "${T}/05portage" || die
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$ED" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! ( [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ) \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
# Compile all source files recursively. Any orphans
# will be identified and removed in postrm.
python_mod_optimize /usr/lib/portage/pym
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if $NEEDED_REBUILD_UPGRADE ; then
einfo "rebuilding NEEDED.ELF.2 files"
for cpv in "${EROOT}/var/db/pkg"/*/*; do
if [ -f "${cpv}/NEEDED" ]; then
rm -f "${cpv}/NEEDED.ELF.2"
while read line; do
filename=${line% *}
needed=${line#* }
needed=${needed//+/++}
needed=${needed//#/##}
needed=${needed//%/%%}
newline=$(scanelf -BF "%a;%F;%S;%r;${needed}" $filename)
newline=${newline// - }
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
fi
done
fi
}
pkg_postrm() {
python_mod_cleanup /usr/lib/portage/pym
}

View File

@ -0,0 +1,332 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha161.ebuild,v 1.2 2013/01/27 22:04:14 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=3
inherit eutils python
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
# The pysqlite blocker is for bug #282760.
DEPEND="${python_dep}
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.2.0_alpha160
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${EPREFIX}/usr/bin/python" -c 'import xattr' 2>/dev/null
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
if use python3; then
python_set_active_version 3
elif use python2; then
python_set_active_version 2
elif use pypy2_0; then
python_set_active_version 2.7-pypy-2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
if use python3; then
einfo "Converting shebangs for python3..."
python_convert_shebangs -r 3 .
elif use python2; then
einfo "Converting shebangs for python2..."
python_convert_shebangs -r 2 .
elif use pypy2_0; then
einfo "Converting shebangs for pypy-c2.0..."
python_convert_shebangs -r 2.7-pypy-2.0 .
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
find . -type f -print0 | \
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
echo -e '\nFEATURES="${FEATURES} preserve-libs"' >> cnf/make.globals \
|| die "failed to append to make.globals"
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
emake epydoc || die
fi
}
src_test() {
# make files executable, in case they were created by patch
find bin -type f | xargs chmod +x
emake test || die
}
src_install() {
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Set PYTHONPATH for portage API consumers. This way we don't have
# to rely on patched python having the correct path, since it has
# been known to incorrectly add /usr/libx32/portage/pym to sys.path.
echo "PYTHONPATH=\"${EPREFIX}/usr/lib/portage/pym\"" > \
"${T}/05portage" || die
doenvd "${T}/05portage" || die
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$ED" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! ( [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ) \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
# Compile all source files recursively. Any orphans
# will be identified and removed in postrm.
python_mod_optimize /usr/lib/portage/pym
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if $NEEDED_REBUILD_UPGRADE ; then
einfo "rebuilding NEEDED.ELF.2 files"
for cpv in "${EROOT}/var/db/pkg"/*/*; do
if [ -f "${cpv}/NEEDED" ]; then
rm -f "${cpv}/NEEDED.ELF.2"
while read line; do
filename=${line% *}
needed=${line#* }
needed=${needed//+/++}
needed=${needed//#/##}
needed=${needed//%/%%}
newline=$(scanelf -BF "%a;%F;%S;%r;${needed}" $filename)
newline=${newline// - }
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
fi
done
fi
}
pkg_postrm() {
python_mod_cleanup /usr/lib/portage/pym
}

View File

@ -0,0 +1,334 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha163.ebuild,v 1.1 2013/02/14 06:04:40 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=3
inherit eutils python
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.2.0_alpha160
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${EPREFIX}/usr/bin/python" -c 'import xattr' 2>/dev/null
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
if use python3; then
python_set_active_version 3
elif use python2; then
python_set_active_version 2
elif use pypy2_0; then
python_set_active_version 2.7-pypy-2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
if use python3; then
einfo "Converting shebangs for python3..."
python_convert_shebangs -r 3 .
elif use python2; then
einfo "Converting shebangs for python2..."
python_convert_shebangs -r 2 .
elif use pypy2_0; then
einfo "Converting shebangs for pypy-c2.0..."
python_convert_shebangs -r 2.7-pypy-2.0 .
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
find . -type f -print0 | \
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
echo -e '\nFEATURES="${FEATURES} preserve-libs"' >> cnf/make.globals \
|| die "failed to append to make.globals"
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
emake epydoc || die
fi
}
src_test() {
# make files executable, in case they were created by patch
find bin -type f | xargs chmod +x
emake test || die
}
src_install() {
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Set PYTHONPATH for portage API consumers. This way we don't have
# to rely on patched python having the correct path, since it has
# been known to incorrectly add /usr/libx32/portage/pym to sys.path.
echo "PYTHONPATH=\"${EPREFIX}/usr/lib/portage/pym\"" > \
"${T}/05portage" || die
doenvd "${T}/05portage" || die
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$ED" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! ( [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ) \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
# Compile all source files recursively. Any orphans
# will be identified and removed in postrm.
python_mod_optimize /usr/lib/portage/pym
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if $NEEDED_REBUILD_UPGRADE ; then
einfo "rebuilding NEEDED.ELF.2 files"
for cpv in "${EROOT}/var/db/pkg"/*/*; do
if [ -f "${cpv}/NEEDED" ]; then
rm -f "${cpv}/NEEDED.ELF.2"
while read line; do
filename=${line% *}
needed=${line#* }
needed=${needed//+/++}
needed=${needed//#/##}
needed=${needed//%/%%}
newline=$(scanelf -BF "%a;%F;%S;%r;${needed}" $filename)
newline=${newline// - }
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
fi
done
fi
}
pkg_postrm() {
python_mod_cleanup /usr/lib/portage/pym
}

View File

@ -0,0 +1,334 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha166.ebuild,v 1.1 2013/03/05 02:23:46 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=3
inherit eutils python
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.2.0_alpha166
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${EPREFIX}/usr/bin/python" -c 'import xattr' 2>/dev/null
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
if use python3; then
python_set_active_version 3
elif use python2; then
python_set_active_version 2
elif use pypy2_0; then
python_set_active_version 2.7-pypy-2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
if use python3; then
einfo "Converting shebangs for python3..."
python_convert_shebangs -r 3 .
elif use python2; then
einfo "Converting shebangs for python2..."
python_convert_shebangs -r 2 .
elif use pypy2_0; then
einfo "Converting shebangs for pypy-c2.0..."
python_convert_shebangs -r 2.7-pypy-2.0 .
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
find . -type f -print0 | \
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
echo -e '\nFEATURES="${FEATURES} preserve-libs"' >> cnf/make.globals \
|| die "failed to append to make.globals"
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
emake epydoc || die
fi
}
src_test() {
# make files executable, in case they were created by patch
find bin -type f | xargs chmod +x
emake test || die
}
src_install() {
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Set PYTHONPATH for portage API consumers. This way we don't have
# to rely on patched python having the correct path, since it has
# been known to incorrectly add /usr/libx32/portage/pym to sys.path.
echo "PYTHONPATH=\"${EPREFIX}/usr/lib/portage/pym\"" > \
"${T}/05portage" || die
doenvd "${T}/05portage" || die
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$ED" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! ( [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ) \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
# Compile all source files recursively. Any orphans
# will be identified and removed in postrm.
python_mod_optimize /usr/lib/portage/pym
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if $NEEDED_REBUILD_UPGRADE ; then
einfo "rebuilding NEEDED.ELF.2 files"
for cpv in "${EROOT}/var/db/pkg"/*/*; do
if [ -f "${cpv}/NEEDED" ]; then
rm -f "${cpv}/NEEDED.ELF.2"
while read line; do
filename=${line% *}
needed=${line#* }
needed=${needed//+/++}
needed=${needed//#/##}
needed=${needed//%/%%}
newline=$(scanelf -BF "%a;%F;%S;%r;${needed}" $filename)
newline=${newline// - }
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
fi
done
fi
}
pkg_postrm() {
python_mod_cleanup /usr/lib/portage/pym
}

View File

@ -0,0 +1,334 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha168.ebuild,v 1.1 2013/03/20 03:53:08 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=3
inherit eutils python
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.2.0_alpha166
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${EPREFIX}/usr/bin/python" -c 'import xattr' 2>/dev/null
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in /usr/bin/python2.* ; do
x=${x#/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
if use python3; then
python_set_active_version 3
elif use python2; then
python_set_active_version 2
elif use pypy2_0; then
python_set_active_version 2.7-pypy-2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
if use python3; then
einfo "Converting shebangs for python3..."
python_convert_shebangs -r 3 .
elif use python2; then
einfo "Converting shebangs for python2..."
python_convert_shebangs -r 2 .
elif use pypy2_0; then
einfo "Converting shebangs for pypy-c2.0..."
python_convert_shebangs -r 2.7-pypy-2.0 .
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
find . -type f -print0 | \
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
echo -e '\nFEATURES="${FEATURES} preserve-libs"' >> cnf/make.globals \
|| die "failed to append to make.globals"
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
emake epydoc || die
fi
}
src_test() {
# make files executable, in case they were created by patch
find bin -type f | xargs chmod +x
emake test || die
}
src_install() {
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Set PYTHONPATH for portage API consumers. This way we don't have
# to rely on patched python having the correct path, since it has
# been known to incorrectly add /usr/libx32/portage/pym to sys.path.
echo "PYTHONPATH=\"${EPREFIX}/usr/lib/portage/pym\"" > \
"${T}/05portage" || die
doenvd "${T}/05portage" || die
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$ED" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! ( [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ) \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
# Compile all source files recursively. Any orphans
# will be identified and removed in postrm.
python_mod_optimize /usr/lib/portage/pym
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if $NEEDED_REBUILD_UPGRADE ; then
einfo "rebuilding NEEDED.ELF.2 files"
for cpv in "${EROOT}/var/db/pkg"/*/*; do
if [ -f "${cpv}/NEEDED" ]; then
rm -f "${cpv}/NEEDED.ELF.2"
while read line; do
filename=${line% *}
needed=${line#* }
needed=${needed//+/++}
needed=${needed//#/##}
needed=${needed//%/%%}
newline=$(scanelf -BF "%a;%F;%S;%r;${needed}" $filename)
newline=${newline// - }
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
fi
done
fi
}
pkg_postrm() {
python_mod_cleanup /usr/lib/portage/pym
}

View File

@ -0,0 +1,444 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha169.ebuild,v 1.4 2013/03/26 05:17:45 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=3
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.2.0_alpha166
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${EROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${EROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=${EPREFIX}$1 PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in "${EPREFIX}"/usr/bin/python2.* ; do
x=${x#${EPREFIX}/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
echo -e '\nFEATURES="${FEATURES} preserve-libs"' >> cnf/make.globals \
|| die "failed to append to make.globals"
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
# make files executable, in case they were created by patch
find bin -type f | xargs chmod +x
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
while read -r mod_dir ; do
cd "${ED}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${ED}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$ED" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! ( [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ) \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if $NEEDED_REBUILD_UPGRADE ; then
einfo "rebuilding NEEDED.ELF.2 files"
for cpv in "${EROOT}/var/db/pkg"/*/*; do
if [ -f "${cpv}/NEEDED" ]; then
rm -f "${cpv}/NEEDED.ELF.2"
while read line; do
filename=${line% *}
needed=${line#* }
needed=${needed//+/++}
needed=${needed//#/##}
needed=${needed//%/%%}
newline=$(scanelf -BF "%a;%F;%S;%r;${needed}" $filename)
newline=${newline// - }
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
fi
done
fi
}

View File

@ -0,0 +1,450 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha171.ebuild,v 1.2 2013/04/04 17:45:27 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=3
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.2.0_alpha170
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${EROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${EROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=${EPREFIX}$1 PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in "${EPREFIX}"/usr/bin/python2.* ; do
x=${x#${EPREFIX}/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
echo -e '\nFEATURES="${FEATURES} preserve-libs"' >> cnf/make.globals \
|| die "failed to append to make.globals"
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
# make files executable, in case they were created by patch
find bin -type f | xargs chmod +x
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
if use build && [[ ${ROOT} == / &&
! -x ${EPREFIX}/usr/bin/$(get_python_interpreter ${impl}) ]] ; then
# Tolerate --nodeps at beginning of stage1 for catalyst
ewarn "skipping python_targets_${impl}, interpreter not found"
continue
fi
while read -r mod_dir ; do
cd "${ED}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${ED}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$ED" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! ( [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ) \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if $NEEDED_REBUILD_UPGRADE ; then
einfo "rebuilding NEEDED.ELF.2 files"
for cpv in "${EROOT}/var/db/pkg"/*/*; do
if [ -f "${cpv}/NEEDED" ]; then
rm -f "${cpv}/NEEDED.ELF.2"
while read line; do
filename=${line% *}
needed=${line#* }
needed=${needed//+/++}
needed=${needed//#/##}
needed=${needed//%/%%}
newline=$(scanelf -BF "%a;%F;%S;%r;${needed}" $filename)
newline=${newline// - }
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
fi
done
fi
}

View File

@ -0,0 +1,459 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha173.ebuild,v 1.2 2013/05/06 21:42:24 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=3
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.2.0_alpha170
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${EROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${EROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=${EPREFIX}$1 PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in "${EPREFIX}"/usr/bin/python2.* ; do
x=${x#${EPREFIX}/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
echo -e '\nFEATURES="${FEATURES} preserve-libs"' >> cnf/make.globals \
|| die "failed to append to make.globals"
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
# make files executable, in case they were created by patch
find bin -type f | xargs chmod +x
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
if use build && [[ ${ROOT} == / &&
! -x ${EPREFIX}/usr/bin/$(get_python_interpreter ${impl}) ]] ; then
# Tolerate --nodeps at beginning of stage1 for catalyst
ewarn "skipping python_targets_${impl}, interpreter not found"
continue
fi
while read -r mod_dir ; do
cd "${ED}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${ED}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$ED" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${ED}"var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog}
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! ( [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ) \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if $NEEDED_REBUILD_UPGRADE ; then
einfo "rebuilding NEEDED.ELF.2 files"
for cpv in "${EROOT}/var/db/pkg"/*/*; do
if [ -f "${cpv}/NEEDED" ]; then
rm -f "${cpv}/NEEDED.ELF.2"
while read line; do
filename=${line% *}
needed=${line#* }
needed=${needed//+/++}
needed=${needed//#/##}
needed=${needed//%/%%}
newline=$(scanelf -BF "%a;%F;%S;%r;${needed}" $filename)
newline=${newline// - }
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
fi
done
fi
}

View File

@ -0,0 +1,459 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha174.ebuild,v 1.2 2013/05/06 21:42:24 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=3
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.2.0_alpha170
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${EROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${EROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=${EPREFIX}$1 PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in "${EPREFIX}"/usr/bin/python2.* ; do
x=${x#${EPREFIX}/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
echo -e '\nFEATURES="${FEATURES} preserve-libs"' >> cnf/make.globals \
|| die "failed to append to make.globals"
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
# make files executable, in case they were created by patch
find bin -type f | xargs chmod +x
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
if use build && [[ ${ROOT} == / &&
! -x ${EPREFIX}/usr/bin/$(get_python_interpreter ${impl}) ]] ; then
# Tolerate --nodeps at beginning of stage1 for catalyst
ewarn "skipping python_targets_${impl}, interpreter not found"
continue
fi
while read -r mod_dir ; do
cd "${ED}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${ED}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$ED" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${ED}"var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog}
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! ( [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ) \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if $NEEDED_REBUILD_UPGRADE ; then
einfo "rebuilding NEEDED.ELF.2 files"
for cpv in "${EROOT}/var/db/pkg"/*/*; do
if [ -f "${cpv}/NEEDED" ]; then
rm -f "${cpv}/NEEDED.ELF.2"
while read line; do
filename=${line% *}
needed=${line#* }
needed=${needed//+/++}
needed=${needed//#/##}
needed=${needed//%/%%}
newline=$(scanelf -BF "%a;%F;%S;%r;${needed}" $filename)
newline=${newline// - }
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
fi
done
fi
}

View File

@ -0,0 +1,452 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha175.ebuild,v 1.1 2013/05/16 00:34:25 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=3
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.2.0_alpha175
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${EROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${EROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=${EPREFIX}$1 PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in "${EPREFIX}"/usr/bin/python2.* ; do
x=${x#${EPREFIX}/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
# make files executable, in case they were created by patch
find bin -type f | xargs chmod +x
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
if use build && [[ ${ROOT} == / &&
! -x ${EPREFIX}/usr/bin/$(get_python_interpreter ${impl}) ]] ; then
# Tolerate --nodeps at beginning of stage1 for catalyst
ewarn "skipping python_targets_${impl}, interpreter not found"
continue
fi
while read -r mod_dir ; do
cd "${ED}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${ED}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$ED" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${ED}"var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog}
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! { [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ; } \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if ${NEEDED_REBUILD_UPGRADE} ; then
einfo "rebuilding NEEDED.ELF.2 files"
local cpv filename line newline
for cpv in "${EROOT}/var/db/pkg"/*/*; do
[[ -f "${cpv}/NEEDED" && ! -f "${cpv}/NEEDED.ELF.2" ]] || continue
while read -r line; do
filename=${line% *}
newline=$(scanelf -BF "%a;%F;%S;%r;%n" "${ROOT%/}${filename}")
newline=${newline// - }
[[ ${#ROOT} -gt 1 ]] && newline=${newline/${ROOT%/}}
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
done
fi
}

View File

@ -0,0 +1,452 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha176.ebuild,v 1.1 2013/05/19 00:14:30 zmedico Exp $
# Require EAPI 2 since we now require at least python-2.6 (for python 3
# syntax support) which also requires EAPI 2.
EAPI=3
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
SLOT="0"
IUSE="build doc epydoc +ipc linguas_pl linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
PV_PL="2.1.2"
PATCHVER_PL=""
TARBALL_PV=2.2.0_alpha175
SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
$(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
$(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
PATCHVER=
[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
if [ -n "${PATCHVER}" ]; then
SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
$(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
fi
S="${WORKDIR}"/${PN}-${TARBALL_PV}
S_PL="${WORKDIR}"/${PN}-${PV_PL}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${EROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${EROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=${EPREFIX}$1 PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in "${EPREFIX}"/usr/bin/python2.* ; do
x=${x#${EPREFIX}/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
if [ -n "${PATCHVER}" ] ; then
if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
rm "$S/bin/ebuild-helpers/portageq" \
|| die "failed to remove portageq helper symlink"
fi
epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
fi
einfo "Setting portage.VERSION to ${PVR} ..."
sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
# make files executable, in case they were created by patch
find bin -type f | xargs chmod +x
call_with_python_impl \
emake test || die
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
if use linguas_pl; then
doman -i18n=pl "${S_PL}"/man/pl/*.[0-9] || die
doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9] || die
fi
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
if use build && [[ ${ROOT} == / &&
! -x ${EPREFIX}/usr/bin/$(get_python_interpreter ${impl}) ]] ; then
# Tolerate --nodeps at beginning of stage1 for catalyst
ewarn "skipping python_targets_${impl}, interpreter not found"
continue
fi
while read -r mod_dir ; do
cd "${ED}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${ED}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "$ED" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${ED}"var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog}
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! { [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ; } \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if ${NEEDED_REBUILD_UPGRADE} ; then
einfo "rebuilding NEEDED.ELF.2 files"
local cpv filename line newline
for cpv in "${EROOT}/var/db/pkg"/*/*; do
[[ -f "${cpv}/NEEDED" && ! -f "${cpv}/NEEDED.ELF.2" ]] || continue
while read -r line; do
filename=${line% *}
newline=$(scanelf -BF "%a;%F;%S;%r;%n" "${ROOT%/}${filename}")
newline=${newline// - }
[[ ${#ROOT} -gt 1 ]] && newline=${newline/${ROOT%/}}
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
done
fi
}

View File

@ -0,0 +1,430 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-9999.ebuild,v 1.77 2013/05/16 13:59:27 zmedico Exp $
EAPI=3
PYTHON_COMPAT=(
pypy1_9 pypy2_0
python3_1 python3_2 python3_3 python3_4
python2_6 python2_7
)
inherit git-2 eutils multilib
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
LICENSE="GPL-2"
KEYWORDS=""
SLOT="0"
IUSE="build doc epydoc +ipc linguas_ru pypy2_0 python2 python3 selinux xattr"
for _pyimpl in ${PYTHON_COMPAT[@]} ; do
IUSE+=" python_targets_${_pyimpl}"
done
unset _pyimpl
# Import of the io module in python-2.6 raises ImportError for the
# thread module if threading is disabled.
python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
!pypy2_0? ( !python2? ( !python3? (
|| ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
) ) )
pypy2_0? ( !python2? ( !python3? ( dev-python/pypy:2.0[bzip2,ssl] ) ) )
python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
python_dep="${python_dep_ssl//\[ssl\]}"
python_dep="${python_dep//,ssl}"
python_dep="${python_dep//ssl,}"
python_dep="${python_dep}
python_targets_pypy1_9? ( dev-python/pypy:1.9 )
python_targets_pypy2_0? ( dev-python/pypy:2.0 )
python_targets_python2_6? ( dev-lang/python:2.6 )
python_targets_python2_7? ( dev-lang/python:2.7 )
python_targets_python3_1? ( dev-lang/python:3.1 )
python_targets_python3_2? ( dev-lang/python:3.2 )
python_targets_python3_3? ( dev-lang/python:3.3 )
python_targets_python3_4? ( dev-lang/python:3.4 )
"
# The pysqlite blocker is for bug #282760.
# make-3.82 is for bug #455858
DEPEND="${python_dep}
>=sys-devel/make-3.82
>=sys-apps/sed-4.0.5 sys-devel/patch
doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
# Require sandbox-2.2 for bug #288863.
# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
# quite slow, so it's not considered in the dependencies as an alternative to
# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
# for now, don't pull in xattr deps for other kernels.
# For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
# For compgen, require bash[readline] (bug #445576).
RDEPEND="${python_dep}
!build? ( >=sys-apps/sed-4.0.5
|| ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
>=app-admin/eselect-1.2
|| ( ${python_dep_ssl} dev-python/python-mhash )
)
elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
elibc_glibc? ( >=sys-apps/sandbox-2.2 )
elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
>=app-misc/pax-utils-0.1.17
xattr? ( kernel_linux? ( || ( >=dev-lang/python-3.3_pre20110902 dev-python/pyxattr ) ) )
selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
!<app-shells/bash-3.2_p17
!<app-admin/logrotate-3.8.0"
PDEPEND="
!build? (
>=net-misc/rsync-2.6.4
userland_GNU? ( >=sys-apps/coreutils-6.4 )
)"
# coreutils-6.4 rdep is for date format in emerge-webrsync #164532
# NOTE: FEATURES=installsources requires debugedit and rsync
SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
prefix_src_archives() {
local x y
for x in ${@}; do
for y in ${SRC_ARCHIVES}; do
echo ${y}/${x}
done
done
}
EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/portage.git"
S="${WORKDIR}"/${PN}
compatible_python_is_selected() {
[[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
}
current_python_has_xattr() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
"${PYTHON}" -c 'import xattr' 2>/dev/null
}
call_with_python_impl() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
env EPYTHON=${EPYTHON} "$@"
}
get_python_interpreter() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1 python
case "${impl}" in
python*)
python=${impl/_/.}
;;
pypy*)
python=${impl/_/.}
python=${python/pypy/pypy-c}
;;
*)
die "Unrecognized python target: ${impl}"
esac
echo ${python}
}
get_python_sitedir() {
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
local impl=$1
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
[[ -d ${EROOT}${site_dir} ]] || \
ewarn "site-packages dir missing for ${impl}: ${EROOT}${site_dir}"
echo "${site_dir}"
}
python_compileall() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d=${EPREFIX}$1 PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
local d_image=${D}${d#/}
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
case "${EPYTHON}" in
python*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
# Note: Using -OO breaks emaint, since it requires __doc__,
# and __doc__ is None when -OO is used.
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
;;
pypy*)
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
;;
*)
die "Unrecognized EPYTHON value: ${EPYTHON}"
esac
}
pkg_setup() {
if use python2 && use python3 ; then
ewarn "Both python2 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python3 ; then
ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python3."
fi
if use pypy2_0 && use python2 ; then
ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
ewarn "can be in the shebangs. Using python2"
fi
if ! use pypy2_0 && ! use python2 && ! use python3 && \
! compatible_python_is_selected ; then
ewarn "Attempting to select a compatible default python interpreter"
local x success=0
for x in "${EPREFIX}"/usr/bin/python2.* ; do
x=${x#${EPREFIX}/usr/bin/python2.}
if [[ $x -ge 6 ]] 2>/dev/null ; then
eselect python set python2.$x
if compatible_python_is_selected ; then
elog "Default python interpreter is now set to python-2.$x"
success=1
break
fi
fi
done
if [ $success != 1 ] ; then
eerror "Unable to select a compatible default python interpreter!"
die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
fi
fi
# We use EPYTHON to designate the active python interpreter,
# but we only export when needed, via call_with_python_impl.
EPYTHON=python
export -n EPYTHON
if use python3; then
EPYTHON=python3
elif use python2; then
EPYTHON=python2
elif use pypy2_0; then
EPYTHON=pypy-c2.0
fi
}
src_prepare() {
epatch_user
einfo "Producing ChangeLog from Git history..."
pushd "${S}/.git" >/dev/null || die
git log ebcf8975b37a8aae9735eb491a9b4cb63549bd5d^.. \
> "${S}"/ChangeLog || die
popd >/dev/null || die
local _version=$(cd "${S}/.git" && git describe --tags | sed -e 's|-\([0-9]\+\)-.\+$|_p\1|')
_version=${_version:1}
einfo "Setting portage.VERSION to ${_version} ..."
sed -e "s/^VERSION=.*/VERSION='${_version}'/" -i pym/portage/__init__.py || \
die "Failed to patch portage.VERSION"
sed -e "1s/VERSION/${_version}/" -i doc/fragment/version || \
die "Failed to patch VERSION in doc/fragment/version"
sed -e "1s/VERSION/${_version}/" -i $(find man -type f) || \
die "Failed to patch VERSION in man page headers"
if ! use ipc ; then
einfo "Disabling ipc..."
sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
-i pym/_emerge/AbstractEbuildProcess.py || \
die "failed to patch AbstractEbuildProcess.py"
fi
if use xattr && use kernel_linux ; then
einfo "Adding FEATURES=xattr to make.globals ..."
echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
local set_shebang=
if use python3; then
set_shebang=python3
elif use python2; then
set_shebang=python2
elif use pypy2_0; then
set_shebang=pypy-c2.0
fi
if [[ -n ${set_shebang} ]] ; then
einfo "Converting shebangs for ${set_shebang}..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
fi
if [[ -n ${EPREFIX} ]] ; then
einfo "Setting portage.const.EPREFIX ..."
sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
-e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
-i pym/portage/const.py || \
die "Failed to patch portage.const.EPREFIX"
einfo "Prefixing shebangs ..."
while read -r -d $'\0' ; do
local shebang=$(head -n1 "$REPLY")
if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
die "sed failed"
fi
done < <(find . -type f -print0)
einfo "Adjusting make.globals ..."
sed -e 's|^SYNC=.*|SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"|' \
-e "s|^\(PORTDIR=\)\(/usr/portage\)|\\1\"${EPREFIX}\\2\"|" \
-e "s|^\(PORTAGE_TMPDIR=\)\(/var/tmp\)|\\1\"${EPREFIX}\\2\"|" \
-i cnf/make.globals || die "sed failed"
einfo "Adding FEATURES=force-prefix to make.globals ..."
echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
|| die "failed to append to make.globals"
fi
cd "${S}/cnf" || die
if [ -f "make.conf.${ARCH}".diff ]; then
patch make.conf "make.conf.${ARCH}".diff || \
die "Failed to patch make.conf.example"
else
eerror ""
eerror "Portage does not have an arch-specific configuration for this arch."
eerror "Please notify the arch maintainer about this issue. Using generic."
eerror ""
fi
}
src_compile() {
if use doc; then
call_with_python_impl \
emake docbook || die
fi
if use epydoc; then
einfo "Generating api docs"
call_with_python_impl \
emake epydoc || die
fi
}
src_test() {
./runtests.sh || die "tests failed"
}
src_install() {
call_with_python_impl \
emake DESTDIR="${D}" \
sysconfdir="${EPREFIX}/etc" \
prefix="${EPREFIX}/usr" \
install || die
# Use dodoc for compression, since the Makefile doesn't do that.
dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
# Allow external portage API consumers to import portage python modules
# (this used to be done with PYTHONPATH setting in /etc/env.d).
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
# site-packages, and compile with the corresponding interpreter.
local impl files mod_dir dest_mod_dir python relative_path x
for impl in "${PYTHON_COMPAT[@]}" ; do
use "python_targets_${impl}" || continue
if use build && [[ ${ROOT} == / &&
! -x ${EPREFIX}/usr/bin/$(get_python_interpreter ${impl}) ]] ; then
# Tolerate --nodeps at beginning of stage1 for catalyst
ewarn "skipping python_targets_${impl}, interpreter not found"
continue
fi
while read -r mod_dir ; do
cd "${ED}/usr/lib/portage/pym/${mod_dir}" || die
files=$(echo *.py)
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
# __pycache__ directories contain no py files
continue
fi
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
dodir "${dest_mod_dir}" || die
relative_path=../../../lib/portage/pym/${mod_dir}
x=/${mod_dir}
while [ -n "${x}" ] ; do
relative_path=../${relative_path}
x=${x%/*}
done
for x in ${files} ; do
dosym "${relative_path}/${x}" \
"${dest_mod_dir}/${x}" || die
done
done < <(cd "${ED}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
cd "${S}" || die
EPYTHON=$(get_python_interpreter ${impl}) \
python_compileall "$(get_python_sitedir ${impl})"
done
# Compile /usr/lib/portage/pym with the active interpreter, since portage
# internal commands force this directory to the beginning of sys.path.
python_compileall /usr/lib/portage/pym
}
pkg_preinst() {
if [[ $ROOT == / ]] ; then
# Run some minimal tests as a sanity check.
local test_runner=$(find "${ED}" -name runTests)
if [[ -n $test_runner && -x $test_runner ]] ; then
einfo "Running preinst sanity tests..."
"$test_runner" || die "preinst sanity tests failed"
fi
fi
if use xattr && ! current_python_has_xattr ; then
ewarn "For optimal performance in xattr handling, install"
ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
ewarn "enable USE=python3 for $CATEGORY/$PN."
fi
# elog dir must exist to avoid logrotate error for bug #415911.
# This code runs in preinst in order to bypass the mapping of
# portage:portage to root:root which happens after src_install.
keepdir /var/log/portage/elog
# This is allowed to fail if the user/group are invalid for prefix users.
if chown portage:portage "${ED}"var/log/portage{,/elog} 2>/dev/null ; then
chmod g+s,ug+rwx "${ED}"var/log/portage{,/elog}
fi
has_version "<=${CATEGORY}/${PN}-2.2_pre5" \
&& WORLD_MIGRATION_UPGRADE=true || WORLD_MIGRATION_UPGRADE=false
# If portage-2.1.6 is installed and the preserved_libs_registry exists,
# assume that the NEEDED.ELF.2 files have already been generated.
has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
! { [ -e "${EROOT}"var/lib/portage/preserved_libs_registry ] && \
has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ; } \
&& NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
}
pkg_postinst() {
if $WORLD_MIGRATION_UPGRADE && \
grep -q "^@" "${EROOT}/var/lib/portage/world"; then
einfo "moving set references from the worldfile into world_sets"
cd "${EROOT}/var/lib/portage/"
grep "^@" world >> world_sets
sed -i -e '/^@/d' world
fi
if ${NEEDED_REBUILD_UPGRADE} ; then
einfo "rebuilding NEEDED.ELF.2 files"
local cpv filename line newline
for cpv in "${EROOT}/var/db/pkg"/*/*; do
[[ -f "${cpv}/NEEDED" && ! -f "${cpv}/NEEDED.ELF.2" ]] || continue
while read -r line; do
filename=${line% *}
newline=$(scanelf -BF "%a;%F;%S;%r;%n" "${ROOT%/}${filename}")
newline=${newline// - }
[[ ${#ROOT} -gt 1 ]] && newline=${newline/${ROOT%/}}
echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
done < "${cpv}/NEEDED"
done
fi
}