public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/eclasses/
Date: Sat,  5 Sep 2015 21:48:08 +0000 (UTC)	[thread overview]
Message-ID: <1441489657.f58cea2bd71b571e0ff49f6284d5d76fdbed446f.dolsen@gentoo> (raw)

commit:     f58cea2bd71b571e0ff49f6284d5d76fdbed446f
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  4 13:40:35 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:47:37 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f58cea2b

repoman/main.py: Split "Live" checks to checks/ebuilds/eclass/live.py

 pym/repoman/checks/ebuilds/eclasses/live.py | 39 +++++++++++++++++++++++++
 pym/repoman/main.py                         | 45 ++++++++++++-----------------
 2 files changed, 57 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/eclasses/live.py b/pym/repoman/checks/ebuilds/eclasses/live.py
new file mode 100644
index 0000000..20c573e
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/eclasses/live.py
@@ -0,0 +1,39 @@
+
+'''live.py
+Performs Live eclass checks
+'''
+
+from repoman.repos import has_global_mask
+
+
+class LiveEclassChecks(object):
+	'''Performs checks for the usage of Live eclasses in ebuilds'''
+
+	def __init__(self, qatracker):
+		'''
+		@param qatracker: QATracker instance
+		'''
+		self.qatracker = qatracker
+
+	def check(self, pkg, package, ebuild, y_ebuild, keywords, global_pmaskdict):
+		'''Ebuilds that inherit a "Live" eclass (darcs, subversion, git, cvs,
+		etc..) should not be allowed to be marked stable
+
+		@param pkg: Package in which we check (object).
+		@param package: Package in which we check (string).
+		@param ebuild: Ebuild which we check (object).
+		@param y_ebuild: Ebuild which we check (string).
+		@param keywords: The keywords of the ebuild.
+		@param global_pmaskdict: A global dictionary of all the masks.
+		'''
+		is_stable = lambda kw: not kw.startswith("~") and not kw.startswith("-")
+		bad_stable_keywords = list(filter(is_stable, keywords))
+
+		if bad_stable_keywords:
+			self.qatracker.add_error(
+				"LIVEVCS.stable", "%s/%s.ebuild with stable keywords:%s " % (
+					package, y_ebuild, bad_stable_keywords))
+
+		good_keywords_exist = len(bad_stable_keywords) < len(keywords)
+		if good_keywords_exist and not has_global_mask(pkg, global_pmaskdict):
+			self.qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
\ No newline at end of file

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 6e9dc22..305e0b1 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -50,6 +50,7 @@ from portage.package.ebuild.digestgen import digestgen
 from repoman.argparser import parse_args
 from repoman.checks.directories.files import FileChecks
 from repoman.checks.ebuilds.checks import run_checks, checks_init
+from repoman.checks.ebuilds.eclasses.live import LiveEclassChecks
 from repoman.checks.ebuilds.fetches import FetchChecks
 from repoman.checks.ebuilds.keywords import KeywordChecks
 from repoman.checks.ebuilds.isebuild import IsEbuild
@@ -63,16 +64,17 @@ from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_keywords, setup_profile
-from repoman.qa_data import (format_qa_output, format_qa_output_column, qahelp,
+from repoman.qa_data import (
+	format_qa_output, format_qa_output_column, qahelp,
 	qawarnings, qacats, max_desc_len, missingvars,
 	ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict)
 from repoman.qa_tracker import QATracker
-from repoman.repos import has_global_mask, RepoSettings, repo_metadata
+from repoman.repos import RepoSettings, repo_metadata
 from repoman.scan import Changes, scan
 from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
-from repoman.vcs.vcs import (git_supports_gpg_sign, vcs_files_to_cps,
-	VCSSettings)
+from repoman.vcs.vcs import (
+	git_supports_gpg_sign, vcs_files_to_cps, VCSSettings)
 from repoman.vcs.vcsstatus import VCSStatus
 
 
@@ -274,18 +276,21 @@ if options.if_modified == "y":
 		chain(changed.changed, changed.new, changed.removed),
 		repolevel, reposplit, categories))
 
-#######  initialize our checks classes here before the big xpkg loop
+######################
+# initialize our checks classes here before the big xpkg loop
 manifester = Manifests(options, qatracker, repoman_settings)
 is_ebuild = IsEbuild(repoman_settings, repo_settings, portdb, qatracker)
-filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
-	vcs_settings)
+filescheck = FileChecks(
+	qatracker, repoman_settings, repo_settings, portdb, vcs_settings)
 status_check = VCSStatus(vcs_settings, qatracker)
-fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
-	vcs_settings)
+fetchcheck = FetchChecks(
+	qatracker, repoman_settings, repo_settings, portdb, vcs_settings)
 pkgmeta = PkgMetadata(options, qatracker, repoman_settings)
 thirdparty = ThirdPartyMirrors(repoman_settings, qatracker)
 use_flag_checks = USEFlagChecks(qatracker, uselist)
 keywordcheck = KeywordChecks(qatracker, options)
+liveeclasscheck = LiveEclassChecks(qatracker)
+######################
 
 for xpkg in effective_scanlist:
 	# ebuilds and digests added to cvs respectively.
@@ -454,25 +459,11 @@ for xpkg in effective_scanlist:
 				qatracker.add_error("KEYWORDS.stupid",
 					xpkg + "/" + y_ebuild + ".ebuild")
 
-		"""
-		Ebuilds that inherit a "Live" eclass (darcs,subversion,git,cvs,etc..) should
-		not be allowed to be marked stable
-		"""
 		if live_ebuild and repo_settings.repo_config.name == "gentoo":
-			bad_stable_keywords = []
-			for keyword in keywords:
-				if not keyword.startswith("~") and \
-					not keyword.startswith("-"):
-					bad_stable_keywords.append(keyword)
-				del keyword
-			if bad_stable_keywords:
-				qatracker.add_error("LIVEVCS.stable",
-					"%s/%s.ebuild with stable keywords:%s " %
-					(xpkg, y_ebuild, bad_stable_keywords))
-			del bad_stable_keywords
-
-			if keywords and not has_global_mask(pkg, global_pmaskdict):
-				qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
+			#######################
+			liveeclasscheck.check(
+				pkg, xpkg, ebuild, y_ebuild, keywords, global_pmaskdict)
+			#######################
 
 		if options.ignore_arches:
 			arches = [[


             reply	other threads:[~2015-09-05 21:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-05 21:48 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-09-21 23:51 [gentoo-commits] proj/portage:master commit in: pym/repoman/checks/ebuilds/eclasses/, pym/repoman/ Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/eclasses/ Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-10 14:45 Michał Górny
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 13:59 Tom Wijsman
2014-06-04 13:41 Tom Wijsman

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=1441489657.f58cea2bd71b571e0ff49f6284d5d76fdbed446f.dolsen@gentoo \
    --to=dolsen@gentoo.org \
    --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