diff options
author | Alexander Bersenev <bay@hackerdom.ru> | 2014-02-17 17:55:51 +0600 |
---|---|---|
committer | Alexander Bersenev <bay@hackerdom.ru> | 2014-02-17 17:55:51 +0600 |
commit | 5a3f506c9ef1cfd78940b0509f10ef94b4434e29 (patch) | |
tree | 147c35a17a8bcd8ff467bb3063adab623da51fac /portage_with_autodep/bin/ebuild | |
parent | fixed a deadlock (diff) | |
download | autodep-5a3f506c9ef1cfd78940b0509f10ef94b4434e29.tar.gz autodep-5a3f506c9ef1cfd78940b0509f10ef94b4434e29.tar.bz2 autodep-5a3f506c9ef1cfd78940b0509f10ef94b4434e29.zip |
updated portage to 2.2.8-r1
Diffstat (limited to 'portage_with_autodep/bin/ebuild')
-rwxr-xr-x | portage_with_autodep/bin/ebuild | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/portage_with_autodep/bin/ebuild b/portage_with_autodep/bin/ebuild index f8b6d79..35cdc14 100755 --- a/portage_with_autodep/bin/ebuild +++ b/portage_with_autodep/bin/ebuild @@ -1,5 +1,5 @@ #!/usr/bin/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 @@ -29,6 +29,7 @@ def debug_signal(signum, frame): signal.signal(signal.SIGUSR1, debug_signal) import imp +import io import optparse import os @@ -46,6 +47,8 @@ parser.add_option("--color", help="enable or disable color output", type="choice", choices=("y", "n")) parser.add_option("--debug", help="show debug output", action="store_true", dest="debug") +parser.add_option("--version", help="show version and exit", + action="store_true", dest="version") parser.add_option("--ignore-default-opts", action="store_true", help="do not use the EBUILD_DEFAULT_OPTS environment variable") @@ -54,14 +57,6 @@ parser.add_option("--skip-manifest", help="skip all manifest checks", opts, pargs = parser.parse_args(args=sys.argv[1:]) -if len(pargs) < 2: - parser.error("missing required args") - -if "merge" in pargs: - print("Disabling noauto in features... merge disables it. (qmerge doesn't)") - os.environ["FEATURES"] = os.environ.get("FEATURES", "") + " -noauto" - -os.environ["PORTAGE_CALLER"]="ebuild" try: import portage except ImportError: @@ -79,6 +74,13 @@ from portage.const import VDB_PATH from _emerge.Package import Package from _emerge.RootConfig import RootConfig +if opts.version: + print("Portage", portage.VERSION) + sys.exit(os.EX_OK) + +if len(pargs) < 2: + parser.error("missing required args") + if not opts.ignore_default_opts: default_opts = portage.settings.get("EBUILD_DEFAULT_OPTS", "").split() opts, pargs = parser.parse_args(default_opts + sys.argv[1:]) @@ -138,27 +140,24 @@ vdb_path = os.path.realpath(os.path.join(portage.settings['EROOT'], VDB_PATH)) # Make sure that portdb.findname() returns the correct ebuild. if ebuild_portdir != vdb_path and \ ebuild_portdir not in portage.portdb.porttrees: + portdir_overlay = portage.settings.get("PORTDIR_OVERLAY", "") if sys.hexversion >= 0x3000000: os.environ["PORTDIR_OVERLAY"] = \ - os.environ.get("PORTDIR_OVERLAY","") + \ + portdir_overlay + \ " " + _shell_quote(ebuild_portdir) else: os.environ["PORTDIR_OVERLAY"] = \ - os.environ.get("PORTDIR_OVERLAY","") + \ + _unicode_encode(portdir_overlay, + encoding=_encodings['content'], errors='strict') + \ " " + _unicode_encode(_shell_quote(ebuild_portdir), encoding=_encodings['content'], errors='strict') print("Appending %s to PORTDIR_OVERLAY..." % ebuild_portdir) imp.reload(portage) -# Constrain eclass resolution to the master(s) -# that are specified in layout.conf (using an -# approach similar to repoman's). myrepo = None if ebuild_portdir != vdb_path: myrepo = portage.portdb.getRepositoryName(ebuild_portdir) - repo_info = portage.portdb._repo_info[ebuild_portdir] - portage.portdb.porttrees = list(repo_info.eclass_db.porttrees) if not os.path.exists(ebuild): print("'%s' does not exist." % ebuild) @@ -167,7 +166,12 @@ if not os.path.exists(ebuild): ebuild_split = ebuild.split("/") cpv = "%s/%s" % (ebuild_split[-3], pf) -if not portage.catpkgsplit(cpv): +with io.open(_unicode_encode(ebuild, encoding=_encodings['fs'], errors='strict'), + mode='r', encoding=_encodings['repo.content'], errors='replace') as f: + eapi = portage._parse_eapi_ebuild_head(f)[0] +if eapi is None: + eapi = "0" +if not portage.catpkgsplit(cpv, eapi=eapi): print("!!! %s does not follow correct package syntax." % (cpv)) sys.exit(1) @@ -204,9 +208,10 @@ def discard_digests(myebuild, mysettings, mydbapi): portage._doebuild_manifest_exempt_depend += 1 pkgdir = os.path.dirname(myebuild) fetchlist_dict = portage.FetchlistDict(pkgdir, mysettings, mydbapi) - from portage.manifest import Manifest - mf = Manifest(pkgdir, mysettings["DISTDIR"], - fetchlist_dict=fetchlist_dict, manifest1_compat=False) + mf = mysettings.repositories.get_repo_for_location( + os.path.dirname(os.path.dirname(pkgdir))) + mf = mf.load_manifest(pkgdir, mysettings["DISTDIR"], + fetchlist_dict=fetchlist_dict) mf.create(requiredDistfiles=None, assumeDistHashesSometimes=True, assumeDistHashesAlways=True) distfiles = fetchlist_dict[cpv] @@ -228,10 +233,8 @@ build_dir_phases = set(["setup", "unpack", "prepare", "configure", "compile", # sourced again even if $T/environment already exists. ebuild_changed = False if mytree == "porttree" and build_dir_phases.intersection(pargs): - metadata, st, emtime = \ - portage.portdb._pull_valid_cache(cpv, ebuild, ebuild_portdir) - if metadata is None: - ebuild_changed = True + ebuild_changed = \ + portage.portdb._pull_valid_cache(cpv, ebuild, ebuild_portdir)[0] is None tmpsettings = portage.config(clone=portage.settings) tmpsettings["PORTAGE_VERBOSE"] = "1" @@ -257,16 +260,20 @@ if "test" in pargs: tmpsettings.features.discard("fail-clean") +if "merge" in pargs and "noauto" in tmpsettings.features: + print("Disabling noauto in features... merge disables it. (qmerge doesn't)") + tmpsettings.features.discard("noauto") + try: metadata = dict(zip(Package.metadata_keys, - portage.db[portage.settings["ROOT"]][mytree].dbapi.aux_get( + portage.db[portage.settings['EROOT']][mytree].dbapi.aux_get( cpv, Package.metadata_keys, myrepo=myrepo))) except KeyError: # aux_get failure, message should have been shown on stderr. sys.exit(1) root_config = RootConfig(portage.settings, - portage.db[portage.settings["ROOT"]], None) + portage.db[portage.settings['EROOT']], None) pkg = Package(built=(pkg_type != "ebuild"), cpv=cpv, installed=(pkg_type=="installed"), @@ -275,7 +282,10 @@ pkg = Package(built=(pkg_type != "ebuild"), cpv=cpv, # Apply package.env and repo-level settings. This allows per-package # FEATURES and other variables (possibly PORTAGE_TMPDIR) to be -# available as soon as possible. +# available as soon as possible. Also, note that the only way to ensure +# that setcpv gets metadata from the correct repository is to pass in +# a Package instance, as we do here (previously we had to modify +# portdb.porttrees in order to accomplish this). tmpsettings.setcpv(pkg) def stale_env_warning(): |