From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.77) (envelope-from ) id 1SljrZ-0008G5-Cb for garchives@archives.gentoo.org; Mon, 02 Jul 2012 16:52:37 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0E20EE07AF; Mon, 2 Jul 2012 16:52:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D2719E07AF for ; Mon, 2 Jul 2012 16:52:29 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2D01C1B40BF for ; Mon, 2 Jul 2012 16:52:29 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id D956EE543D for ; Mon, 2 Jul 2012 16:52:27 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1341247460.434998b389419ad929a53540057f80d4a921ea7b.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/manifest/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/manifest/helpers.py X-VCS-Directories: roverlay/manifest/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 434998b389419ad929a53540057f80d4a921ea7b X-VCS-Branch: master Date: Mon, 2 Jul 2012 16:52:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 0e5e2cc3-2962-4538-a7ae-1b8c11b00c17 X-Archives-Hash: cb3dfd783888fd1afbef92e25d28ee7e commit: 434998b389419ad929a53540057f80d4a921ea7b Author: Andr=C3=A9 Erdmann mailerd de> AuthorDate: Mon Jul 2 16:44:20 2012 +0000 Commit: Andr=C3=A9 Erdmann mailerd de> CommitDate: Mon Jul 2 16:44:20 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/R_overlay.git= ;a=3Dcommit;h=3D434998b3 Manifest creation: use one instance per job modified: roverlay/manifest/helpers.py --- roverlay/manifest/helpers.py | 29 ++++++++++++++++++++--------- 1 files changed, 20 insertions(+), 9 deletions(-) diff --git a/roverlay/manifest/helpers.py b/roverlay/manifest/helpers.py index 5e2919c..47e1e20 100644 --- a/roverlay/manifest/helpers.py +++ b/roverlay/manifest/helpers.py @@ -12,14 +12,13 @@ import re import copy import logging import subprocess +import threading =20 from roverlay import config, util =20 class _ManifestCreation ( object ): """This is the base class for Manifest file creation.""" =20 - static_instance =3D None - def __init__ ( self ): self.logger =3D logging.getLogger ( 'ManifestCreation' ) # --- end of __init__ (...) --- @@ -31,11 +30,8 @@ class _ManifestCreation ( object ): =20 @classmethod def do ( cls, package_info ): - """Class/static access to Manifest creation.""" - if cls.static_instance is None: - cls.static_instance =3D cls() - - return cls.static_instance.create_for ( package_info ) + """Class access to Manifest creation.""" + return cls().create_for ( package_info ) # --- end of do (...) --- =20 =20 @@ -44,9 +40,24 @@ class ExternalManifestCreation ( _ManifestCreation ): interface, ebuild(1), which is called in a filtered environment. """ =20 + envlock =3D threading.Lock() + manifest_env =3D None + + @classmethod + def get_env ( cls, repo_dir ): + cls.envlock.acquire() + try: + if cls.manifest_env is None: + cls.manifest_env =3D ManifestEnv ( filter_env=3DTrue ) + ret =3D cls.manifest_env [repo_dir] + finally: + cls.envlock.release() + + return ret + + def __init__ ( self ): super ( ExternalManifestCreation, self ) . __init__ () - self.manifest_env =3D ManifestEnv ( filter_env=3DTrue ) # ebuild , where target is: self.ebuild_tgt =3D config.get ( 'TOOLS.EBUILD.target', 'manifest' ) self.ebuild_prog =3D config.get ( 'TOOLS.EBUILD.prog', '/usr/bin/ebui= ld' ) @@ -60,7 +71,7 @@ class ExternalManifestCreation ( _ManifestCreation ): raises: *passes Exceptions from failed config lookups """ =20 - my_env =3D self.manifest_env [ package_info ['distdir'] ] + my_env =3D self.__class__.get_env ( package_info ['distdir'] ) =20 ebuild_file =3D package_info ['ebuild_file'] =20