From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/, pym/repoman/checks/ebuilds/
Date: Wed, 1 Oct 2014 23:46:35 +0000 (UTC) [thread overview]
Message-ID: <1412207133.03094ff0f3d6b20d97d7ac48ecd4f2f70868b7f3.dol-sen@gentoo> (raw)
commit: 03094ff0f3d6b20d97d7ac48ecd4f2f70868b7f3
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 3 05:38:19 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct 1 23:45:33 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=03094ff0
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 | 8 ++++++--
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, 87 insertions(+), 24 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 393d755..1b2fe6b 100644
--- a/pym/repoman/argparser.py
+++ b/pym/repoman/argparser.py
@@ -5,11 +5,15 @@
"""This module contains functions used in Repoman to parse CLI arguments."""
import logging
-import portage
import sys
+
+# 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:
@@ -206,4 +210,4 @@ def parse_args(argv, qahelp, repoman_default_opts):
opts.without_mask = False
logging.warn('Commit mode automatically disables --without-mask')
- return (opts, args)
\ No newline at end of file
+ return (opts, args)
diff --git a/pym/repoman/checks/ebuilds/checks.py b/pym/repoman/checks/ebuilds/checks.py
index 41ddbbb..890cd18 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 d567f94..fcd4c19 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()
@@ -115,12 +116,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)
@@ -283,12 +287,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 b4950ad..059b0af 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 5e39e29..4b62b5d 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 7274d13..b7b3945 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
next reply other threads:[~2014-10-01 23:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 23:46 Brian Dolbec [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-06-03 5:39 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/, pym/repoman/checks/ebuilds/ Brian Dolbec
2014-05-30 19:25 Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1412207133.03094ff0f3d6b20d97d7ac48ecd4f2f70868b7f3.dol-sen@gentoo \
--to=brian.dolbec@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox