* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/vcs/, pym/repoman/
@ 2015-09-17 4:51 Brian Dolbec
0 siblings, 0 replies; only message in thread
From: Brian Dolbec @ 2015-09-17 4:51 UTC (permalink / raw
To: gentoo-commits
commit: ad2d5a60cbc4ae300e5490ad64b55738c4d921cd
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 3 05:38:19 2014 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:24 2015 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=ad2d5a60
Repoman: Create repoman/_portage.py to centrally import portage for all modules
This prevents repository errors when running repoman on non repos.conf repositories.
For some reason submodule imports of portage did not contain the repo being scanned.
checks.py: sort the imports.
argparser.py: fix a lack of a newline at the end of the file.
pym/repoman/_portage.py | 26 +++++++++++++++++++++++++
pym/repoman/_subprocess.py | 4 +++-
pym/repoman/_xml.py | 4 +++-
pym/repoman/argparser.py | 5 ++++-
pym/repoman/checks/ebuilds/checks.py | 8 ++++++--
pym/repoman/checks/ebuilds/fetches.py | 4 +++-
pym/repoman/checks/ebuilds/isebuild.py | 4 +++-
pym/repoman/checks/ebuilds/manifests.py | 10 ++++++----
pym/repoman/checks/ebuilds/misc.py | 3 ++-
pym/repoman/checks/ebuilds/pkgmetadata.py | 4 +++-
pym/repoman/checks/ebuilds/thirdpartymirrors.py | 3 ++-
pym/repoman/main.py | 12 ++++++++----
pym/repoman/metadata.py | 4 +++-
pym/repoman/qa_data.py | 5 ++++-
pym/repoman/repos.py | 4 +++-
pym/repoman/utilities.py | 4 +++-
pym/repoman/vcs/vcsstatus.py | 4 +++-
17 files changed, 85 insertions(+), 23 deletions(-)
diff --git a/pym/repoman/_portage.py b/pym/repoman/_portage.py
new file mode 100644
index 0000000..e72ce9f
--- /dev/null
+++ b/pym/repoman/_portage.py
@@ -0,0 +1,26 @@
+
+'''repoman/_portage.py
+Central location for the portage import.
+There were problems when portage was imported by submodules
+due to the portage instance was somehow different that the
+initial portage import in main.py. The later portage imports
+did not contain the repo it was working on. That repo was my cvs tree
+and not listed in those subsequent portage imports.
+
+All modules should import portage from this one
+
+from repoman._portage import portage
+
+Then continue to import the remaining portage modules needed
+'''
+
+import sys
+
+from os import path as osp
+pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))))
+sys.path.insert(0, pym_path)
+
+import portage
+portage._internal_caller = True
+portage._disable_legacy_globals()
+
diff --git a/pym/repoman/_subprocess.py b/pym/repoman/_subprocess.py
index 3a404ce..5449e64 100644
--- a/pym/repoman/_subprocess.py
+++ b/pym/repoman/_subprocess.py
@@ -4,7 +4,9 @@ import codecs
import subprocess
import sys
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage import os
from portage.process import find_binary
from portage import _encodings, _unicode_encode
diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index 513b62a..1871875 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -2,7 +2,9 @@
import sys
import xml
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage import os
from portage.output import red
from portage.process import find_binary
diff --git a/pym/repoman/argparser.py b/pym/repoman/argparser.py
index 45f65fd..1c9bd45 100644
--- a/pym/repoman/argparser.py
+++ b/pym/repoman/argparser.py
@@ -7,10 +7,13 @@
import logging
import sys
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage import util
from portage.util._argparse import ArgumentParser
+
def parse_args(argv, qahelp, repoman_default_opts):
"""Use a customized optionParser to parse command line arguments for repoman
Args:
diff --git a/pym/repoman/checks/ebuilds/checks.py b/pym/repoman/checks/ebuilds/checks.py
index 694d677..b3c988a 100644
--- a/pym/repoman/checks/ebuilds/checks.py
+++ b/pym/repoman/checks/ebuilds/checks.py
@@ -11,13 +11,17 @@ import codecs
from itertools import chain
import re
import time
-import repoman.checks.ebuilds.errors as errors
-import portage
+
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage.eapi import (
eapi_supports_prefix, eapi_has_implicit_rdepend,
eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard,
eapi_exports_AA, eapi_has_pkg_pretend)
+import repoman.checks.ebuilds.errors as errors
+
class LineCheck(object):
"""Run a check on a line of an ebuild."""
diff --git a/pym/repoman/checks/ebuilds/fetches.py b/pym/repoman/checks/ebuilds/fetches.py
index ccf9ff9..22e89b6 100644
--- a/pym/repoman/checks/ebuilds/fetches.py
+++ b/pym/repoman/checks/ebuilds/fetches.py
@@ -5,7 +5,9 @@ Performs the src_uri fetchlist and files checks
from stat import S_ISDIR
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage import os
from repoman.vcs.vcs import vcs_new_changed
diff --git a/pym/repoman/checks/ebuilds/isebuild.py b/pym/repoman/checks/ebuilds/isebuild.py
index 2369ea6..065914e 100644
--- a/pym/repoman/checks/ebuilds/isebuild.py
+++ b/pym/repoman/checks/ebuilds/isebuild.py
@@ -4,7 +4,9 @@ import stat
from _emerge.Package import Package
from _emerge.RootConfig import RootConfig
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage import os
from repoman.qa_data import no_exec, allvars
diff --git a/pym/repoman/checks/ebuilds/manifests.py b/pym/repoman/checks/ebuilds/manifests.py
index fb08c5e..1d65e1d 100644
--- a/pym/repoman/checks/ebuilds/manifests.py
+++ b/pym/repoman/checks/ebuilds/manifests.py
@@ -2,7 +2,9 @@
import logging
import sys
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage import os
from portage.package.ebuild.digestgen import digestgen
from portage.util import writemsg_level
@@ -11,17 +13,17 @@ from portage.util import writemsg_level
class Manifests(object):
- def __init__(self, options, qatracker, repoman_settings):
+ def __init__(self, options, qatracker=None, repoman_settings=None):
self.options = options
self.qatracker = qatracker
self.repoman_settings = repoman_settings
-
- self.digest_only = options.mode != 'manifest-check' and options.digest == 'y'
self.generated_manifest = False
def run(self, checkdir, portdb):
self.generated_manifest = False
+ self.digest_only = self.options.mode != 'manifest-check' \
+ and self.options.digest == 'y'
if self.options.pretend:
return False
if self.options.mode in ("manifest", 'commit', 'fix') or self.digest_only:
diff --git a/pym/repoman/checks/ebuilds/misc.py b/pym/repoman/checks/ebuilds/misc.py
index c1edd2c..3bf61f0 100644
--- a/pym/repoman/checks/ebuilds/misc.py
+++ b/pym/repoman/checks/ebuilds/misc.py
@@ -4,7 +4,8 @@ Miscelaneous ebuild check functions'''
import re
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
pv_toolong_re = re.compile(r'[0-9]{19,}')
diff --git a/pym/repoman/checks/ebuilds/pkgmetadata.py b/pym/repoman/checks/ebuilds/pkgmetadata.py
index d40691d..0778696 100644
--- a/pym/repoman/checks/ebuilds/pkgmetadata.py
+++ b/pym/repoman/checks/ebuilds/pkgmetadata.py
@@ -20,7 +20,9 @@ except (ImportError, SystemError, RuntimeError, Exception):
out.eerror(line)
sys.exit(1)
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage.exception import InvalidAtom
from portage import os
from portage import _encodings, _unicode_encode
diff --git a/pym/repoman/checks/ebuilds/thirdpartymirrors.py b/pym/repoman/checks/ebuilds/thirdpartymirrors.py
index f867c19..50a0da8 100644
--- a/pym/repoman/checks/ebuilds/thirdpartymirrors.py
+++ b/pym/repoman/checks/ebuilds/thirdpartymirrors.py
@@ -1,5 +1,6 @@
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
class ThirdPartyMirrors(object):
diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 89c260d..c45af26 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -21,7 +21,8 @@ from os import path as osp
if osp.isfile(osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), ".portage_not_installed")):
pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__)))) #, "pym")
sys.path.insert(0, pym_path)
-import portage
+# import our centrally initialized portage instance
+from repoman._portage import portage
portage._internal_caller = True
portage._disable_legacy_globals()
@@ -118,12 +119,15 @@ if options.experimental_inherit == 'y':
can_force = True
portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
+print("portdir", portdir)
+print("portdir_overlay", portdir_overlay)
+print("mydir", mydir)
if portdir is None:
sys.exit(1)
myreporoot = os.path.basename(portdir_overlay)
myreporoot += mydir[len(portdir_overlay):]
-
+print("myreporoot", myreporoot)
##################
vcs_settings = VCSSettings(options, repoman_settings)
@@ -286,12 +290,12 @@ for xpkg in effective_scanlist:
checkdir_relative = os.path.join(catdir, checkdir_relative)
checkdir_relative = os.path.join(".", checkdir_relative)
-#####################
+#####################^^^^^^^^^^^^^^
manifester = Manifests(options, qatracker, repoman_settings)
if manifester.run(checkdir, portdb):
continue
if not manifester.generated_manifest:
- manifester.digest_check(xpkg, checkdir)
+ manifester.digest_check(xpkg, checkdir)
######################
if options.mode == 'manifest-check':
diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index 7d41e37..f2b63a7 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -11,7 +11,9 @@ except ImportError:
from urlparse import urlparse
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage import exception
from portage import os
from portage.output import green
diff --git a/pym/repoman/qa_data.py b/pym/repoman/qa_data.py
index 65a0b5e..f4415ba 100644
--- a/pym/repoman/qa_data.py
+++ b/pym/repoman/qa_data.py
@@ -2,7 +2,10 @@
import logging
from _emerge.Package import Package
-import portage
+
+# import our initialized portage instance
+from repoman._portage import portage
+
# 14 is the length of DESCRIPTION=""
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index 16de8bf..b79e241 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -6,7 +6,9 @@ import re
import sys
import textwrap
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage import os
from portage import _encodings
from portage import _unicode_encode
diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 075ab7c..93e8840 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -31,7 +31,9 @@ import textwrap
import difflib
from tempfile import mkstemp
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage import os
from portage import shutil
from portage import _encodings
diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py
index f984832..6a81b1b 100644
--- a/pym/repoman/vcs/vcsstatus.py
+++ b/pym/repoman/vcs/vcsstatus.py
@@ -1,6 +1,8 @@
-import portage
+# import our initialized portage instance
+from repoman._portage import portage
+
from portage import os
from repoman._subprocess import repoman_popen
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-09-17 4:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 4:51 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/vcs/, pym/repoman/ Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox