-#!/usr/bin/python
+#!@PREFIX_PORTAGE_PYTHON@
- # Copyright 1999-2006 Gentoo Foundation
+ # Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
-#!/usr/bin/python -O
+#!@PREFIX_PORTAGE_PYTHON@ -O
- # Copyright 1999-2011 Gentoo Foundation
+ # Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
- source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
-source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
++source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/helper-functions.sh
if [[ -z $1 ]] ; then
helpers_die "${0##*/}: at least one argument needed"
-#!/bin/bash
+#!@PORTAGE_BASH@
- # Copyright 1999-2011 Gentoo Foundation
+ # Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
- source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh
-source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
++source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/helper-functions.sh
# avoid multiple calls to `has`. this creates things like:
# FEATURES_foo=false
-#!/usr/bin/python
+#!@PREFIX_PORTAGE_PYTHON@
- # Copyright 2010-2011 Gentoo Foundation
+ # Copyright 2010-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# This is a helper which ebuild processes can use
-#!/usr/bin/python
+#!@PREFIX_PORTAGE_PYTHON@
- # Copyright 2009-2011 Gentoo Foundation
+ # Copyright 2009-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
from portage.util import cmp_sort_key, writemsg_level
from portage import cpv_getkey
from portage.dep import Atom, isjustname
- from portage.versions import pkgcmp, pkgsplit, vercmp
+ from portage.versions import pkgsplit, vercmp
+from portage.const import EPREFIX
try:
from xml.etree import ElementTree
-#!/usr/bin/python -O
+#!@PREFIX_PORTAGE_PYTHON@ -O
- # vim: noet :
+ # Copyright 2005-2012 Gentoo Foundation
+ # Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
-#!/usr/bin/python
+#!@PREFIX_PORTAGE_PYTHON@
- # Copyright 2006-2011 Gentoo Foundation
+ # Copyright 2006-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
def debug_signal(signum, frame):
import pdb
pdb.set_trace()
- signal.signal(signal.SIGUSR1, debug_signal)
+
+ if platform.python_implementation() == 'Jython':
+ debug_signum = signal.SIGUSR2 # bug #424259
+ else:
+ debug_signum = signal.SIGUSR1
+
+ signal.signal(debug_signum, debug_signal)
-try:
- from _emerge.main import emerge_main
-except ImportError:
- from os import path as osp
- import sys
- sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
- from _emerge.main import emerge_main
+# for an explanation on this logic, see pym/_emerge/__init__.py
+from os import environ as ose
+from os import path as osp
+if ose.__contains__("PORTAGE_PYTHONPATH"):
+ sys.path.insert(0, ose["PORTAGE_PYTHONPATH"])
+else:
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp. realpath(__file__))), "pym"))
+from _emerge.main import emerge_main
if __name__ == "__main__":
import sys
install_qa_check() {
local f i qa_var x
[[ " ${FEATURES} " == *" force-prefix "* ]] || \
- case "$EAPI" in 0|1|2) local ED=${D} ;; esac
+ case "$EAPI" in 0|1|2) local EPREFIX= ED=${D} ;; esac
- cd "${ED}" || die "cd failed"
+ # PREFIX LOCAL: ED needs not to exist, whereas D does
+ cd "${D}" || die "cd failed"
+ # END PREFIX LOCAL
# Merge QA_FLAGS_IGNORED and QA_DT_HASH into a single array, since
# QA_DT_HASH is deprecated.
fi
# Now we look for all world writable files.
-- local unsafe_files=$(find "${ED}" -type f -perm -2 | sed -e "s:^${ED}:- :")
++ # PREFIX LOCAL: keep offset in the paths
++ local unsafe_files=$(find "${ED}" -type f -perm -2 | sed -e "s:^${D}:- :")
++ # END PREFIX LOCAL
if [[ -n ${unsafe_files} ]] ; then
vecho "QA Security Notice: world writable file(s):"
vecho "${unsafe_files}"
PORTAGE_QUIET=${tmp_quiet}
fi
+
+ # Create NEEDED.ELF.2 regardless of RESTRICT=binchecks, since this info is
+ # too useful not to have (it's required for things like preserve-libs), and
+ # it's tempting for ebuild authors to set RESTRICT=binchecks for packages
+ # containing pre-built binaries.
+ if type -P scanelf > /dev/null ; then
+ # Save NEEDED information after removing self-contained providers
+ rm -f "$PORTAGE_BUILDDIR"/build-info/NEEDED{,.ELF.2}
+ scanelf -qyRF '%a;%p;%S;%r;%n' "${D}" | { while IFS= read -r l; do
+ arch=${l%%;*}; l=${l#*;}
+ obj="/${l%%;*}"; l=${l#*;}
+ soname=${l%%;*}; l=${l#*;}
+ rpath=${l%%;*}; l=${l#*;}; [ "${rpath}" = " - " ] && rpath=""
+ needed=${l%%;*}; l=${l#*;}
+ echo "${obj} ${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
+ echo "${arch:3};${obj};${soname};${rpath};${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.ELF.2
+ done }
+
+ [ -n "${QA_SONAME_NO_SYMLINK}" ] && \
+ echo "${QA_SONAME_NO_SYMLINK}" > \
+ "${PORTAGE_BUILDDIR}"/build-info/QA_SONAME_NO_SYMLINK
+
+ if has binchecks ${RESTRICT} && \
+ [ -s "${PORTAGE_BUILDDIR}/build-info/NEEDED.ELF.2" ] ; then
+ eqawarn "QA Notice: RESTRICT=binchecks prevented checks on these ELF files:"
+ eqawarn "$(while read -r x; do x=${x#*;} ; x=${x%%;*} ; echo "${x#${EPREFIX}}" ; done < "${PORTAGE_BUILDDIR}"/build-info/NEEDED.ELF.2)"
+ fi
+ fi
+}
- local unsafe_files=$(find "${ED}" -type f '(' -perm -2002 -o -perm -4002 ')' | sed -e "s:^${ED}:/:")
+install_qa_check_misc() {
+ # PREFIX LOCAL: keep offset prefix in the reported files
+ local unsafe_files=$(find "${ED}" -type f '(' -perm -2002 -o -perm -4002 ')' | sed -e "s:^${D}:/:")
+ # END PREFIX LOCAL
if [[ -n ${unsafe_files} ]] ; then
eqawarn "QA Notice: Unsafe files detected (set*id and world writable)"
eqawarn "${unsafe_files}"
-#!/usr/bin/python
+#!@PREFIX_PORTAGE_PYTHON@
- # Copyright 1999-2010 Gentoo Foundation
+ # Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
PORTAGE_ELOG_CLASSES="log warn error"
PORTAGE_ELOG_SYSTEM="save_summary echo"
-PORTAGE_ELOG_MAILURI="root"
+PORTAGE_ELOG_MAILURI="@rootuser@"
PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for \${PACKAGE} on \${HOST}"
-PORTAGE_ELOG_MAILFROM="portage@localhost"
+PORTAGE_ELOG_MAILFROM="@portageuser@@localhost"
# Signing command used by repoman
- PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --clearsign --yes --default-key \"\${PORTAGE_GPG_KEY}\" --homedir \"\${PORTAGE_GPG_DIR}\" \"\${FILE}\""
+ PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --digest-algo SHA512 --clearsign --yes --default-key \"\${PORTAGE_GPG_KEY}\" --homedir \"\${PORTAGE_GPG_DIR}\" \"\${FILE}\""
# *****************************
# ** DO NOT EDIT THIS FILE **
from portage.cache.mappings import slot_dict_class
from portage.const import EBUILD_PHASES
from portage.dep import Atom, check_required_use, use_reduce, \
- paren_enclose, _slot_re, _slot_separator, _repo_separator
- from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+ paren_enclose, _slot_separator, _repo_separator
+ from portage.versions import _pkg_str, _unknown_repo
+ from portage.eapi import _get_eapi_attrs
from portage.exception import InvalidDependString
- from portage.repository.config import _gen_valid_repo
from _emerge.Task import Task
+from portage.const import EPREFIX
if sys.hexversion >= 0x3000000:
basestring = str
from portage.localization import _
from portage import os
from portage import shutil
- from portage import _unicode_decode
+ from portage import eapi_is_supported, _unicode_decode
from portage.cache.cache_errors import CacheError
- from portage.const import GLOBAL_CONFIG_PATH, EPREFIX
- from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE_SET_CONFIG
++from portage.const import EPREFIX
+ from portage.const import GLOBAL_CONFIG_PATH
+ from portage.const import _ENABLE_DYN_LINK_MAP
from portage.dbapi.dep_expand import dep_expand
from portage.dbapi._expand_new_virt import expand_new_virt
from portage.dep import Atom, extended_cp_match
- # Copyright 2007-2011 Gentoo Foundation
+ # Copyright 2007-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-import errno
import re
from itertools import chain
# portage: Constants
- # Copyright 1998-2011 Gentoo Foundation
+ # Copyright 1998-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+# ===========================================================================
+# autotool supplied constants.
+# ===========================================================================
+from portage.const_autotool import *
+
import os
# ===========================================================================
"ccache", "chflags", "clean-logs",
"collision-protect", "compress-build-logs", "compressdebug",
"config-protect-if-modified",
- "digest", "distcc", "distcc-pump", "distlocks", "ebuild-locks", "fakeroot",
+ "digest", "distcc", "distcc-pump", "distlocks",
+ "downgrade-backup", "ebuild-locks", "fakeroot",
"fail-clean", "force-mirror", "force-prefix", "getbinpkg",
"installsources", "keeptemp", "keepwork", "fixlafiles", "lmirror",
+ "macossandbox", "macosprefixsandbox", "macosusersandbox",
"metadata-transfer", "mirror", "multilib-strict", "news",
"noauto", "noclean", "nodoc", "noinfo", "noman",
"nostrip", "notitles", "parallel-fetch", "parallel-install",
from portage.const import CACHE_PATH
from portage.dbapi.virtual import fakedbapi
from portage.dep import Atom, use_reduce, paren_enclose
- from portage.exception import AlarmSignal, InvalidPackageName, \
+ from portage.exception import AlarmSignal, InvalidData, InvalidPackageName, \
PermissionDenied, PortageException
+from portage.const import EAPI
from portage.localization import _
from portage import _movefile
from portage import os
'portage.util.movefile:movefile',
'portage.util._dyn_libs.PreservedLibsRegistry:PreservedLibsRegistry',
'portage.util._dyn_libs.LinkageMapELF:LinkageMapELF@LinkageMap',
- 'portage.versions:best,catpkgsplit,catsplit,cpv_getkey,pkgcmp,' + \
- '_pkgsplit@pkgsplit',
+ 'portage.util._dyn_libs.LinkageMapMachO:LinkageMapMachO',
+ 'portage.util._dyn_libs.LinkageMapPeCoff:LinkageMapPeCoff',
+ 'portage.util._dyn_libs.LinkageMapXCoff:LinkageMapXCoff',
+ 'portage.versions:best,catpkgsplit,catsplit,cpv_getkey,vercmp,' + \
+ '_pkgsplit@pkgsplit,_pkg_str',
'subprocess',
'tarfile',
)
if sys.hexversion >= 0x3000000:
basestring = str
long = int
+ _unicode = str
+ else:
+ _unicode = unicode
+
class vardbapi(dbapi):
_excluded_dirs = ["CVS", "lost+found"]
import portage
from portage.env.loaders import KeyValuePairFileLoader
from portage.localization import _
- from portage.util import varexpand
+ from portage.util import shlex_split, varexpand
+from portage.const import EPREFIX
RCS_BRANCH = '1.1.1'
RCS_LOCK = 'rcs -ko -M -l'
from portage import auxdbkeys, bsd_chflags, \
eapi_is_supported, merge, os, selinux, shutil, \
- unmerge, _encodings, _parse_eapi_ebuild_head, _os_merge, \
+ unmerge, _encodings, _os_merge, \
_shell_quote, _unicode_decode, _unicode_encode
from portage.const import EBUILD_SH_ENV_FILE, EBUILD_SH_ENV_DIR, \
- EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY
+ EBUILD_SH_BINARY, INVALID_ENV_FILE, MISC_SH_BINARY, \
+ EPREFIX, MACOSSANDBOX_PROFILE
from portage.data import portage_gid, portage_uid, secpass, \
uid, userpriv_groups
from portage.dbapi.porttree import _parse_uri_map
-#!/usr/bin/python -Wd
+#!/usr/bin/env python
# runTests.py -- Portage Unit Test Functionality
- # Copyright 2006 Gentoo Foundation
+ # Copyright 2006-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import os, sys
# 2.1.2 A package name may contain any of the characters [A-Za-z0-9+_-].
# It must not begin with a hyphen,
# and must not end in a hyphen followed by one or more digits.
- _pkg = r'[\w+][\w+-]*?'
+ _pkg = {
+ "dots_disallowed_in_PN": r'[\w+][\w+-]*?',
+ "dots_allowed_in_PN": r'[\w+][\w+.-]*?',
+ }
_v = r'(cvs\.)?(\d+)((\.\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\d*)*)'
-_rev = r'\d+'
+# PREFIX hack: -r(\d+) -> -r(\d+|0\d+\.\d+) (see below)
+_rev = r'(\d+|0\d+\.\d+)'
_vr = _v + '(-r(' + _rev + '))?'
- _cp = '(' + _cat + '/' + _pkg + '(-' + _vr + ')?)'
- _cpv = '(' + _cp + '-' + _vr + ')'
- _pv = '(?P<pn>' + _pkg + '(?P<pn_inval>-' + _vr + ')?)' + '-(?P<ver>' + _v + ')(-r(?P<rev>' + _rev + '))?'
+ _cp = {
+ "dots_disallowed_in_PN": '(' + _cat + '/' + _pkg['dots_disallowed_in_PN'] + '(-' + _vr + ')?)',
+ "dots_allowed_in_PN": '(' + _cat + '/' + _pkg['dots_allowed_in_PN'] + '(-' + _vr + ')?)',
+ }
+ _cpv = {
+ "dots_disallowed_in_PN": '(' + _cp['dots_disallowed_in_PN'] + '-' + _vr + ')',
+ "dots_allowed_in_PN": '(' + _cp['dots_allowed_in_PN'] + '-' + _vr + ')',
+ }
+ _pv = {
+ "dots_disallowed_in_PN": '(?P<pn>' + _pkg['dots_disallowed_in_PN'] + '(?P<pn_inval>-' + _vr + ')?)' + '-(?P<ver>' + _v + ')(-r(?P<rev>' + _rev + '))?',
+ "dots_allowed_in_PN": '(?P<pn>' + _pkg['dots_allowed_in_PN'] + '(?P<pn_inval>-' + _vr + ')?)' + '-(?P<ver>' + _v + ')(-r(?P<rev>' + _rev + '))?',
+ }
ver_regexp = re.compile("^" + _vr + "$")
suffix_regexp = re.compile("^(alpha|beta|rc|pre|p)(\\d*)$")
r2 = 0
rval = (r1 > r2) - (r1 < r2)
if rval:
- vercmp_cache[mykey] = rval
return rval
- # the suffix part is equal to, so finally check the revision
+ # The suffix part is equal too, so finally check the revision
+ # PREFIX hack: a revision starting with 0 is an 'inter-revision',
+ # which means that it is possible to create revisions on revisions.
+ # An example is -r01.1 which is the first revision of -r1. Note
+ # that a period (.) is used to separate the real revision and the
+ # secondary revision number. This trick is in use to allow revision
+ # bumps in ebuilds synced from the main tree for Prefix changes,
+ # while still staying in the main tree versioning scheme.
if match1.group(10):
- r1 = int(match1.group(10))
+ if match1.group(10)[0] == '0' and '.' in match1.group(10):
+ t = match1.group(10)[1:].split(".")
+ r1 = int(t[0])
+ r3 = int(t[1])
+ else:
+ r1 = int(match1.group(10))
+ r3 = 0
else:
r1 = 0
+ r3 = 0
if match2.group(10):
- r2 = int(match2.group(10))
+ if match2.group(10)[0] == '0' and '.' in match2.group(10):
+ t = match2.group(10)[1:].split(".")
+ r2 = int(t[0])
+ r4 = int(t[1])
+ else:
+ r2 = int(match2.group(10))
+ r4 = 0
else:
r2 = 0
+ r4 = 0
+ if r1 == r2 and (r3 != 0 or r4 != 0):
+ r1 = r3
+ r2 = r4
rval = (r1 > r2) - (r1 < r2)
- vercmp_cache[mykey] = rval
return rval
def pkgcmp(pkg1, pkg2):