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/checks/ebuilds/
Date: Mon, 2 Jun 2014 01:10:48 +0000 (UTC) [thread overview]
Message-ID: <1401670805.7b48d08d50a9da5514190abc3c70a30372bd7c5d.dol-sen@gentoo> (raw)
commit: 7b48d08d50a9da5514190abc3c70a30372bd7c5d
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 2 01:00:05 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 2 01:00:05 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7b48d08d
repoman/main.py: Create IsEbuild class and check
Split the code from main.py into checks/ebuilds/isebuild.py.
---
pym/repoman/checks/ebuilds/isebuild.py | 70 ++++++++++++++++++++++++++++++++++
pym/repoman/main.py | 50 +++++-------------------
2 files changed, 79 insertions(+), 41 deletions(-)
diff --git a/pym/repoman/checks/ebuilds/isebuild.py b/pym/repoman/checks/ebuilds/isebuild.py
new file mode 100644
index 0000000..2369ea6
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/isebuild.py
@@ -0,0 +1,70 @@
+
+import stat
+
+from _emerge.Package import Package
+from _emerge.RootConfig import RootConfig
+
+import portage
+from portage import os
+
+from repoman.qa_data import no_exec, allvars
+
+
+class IsEbuild(object):
+
+
+ def __init__(self, repoman_settings, repo_settings, portdb, qatracker):
+ ''''''
+ self.portdb = portdb
+ self.qatracker = qatracker
+ self.root_config = RootConfig(repoman_settings,
+ repo_settings.trees[repo_settings.root], None)
+
+
+ def check(self, checkdirlist, checkdir, xpkg):
+ self.continue_ = False
+ ebuildlist = []
+ pkgs = {}
+ allvalid = True
+ for y in checkdirlist:
+ file_is_ebuild = y.endswith(".ebuild")
+ file_should_be_non_executable = y in no_exec or file_is_ebuild
+
+ if file_should_be_non_executable:
+ file_is_executable = stat.S_IMODE(
+ os.stat(os.path.join(checkdir, y)).st_mode) & 0o111
+
+ if file_is_executable:
+ self.qatracker.add_error("file.executable", os.path.join(checkdir, y))
+ if file_is_ebuild:
+ pf = y[:-7]
+ ebuildlist.append(pf)
+ catdir = xpkg.split("/")[0]
+ cpv = "%s/%s" % (catdir, pf)
+ try:
+ myaux = dict(zip(allvars, self.portdb.aux_get(cpv, allvars)))
+ except KeyError:
+ allvalid = False
+ self.qatracker.add_error("ebuild.syntax", os.path.join(xpkg, y))
+ continue
+ except IOError:
+ allvalid = False
+ self.qatracker.add_error("ebuild.output", os.path.join(xpkg, y))
+ continue
+ if not portage.eapi_is_supported(myaux["EAPI"]):
+ allvalid = False
+ self.qatracker.add_error("EAPI.unsupported", os.path.join(xpkg, y))
+ continue
+ pkgs[pf] = Package(
+ cpv=cpv, metadata=myaux, root_config=self.root_config,
+ type_name="ebuild")
+
+ if len(pkgs) != len(ebuildlist):
+ # If we can't access all the metadata then it's totally unsafe to
+ # commit since there's no way to generate a correct Manifest.
+ # Do not try to do any more QA checks on this package since missing
+ # metadata leads to false positives for several checks, and false
+ # positives confuse users.
+ self.continue_ = True
+
+ return pkgs, allvalid
diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 3a1ff7a..6a7ada7 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -11,7 +11,6 @@ import io
import logging
import re
import signal
-import stat
import subprocess
import sys
import tempfile
@@ -45,7 +44,6 @@ from portage import os
from portage import _encodings
from portage import _unicode_encode
from _emerge.Package import Package
-from _emerge.RootConfig import RootConfig
from _emerge.userquery import userquery
import portage.checksum
import portage.const
@@ -65,6 +63,7 @@ from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
from repoman.argparser import parse_args
from repoman.checks.ebuilds.checks import run_checks, checks_init
+from repoman.checks.ebuilds.isebuild import IsEbuild
from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
from repoman.checks.ebuilds.manifests import Manifests
from repoman.checks.herds.herdbase import make_herd_base
@@ -75,7 +74,7 @@ from repoman.metadata import (metadata_xml_encoding, metadata_doctype_name,
from repoman.modules import commit
from repoman.profile import check_profiles, dev_keywords, setup_profile
from repoman.qa_data import (format_qa_output, format_qa_output_column, qahelp,
- qawarnings, qacats, no_exec, allvars, max_desc_len, missingvars,
+ qawarnings, qacats, max_desc_len, missingvars,
ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict)
from qa_tracker import QATracker
from repoman.repos import has_global_mask, RepoSettings, repo_metadata
@@ -206,7 +205,6 @@ repoman_settings.categories = frozenset(
categories = repoman_settings.categories
portdb.settings = repoman_settings
-root_config = RootConfig(repoman_settings, repo_settings.trees[repo_settings.root], None)
# We really only need to cache the metadata that's necessary for visibility
# filtering. Anything else can be discarded to reduce memory consumption.
portdb._aux_cache_keys.clear()
@@ -351,44 +349,11 @@ for xpkg in effective_scanlist:
continue
checkdirlist = os.listdir(checkdir)
- ebuildlist = []
- pkgs = {}
- allvalid = True
- for y in checkdirlist:
- file_is_ebuild = y.endswith(".ebuild")
- file_should_be_non_executable = y in no_exec or file_is_ebuild
-
- if file_should_be_non_executable:
- file_is_executable = stat.S_IMODE(
- os.stat(os.path.join(checkdir, y)).st_mode) & 0o111
-
- if file_is_executable:
- qatracker.add_error("file.executable", os.path.join(checkdir, y))
- if file_is_ebuild:
- pf = y[:-7]
- ebuildlist.append(pf)
- cpv = "%s/%s" % (catdir, pf)
- try:
- myaux = dict(zip(allvars, portdb.aux_get(cpv, allvars)))
- except KeyError:
- allvalid = False
- qatracker.add_error("ebuild.syntax", os.path.join(xpkg, y))
- continue
- except IOError:
- allvalid = False
- qatracker.add_error("ebuild.output", os.path.join(xpkg, y))
- continue
- if not portage.eapi_is_supported(myaux["EAPI"]):
- allvalid = False
- qatracker.add_error("EAPI.unsupported", os.path.join(xpkg, y))
- continue
- pkgs[pf] = Package(
- cpv=cpv, metadata=myaux, root_config=root_config,
- type_name="ebuild")
- slot_keywords = {}
-
- if len(pkgs) != len(ebuildlist):
+######################
+ is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
+ pkgs, allvalid = is_ebuild.check(checkdirlist, checkdir, xpkg)
+ if is_ebuild.continue_:
# If we can't access all the metadata then it's totally unsafe to
# commit since there's no way to generate a correct Manifest.
# Do not try to do any more QA checks on this package since missing
@@ -396,6 +361,9 @@ for xpkg in effective_scanlist:
# positives confuse users.
can_force = False
continue
+######################
+
+ slot_keywords = {}
# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
ebuildlist = sorted(pkgs.values())
next reply other threads:[~2014-06-02 1:10 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 1:10 Brian Dolbec [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-09-20 2:06 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/ Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-10 14:45 Michał Górny
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2014-11-17 0:55 Brian Dolbec
2014-11-17 0:55 Brian Dolbec
2014-11-17 0:55 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-06-04 14:18 Tom Wijsman
2014-06-04 9:18 Tom Wijsman
2014-06-03 19:33 Brian Dolbec
2014-06-03 11:16 Tom Wijsman
2014-06-02 6:44 Brian Dolbec
2014-06-02 6:05 Brian Dolbec
2014-06-02 3:35 Brian Dolbec
2014-05-30 13:03 Brian Dolbec
2014-05-30 13:03 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=1401670805.7b48d08d50a9da5514190abc3c70a30372bd7c5d.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