From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E156413838B for ; Wed, 1 Oct 2014 23:46:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 67730E08B2; Wed, 1 Oct 2014 23:46:40 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8A21EE08B0 for ; Wed, 1 Oct 2014 23:46:39 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 694E534036E for ; Wed, 1 Oct 2014 23:46:38 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6D8456B7F for ; Wed, 1 Oct 2014 23:46:35 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1412207133.03094ff0f3d6b20d97d7ac48ecd4f2f70868b7f3.dol-sen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/, pym/repoman/checks/ebuilds/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/_portage.py pym/repoman/_subprocess.py pym/repoman/_xml.py pym/repoman/argparser.py pym/repoman/checks/ebuilds/checks.py pym/repoman/checks/ebuilds/fetches.py pym/repoman/checks/ebuilds/isebuild.py pym/repoman/checks/ebuilds/manifests.py pym/repoman/checks/ebuilds/misc.py pym/repoman/checks/ebuilds/pkgmetadata.py pym/repoman/checks/ebuilds/thirdpartymirrors.py pym/repoman/main.py pym/repoman/metadata.py pym/repoman/qa_data.py pym/repoman/repos.py pym/repoman/utilities.py pym/repoman/vcs/vcsstatus.py X-VCS-Directories: pym/repoman/checks/ebuilds/ pym/repoman/vcs/ pym/repoman/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 03094ff0f3d6b20d97d7ac48ecd4f2f70868b7f3 X-VCS-Branch: repoman Date: Wed, 1 Oct 2014 23:46:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: b061d662-e46c-456f-be78-8ae5c2d16188 X-Archives-Hash: c9b83dc143b4ac6e23cf3a0a2421158e commit: 03094ff0f3d6b20d97d7ac48ecd4f2f70868b7f3 Author: Brian Dolbec gentoo org> AuthorDate: Tue Jun 3 05:38:19 2014 +0000 Commit: Brian Dolbec gmail 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