Merged from trunk -r12173:12181
authorFabian Groffen <grobian@gentoo.org>
Mon, 8 Dec 2008 21:24:31 +0000 (21:24 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 8 Dec 2008 21:24:31 +0000 (21:24 -0000)
   | 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 <betelgeuse@g.o> 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 <ikelos@g.o> for this patch.                       |

   | 12180   | Avoid TypeError in BlockerCache.__iter__() that's triggered  |
   | zmedico | with FEATURES=python-trace. Thanks to Fabian Groffen         |
   |         | <grobian@g.o> for reporting.                                 |

   | 12181   | Fix deprecated_profile_check() to account for                |
   | zmedico | PORTAGE_CONFIGROOT. Thanks to Jeremy Olexa <darkside@g.o>    |
   |         | for the initial patch.                                       |

svn path=/main/branches/prefix/; revision=12182

bin/repoman
man/repoman.1
pym/_emerge/__init__.py
pym/portage/__init__.py
pym/portage/locks.py
pym/repoman/checks.py
pym/repoman/errors.py

index 3fc8e1757e9af6ab2ed9d843ec42d6166c66e2ff..6286b2bfedb61c44e8888afd81f9ed6551fe34c8 100755 (executable)
@@ -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"
 ))
 
index c6d83d5cdce238fed00f15f34fa710a734409941..dde0d15d2a83776200ede82348c153185ac919a8 100644 (file)
@@ -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
index ca8785d4a6195296a37ba93d69890a8f2edc2666..1a82da933f28a4d9923ea7c88228ed6926bce56a 100644 (file)
@@ -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)
 
index 8541b7caebb645df6eb9d8eb6434e8153722f6d3..c11f672f51a247298b50c5528840ae36d9460d86 100644 (file)
@@ -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"),
index 10f15998c46d5ad4559bb29fcada80f3962edf05..830c06b003888055a2560be52b6e8c8c74f375c7 100644 (file)
@@ -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)
index c9415b759b2936786beff1b38679f92f46fb94bc..c90b54f7bbcd8f3d778758c2ba649f9bb5ba1333 100644 (file)
@@ -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
 
index 7c54cc13d9982c013cc9130932c58cbe2dab27a8..7f45bea21b949596d57045fa4cf1a44fb874f589 100644 (file)
@@ -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'