From 2f4e0e253dca2ec666073c8296ee29dee054f166 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Mon, 8 Dec 2008 21:24:31 +0000 Subject: [PATCH] Merged from trunk -r12173:12181 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit | 12174 | If pkg_nofetch needs to be spawned inside fetch() and it | | zmedico | happens that PORTAGE_BUILDDIR doesn't exist, like when | | | called by digestgen(), use mkdtemp to create a private | | | temporary directory so that pkg_nofetch can be spawned | | | (directory needed to satisfy safe $PWD requirement of bug | | | #239560). This is more user friendly since before the | | | pkg_nofetch phase would simply be skipped in this case. | | | Thanks to Petteri Räty for reporting. | | 12176 | Bug #249586 - Use writemsg() to send output to stderr | | zmedico | instead of stdout. | | 12179 | Bug #250212 - Add a new 'upstream.workaround' qa category, | | zmedico | and use it for the EMakeParallelDisabled check. Thanks to | | | Mike Auty for this patch. | | 12180 | Avoid TypeError in BlockerCache.__iter__() that's triggered | | zmedico | with FEATURES=python-trace. Thanks to Fabian Groffen | | | for reporting. | | 12181 | Fix deprecated_profile_check() to account for | | zmedico | PORTAGE_CONFIGROOT. Thanks to Jeremy Olexa | | | for the initial patch. | svn path=/main/branches/prefix/; revision=12182 --- bin/repoman | 4 +++- man/repoman.1 | 4 ++++ pym/_emerge/__init__.py | 5 ++++- pym/portage/__init__.py | 40 +++++++++++++++++++++++++++++++++++++--- pym/portage/locks.py | 25 +++++++++++++++---------- pym/repoman/checks.py | 2 +- pym/repoman/errors.py | 2 +- 7 files changed, 65 insertions(+), 17 deletions(-) diff --git a/bin/repoman b/bin/repoman index 3fc8e1757..6286b2bfe 100755 --- a/bin/repoman +++ b/bin/repoman @@ -312,7 +312,8 @@ qahelp={ "virtual.versioned":"PROVIDE contains virtuals with versions", "virtual.exists":"PROVIDE contains existing package names", "virtual.unavailable":"PROVIDE contains a virtual which contains no profile default", - "usage.obsolete":"The ebuild makes use of an obsolete construct" + "usage.obsolete":"The ebuild makes use of an obsolete construct", + "upstream.workaround":"The ebuild works around an upstream bug, an upstream bug should be filed and tracked in bugs.gentoo.org" } qacats = qahelp.keys() @@ -350,6 +351,7 @@ qawarnings = set(( "virtual.exists", "virtual.unavailable", "usage.obsolete", +"upstream.workaround", "LIVEVCS.stable" )) diff --git a/man/repoman.1 b/man/repoman.1 index c6d83d5cd..dde0d15d2 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -263,6 +263,10 @@ Bad metadata.xml files .B metadata.missing Missing metadata.xml files .TP +.B upstream.workaround +The ebuild works around an upstream bug, an upstream bug should be filed and +tracked in bugs.gentoo.org +.TP .B usage.obsolete The ebuild makes use of an obsolete construct .TP diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index ca8785d4a..1a82da933 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -3917,6 +3917,9 @@ class BlockerCache(DictMixin): self._modified.add(cpv) def __iter__(self): + if self._cache_data is None: + # triggered by python-trace + return iter([]) return iter(self._cache_data["blockers"]) def __delitem__(self, cpv): @@ -14295,7 +14298,7 @@ def emerge_main(): spinner.update = spinner.update_scroll if "--quiet" not in myopts: - portage.deprecated_profile_check() + portage.deprecated_profile_check(settings=settings) repo_name_check(trees) config_protect_check(trees) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 8541b7cae..c11f672f5 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -4151,6 +4151,33 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", level=logging.ERROR, noiselevel=-1) have_builddir = "PORTAGE_BUILDDIR" in mysettings and \ os.path.isdir(mysettings["PORTAGE_BUILDDIR"]) + + global_tmpdir = mysettings["PORTAGE_TMPDIR"] + private_tmpdir = None + if not parallel_fetchonly and not have_builddir: + # When called by digestgen(), it's normal that + # PORTAGE_BUILDDIR doesn't exist. It's helpful + # to show the pkg_nofetch output though, so go + # ahead and create a temporary PORTAGE_BUILDDIR. + # Use a temporary config instance to avoid altering + # the state of the one that's been passed in. + mysettings = config(clone=mysettings) + from tempfile import mkdtemp + try: + private_tmpdir = mkdtemp("", "._portage_fetch_.", + global_tmpdir) + except OSError, e: + if e.errno != portage.exception.PermissionDenied.errno: + raise + raise portage.exception.PermissionDenied(global_tmpdir) + mysettings["PORTAGE_TMPDIR"] = private_tmpdir + mysettings.backup_changes("PORTAGE_TMPDIR") + debug = mysettings.get("PORTAGE_DEBUG") == "1" + portage.doebuild_environment(mysettings["EBUILD"], "fetch", + mysettings["ROOT"], mysettings, debug, 1, None) + prepare_build_dirs(mysettings["ROOT"], mysettings, 0) + have_builddir = True + if not parallel_fetchonly and have_builddir: # To spawn pkg_nofetch requires PORTAGE_BUILDDIR for # ensuring sane $PWD (bug #239560) and storing elog @@ -4175,6 +4202,8 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", mysettings.pop("EBUILD_PHASE", None) else: mysettings["EBUILD_PHASE"] = ebuild_phase + if private_tmpdir is not None: + shutil.rmtree(private_tmpdir) elif restrict_fetch: pass @@ -7296,10 +7325,15 @@ def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, raise del e -def deprecated_profile_check(): - if not os.access(DEPRECATED_PROFILE_FILE, os.R_OK): +def deprecated_profile_check(settings=None): + config_root = "/" + if settings is not None: + config_root = settings["PORTAGE_CONFIGROOT"] + deprecated_profile_file = os.path.join(config_root, + DEPRECATED_PROFILE_FILE.lstrip(os.sep)) + if not os.access(deprecated_profile_file, os.R_OK): return False - deprecatedfile = open(DEPRECATED_PROFILE_FILE, "r") + deprecatedfile = open(deprecated_profile_file, "r") dcontent = deprecatedfile.readlines() deprecatedfile.close() writemsg(red("\n!!! Your current profile is deprecated and not supported anymore.\n"), diff --git a/pym/portage/locks.py b/pym/portage/locks.py index 10f15998c..830c06b00 100644 --- a/pym/portage/locks.py +++ b/pym/portage/locks.py @@ -3,6 +3,9 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ +__all__ = ["lockdir", "unlockdir", "lockfile", "unlockfile", \ + "hardlock_name", "hardlink_is_mine", "hardlink_lockfile", \ + "unhardlink_lockfile", "hardlock_cleanup"] import errno, os, stat, time, types from portage.exception import DirectoryNotFound, FileNotFound, \ @@ -94,11 +97,13 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, pass elif waiting_msg is None: if isinstance(mypath, int): - print "waiting for lock on fd %i" % myfd + writemsg("waiting for lock on fd %i\n" % myfd, + noiselevel=-1) else: - print "waiting for lock on %s" % lockfilename + writemsg("waiting for lock on %s\n" % lockfilename, + noiselevel=-1) elif waiting_msg: - print waiting_msg + writemsg(waiting_msg + "\n", noiselevel=-1) # try for the exclusive lock now. fcntl.lockf(myfd,fcntl.LOCK_EX) elif e.errno == errno.ENOLCK: @@ -257,19 +262,19 @@ def hardlink_lockfile(lockfilename, max_wait=14400): if hardlink_is_mine(myhardlock, lockfilename): # We have the lock. if reported_waiting: - print + writemsg("\n", noiselevel=-1) return True if reported_waiting: - writemsg(".") + writemsg(".", noiselevel=-1) else: reported_waiting = True from portage.const import PORTAGE_BIN_PATH - print - print "Waiting on (hardlink) lockfile: (one '.' per 3 seconds)" - print "This is a feature to prevent distfiles corruption." - print "%s/clean_locks can fix stuck locks." % PORTAGE_BIN_PATH - print "Lockfile: " + lockfilename + msg = "\nWaiting on (hardlink) lockfile:" + \ + " (one '.' per 3 seconds)\n" + \ + "%s/clean_locks can fix stuck locks.\n" % PORTAGE_BIN_PATH + \ + "Lockfile: %s\n" % lockfilename + writemsg(msg, noiselevel=-1) time.sleep(3) os.unlink(myhardlock) diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index c9415b759..c90b54f7b 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -291,7 +291,7 @@ class IUseUndefined(LineCheck): class EMakeParallelDisabled(LineCheck): """Check for emake -j1 calls which disable parallelization.""" - repoman_check_name = 'ebuild.minorsyn' + repoman_check_name = 'upstream.workaround' re = re.compile(r'^\s*emake\s+-j\s*1\s') error = errors.EMAKE_PARALLEL_DISABLED diff --git a/pym/repoman/errors.py b/pym/repoman/errors.py index 7c54cc13d..7f45bea21 100644 --- a/pym/repoman/errors.py +++ b/pym/repoman/errors.py @@ -13,5 +13,5 @@ MISSING_QUOTES_ERROR = 'Unquoted Variable on line: %d' NESTED_DIE_ERROR = 'Ebuild calls die in a subshell on line: %d' PATCHES_ERROR = 'PATCHES is not a bash array on line: %d' REDUNDANT_CD_S_ERROR = 'Ebuild has redundant cd ${S} statement on line: %d' -EMAKE_PARALLEL_DISABLED = 'Ebuild calls emake -j1 on line: %d' +EMAKE_PARALLEL_DISABLED = 'Upstream parallel compilation bug (ebuild calls emake -j1 on line: %d)' DEPRECATED_BINDNOW_FLAGS = 'Deprecated bindnow-flags call on line: %d' -- 2.26.2