[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
commit: 2aaa7db8d8178a6a1a062fae77f6db88a5353c91 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 14:40:39 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:34 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2aaa7db8 repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py --- pym/repoman/checks/ebuilds/variables/__init__.py | 0 pym/repoman/checks/ebuilds/variables/eapi.py | 44 pym/repoman/main.py | 12 +++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py new file mode 100644 index 000..e69de29 diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py new file mode 100644 index 000..2f8b1cb --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/eapi.py @@ -0,0 +1,44 @@ + +'''eapi.py +Perform checks on the EAPI variable. +''' + + +class EAPIChecks(object): + '''Perform checks on the EAPI variable.''' + + def __init__(self, qatracker, repo_settings): + ''' + @param qatracker: QATracker instance + @param repo_settings: Repository settings + ''' + self.qatracker = qatracker + self.repo_settings = repo_settings + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + eapi = pkg._metadata[EAPI] + + if not self._checkBanned(ebuild, eapi): + self._checkDeprecated(ebuild, eapi) + + def _checkBanned(self, ebuild, eapi): + if self.repo_settings.repo_config.eapi_is_banned(eapi): + self.qatracker.add_error( + repo.eapi.banned, %s: %s % (ebuild.relative_path, eapi)) + + return True + + return False + + def _checkDeprecated(self, ebuild, eapi): + if self.repo_settings.repo_config.eapi_is_deprecated(eapi): + self.qatracker.add_error( + repo.eapi.deprecated, %s: %s % (ebuild.relative_path, eapi)) + + return True + + return False diff --git a/pym/repoman/main.py b/pym/repoman/main.py index ecdecfa..c6f38df 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -58,6 +58,7 @@ from repoman.checks.ebuilds.manifests import Manifests from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks +from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -292,6 +293,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist) keywordcheck = KeywordChecks(qatracker) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) +eapicheck = EAPIChecks(qatracker, repo_settings) ## for xpkg in effective_scanlist: @@ -393,13 +395,9 @@ for xpkg in effective_scanlist: inherited = pkg.inherited live_ebuild = live_eclasses.intersection(inherited) - if repo_settings.repo_config.eapi_is_banned(eapi): - qatracker.add_error( - repo.eapi.banned, %s: %s % (ebuild.relative_path, eapi)) - - elif repo_settings.repo_config.eapi_is_deprecated(eapi): - qatracker.add_error( - repo.eapi.deprecated, %s: %s % (ebuild.relative_path, eapi)) + ### + eapicheck.check(pkg, ebuild) + ### for k, v in myaux.items(): if not isinstance(v, basestring):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
commit: 8b4fa96f5946c9605633fe93b7602a463d90c678 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 14:50:26 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:34 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8b4fa96f repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ --- .../checks/ebuilds/variables/description.py| 32 ++ pym/repoman/main.py| 13 - 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py new file mode 100644 index 000..a2b1057 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/description.py @@ -0,0 +1,32 @@ + +'''description.py +Perform checks on the DESCRIPTION variable. +''' + +from repoman.qa_data import max_desc_len + + +class DescriptionChecks(object): + '''Perform checks on the DESCRIPTION variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + self._checkTooLong(pkg, ebuild) + + def _checkTooLong(self, pkg, ebuild): + # 14 is the length of DESCRIPTION= + if len(pkg._metadata['DESCRIPTION']) max_desc_len: + self.qatracker.add_error( + 'DESCRIPTION.toolong', + %s: DESCRIPTION is %d characters (max %d) % + (ebuild.relative_path, len( + pkg._metadata['DESCRIPTION']), max_desc_len)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index c6f38df..ed3cf88 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -58,6 +58,7 @@ from repoman.checks.ebuilds.manifests import Manifests from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks +from repoman.checks.ebuilds.variables.description import DescriptionChecks from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.ebuild import Ebuild from repoman.errors import err @@ -65,7 +66,7 @@ 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, - qawarnings, qacats, max_desc_len, missingvars, + qawarnings, qacats, missingvars, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata @@ -294,6 +295,7 @@ keywordcheck = KeywordChecks(qatracker) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) +descriptioncheck = DescriptionChecks(qatracker) ## for xpkg in effective_scanlist: @@ -433,12 +435,9 @@ for xpkg in effective_scanlist: myqakey = var + .virtual qatracker.add_error(myqakey, ebuild.relative_path) - # 14 is the length of DESCRIPTION= - if len(myaux['DESCRIPTION']) max_desc_len: - qatracker.add_error( - 'DESCRIPTION.toolong', - %s: DESCRIPTION is %d characters (max %d) % - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) + ### + descriptioncheck.check(pkg, ebuild) + ### keywords = myaux[KEYWORDS].split()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/
commit: 05231093d7ab7b38f82f99d5ed6164f0dc40ab55 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 16:24:03 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:32 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=05231093 repoman/checks/ebuild/thirdpartymirrors.py: Fix logic --- pym/repoman/checks/ebuilds/thirdpartymirrors.py | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pym/repoman/checks/ebuilds/thirdpartymirrors.py b/pym/repoman/checks/ebuilds/thirdpartymirrors.py index cce61f6..f867c19 100644 --- a/pym/repoman/checks/ebuilds/thirdpartymirrors.py +++ b/pym/repoman/checks/ebuilds/thirdpartymirrors.py @@ -5,13 +5,15 @@ import portage class ThirdPartyMirrors(object): def __init__(self, repoman_settings, qatracker): - # Build a regex from thirdpartymirrors for the SRC_URI.mirror check. + # TODO: Build a regex instead here, for the SRC_URI.mirror check. self.thirdpartymirrors = {} - for k, v in repoman_settings.thirdpartymirrors().items(): - for v in v: - if not v.endswith(/): - v += / - self.thirdpartymirrors[v] = k + profile_thirdpartymirrors = repoman_settings.thirdpartymirrors().items() + for mirror_alias, mirrors in profile_thirdpartymirrors: + for mirror in mirrors: + if not mirror.endswith(/): + mirror += / + self.thirdpartymirrors[mirror] = mirror_alias + self.qatracker = qatracker
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/eclasses/
commit: 93caaa92a33f3b199e53077d7066d75fb27ac0e3 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Wed Jun 4 13:40:35 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:34 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=93caaa92 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 000..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 05d9a14..2cd89b2 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -48,6 +48,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 @@ -60,16 +61,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 @@ -271,18 +273,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 =
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/
commit: 6df89d303139784089ebf5a6fecfc560a9f7ec1d Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Tue Jun 3 11:15:10 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:33 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6df89d30 repoman/main.py: Split USE flag checks to checks/ebuilds/use_flags.py --- pym/repoman/checks/ebuilds/misc.py | 2 +- pym/repoman/checks/ebuilds/use_flags.py | 85 + pym/repoman/main.py | 52 3 files changed, 95 insertions(+), 44 deletions(-) diff --git a/pym/repoman/checks/ebuilds/misc.py b/pym/repoman/checks/ebuilds/misc.py index 3bf61f0..744784a 100644 --- a/pym/repoman/checks/ebuilds/misc.py +++ b/pym/repoman/checks/ebuilds/misc.py @@ -39,7 +39,7 @@ def bad_split_check(xpkg, y_ebuild, pkgdir, qatracker): return False -def pkg_invalid(pkg, qatracker): +def pkg_invalid(pkg, qatracker, ebuild): '''Checks for invalid packages @param pkg: _emerge.Package instance diff --git a/pym/repoman/checks/ebuilds/use_flags.py b/pym/repoman/checks/ebuilds/use_flags.py new file mode 100644 index 000..bc09ed7 --- /dev/null +++ b/pym/repoman/checks/ebuilds/use_flags.py @@ -0,0 +1,85 @@ + +'''use_flags.py +Performs USE flag related checks +''' + +# import our centrally initialized portage instance +from repoman._portage import portage + +from portage import eapi +from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use + + +class USEFlagChecks(object): + '''Performs checks on USE flags listed in the ebuilds and metadata.xml''' + + def __init__(self, qatracker, globalUseFlags): + ''' + @param qatracker: QATracker instance + @param globalUseFlags: Global USE flags + ''' + self.qatracker = qatracker + self.useFlags = [] + self.defaultUseFlags = [] + self.usedUseFlags = set() + self.globalUseFlags = globalUseFlags + + def check(self, pkg, package, ebuild, y_ebuild, localUseFlags): + '''Perform the check. + + @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 localUseFlags: Local USE flags of the package + ''' + self._checkGlobal(pkg) + self._checkMetadata(package, ebuild, y_ebuild, localUseFlags) + self._checkRequiredUSE(pkg, ebuild) + + def getUsedUseFlags(self): + '''Get the USE flags that this check has seen''' + return self.usedUseFlags + + def _checkGlobal(self, pkg): + for myflag in pkg._metadata[IUSE].split(): + flag_name = myflag.lstrip(+-) + self.usedUseFlags.add(flag_name) + if myflag != flag_name: + self.defaultUseFlags.append(myflag) + if flag_name not in self.globalUseFlags: + self.useFlags.append(flag_name) + + def _checkMetadata(self, package, ebuild, y_ebuild, localUseFlags): + for mypos in range(len(self.useFlags) - 1, -1, -1): + if self.useFlags[mypos] and (self.useFlags[mypos] in localUseFlags): + del self.useFlags[mypos] + + if self.defaultUseFlags and not eapi_has_iuse_defaults(eapi): + for myflag in self.defaultUseFlags: + self.qatracker.add_error( + 'EAPI.incompatible', %s: IUSE defaults +not supported with EAPI='%s': '%s' % ( + ebuild.relative_path, eapi, myflag)) + + for mypos in range(len(self.useFlags)): + self.qatracker.add_error( + IUSE.invalid, + %s/%s.ebuild: %s % (package, y_ebuild, self.useFlags[mypos])) + + def _checkRequiredUSE(self, pkg, ebuild): + required_use = pkg._metadata[REQUIRED_USE] + if required_use: + if not eapi_has_required_use(eapi): + self.qatracker.add_error( + 'EAPI.incompatible', %s: REQUIRED_USE +not supported with EAPI='%s' + % (ebuild.relative_path, eapi,)) + try: + portage.dep.check_required_use( + required_use, (), pkg.iuse.is_valid_flag,
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/
commit: 7dc0305c383403bb643d8e9cba967064c87aa1c6 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 19:20:43 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:33 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7dc0305c Repoman: Refactor PkgMetadata and XmlLint classes for variable data passed in Move all non-consistent data to be passed in via the check functions. Initialize XmlLint once in the PkgMetadata class __init__(). --- pym/repoman/_xml.py | 33 ++- pym/repoman/checks/ebuilds/pkgmetadata.py | 12 +-- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py index b97c027..d5b5a5e 100644 --- a/pym/repoman/_xml.py +++ b/pym/repoman/_xml.py @@ -14,6 +14,8 @@ from repoman._subprocess import repoman_getstatusoutput class _XMLParser(xml.etree.ElementTree.XMLParser): + + def __init__(self, data, **kwargs): xml.etree.ElementTree.XMLParser.__init__(self, **kwargs) self._portage_data = data @@ -25,11 +27,13 @@ class _XMLParser(xml.etree.ElementTree.XMLParser): self.parser.StartDoctypeDeclHandler = \ self._portage_StartDoctypeDeclHandler + def _portage_XmlDeclHandler(self, version, encoding, standalone): if self._base_XmlDeclHandler is not None: self._base_XmlDeclHandler(version, encoding, standalone) self._portage_data[XML_DECLARATION] = (version, encoding, standalone) + def _portage_StartDoctypeDeclHandler( self, doctypeName, systemId, publicId, has_internal_subset): if self._base_StartDoctypeDeclHandler is not None: @@ -49,33 +53,44 @@ class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder): class XmlLint(object): - def __init__(self, options, repolevel, repoman_settings): + def __init__(self, options, repoman_settings): self.metadata_dtd = os.path.join(repoman_settings[DISTDIR], 'metadata.dtd') + self.options = options + self.repoman_settings = repoman_settings self._is_capable = False self.binary = None - self._check_capable(options, repolevel, repoman_settings) + self._check_capable() + - def _check_capable(self, options, repolevel, repoman_settings): - if options.mode == manifest: + def _check_capable(self): + if self.options.mode == manifest: return self.binary = find_binary('xmllint') if not self.binary: print(red(!!! xmllint not found. Can't check metadata.xml.\n)) - if options.xml_parse or repolevel == 3: - print(%s sorry, xmllint is needed. failing\n % red(!!!)) - sys.exit(1) else: - if not fetch_metadata_dtd(self.metadata_dtd, repoman_settings): + if not fetch_metadata_dtd(self.metadata_dtd, self.repoman_settings): sys.exit(1) # this can be problematic if xmllint changes their output self._is_capable = True + @property def capable(self): return self._is_capable - def check(self, checkdir): + + def check(self, checkdir, repolevel): + '''Runs checks on the package metadata.xml file + + @param checkdir: string, path + @param repolevel: integer + @return boolean, False == bad metadata + ''' if not self.capable: + if self.options.xml_parse or repolevel == 3: + print(%s sorry, xmllint is needed. failing\n % red(!!!)) + sys.exit(1) return True # xmlint can produce garbage output even on success, so only dump # the ouput when it fails. diff --git a/pym/repoman/checks/ebuilds/pkgmetadata.py b/pym/repoman/checks/ebuilds/pkgmetadata.py index 0778696..674d32f 100644 --- a/pym/repoman/checks/ebuilds/pkgmetadata.py +++ b/pym/repoman/checks/ebuilds/pkgmetadata.py @@ -38,27 +38,28 @@ from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint class PkgMetadata(object): '''Package metadata.xml checks''' - def __init__(self, options, qatracker, repolevel, repoman_settings): + def __init__(self, options, qatracker, repoman_settings): '''PkgMetadata init function @param options: ArgumentParser.parse_known_args(argv[1:]) options @param qatracker: QATracker instance -
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/eclasses/
commit: 7d2e89a4fc4f1a3a8c88c4b999cb52b11415fa60 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Wed Jun 4 13:58:31 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:34 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7d2e89a4 repoman/main.py: Split Ruby checks to checks/ebuild/eclass/ruby.py --- pym/repoman/checks/ebuilds/eclasses/__init__.py | 0 pym/repoman/checks/ebuilds/eclasses/ruby.py | 32 + pym/repoman/main.py | 18 -- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/pym/repoman/checks/ebuilds/eclasses/__init__.py b/pym/repoman/checks/ebuilds/eclasses/__init__.py new file mode 100644 index 000..e69de29 diff --git a/pym/repoman/checks/ebuilds/eclasses/ruby.py b/pym/repoman/checks/ebuilds/eclasses/ruby.py new file mode 100644 index 000..abfb166 --- /dev/null +++ b/pym/repoman/checks/ebuilds/eclasses/ruby.py @@ -0,0 +1,32 @@ + +'''live.py +Performs Ruby eclass checks +''' + +from repoman.qa_data import ruby_deprecated + + +class RubyEclassChecks(object): + '''Performs checks for the usage of Ruby eclasses in ebuilds''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + self.old_ruby_eclasses = [ruby-ng, ruby-fakegem, ruby] + + def check(self, pkg, ebuild): + is_inherited = lambda eclass: eclass in pkg.inherited + is_old_ruby_eclass_inherited = filter( + is_inherited, self.old_ruby_eclasses) + + if is_old_ruby_eclass_inherited: + ruby_intersection = pkg.iuse.all.intersection(ruby_deprecated) + + if ruby_intersection: + for myruby in ruby_intersection: + self.qatracker.add_error( + IUSE.rubydeprecated, + (ebuild.relative_path + : Deprecated ruby target: %s) + % myruby) \ No newline at end of file diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 2cd89b2..1107c63 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -49,6 +49,7 @@ 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.eclasses.ruby import RubyEclassChecks from repoman.checks.ebuilds.fetches import FetchChecks from repoman.checks.ebuilds.keywords import KeywordChecks from repoman.checks.ebuilds.isebuild import IsEbuild @@ -64,7 +65,7 @@ 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, max_desc_len, missingvars, - ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -287,6 +288,7 @@ thirdparty = ThirdPartyMirrors(repoman_settings, qatracker) use_flag_checks = USEFlagChecks(qatracker, uselist) keywordcheck = KeywordChecks(qatracker) liveeclasscheck = LiveEclassChecks(qatracker) +rubyeclasscheck = RubyEclassChecks(qatracker) ## for xpkg in effective_scanlist: @@ -609,18 +611,8 @@ for xpkg in effective_scanlist: ebuild_used_useflags = use_flag_checks.getUsedUseFlags() used_useflags = used_useflags.union(ebuild_used_useflags) # - - # Check for outdated RUBY targets - old_ruby_eclasses = [ruby-ng, ruby-fakegem, ruby] - is_old_ruby_eclass_inherited = filter( - lambda e: e in inherited, old_ruby_eclasses) - if is_old_ruby_eclass_inherited: - ruby_intersection = pkg.iuse.all.intersection(ruby_deprecated) - if ruby_intersection: - for myruby in ruby_intersection: - qatracker.add_error(IUSE.rubydeprecated, - (ebuild.relative_path + : Deprecated ruby target: %s) - % myruby) + rubyeclasscheck.check(pkg, ebuild) + # # license checks if not badlicsyntax:
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/
commit: 4628c9fba067e03bb9bf9bc72f5e09c0d1c48ca2 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 18:42:37 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:33 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4628c9fb Repoman: Refactor VCSStatus to pass non consistent data to the check() This will facilitae for the initialization of the class before the big xpkg loop. --- pym/repoman/main.py | 4 ++-- pym/repoman/vcs/vcsstatus.py | 39 ++- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index c19bf94..8197400 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -322,8 +322,8 @@ for xpkg in effective_scanlist: filescheck.check(checkdir, checkdirlist, checkdir_relative, changed.changed, changed.new) ### - status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker) - status_check.check(check_ebuild_notadded) + status_check = VCSStatus(vcs_settings, qatracker) + status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg) eadded.extend(status_check.eadded) # diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py index 6a81b1b..0517c04 100644 --- a/pym/repoman/vcs/vcsstatus.py +++ b/pym/repoman/vcs/vcsstatus.py @@ -13,52 +13,49 @@ class VCSStatus(object): '''Determines the status of the vcs repositories to determine if files are not added''' - def __init__(self, vcs_settings, checkdir, checkdir_relative, xpkg, qatracker): + def __init__(self, vcs_settings, qatracker): self.vcs_settings = vcs_settings self.vcs = vcs_settings.vcs self.eadded = [] - self.checkdir = checkdir - self.checkdir_relative = checkdir_relative - self.xpkg = xpkg self.qatracker = qatracker - def check(self, check_not_added): + def check(self, check_not_added, checkdir, checkdir_relative, xpkg): if self.vcs and check_not_added: vcscheck = getattr(self, 'check_%s' % self.vcs) - vcscheck() + vcscheck(checkdir, checkdir_relative, xpkg) - def post_git_hg(self, myf): + def post_git_hg(self, myf, xpkg): for l in myf: if l[:-1][-7:] == .ebuild: self.qatracker.add_error(ebuild.notadded, - os.path.join(self.xpkg, os.path.basename(l[:-1]))) + os.path.join(xpkg, os.path.basename(l[:-1]))) myf.close() - def check_git(self): + def check_git(self, checkdir, checkdir_relative, xpkg): myf = repoman_popen( git ls-files --others %s % - (portage._shell_quote(self.checkdir_relative),)) - self.post_git_hg(myf) + (portage._shell_quote(checkdir_relative),)) + self.post_git_hg(myf, xpkg) - def check_hg(self): + def check_hg(self, checkdir, checkdir_relative, xpkg): myf = repoman_popen( hg status --no-status --unknown %s % - (portage._shell_quote(self.checkdir_relative),)) - self.post_git_hg(myf) + (portage._shell_quote(checkdir_relative),)) + self.post_git_hg(myf, xpkg) - def check_cvs(self): + def check_cvs(self, checkdir, checkdir_relative, xpkg): try: - myf = open(self.checkdir + /CVS/Entries, r) + myf = open(checkdir + /CVS/Entries, r) myl = myf.readlines() myf.close() except IOError: self.qatracker.add_error(CVS/Entries.IO_error, - self.checkdir + /CVS/Entries) + checkdir + /CVS/Entries) return True for l in myl: if l[0] != /: @@ -71,7 +68,7 @@ class VCSStatus(object): return True - def check_svn(self): + def check_svn(self, checkdir, checkdir_relative, xpkg): try: myf = repoman_popen( svn status --depth=files --verbose + @@ -92,7 +89,7 @@ class VCSStatus(object): try: myf = repoman_popen( svn status + -
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/, pym/repoman/checks/ebuilds/
commit: 03094ff0f3d6b20d97d7ac48ecd4f2f70868b7f3 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 05:38:19 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:33 2014 + 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 000..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,
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/checks/herds/, ...
commit: b0cc44e4e57948421b474ad6693c6aa3994b6555 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 12:24:18 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:34 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b0cc44e4 repoman: Apply PEP 8 guidelines again (except for W191) --- pym/repoman/_portage.py | 1 - pym/repoman/_xml.py | 6 -- pym/repoman/checks/directories/files.py | 17 ++-- pym/repoman/checks/ebuilds/checks.py| 2 +- pym/repoman/checks/ebuilds/eclasses/live.py | 2 +- pym/repoman/checks/ebuilds/eclasses/ruby.py | 2 +- pym/repoman/checks/ebuilds/fetches.py | 29 --- pym/repoman/checks/ebuilds/isebuild.py | 6 +- pym/repoman/checks/ebuilds/manifests.py | 7 +- pym/repoman/checks/ebuilds/misc.py | 11 ++- pym/repoman/checks/ebuilds/pkgmetadata.py | 42 - pym/repoman/checks/ebuilds/thirdpartymirrors.py | 8 +- pym/repoman/checks/ebuilds/use_flags.py | 5 -- pym/repoman/checks/herds/metadata.py| 4 - pym/repoman/ebuild.py | 6 +- pym/repoman/errors.py | 2 - pym/repoman/main.py | 109 ++-- pym/repoman/qa_data.py | 4 - pym/repoman/qa_tracker.py | 13 ++- pym/repoman/repos.py| 35 pym/repoman/scan.py | 18 ++-- pym/repoman/vcs/vcs.py | 10 ++- pym/repoman/vcs/vcsstatus.py| 17 ++-- 23 files changed, 169 insertions(+), 187 deletions(-) diff --git a/pym/repoman/_portage.py b/pym/repoman/_portage.py index e72ce9f..0f611f7 100644 --- a/pym/repoman/_portage.py +++ b/pym/repoman/_portage.py @@ -23,4 +23,3 @@ sys.path.insert(0, pym_path) import portage portage._internal_caller = True portage._disable_legacy_globals() - diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py index d5b5a5e..7bf6698 100644 --- a/pym/repoman/_xml.py +++ b/pym/repoman/_xml.py @@ -15,7 +15,6 @@ from repoman._subprocess import repoman_getstatusoutput class _XMLParser(xml.etree.ElementTree.XMLParser): - def __init__(self, data, **kwargs): xml.etree.ElementTree.XMLParser.__init__(self, **kwargs) self._portage_data = data @@ -27,13 +26,11 @@ class _XMLParser(xml.etree.ElementTree.XMLParser): self.parser.StartDoctypeDeclHandler = \ self._portage_StartDoctypeDeclHandler - def _portage_XmlDeclHandler(self, version, encoding, standalone): if self._base_XmlDeclHandler is not None: self._base_XmlDeclHandler(version, encoding, standalone) self._portage_data[XML_DECLARATION] = (version, encoding, standalone) - def _portage_StartDoctypeDeclHandler( self, doctypeName, systemId, publicId, has_internal_subset): if self._base_StartDoctypeDeclHandler is not None: @@ -61,7 +58,6 @@ class XmlLint(object): self.binary = None self._check_capable() - def _check_capable(self): if self.options.mode == manifest: return @@ -74,12 +70,10 @@ class XmlLint(object): # this can be problematic if xmllint changes their output self._is_capable = True - @property def capable(self): return self._is_capable - def check(self, checkdir, repolevel): '''Runs checks on the package metadata.xml file diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py index 87220c0..b1d77df 100644 --- a/pym/repoman/checks/directories/files.py +++ b/pym/repoman/checks/directories/files.py @@ -13,8 +13,8 @@ from repoman.vcs.vcs import vcs_new_changed class FileChecks(object): - def __init__(self, qatracker, repoman_settings, repo_settings, portdb, - vcs_settings): + def __init__( + self, qatracker, repoman_settings, repo_settings, portdb, vcs_settings): ''' @param qatracker: QATracker instance @param repoman_settings: settings instance @@ -27,7 +27,6 @@ class FileChecks(object): self.repoman_settings = repoman_settings self.vcs_settings = vcs_settings - def check(self, checkdir, checkdirlist, checkdir_relative, changed, new): '''Checks the ebuild sources and files for errors @@ -48,10 +47,12 @@ class FileChecks(object): # prohibited characters). See bug #406877.
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/vcs/
commit: d5edea08999256c46cee5bac2ac0c641e0821220 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 16:23:20 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:32 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d5edea08 repoman/vcs/vcsstatus.py: Only check VCS status in a VCS --- pym/repoman/vcs/vcsstatus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py index eedf866..f984832 100644 --- a/pym/repoman/vcs/vcsstatus.py +++ b/pym/repoman/vcs/vcsstatus.py @@ -22,7 +22,7 @@ class VCSStatus(object): def check(self, check_not_added): - if check_not_added: + if self.vcs and check_not_added: vcscheck = getattr(self, 'check_%s' % self.vcs) vcscheck()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/directories/
commit: 1963d867cdcbb50904f799c3c4d1b51f0f689a97 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 15:58:38 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:32 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1963d867 repoman/checks/directories/files.py: Fix to use global vcs_new_changed --- pym/repoman/checks/directories/files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py index 5dfca25..87220c0 100644 --- a/pym/repoman/checks/directories/files.py +++ b/pym/repoman/checks/directories/files.py @@ -40,7 +40,7 @@ class FileChecks(object): if index != -1: y_relative = os.path.join(checkdir_relative, y_file) invcs = self.vcs_settings.vcs is not None - inchangeset = self.vcs_new_changed(y_relative, changed, new) + inchangeset = vcs_new_changed(y_relative, changed, new) if invcs and not inchangeset: # If the file isn't in the VCS new or changed set, then # assume that it's an irrelevant temporary file (Manifest
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/commit/, pym/repoman/
commit: 8fcbc2c7244dfa53008501df760efdfbf48ef999 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 18:28:34 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:33 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8fcbc2c7 repoman: Fix up commit imports and calls --- pym/repoman/argparser.py | 3 ++- pym/repoman/copyrights.py| 2 +- pym/repoman/main.py | 24 ++-- pym/repoman/modules/commit/repochecks.py | 3 ++- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/pym/repoman/argparser.py b/pym/repoman/argparser.py index 19ec6e9..393d755 100644 --- a/pym/repoman/argparser.py +++ b/pym/repoman/argparser.py @@ -6,6 +6,7 @@ import logging import portage +import sys from portage import util from portage.util._argparse import ArgumentParser @@ -167,7 +168,7 @@ def parse_args(argv, qahelp, repoman_default_opts): opts, args = parser.parse_known_args(argv[1:]) if not opts.ignore_default_opts: - default_opts = portage.util.shlex_split(repoman_default_opts) + default_opts = util.shlex_split(repoman_default_opts) if default_opts: opts, args = parser.parse_known_args(default_opts + sys.argv[1:]) diff --git a/pym/repoman/copyrights.py b/pym/repoman/copyrights.py index 231857f..01ce42f 100644 --- a/pym/repoman/copyrights.py +++ b/pym/repoman/copyrights.py @@ -83,7 +83,7 @@ def update_copyright(fn_path, year, pretend=False): new_header.append(line) break - line = _update_copyright_year(year, line) + line = update_copyright_year(year, line) new_header.append(line) difflines = 0 diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 9ce3c18..d567f94 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -56,7 +56,7 @@ from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.ebuild import Ebuild from repoman.errors import err -from repoman.modules import commit +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, qawarnings, qacats, max_desc_len, missingvars, @@ -187,8 +187,8 @@ repolevel = len(reposplit) ### if options.mode == 'commit': - commit.repochecks.commit_check(repolevel, reposplit) - commit.repochecks.conflict_check(vcs_settings, options) + repochecks.commit_check(repolevel, reposplit) + repochecks.conflict_check(vcs_settings, options) ### @@ -265,7 +265,8 @@ check_ebuild_notadded = not \ effective_scanlist = scanlist if options.if_modified == y: effective_scanlist = sorted(vcs_files_to_cps( - chain(changed.changed, changed.new, changed.removed))) + chain(changed.changed, changed.new, changed.removed), + repolevel, reposplit, categories)) for xpkg in effective_scanlist: # ebuilds and digests added to cvs respectively. @@ -1266,7 +1267,8 @@ else: else: commitmessage = utilities.get_commit_message_with_stdin() except KeyboardInterrupt: - exithandler() + logging.fatal(Interrupted; exiting...) + sys.exit(1) if not commitmessage or not commitmessage.strip(): print(* no commit message? aborting commit.) sys.exit(1) @@ -1326,7 +1328,8 @@ else: logging.info(checking for unmodified ChangeLog files) committer_name = utilities.get_committer_name(env=repoman_settings) for x in sorted(vcs_files_to_cps( - chain(myupdates, mymanifests, myremoved))): + chain(myupdates, mymanifests, myremoved), + repolevel, reposplit, categories)): catdir, pkgdir = x.split(/) checkdir = repo_settings.repodir + / + x checkdir_relative = @@ -1466,7 +1469,7 @@ else: print(%s have headers that will change. % green(str(len(myheaders print( - * Files with headers will + * Files with headers will cause the manifests to be changed and committed separately.) logging.info(myupdates: %s, myupdates) @@ -1621,9 +1624,9 @@ else: doing the entire repository.\\n) if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved): - for x in
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/
commit: c4c004b5125e1785af163d3d574a3f61ccadd062 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 19:39:56 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:34 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c4c004b5 repoman.../use_flags.py: Reset state variables for each check() run Also double space function separations. --- pym/repoman/checks/ebuilds/use_flags.py | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pym/repoman/checks/ebuilds/use_flags.py b/pym/repoman/checks/ebuilds/use_flags.py index bc09ed7..d63ae6d 100644 --- a/pym/repoman/checks/ebuilds/use_flags.py +++ b/pym/repoman/checks/ebuilds/use_flags.py @@ -19,10 +19,11 @@ class USEFlagChecks(object): @param globalUseFlags: Global USE flags ''' self.qatracker = qatracker + self.globalUseFlags = globalUseFlags self.useFlags = [] self.defaultUseFlags = [] self.usedUseFlags = set() - self.globalUseFlags = globalUseFlags + def check(self, pkg, package, ebuild, y_ebuild, localUseFlags): '''Perform the check. @@ -33,14 +34,20 @@ class USEFlagChecks(object): @param y_ebuild: Ebuild which we check (string). @param localUseFlags: Local USE flags of the package ''' + # reset state variables for the run + self.useFlags = [] + self.defaultUseFlags = [] + self.usedUseFlags = set() self._checkGlobal(pkg) self._checkMetadata(package, ebuild, y_ebuild, localUseFlags) self._checkRequiredUSE(pkg, ebuild) + def getUsedUseFlags(self): '''Get the USE flags that this check has seen''' return self.usedUseFlags + def _checkGlobal(self, pkg): for myflag in pkg._metadata[IUSE].split(): flag_name = myflag.lstrip(+-) @@ -50,6 +57,7 @@ class USEFlagChecks(object): if flag_name not in self.globalUseFlags: self.useFlags.append(flag_name) + def _checkMetadata(self, package, ebuild, y_ebuild, localUseFlags): for mypos in range(len(self.useFlags) - 1, -1, -1): if self.useFlags[mypos] and (self.useFlags[mypos] in localUseFlags): @@ -67,6 +75,7 @@ class USEFlagChecks(object): IUSE.invalid, %s/%s.ebuild: %s % (package, y_ebuild, self.useFlags[mypos])) + def _checkRequiredUSE(self, pkg, ebuild): required_use = pkg._metadata[REQUIRED_USE] if required_use:
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: a7c9f77f9ab9321fe9beda0bbf7716f2b206405b Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 15:23:33 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:35 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a7c9f77f repoman/main.py: Split RESTRICT checks to checks/ebuild/variables/ --- pym/repoman/checks/ebuilds/variables/restrict.py | 41 pym/repoman/main.py | 25 --- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/checks/ebuilds/variables/restrict.py new file mode 100644 index 000..215b792 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/restrict.py @@ -0,0 +1,41 @@ + +'''restrict.py +Perform checks on the RESTRICT variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + +from repoman.qa_data import valid_restrict + + +class RestrictChecks(object): + '''Perform checks on the RESTRICT variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, package, ebuild, y_ebuild): + myrestrict = None + + try: + myrestrict = portage.dep.use_reduce( + pkg._metadata[RESTRICT], matchall=1, flat=True) + except portage.exception.InvalidDependString as e: + self. qatracker.add_error( + RESTRICT.syntax, + %s: RESTRICT: %s % (ebuild.relative_path, e)) + del e + + if myrestrict: + myrestrict = set(myrestrict) + mybadrestrict = myrestrict.difference(valid_restrict) + + if mybadrestrict: + for mybad in mybadrestrict: + self.qatracker.add_error( + RESTRICT.invalid, + package + / + y_ebuild + .ebuild: %s % mybad) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 722de79..b3e93bf 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.checks.ebuilds.use_flags import USEFlagChecks from repoman.checks.ebuilds.variables.description import DescriptionChecks from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.checks.ebuilds.variables.license import LicenseChecks +from repoman.checks.ebuilds.variables.restrict import RestrictChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -68,7 +69,7 @@ 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, missingvars, - suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -298,6 +299,7 @@ rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) +restrictcheck = RestrictChecks(qatracker) ## for xpkg in effective_scanlist: @@ -617,24 +619,9 @@ for xpkg in effective_scanlist: licensecheck.check(pkg, xpkg, ebuild, y_ebuild) # - # restrict checks - myrestrict = None - try: - myrestrict = portage.dep.use_reduce( - myaux[RESTRICT], matchall=1, flat=True) - except portage.exception.InvalidDependString as e: - qatracker.add_error( - RESTRICT.syntax, - %s: RESTRICT: %s % (ebuild.relative_path, e)) - del e - if myrestrict: - myrestrict = set(myrestrict) - mybadrestrict = myrestrict.difference(valid_restrict) - if mybadrestrict: - for mybad in mybadrestrict: - qatracker.add_error( - RESTRICT.invalid, - xpkg + / + y_ebuild + .ebuild: %s % mybad) + # + restrictcheck.check(pkg, xpkg, ebuild, y_ebuild) +
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: bba8bc9075d3953db26120176431790b9c1d79fa Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 19:32:18 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:34 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bba8bc90 repoman/main.py: Move the check class instantiations out of the xpkg loop This should help reduce overall run time when doing large repoman full runs. It instead re-uses the class instances for each pkg checked. --- pym/repoman/main.py | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 8197400..8a1a043 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -270,6 +270,19 @@ 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 +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) +status_check = VCSStatus(vcs_settings, qatracker) +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) + + for xpkg in effective_scanlist: # ebuilds and digests added to cvs respectively. logging.info(checking package %s % xpkg) @@ -286,7 +299,6 @@ for xpkg in effective_scanlist: checkdir_relative = os.path.join(., checkdir_relative) # - manifester = Manifests(options, qatracker, repoman_settings) if manifester.run(checkdir, portdb): continue if not manifester.generated_manifest: @@ -299,7 +311,6 @@ for xpkg in effective_scanlist: checkdirlist = os.listdir(checkdir) ## - 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 @@ -317,26 +328,20 @@ for xpkg in effective_scanlist: ebuildlist = sorted(pkgs.values()) ebuildlist = [pkg.pf for pkg in ebuildlist] ### - filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb, - vcs_settings) filescheck.check(checkdir, checkdirlist, checkdir_relative, changed.changed, changed.new) ### - status_check = VCSStatus(vcs_settings, qatracker) status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg) eadded.extend(status_check.eadded) # - fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb, - vcs_settings) fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new) # if check_changelog and ChangeLog not in checkdirlist: qatracker.add_error(changelog.missing, xpkg + /ChangeLog) # - pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings) - pkgmeta.check(xpkg, checkdir, checkdirlist) + pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel) muselist = frozenset(pkgmeta.musedict) # @@ -394,7 +399,6 @@ for xpkg in effective_scanlist: if not fetchcheck.src_uri_error: ### - thirdparty = ThirdPartyMirrors(repoman_settings, qatracker) thirdparty.check(myaux, ebuild.relative_path) ### if myaux.get(PROVIDE): @@ -625,7 +629,6 @@ for xpkg in effective_scanlist: badprovsyntax = badprovsyntax 0 # - use_flag_checks = USEFlagChecks(qatracker, uselist) use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist) ebuild_used_useflags = use_flag_checks.getUsedUseFlags()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: c994b32104ffe2f26338261a89b2a2f9388ecfef Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 17:00:53 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Wed Oct 1 23:45:32 2014 + URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c994b321 repoman/main.py: Add global_pmaskdict param to has_global_mask call --- pym/repoman/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 583c538..9ce3c18 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -477,7 +477,7 @@ for xpkg in effective_scanlist: (xpkg, y_ebuild, bad_stable_keywords)) del bad_stable_keywords - if keywords and not has_global_mask(pkg): + if keywords and not has_global_mask(pkg, global_pmaskdict): qatracker.add_error(LIVEVCS.unmasked, ebuild.relative_path) if options.ignore_arches:
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/herds/, pym/repoman/checks/directories/, ...
commit: ca0203536a13c085ee59d752649cc202688a625e Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 12:24:18 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Fri Jun 6 12:24:18 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ca020353 repoman: Apply PEP 8 guidelines again (except for W191) --- pym/repoman/_portage.py | 1 - pym/repoman/_xml.py | 6 -- pym/repoman/checks/directories/files.py | 17 ++-- pym/repoman/checks/ebuilds/checks.py| 2 +- pym/repoman/checks/ebuilds/eclasses/live.py | 2 +- pym/repoman/checks/ebuilds/eclasses/ruby.py | 2 +- pym/repoman/checks/ebuilds/fetches.py | 29 +++--- pym/repoman/checks/ebuilds/isebuild.py | 6 +- pym/repoman/checks/ebuilds/manifests.py | 7 +- pym/repoman/checks/ebuilds/misc.py | 11 +-- pym/repoman/checks/ebuilds/pkgmetadata.py | 42 + pym/repoman/checks/ebuilds/thirdpartymirrors.py | 8 +- pym/repoman/checks/ebuilds/use_flags.py | 5 - pym/repoman/checks/herds/metadata.py| 4 - pym/repoman/ebuild.py | 6 +- pym/repoman/errors.py | 2 - pym/repoman/main.py | 116 ++-- pym/repoman/qa_data.py | 4 - pym/repoman/qa_tracker.py | 13 ++- pym/repoman/repos.py| 35 --- pym/repoman/scan.py | 18 +--- pym/repoman/vcs/vcs.py | 10 +- pym/repoman/vcs/vcsstatus.py| 17 +--- 23 files changed, 173 insertions(+), 190 deletions(-) diff --git a/pym/repoman/_portage.py b/pym/repoman/_portage.py index e72ce9f..0f611f7 100644 --- a/pym/repoman/_portage.py +++ b/pym/repoman/_portage.py @@ -23,4 +23,3 @@ sys.path.insert(0, pym_path) import portage portage._internal_caller = True portage._disable_legacy_globals() - diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py index d5b5a5e..7bf6698 100644 --- a/pym/repoman/_xml.py +++ b/pym/repoman/_xml.py @@ -15,7 +15,6 @@ from repoman._subprocess import repoman_getstatusoutput class _XMLParser(xml.etree.ElementTree.XMLParser): - def __init__(self, data, **kwargs): xml.etree.ElementTree.XMLParser.__init__(self, **kwargs) self._portage_data = data @@ -27,13 +26,11 @@ class _XMLParser(xml.etree.ElementTree.XMLParser): self.parser.StartDoctypeDeclHandler = \ self._portage_StartDoctypeDeclHandler - def _portage_XmlDeclHandler(self, version, encoding, standalone): if self._base_XmlDeclHandler is not None: self._base_XmlDeclHandler(version, encoding, standalone) self._portage_data[XML_DECLARATION] = (version, encoding, standalone) - def _portage_StartDoctypeDeclHandler( self, doctypeName, systemId, publicId, has_internal_subset): if self._base_StartDoctypeDeclHandler is not None: @@ -61,7 +58,6 @@ class XmlLint(object): self.binary = None self._check_capable() - def _check_capable(self): if self.options.mode == manifest: return @@ -74,12 +70,10 @@ class XmlLint(object): # this can be problematic if xmllint changes their output self._is_capable = True - @property def capable(self): return self._is_capable - def check(self, checkdir, repolevel): '''Runs checks on the package metadata.xml file diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py index 87220c0..b1d77df 100644 --- a/pym/repoman/checks/directories/files.py +++ b/pym/repoman/checks/directories/files.py @@ -13,8 +13,8 @@ from repoman.vcs.vcs import vcs_new_changed class FileChecks(object): - def __init__(self, qatracker, repoman_settings, repo_settings, portdb, - vcs_settings): + def __init__( + self, qatracker, repoman_settings, repo_settings, portdb, vcs_settings): ''' @param qatracker: QATracker instance @param repoman_settings: settings instance @@ -27,7 +27,6 @@ class FileChecks(object): self.repoman_settings = repoman_settings self.vcs_settings = vcs_settings - def check(self, checkdir, checkdirlist, checkdir_relative, changed, new): '''Checks the ebuild sources and files for errors @@ -48,10 +47,12 @@ class FileChecks(object): # prohibited characters). See bug #406877. index
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 89ad2061c0af9ea711d4eae396d0d06356a780bc Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 14:40:39 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Fri Jun 6 14:40:39 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=89ad2061 repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py --- pym/repoman/checks/ebuilds/variables/__init__.py | 0 pym/repoman/checks/ebuilds/variables/eapi.py | 44 pym/repoman/main.py | 12 +++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py new file mode 100644 index 000..e69de29 diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py new file mode 100644 index 000..2f8b1cb --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/eapi.py @@ -0,0 +1,44 @@ + +'''eapi.py +Perform checks on the EAPI variable. +''' + + +class EAPIChecks(object): + '''Perform checks on the EAPI variable.''' + + def __init__(self, qatracker, repo_settings): + ''' + @param qatracker: QATracker instance + @param repo_settings: Repository settings + ''' + self.qatracker = qatracker + self.repo_settings = repo_settings + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + eapi = pkg._metadata[EAPI] + + if not self._checkBanned(ebuild, eapi): + self._checkDeprecated(ebuild, eapi) + + def _checkBanned(self, ebuild, eapi): + if self.repo_settings.repo_config.eapi_is_banned(eapi): + self.qatracker.add_error( + repo.eapi.banned, %s: %s % (ebuild.relative_path, eapi)) + + return True + + return False + + def _checkDeprecated(self, ebuild, eapi): + if self.repo_settings.repo_config.eapi_is_deprecated(eapi): + self.qatracker.add_error( + repo.eapi.deprecated, %s: %s % (ebuild.relative_path, eapi)) + + return True + + return False diff --git a/pym/repoman/main.py b/pym/repoman/main.py index c5d5276..92a9f51 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -51,6 +51,7 @@ from repoman.checks.ebuilds.manifests import Manifests from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks +from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -285,6 +286,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist) keywordcheck = KeywordChecks(qatracker) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) +eapicheck = EAPIChecks(qatracker, repo_settings) ## for xpkg in effective_scanlist: @@ -386,13 +388,9 @@ for xpkg in effective_scanlist: inherited = pkg.inherited live_ebuild = live_eclasses.intersection(inherited) - if repo_settings.repo_config.eapi_is_banned(eapi): - qatracker.add_error( - repo.eapi.banned, %s: %s % (ebuild.relative_path, eapi)) - - elif repo_settings.repo_config.eapi_is_deprecated(eapi): - qatracker.add_error( - repo.eapi.deprecated, %s: %s % (ebuild.relative_path, eapi)) + ### + eapicheck.check(pkg, ebuild) + ### for k, v in myaux.items(): if not isinstance(v, basestring):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 315cb3236f57ff7e60a2e77a35f3deb3878de39b Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 14:50:26 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Fri Jun 6 14:50:26 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=315cb323 repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/ --- .../checks/ebuilds/variables/description.py| 40 ++ pym/repoman/main.py| 19 -- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py new file mode 100644 index 000..fba8f97 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/description.py @@ -0,0 +1,40 @@ + +'''description.py +Perform checks on the DESCRIPTION variable. +''' + +from repoman.qa_data import max_desc_len + + +class DescriptionChecks(object): + '''Perform checks on the DESCRIPTION variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + self._checkPunctuation(pkg, ebuild) + self._checkTooLong(pkg, ebuild) + + def _checkPunctuation(self, pkg, ebuild): + if pkg._metadata['DESCRIPTION'][-1:] in ['.']: + self.qatracker.add_error( + 'DESCRIPTION.punctuation', + %s: DESCRIPTION ends with a '%s' character % + (ebuild.relative_path, pkg._metadata['DESCRIPTION'][-1:])) + + def _checkTooLong(self, pkg, ebuild): + # 14 is the length of DESCRIPTION= + if len(pkg._metadata['DESCRIPTION']) max_desc_len: + self.qatracker.add_error( + 'DESCRIPTION.toolong', + %s: DESCRIPTION is %d characters (max %d) % + (ebuild.relative_path, len( + pkg._metadata['DESCRIPTION']), max_desc_len)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 92a9f51..83dfd07 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -51,6 +51,7 @@ from repoman.checks.ebuilds.manifests import Manifests from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks +from repoman.checks.ebuilds.variables.description import DescriptionChecks from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.ebuild import Ebuild from repoman.errors import err @@ -58,7 +59,7 @@ 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, - qawarnings, qacats, max_desc_len, missingvars, + qawarnings, qacats, missingvars, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata @@ -287,6 +288,7 @@ keywordcheck = KeywordChecks(qatracker) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) +descriptioncheck = DescriptionChecks(qatracker) ## for xpkg in effective_scanlist: @@ -426,18 +428,9 @@ for xpkg in effective_scanlist: myqakey = var + .virtual qatracker.add_error(myqakey, ebuild.relative_path) - if myaux['DESCRIPTION'][-1:] in ['.']: - qatracker.add_error( - 'DESCRIPTION.punctuation', - %s: DESCRIPTION ends with a '%s' character % - (ebuild.relative_path, myaux['DESCRIPTION'][-1:])) - - # 14 is the length of DESCRIPTION= - if len(myaux['DESCRIPTION']) max_desc_len: - qatracker.add_error( - 'DESCRIPTION.toolong', - %s: DESCRIPTION is %d characters (max %d) % - (ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len)) + ### + descriptioncheck.check(pkg, ebuild) + ### keywords = myaux[KEYWORDS].split()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 60fbda473665c8b4d5adf00323923538adc6357e Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 15:09:43 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Fri Jun 6 15:09:43 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=60fbda47 repoman/main.py: Split LICENSE checks to checks/ebuild/variables/ --- pym/repoman/checks/ebuilds/variables/license.py | 47 + pym/repoman/main.py | 21 +++ 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/license.py b/pym/repoman/checks/ebuilds/variables/license.py new file mode 100644 index 000..bdc859c --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/license.py @@ -0,0 +1,47 @@ + +'''description.py +Perform checks on the LICENSE variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + + +class LicenseChecks(object): + '''Perform checks on the LICENSE variable.''' + + def __init__(self, qatracker, liclist, liclist_deprecated): + ''' + @param qatracker: QATracker instance + @param liclist: List of licenses. + @param liclist: List of deprecated licenses. + ''' + self.qatracker = qatracker + self.liclist = liclist + self.liclist_deprecated = liclist_deprecated + + def check( + self, pkg, package, ebuild, y_ebuild): + ''' + @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). + ''' + + # Parse the LICENSE variable, remove USE conditions and flatten it. + licenses = portage.dep.use_reduce( + pkg._metadata[LICENSE], matchall=1, flat=True) + + # Check each entry to ensure that it exists in ${PORTDIR}/licenses/. + for lic in licenses: + # Need to check for || manually as no portage + # function will remove it without removing values. + if lic not in self.liclist and lic != ||: + self.qatracker.add_error( + LICENSE.invalid, + package + / + y_ebuild + .ebuild: %s % lic) + elif lic in self.liclist_deprecated: + self.qatracker.add_error( + LICENSE.deprecated, + %s: %s % (ebuild.relative_path, lic)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 83dfd07..6667d6b 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -53,6 +53,7 @@ from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks from repoman.checks.ebuilds.variables.description import DescriptionChecks from repoman.checks.ebuilds.variables.eapi import EAPIChecks +from repoman.checks.ebuilds.variables.license import LicenseChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -289,6 +290,7 @@ liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) +licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) ## for xpkg in effective_scanlist: @@ -597,22 +599,9 @@ for xpkg in effective_scanlist: # license checks if not badlicsyntax: - # Parse the LICENSE variable, remove USE conditions and - # flatten it. - licenses = portage.dep.use_reduce(myaux[LICENSE], matchall=1, flat=True) - # Check each entry to ensure that it exists in PORTDIR's - # license directory. - for lic in licenses: - # Need to check for || manually as no portage - # function will remove it without removing values. - if lic not in liclist and lic != ||: - qatracker.add_error( - LICENSE.invalid, - xpkg + / + y_ebuild + .ebuild: %s % lic) - elif lic in liclist_deprecated: - qatracker.add_error( - LICENSE.deprecated, -
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/
commit: 6d4cf83b8927d887f2d751251e504fee4d452b38 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Fri Jun 6 15:23:33 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Fri Jun 6 15:23:33 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6d4cf83b repoman/main.py: Split RESTRICT checks to checks/ebuild/variables/ --- pym/repoman/checks/ebuilds/variables/restrict.py | 41 pym/repoman/main.py | 25 --- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/checks/ebuilds/variables/restrict.py new file mode 100644 index 000..215b792 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/restrict.py @@ -0,0 +1,41 @@ + +'''restrict.py +Perform checks on the RESTRICT variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + +from repoman.qa_data import valid_restrict + + +class RestrictChecks(object): + '''Perform checks on the RESTRICT variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, package, ebuild, y_ebuild): + myrestrict = None + + try: + myrestrict = portage.dep.use_reduce( + pkg._metadata[RESTRICT], matchall=1, flat=True) + except portage.exception.InvalidDependString as e: + self. qatracker.add_error( + RESTRICT.syntax, + %s: RESTRICT: %s % (ebuild.relative_path, e)) + del e + + if myrestrict: + myrestrict = set(myrestrict) + mybadrestrict = myrestrict.difference(valid_restrict) + + if mybadrestrict: + for mybad in mybadrestrict: + self.qatracker.add_error( + RESTRICT.invalid, + package + / + y_ebuild + .ebuild: %s % mybad) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 6667d6b..f56426b 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -54,6 +54,7 @@ from repoman.checks.ebuilds.use_flags import USEFlagChecks from repoman.checks.ebuilds.variables.description import DescriptionChecks from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.checks.ebuilds.variables.license import LicenseChecks +from repoman.checks.ebuilds.variables.restrict import RestrictChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -61,7 +62,7 @@ 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, missingvars, - suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -291,6 +292,7 @@ rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) +restrictcheck = RestrictChecks(qatracker) ## for xpkg in effective_scanlist: @@ -603,24 +605,9 @@ for xpkg in effective_scanlist: licensecheck.check(pkg, xpkg, ebuild, y_ebuild) # - # restrict checks - myrestrict = None - try: - myrestrict = portage.dep.use_reduce( - myaux[RESTRICT], matchall=1, flat=True) - except portage.exception.InvalidDependString as e: - qatracker.add_error( - RESTRICT.syntax, - %s: RESTRICT: %s % (ebuild.relative_path, e)) - del e - if myrestrict: - myrestrict = set(myrestrict) - mybadrestrict = myrestrict.difference(valid_restrict) - if mybadrestrict: - for mybad in mybadrestrict: - qatracker.add_error( - RESTRICT.invalid, - xpkg + / + y_ebuild + .ebuild: %s % mybad) + # + restrictcheck.check(pkg, xpkg, ebuild, y_ebuild) +
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/
commit: 916886782e5a4123d95ce50e2593d9c2bb114995 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Wed Jun 4 09:17:12 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Wed Jun 4 09:17:12 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=91688678 repoman/main.py: Split KEYWORDS checks to checks/ebuilds/keywords.py --- pym/repoman/checks/ebuilds/keywords.py | 67 ++ pym/repoman/main.py| 32 2 files changed, 75 insertions(+), 24 deletions(-) diff --git a/pym/repoman/checks/ebuilds/keywords.py b/pym/repoman/checks/ebuilds/keywords.py new file mode 100644 index 000..29de0db --- /dev/null +++ b/pym/repoman/checks/ebuilds/keywords.py @@ -0,0 +1,67 @@ + +'''keywords.py +Perform KEYWORDS related checks +''' + + +class KeywordChecks(object): + '''Perform checks on the KEYWORDS of an ebuild''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + self.slot_keywords = {} + + def prepare(self): + '''Prepare the checks for the next package.''' + self.slot_keywords = {} + + def check( + self, pkg, package, ebuild, y_ebuild, keywords, ebuild_archs, changed, + live_ebuild): + '''Perform the check. + + @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: All the keywords (including -...) of the ebuild. + @param ebuild_archs: Just the architectures (no prefixes) of the ebuild. + @param changed: Changes instance + @param slot_keywords: A dictionary of keywords per slot. + @param live_ebuild: A boolean that determines if this is a live ebuild. + ''' + self._checkAddedWithStableKeywords( + package, ebuild, y_ebuild, keywords, changed) + self._checkForDroppedKeywords( + pkg, ebuild, ebuild_archs, live_ebuild) + + self.slot_keywords[pkg.slot].update(ebuild_archs) + + def _checkAddedWithStableKeywords( + self, package, ebuild, y_ebuild, keywords, changed): + catdir, pkgdir = package.split(/) + + is_stable = lambda kw: not kw.startswith(~) and not kw.startswith(-) + stable_keywords = list(filter(is_stable, keywords)) + if stable_keywords: + if ebuild.ebuild_path in changed.new_ebuilds and catdir != virtual: + stable_keywords.sort() + self.qatracker.add_error( + KEYWORDS.stable, + %s/%s.ebuild added with stable keywords: %s % + (package, y_ebuild, .join(stable_keywords))) + + def _checkForDroppedKeywords( + self, pkg, ebuild, ebuild_archs, live_ebuild): + previous_keywords = self.slot_keywords.get(pkg.slot) + if previous_keywords is None: + self.slot_keywords[pkg.slot] = set() + elif ebuild_archs and * not in ebuild_archs and not live_ebuild: + dropped_keywords = previous_keywords.difference(ebuild_archs) + if dropped_keywords: + self.qatracker.add_error(KEYWORDS.dropped, + %s: %s % + (ebuild.relative_path, .join(sorted(dropped_keywords \ No newline at end of file diff --git a/pym/repoman/main.py b/pym/repoman/main.py index b347369..62c1509 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -42,6 +42,7 @@ 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.fetches import FetchChecks +from repoman.checks.ebuilds.keywords import KeywordChecks from repoman.checks.ebuilds.isebuild import IsEbuild from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors from repoman.checks.ebuilds.manifests import Manifests @@ -274,7 +275,7 @@ fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb, pkgmeta = PkgMetadata(options, qatracker, repoman_settings) thirdparty = ThirdPartyMirrors(repoman_settings, qatracker) use_flag_checks = USEFlagChecks(qatracker, uselist) - +keywordcheck = KeywordChecks(qatracker) for xpkg in effective_scanlist: # ebuilds and digests added to
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/eclasses/
commit: 52b37c2ed257975158031b10bb74418f4e2cf8ae Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Wed Jun 4 13:40:35 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Wed Jun 4 13:40:35 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=52b37c2e 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 000..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 62c1509..eb083ca 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -41,6 +41,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 @@ -53,16 +54,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 @@ -264,18 +266,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 =
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/eclasses/
commit: 1a1e2aa4e650283004fd9cba23c084b111a70115 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Wed Jun 4 13:58:31 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Wed Jun 4 13:58:31 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1a1e2aa4 repoman/main.py: Split Ruby checks to checks/ebuild/eclass/ruby.py --- pym/repoman/checks/ebuilds/eclasses/__init__.py | 0 pym/repoman/checks/ebuilds/eclasses/ruby.py | 32 + pym/repoman/main.py | 18 -- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/pym/repoman/checks/ebuilds/eclasses/__init__.py b/pym/repoman/checks/ebuilds/eclasses/__init__.py new file mode 100644 index 000..e69de29 diff --git a/pym/repoman/checks/ebuilds/eclasses/ruby.py b/pym/repoman/checks/ebuilds/eclasses/ruby.py new file mode 100644 index 000..abfb166 --- /dev/null +++ b/pym/repoman/checks/ebuilds/eclasses/ruby.py @@ -0,0 +1,32 @@ + +'''live.py +Performs Ruby eclass checks +''' + +from repoman.qa_data import ruby_deprecated + + +class RubyEclassChecks(object): + '''Performs checks for the usage of Ruby eclasses in ebuilds''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + self.old_ruby_eclasses = [ruby-ng, ruby-fakegem, ruby] + + def check(self, pkg, ebuild): + is_inherited = lambda eclass: eclass in pkg.inherited + is_old_ruby_eclass_inherited = filter( + is_inherited, self.old_ruby_eclasses) + + if is_old_ruby_eclass_inherited: + ruby_intersection = pkg.iuse.all.intersection(ruby_deprecated) + + if ruby_intersection: + for myruby in ruby_intersection: + self.qatracker.add_error( + IUSE.rubydeprecated, + (ebuild.relative_path + : Deprecated ruby target: %s) + % myruby) \ No newline at end of file diff --git a/pym/repoman/main.py b/pym/repoman/main.py index eb083ca..5762abd 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -42,6 +42,7 @@ 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.eclasses.ruby import RubyEclassChecks from repoman.checks.ebuilds.fetches import FetchChecks from repoman.checks.ebuilds.keywords import KeywordChecks from repoman.checks.ebuilds.isebuild import IsEbuild @@ -57,7 +58,7 @@ 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, max_desc_len, missingvars, - ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend, valid_restrict) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -280,6 +281,7 @@ thirdparty = ThirdPartyMirrors(repoman_settings, qatracker) use_flag_checks = USEFlagChecks(qatracker, uselist) keywordcheck = KeywordChecks(qatracker) liveeclasscheck = LiveEclassChecks(qatracker) +rubyeclasscheck = RubyEclassChecks(qatracker) ## for xpkg in effective_scanlist: @@ -600,18 +602,8 @@ for xpkg in effective_scanlist: ebuild_used_useflags = use_flag_checks.getUsedUseFlags() used_useflags = used_useflags.union(ebuild_used_useflags) # - - # Check for outdated RUBY targets - old_ruby_eclasses = [ruby-ng, ruby-fakegem, ruby] - is_old_ruby_eclass_inherited = filter( - lambda e: e in inherited, old_ruby_eclasses) - if is_old_ruby_eclass_inherited: - ruby_intersection = pkg.iuse.all.intersection(ruby_deprecated) - if ruby_intersection: - for myruby in ruby_intersection: - qatracker.add_error(IUSE.rubydeprecated, - (ebuild.relative_path + : Deprecated ruby target: %s) - % myruby) + rubyeclasscheck.check(pkg, ebuild) + # # license checks if not badlicsyntax:
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/
commit: 86498a4b2fcedd7c9d461da1114a347d5df997de Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Wed Jun 4 14:17:49 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Wed Jun 4 14:17:49 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=86498a4b repoman/main.py: More KEYWORDS checks to checks/ebuilds/keywords.py --- pym/repoman/checks/ebuilds/keywords.py | 64 ++ pym/repoman/main.py| 32 + 2 files changed, 59 insertions(+), 37 deletions(-) diff --git a/pym/repoman/checks/ebuilds/keywords.py b/pym/repoman/checks/ebuilds/keywords.py index 29de0db..bec7a1d 100644 --- a/pym/repoman/checks/ebuilds/keywords.py +++ b/pym/repoman/checks/ebuilds/keywords.py @@ -20,7 +20,7 @@ class KeywordChecks(object): def check( self, pkg, package, ebuild, y_ebuild, keywords, ebuild_archs, changed, - live_ebuild): + live_ebuild, kwlist, profiles): '''Perform the check. @param pkg: Package in which we check (object). @@ -32,20 +32,31 @@ class KeywordChecks(object): @param changed: Changes instance @param slot_keywords: A dictionary of keywords per slot. @param live_ebuild: A boolean that determines if this is a live ebuild. + @param kwlist: A list of all global keywords. + @param profiles: A list of all profiles. ''' self._checkAddedWithStableKeywords( package, ebuild, y_ebuild, keywords, changed) + self._checkForDroppedKeywords( pkg, ebuild, ebuild_archs, live_ebuild) + self._checkForInvalidKeywords( + pkg, package, y_ebuild, kwlist, profiles) + + self._checkForMaskLikeKeywords( + package, y_ebuild, keywords, kwlist) + self.slot_keywords[pkg.slot].update(ebuild_archs) + def _isKeywordStable(self, keyword): + return not keyword.startswith(~) and not keyword.startswith(-) + def _checkAddedWithStableKeywords( self, package, ebuild, y_ebuild, keywords, changed): catdir, pkgdir = package.split(/) - is_stable = lambda kw: not kw.startswith(~) and not kw.startswith(-) - stable_keywords = list(filter(is_stable, keywords)) + stable_keywords = list(filter(self._isKeywordStable, keywords)) if stable_keywords: if ebuild.ebuild_path in changed.new_ebuilds and catdir != virtual: stable_keywords.sort() @@ -62,6 +73,47 @@ class KeywordChecks(object): elif ebuild_archs and * not in ebuild_archs and not live_ebuild: dropped_keywords = previous_keywords.difference(ebuild_archs) if dropped_keywords: - self.qatracker.add_error(KEYWORDS.dropped, - %s: %s % - (ebuild.relative_path, .join(sorted(dropped_keywords \ No newline at end of file + self.qatracker.add_error( + KEYWORDS.dropped, %s: %s % ( + ebuild.relative_path, + .join(sorted(dropped_keywords + + def _checkForInvalidKeywords( + self, pkg, package, y_ebuild, kwlist, profiles): + myuse = pkg._metadata[KEYWORDS].split() + + for mykey in myuse: + if mykey not in (-*, *, ~*): + myskey = mykey + + if not self._isKeywordStable(myskey[:1]): + myskey = myskey[1:] + + if myskey not in kwlist: + self.qatracker.add_error( + KEYWORDS.invalid, + %s/%s.ebuild: %s % ( + package, y_ebuild, mykey)) + elif myskey not in profiles: + self.qatracker.add_error( + KEYWORDS.invalid, + %s/%s.ebuild: %s (profile invalid) % ( + package, y_ebuild, mykey)) + + def _checkForMaskLikeKeywords( + self, package, y_ebuild, keywords, kwlist): + + # KEYWORDS=-* is a stupid replacement for package.mask + # and screws general KEYWORDS semantics + if -* in keywords: +
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: dd3b5ade5fda333a6a12471374a112fac4e043eb Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Tue Jun 3 11:28:44 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Tue Jun 3 11:28:44 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=dd3b5ade repoman/main.py: Refactor RepoMan Sez --- pym/repoman/main.py | 27 ++- pym/repoman/utilities.py | 8 ++-- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index c698265..425b891 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -964,25 +964,21 @@ if options.mode != 'commit': if dofull: print(bold(Note: type \repoman full\ for a complete listing.)) if dowarn and not dofail: - print( - green(RepoMan sez:), + utilities.repoman_sez( \You're only giving me a partial QA payment?\n I'll take it this time, but I'm not happy.\) elif not dofail: - print( - green(RepoMan sez:), + utilities.repoman_sez( \If everyone were like you, I'd be out of business!\) elif dofail: print(bad(Please fix these important QA issues first.)) - print( - green(RepoMan sez:), + utilities.repoman_sez( \Make your QA payment on time and you'll never see the likes of me.\\n) sys.exit(1) else: if dofail and can_force and options.force and not options.pretend: - print( - green(RepoMan sez:), + utilities.repoman_sez( \You want to commit even with these QA issues?\n I'll take it this time, but I'm not happy.\\n) elif dofail: @@ -991,15 +987,13 @@ else: The --force option has been disabled due to extraordinary issues.)) print(bad(Please fix these important QA issues first.)) - print( - green(RepoMan sez:), + utilities.repoman_sez( \Make your QA payment on time and you'll never see the likes of me.\\n) sys.exit(1) if options.pretend: - print( - green(RepoMan sez:), + utilities.repoman_sez( \So, you want to play it safe. Good call.\\n) myunadded = [] @@ -1178,7 +1172,8 @@ else: if vcs_settings.vcs: if not (mychanged or mynew or myremoved or (vcs_settings.vcs == hg and mydeleted)): - print(green(RepoMan sez:), \Doing nothing is not always good for QA.\) + utilities.repoman_sez( + \Doing nothing is not always good for QA.\) print() print((Didn't find any changed files...)) print() @@ -1578,8 +1573,7 @@ else: portage.util.write_atomic(x, b''.join(mylines), mode='wb') if repolevel == 1: - print( - green(RepoMan sez:), + utilities.repoman_sez( \You're rather crazy... doing the entire repository.\\n) @@ -1696,7 +1690,6 @@ else: repoman was too scared by not seeing any familiar version control file that he forgot to commit anything) - print( - green(RepoMan sez:), + utilities.repoman_sez( \If everyone were like you, I'd be out of business!\\n) sys.exit(0) diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index b7b3945..b19d4e1 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -39,9 +39,10 @@ from portage import shutil from portage import _encodings from portage import _unicode_decode from portage import _unicode_encode +from portage import util from portage.localization import _ from portage.process import find_binary -from portage import util +from portage.output import green from repoman.copyrights import update_copyright, update_copyright_year @@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit): path = os.path.join(startdir, cat) if not os.path.isdir(path): continue - pkgdirs = os.listdir(path) scanlist.extend(AddPackagesInDir(path)) elif repolevel == 2: # category level, startdir = catdir # We only want 1 segment
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/herds/, pym/repoman/modules/commit/
commit: 160508618c8515f56663d48158d15a139467b4fd Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Tue Jun 3 11:42:39 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Tue Jun 3 11:42:39 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=16050861 repoman: Fix up pyflakes imports and undefined functions or values --- pym/repoman/_xml.py | 5 + pym/repoman/checks/herds/herdbase.py | 2 ++ pym/repoman/copyrights.py| 10 -- pym/repoman/modules/commit/repochecks.py | 2 -- pym/repoman/profile.py | 3 ++- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py index 1871875..b97c027 100644 --- a/pym/repoman/_xml.py +++ b/pym/repoman/_xml.py @@ -55,7 +55,6 @@ class XmlLint(object): self.binary = None self._check_capable(options, repolevel, repoman_settings) - def _check_capable(self, options, repolevel, repoman_settings): if options.mode == manifest: return @@ -71,15 +70,13 @@ class XmlLint(object): # this can be problematic if xmllint changes their output self._is_capable = True - @property def capable(self): return self._is_capable - def check(self, checkdir): if not self.capable: - return true + return True # xmlint can produce garbage output even on success, so only dump # the ouput when it fails. st, out = repoman_getstatusoutput( diff --git a/pym/repoman/checks/herds/herdbase.py b/pym/repoman/checks/herds/herdbase.py index b1ba671..cfa37e4 100644 --- a/pym/repoman/checks/herds/herdbase.py +++ b/pym/repoman/checks/herds/herdbase.py @@ -24,6 +24,8 @@ from portage import _encodings, _unicode_encode from portage.exception import FileNotFound, ParseError, PermissionDenied from portage import os +from repoman.errors import err + __all__ = [ make_herd_base, get_herd_base ] diff --git a/pym/repoman/copyrights.py b/pym/repoman/copyrights.py index 01ce42f..056cfda 100644 --- a/pym/repoman/copyrights.py +++ b/pym/repoman/copyrights.py @@ -87,11 +87,11 @@ def update_copyright(fn_path, year, pretend=False): new_header.append(line) difflines = 0 - for line in difflib.unified_diff( - [_unicode_decode(line) for line in orig_header], - [_unicode_decode(line) for line in new_header], + for diffline in difflib.unified_diff( + [_unicode_decode(diffline) for diffline in orig_header], + [_unicode_decode(diffline) for diffline in new_header], fromfile=fn_path, tofile=fn_path, n=0): - util.writemsg_stdout(line, noiselevel=-1) + util.writemsg_stdout(diffline, noiselevel=-1) difflines += 1 util.writemsg_stdout(\n, noiselevel=-1) @@ -117,5 +117,3 @@ def update_copyright(fn_path, year, pretend=False): else: util.apply_stat_permissions(fn_path, fn_stat) fn_hdl.close() - - diff --git a/pym/repoman/modules/commit/repochecks.py b/pym/repoman/modules/commit/repochecks.py index d0e2f28..2839864 100644 --- a/pym/repoman/modules/commit/repochecks.py +++ b/pym/repoman/modules/commit/repochecks.py @@ -1,9 +1,7 @@ - from portage.output import red from repoman.errors import err -from repoman.vcs import vcs from repoman.vcs.vcs import detect_vcs_conflicts diff --git a/pym/repoman/profile.py b/pym/repoman/profile.py index 03e6c24..11b93c7 100644 --- a/pym/repoman/profile.py +++ b/pym/repoman/profile.py @@ -1,6 +1,7 @@ -from portage import os from portage import normalize_path +from portage import os +from portage.output import red class ProfileDesc(object):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: c345511a62b9a2f89b43d4e539c7079868e82e91 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 18:02:47 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue Jun 3 18:14:58 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c345511a repoman/main.py: Remove some temporary dubug print() --- pym/repoman/main.py | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index a96f38f..5f91713 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -109,15 +109,11 @@ 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) @@ -282,7 +278,7 @@ 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
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: 9a17984d163ea81df5cbf0b54eda6b9cbb38301a Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 18:00:05 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue Jun 3 18:07:12 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9a17984d Repoman: Refactor repos.RepoSettings class, fix the repoman_settings not being re-assigned When the repo is not in the confiig'd repos, it creates a ne repoman_settings object which contains the temporaily activated repo. main.py was not re-assigning repoman_settings to the new object. Split out _add_repo() to it's own function. Split out the gpg-sign specific function for git into plugin-ready functions, for later. --- pym/repoman/main.py | 2 + pym/repoman/repos.py | 119 --- 2 files changed, 77 insertions(+), 44 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 425b891..a96f38f 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -128,6 +128,8 @@ vcs_settings = VCSSettings(options, repoman_settings) repo_settings = RepoSettings(config_root, portdir, portdir_overlay, repoman_settings, vcs_settings, options, qawarnings) +repoman_settings = repo_settings.repoman_settings + portdb = repo_settings.portdb ## diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py index b79e241..6bd1eb4 100644 --- a/pym/repoman/repos.py +++ b/pym/repoman/repos.py @@ -26,75 +26,46 @@ class RepoSettings(object): def __init__(self, config_root, portdir, portdir_overlay, repoman_settings=None, vcs_settings=None, options=None, qawarnings=None): + self.repoman_settings = repoman_settings + self.vcs_settings = vcs_settings + # Ensure that current repository is in the list of enabled repositories. self.repodir = os.path.realpath(portdir_overlay) try: repoman_settings.repositories.get_repo_for_location(self.repodir) except KeyError: - self.repo_conf = portage.repository.config - self.repo_name = self.repo_conf.RepoConfig._read_valid_repo_name(portdir_overlay)[0] - self.layout_conf_data = self.repo_conf.parse_layout_conf(portdir_overlay)[0] - if self.layout_conf_data['repo-name']: - self.repo_name = self.layout_conf_data['repo-name'] - tmp_conf_file = io.StringIO(textwrap.dedent( - [%s] - location = %s - ) % (self.repo_name, portdir_overlay)) - # Ensure that the repository corresponding to $PWD overrides a - # repository of the same name referenced by the existing PORTDIR - # or PORTDIR_OVERLAY settings. - repoman_settings['PORTDIR_OVERLAY'] = %s %s % ( - repoman_settings.get('PORTDIR_OVERLAY', ''), - portage._shell_quote(portdir_overlay)) - self.repositories = self.repo_conf.load_repository_config( - repoman_settings, extra_files=[tmp_conf_file]) - # We have to call the config constructor again so that attributes - # dependent on config.repositories are initialized correctly. - repoman_settings = portage.config( - config_root=config_root, local_config=False, repositories=self.repositories) + self._add_repo(config_root, portdir_overlay) - self.root = repoman_settings['EROOT'] + self.root = self.repoman_settings['EROOT'] self.trees = { - self.root: {'porttree': portage.portagetree(settings=repoman_settings)} + self.root: {'porttree': portage.portagetree(settings=self.repoman_settings)} } self.portdb = self.trees[self.root]['porttree'].dbapi # Constrain dependency resolution to the master(s) # that are specified in layout.conf. - self.repo_config = repoman_settings.repositories.get_repo_for_location(self.repodir) + self.repo_config = self.repoman_settings.repositories.get_repo_for_location(self.repodir) self.portdb.porttrees = list(self.repo_config.eclass_db.porttrees) self.portdir = self.portdb.porttrees[0] self.commit_env = os.environ.copy() # list() is for iteration on a copy. - for repo in list(repoman_settings.repositories): + for repo in list(self.repoman_settings.repositories):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/
commit: b92c2564c1cdf5d53a5c148a427b51ff617f5613 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 18:42:37 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue Jun 3 18:42:37 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b92c2564 Repoman: Refactor VCSStatus to pass non consistent data to the check() This will facilitae for the initialization of the class before the big xpkg loop. --- pym/repoman/main.py | 4 ++-- pym/repoman/vcs/vcsstatus.py | 39 ++- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 5f91713..37319a3 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -315,8 +315,8 @@ for xpkg in effective_scanlist: filescheck.check(checkdir, checkdirlist, checkdir_relative, changed.changed, changed.new) ### - status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker) - status_check.check(check_ebuild_notadded) + status_check = VCSStatus(vcs_settings, qatracker) + status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg) eadded.extend(status_check.eadded) # diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py index 6a81b1b..0517c04 100644 --- a/pym/repoman/vcs/vcsstatus.py +++ b/pym/repoman/vcs/vcsstatus.py @@ -13,52 +13,49 @@ class VCSStatus(object): '''Determines the status of the vcs repositories to determine if files are not added''' - def __init__(self, vcs_settings, checkdir, checkdir_relative, xpkg, qatracker): + def __init__(self, vcs_settings, qatracker): self.vcs_settings = vcs_settings self.vcs = vcs_settings.vcs self.eadded = [] - self.checkdir = checkdir - self.checkdir_relative = checkdir_relative - self.xpkg = xpkg self.qatracker = qatracker - def check(self, check_not_added): + def check(self, check_not_added, checkdir, checkdir_relative, xpkg): if self.vcs and check_not_added: vcscheck = getattr(self, 'check_%s' % self.vcs) - vcscheck() + vcscheck(checkdir, checkdir_relative, xpkg) - def post_git_hg(self, myf): + def post_git_hg(self, myf, xpkg): for l in myf: if l[:-1][-7:] == .ebuild: self.qatracker.add_error(ebuild.notadded, - os.path.join(self.xpkg, os.path.basename(l[:-1]))) + os.path.join(xpkg, os.path.basename(l[:-1]))) myf.close() - def check_git(self): + def check_git(self, checkdir, checkdir_relative, xpkg): myf = repoman_popen( git ls-files --others %s % - (portage._shell_quote(self.checkdir_relative),)) - self.post_git_hg(myf) + (portage._shell_quote(checkdir_relative),)) + self.post_git_hg(myf, xpkg) - def check_hg(self): + def check_hg(self, checkdir, checkdir_relative, xpkg): myf = repoman_popen( hg status --no-status --unknown %s % - (portage._shell_quote(self.checkdir_relative),)) - self.post_git_hg(myf) + (portage._shell_quote(checkdir_relative),)) + self.post_git_hg(myf, xpkg) - def check_cvs(self): + def check_cvs(self, checkdir, checkdir_relative, xpkg): try: - myf = open(self.checkdir + /CVS/Entries, r) + myf = open(checkdir + /CVS/Entries, r) myl = myf.readlines() myf.close() except IOError: self.qatracker.add_error(CVS/Entries.IO_error, - self.checkdir + /CVS/Entries) + checkdir + /CVS/Entries) return True for l in myl: if l[0] != /: @@ -71,7 +68,7 @@ class VCSStatus(object): return True - def check_svn(self): + def check_svn(self, checkdir, checkdir_relative, xpkg): try: myf = repoman_popen( svn status --depth=files --verbose + @@ -92,7 +89,7 @@ class VCSStatus(object): try: myf = repoman_popen( svn status + -
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/
commit: d7ebf107b68630eef02eaa4f74f69252854e31bb Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 19:20:43 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue Jun 3 19:20:43 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d7ebf107 Repoman: Refactor PkgMetadata and XmlLint classes for variable data passed in Move all non-consistent data to be passed in via the check functions. Initialize XmlLint once in the PkgMetadata class __init__(). --- pym/repoman/_xml.py | 33 ++- pym/repoman/checks/ebuilds/pkgmetadata.py | 12 +-- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py index b97c027..d5b5a5e 100644 --- a/pym/repoman/_xml.py +++ b/pym/repoman/_xml.py @@ -14,6 +14,8 @@ from repoman._subprocess import repoman_getstatusoutput class _XMLParser(xml.etree.ElementTree.XMLParser): + + def __init__(self, data, **kwargs): xml.etree.ElementTree.XMLParser.__init__(self, **kwargs) self._portage_data = data @@ -25,11 +27,13 @@ class _XMLParser(xml.etree.ElementTree.XMLParser): self.parser.StartDoctypeDeclHandler = \ self._portage_StartDoctypeDeclHandler + def _portage_XmlDeclHandler(self, version, encoding, standalone): if self._base_XmlDeclHandler is not None: self._base_XmlDeclHandler(version, encoding, standalone) self._portage_data[XML_DECLARATION] = (version, encoding, standalone) + def _portage_StartDoctypeDeclHandler( self, doctypeName, systemId, publicId, has_internal_subset): if self._base_StartDoctypeDeclHandler is not None: @@ -49,33 +53,44 @@ class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder): class XmlLint(object): - def __init__(self, options, repolevel, repoman_settings): + def __init__(self, options, repoman_settings): self.metadata_dtd = os.path.join(repoman_settings[DISTDIR], 'metadata.dtd') + self.options = options + self.repoman_settings = repoman_settings self._is_capable = False self.binary = None - self._check_capable(options, repolevel, repoman_settings) + self._check_capable() + - def _check_capable(self, options, repolevel, repoman_settings): - if options.mode == manifest: + def _check_capable(self): + if self.options.mode == manifest: return self.binary = find_binary('xmllint') if not self.binary: print(red(!!! xmllint not found. Can't check metadata.xml.\n)) - if options.xml_parse or repolevel == 3: - print(%s sorry, xmllint is needed. failing\n % red(!!!)) - sys.exit(1) else: - if not fetch_metadata_dtd(self.metadata_dtd, repoman_settings): + if not fetch_metadata_dtd(self.metadata_dtd, self.repoman_settings): sys.exit(1) # this can be problematic if xmllint changes their output self._is_capable = True + @property def capable(self): return self._is_capable - def check(self, checkdir): + + def check(self, checkdir, repolevel): + '''Runs checks on the package metadata.xml file + + @param checkdir: string, path + @param repolevel: integer + @return boolean, False == bad metadata + ''' if not self.capable: + if self.options.xml_parse or repolevel == 3: + print(%s sorry, xmllint is needed. failing\n % red(!!!)) + sys.exit(1) return True # xmlint can produce garbage output even on success, so only dump # the ouput when it fails. diff --git a/pym/repoman/checks/ebuilds/pkgmetadata.py b/pym/repoman/checks/ebuilds/pkgmetadata.py index 0778696..674d32f 100644 --- a/pym/repoman/checks/ebuilds/pkgmetadata.py +++ b/pym/repoman/checks/ebuilds/pkgmetadata.py @@ -38,27 +38,28 @@ from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint class PkgMetadata(object): '''Package metadata.xml checks''' - def __init__(self, options, qatracker, repolevel, repoman_settings): + def __init__(self, options, qatracker, repoman_settings): '''PkgMetadata init function @param options: ArgumentParser.parse_known_args(argv[1:]) options @param qatracker: QATracker instance
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: 1005c1b750558ed3e13cb82f0985b1f1294ba24c Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 19:32:18 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue Jun 3 19:32:18 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1005c1b7 repoman/main.py: Move the check class instantiations out of the xpkg loop This should help reduce overall run time when doing large repoman full runs. It instead re-uses the class instances for each pkg checked. --- pym/repoman/main.py | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 37319a3..b347369 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -263,6 +263,19 @@ 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 +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) +status_check = VCSStatus(vcs_settings, qatracker) +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) + + for xpkg in effective_scanlist: # ebuilds and digests added to cvs respectively. logging.info(checking package %s % xpkg) @@ -279,7 +292,6 @@ for xpkg in effective_scanlist: checkdir_relative = os.path.join(., checkdir_relative) # - manifester = Manifests(options, qatracker, repoman_settings) if manifester.run(checkdir, portdb): continue if not manifester.generated_manifest: @@ -292,7 +304,6 @@ for xpkg in effective_scanlist: checkdirlist = os.listdir(checkdir) ## - 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 @@ -310,26 +321,20 @@ for xpkg in effective_scanlist: ebuildlist = sorted(pkgs.values()) ebuildlist = [pkg.pf for pkg in ebuildlist] ### - filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb, - vcs_settings) filescheck.check(checkdir, checkdirlist, checkdir_relative, changed.changed, changed.new) ### - status_check = VCSStatus(vcs_settings, qatracker) status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg) eadded.extend(status_check.eadded) # - fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb, - vcs_settings) fetchcheck.check(xpkg, checkdir, checkdir_relative, changed.changed, changed.new) # if check_changelog and ChangeLog not in checkdirlist: qatracker.add_error(changelog.missing, xpkg + /ChangeLog) # - pkgmeta = PkgMetadata(options, qatracker, repolevel, repoman_settings) - pkgmeta.check(xpkg, checkdir, checkdirlist) + pkgmeta.check(xpkg, checkdir, checkdirlist, repolevel) muselist = frozenset(pkgmeta.musedict) # @@ -387,7 +392,6 @@ for xpkg in effective_scanlist: if not fetchcheck.src_uri_error: ### - thirdparty = ThirdPartyMirrors(repoman_settings, qatracker) thirdparty.check(myaux, ebuild.relative_path) ### if myaux.get(PROVIDE): @@ -616,7 +620,6 @@ for xpkg in effective_scanlist: badprovsyntax = badprovsyntax 0 # - use_flag_checks = USEFlagChecks(qatracker, uselist) use_flag_checks.check(pkg, xpkg, ebuild, y_ebuild, muselist) ebuild_used_useflags = use_flag_checks.getUsedUseFlags()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/
commit: fc3ff802cda4854498aa8b304c1102af0cef257c Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 19:39:56 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue Jun 3 19:39:56 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fc3ff802 repoman.../use_flags.py: Reset state variables for each check() run Also double space function separations. --- pym/repoman/checks/ebuilds/use_flags.py | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pym/repoman/checks/ebuilds/use_flags.py b/pym/repoman/checks/ebuilds/use_flags.py index bc09ed7..d63ae6d 100644 --- a/pym/repoman/checks/ebuilds/use_flags.py +++ b/pym/repoman/checks/ebuilds/use_flags.py @@ -19,10 +19,11 @@ class USEFlagChecks(object): @param globalUseFlags: Global USE flags ''' self.qatracker = qatracker + self.globalUseFlags = globalUseFlags self.useFlags = [] self.defaultUseFlags = [] self.usedUseFlags = set() - self.globalUseFlags = globalUseFlags + def check(self, pkg, package, ebuild, y_ebuild, localUseFlags): '''Perform the check. @@ -33,14 +34,20 @@ class USEFlagChecks(object): @param y_ebuild: Ebuild which we check (string). @param localUseFlags: Local USE flags of the package ''' + # reset state variables for the run + self.useFlags = [] + self.defaultUseFlags = [] + self.usedUseFlags = set() self._checkGlobal(pkg) self._checkMetadata(package, ebuild, y_ebuild, localUseFlags) self._checkRequiredUSE(pkg, ebuild) + def getUsedUseFlags(self): '''Get the USE flags that this check has seen''' return self.usedUseFlags + def _checkGlobal(self, pkg): for myflag in pkg._metadata[IUSE].split(): flag_name = myflag.lstrip(+-) @@ -50,6 +57,7 @@ class USEFlagChecks(object): if flag_name not in self.globalUseFlags: self.useFlags.append(flag_name) + def _checkMetadata(self, package, ebuild, y_ebuild, localUseFlags): for mypos in range(len(self.useFlags) - 1, -1, -1): if self.useFlags[mypos] and (self.useFlags[mypos] in localUseFlags): @@ -67,6 +75,7 @@ class USEFlagChecks(object): IUSE.invalid, %s/%s.ebuild: %s % (package, y_ebuild, self.useFlags[mypos])) + def _checkRequiredUSE(self, pkg, ebuild): required_use = pkg._metadata[REQUIRED_USE] if required_use:
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/directories/
commit: 1369a76925496f835dd7076029926f57f9605f8a Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 06:04:27 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 06:04:27 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1369a769 repoman/main.py: Create FileChecks class Move file checks code block to a new checks/directories/ module --- pym/repoman/checks/directories/__init__.py | 0 pym/repoman/checks/directories/files.py| 77 ++ pym/repoman/main.py| 48 +++ 3 files changed, 84 insertions(+), 41 deletions(-) diff --git a/pym/repoman/checks/directories/__init__.py b/pym/repoman/checks/directories/__init__.py new file mode 100644 index 000..e69de29 diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py new file mode 100644 index 000..62f6169 --- /dev/null +++ b/pym/repoman/checks/directories/files.py @@ -0,0 +1,77 @@ + +'''repoman/checks/diretories/files.py + +''' + +import io + +from portage import _encodings, _unicode_encode +from portage import os + + + +class FileChecks(object): + + def __init__(self, qatracker, repoman_settings, repo_settings, portdb, + vcs_settings, vcs_new_changed): + ''' + @param qatracker: QATracker instance + @param repoman_settings: settings instance + @param repo_settings: repository settings instance + @param portdb: portdb instance + ''' + self.portdb = portdb + self.qatracker = qatracker + self.repo_settings = repo_settings + self.repoman_settings = repoman_settings + self.vcs_settings = vcs_settings + self.vcs_new_changed = vcs_new_changed + + + def check(self, checkdir, checkdirlist, checkdir_relative): + '''Checks the ebuild sources and files for errors + + @param xpkg: the pacakge being checked + @param checkdir: string, directory path + @param checkdir_relative: repolevel determined path + ''' + for y_file in checkdirlist: + index = self.repo_settings.repo_config.find_invalid_path_char(y_file) + if index != -1: + y_relative = os.path.join(checkdir_relative, y_file) + if self.vcs_settings.vcs is not None and not self.vcs_new_changed(y_relative): + # If the file isn't in the VCS new or changed set, then + # assume that it's an irrelevant temporary file (Manifest + # entries are not generated for file names containing + # prohibited characters). See bug #406877. + index = -1 + if index != -1: + self.qatracker.add_error(file.name, + %s/%s: char '%s' % (checkdir, y_file, y_file[index])) + + if not (y_file in (ChangeLog, metadata.xml) + or y_file.endswith(.ebuild)): + continue + f = None + try: + line = 1 + f = io.open( + _unicode_encode( + os.path.join(checkdir, y_file), + encoding=_encodings['fs'], errors='strict'), + mode='r', encoding=_encodings['repo.content']) + for l in f: + line += 1 + except UnicodeDecodeError as ue: + s = ue.object[:ue.start] + l2 = s.count(\n) + line += l2 + if l2 != 0: + s = s[s.rfind(\n) + 1:] + self.qatracker.add_error(file.UTF8, + %s/%s: line %i, just after: '%s' % (checkdir, y_file, line, s)) + finally: + if f is not None: + f.close() + return + diff --git a/pym/repoman/main.py b/pym/repoman/main.py index ffb9929..9db52c0 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -45,6 +45,7 @@ from portage.package.ebuild.digestgen import digestgen from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use from repoman.argparser import parse_args +from
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/
commit: fc8b6617dfc742e683af929de7ad6d8ab70d9dc6 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 05:31:45 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 05:31:45 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fc8b6617 repoman/main.py: Create FetchChecks class Create the new class in checks/ebuilds/fetches.py. --- pym/repoman/checks/ebuilds/fetches.py | 132 ++ pym/repoman/main.py | 96 ++--- 2 files changed, 139 insertions(+), 89 deletions(-) diff --git a/pym/repoman/checks/ebuilds/fetches.py b/pym/repoman/checks/ebuilds/fetches.py new file mode 100644 index 000..3d59339 --- /dev/null +++ b/pym/repoman/checks/ebuilds/fetches.py @@ -0,0 +1,132 @@ + +'''fetches.py +Performs the src_uri fetchlist and files checks +''' + +from stat import S_ISDIR + +import portage +from portage import os + + +class FetchChecks(object): + '''Performs checks on the files needed for the ebuild''' + + def __init__(self, qatracker, repoman_settings, repo_settings, portdb, + vcs_settings, vcs_new_changed): + ''' + @param qatracker: QATracker instance + @param repoman_settings: settings instance + @param repo_settings: repository settings instance + @param portdb: portdb instance + ''' + self.portdb = portdb + self.qatracker = qatracker + self.repo_settings = repo_settings + self.repoman_settings = repoman_settings + self.vcs_settings = vcs_settings + self.vcs_new_changed = vcs_new_changed + self._digests = None + + + def check(self, xpkg, checkdir, checkdir_relative): + '''Checks the ebuild sources and files for errors + + @param xpkg: the pacakge being checked + @param checkdir: string, directory path + @param checkdir_relative: repolevel determined path + ''' + self.checkdir = checkdir + fetchlist_dict = portage.FetchlistDict(checkdir, self.repoman_settings, self.portdb) + myfiles_all = [] + self.src_uri_error = False + for mykey in fetchlist_dict: + try: + myfiles_all.extend(fetchlist_dict[mykey]) + except portage.exception.InvalidDependString as e: + self.src_uri_error = True + try: + self.portdb.aux_get(mykey, [SRC_URI]) + except KeyError: + # This will be reported as an ebuild.syntax error. + pass + else: + self.qatracker.add_error(SRC_URI.syntax, + %s.ebuild SRC_URI: %s % (mykey, e)) + del fetchlist_dict + if not self.src_uri_error: + # This test can produce false positives if SRC_URI could not + # be parsed for one or more ebuilds. There's no point in + # producing a false error here since the root cause will + # produce a valid error elsewhere, such as SRC_URI.syntax + # or ebuild.sytax. + myfiles_all = set(myfiles_all) + for entry in self.digests: + if entry not in myfiles_all: + self.qatracker.add_error(digest.unused, checkdir + :: + entry) + for entry in myfiles_all: + if entry not in self.digests: + self.qatracker.add_error(digest.missing, checkdir + :: + entry) + del myfiles_all + + if os.path.exists(checkdir + /files): + filesdirlist = os.listdir(checkdir + /files) + + # Recurse through files directory, use filesdirlist as a stack; + # appending directories as needed, + # so people can't hide 20k files in a subdirectory. + while filesdirlist: + y = filesdirlist.pop(0) + relative_path = os.path.join(xpkg, files, y) + full_path = os.path.join(self.repo_settings.repodir, relative_path) + try: + mystat = os.stat(full_path) + except OSError as oe: + if oe.errno == 2: +
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/
commit: 71ed484f67919a13f97bfa4e0e9a251119df0c99 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 06:43:19 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 06:43:19 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=71ed484f repoman/main.py: Split out some small ebuild checks functions Create new checks/ebuilds/misc.py file Add bad_split_check(). Add pkg_invalid(). --- pym/repoman/checks/ebuilds/misc.py | 54 ++ pym/repoman/main.py| 29 2 files changed, 59 insertions(+), 24 deletions(-) diff --git a/pym/repoman/checks/ebuilds/misc.py b/pym/repoman/checks/ebuilds/misc.py new file mode 100644 index 000..c1edd2c --- /dev/null +++ b/pym/repoman/checks/ebuilds/misc.py @@ -0,0 +1,54 @@ + +'''repoman/checks/ebuilds/misc.py +Miscelaneous ebuild check functions''' + +import re + +import portage + + +pv_toolong_re = re.compile(r'[0-9]{19,}') + + +def bad_split_check(xpkg, y_ebuild, pkgdir, qatracker): + '''Checks for bad category/package splits. + + @param xpkg: the pacakge being checked + @param y_ebuild: string of the ebuild name being tested + @param pkgdir: string: path + @param qatracker: QATracker instance + ''' + myesplit = portage.pkgsplit(y_ebuild) + + is_bad_split = myesplit is None or myesplit[0] != xpkg.split(/)[-1] + + if is_bad_split: + is_pv_toolong = pv_toolong_re.search(myesplit[1]) + is_pv_toolong2 = pv_toolong_re.search(myesplit[2]) + + if is_pv_toolong or is_pv_toolong2: + qatracker.add_error(ebuild.invalidname, + xpkg + / + y_ebuild + .ebuild) + return True + elif myesplit[0] != pkgdir: + print(pkgdir, myesplit[0]) + qatracker.add_error(ebuild.namenomatch, + xpkg + / + y_ebuild + .ebuild) + return True + return False + + +def pkg_invalid(pkg, qatracker): + '''Checks for invalid packages + + @param pkg: _emerge.Package instance + @param qatracker: QATracker instance + @return boolean: + ''' + if pkg.invalid: + for k, msgs in pkg.invalid.items(): + for msg in msgs: + qatracker.add_error(k, + %s: %s % (ebuild.relative_path, msg)) + return True + return False diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 9db52c0..c680752 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -51,6 +51,7 @@ from repoman.checks.ebuilds.fetches import FetchChecks from repoman.checks.ebuilds.isebuild import IsEbuild from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors from repoman.checks.ebuilds.manifests import Manifests +from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.ebuild import Ebuild from repoman.errors import err @@ -76,8 +77,6 @@ util.initialize_logger() commitmessage = None -pv_toolong_re = re.compile(r'[0-9]{19,}') - bad = create_color_func(BAD) live_eclasses = portage.const.LIVE_ECLASSES @@ -368,32 +367,14 @@ for xpkg in effective_scanlist: # ebuild not added to vcs qatracker.add_error(ebuild.notadded, xpkg + / + y_ebuild + .ebuild) - myesplit = portage.pkgsplit(y_ebuild) - - is_bad_split = myesplit is None or myesplit[0] != xpkg.split(/)[-1] - - if is_bad_split: - is_pv_toolong = pv_toolong_re.search(myesplit[1]) - is_pv_toolong2 = pv_toolong_re.search(myesplit[2]) - if is_pv_toolong or is_pv_toolong2: - qatracker.add_error(ebuild.invalidname, - xpkg + / + y_ebuild + .ebuild) - continue - elif myesplit[0] != pkgdir: - print(pkgdir, myesplit[0]) - qatracker.add_error(ebuild.namenomatch, - xpkg + / + y_ebuild + .ebuild) +## + if bad_split_check(xpkg, y_ebuild, pkgdir, qatracker): continue - +### pkg = pkgs[y_ebuild] - - if pkg.invalid: + if pkg_invalid(pkg, qatracker): allvalid = False - for k, msgs in pkg.invalid.items(): - for msg in msgs: - qatracker.add_error(k, - %s: %s % (ebuild.relative_path, msg))
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: f40235dc6ae4e9efd5db5be259740dc6f1a70b8e Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 14:10:21 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Mon Jun 2 14:10:21 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f40235dc repoman/main.py: Fix qa_tracker import --- pym/repoman/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index c680752..dfe188d 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -60,7 +60,7 @@ 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, max_desc_len, missingvars, ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict) -from qa_tracker import QATracker +from repoman.qa_tracker import QATracker from repoman.repos import has_global_mask, RepoSettings, repo_metadata from repoman.scan import Changes, scan from repoman._subprocess import repoman_popen, repoman_getstatusoutput
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: 9b3d5b8544074c62ed30a45484039f9c18457a8d Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 14:23:26 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 14:23:54 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9b3d5b85 repoman/main.py: Remove the exit_handler() and intialization This script is no longer the start script. There is a handler in hte new start script. --- pym/repoman/main.py | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index dfe188d..c5a6ea6 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -96,18 +96,6 @@ if repoman_settings.get(NOCOLOR, ).lower() in (yes, true) or \ not sys.stdout.isatty(): nocolor() - -def exithandler(signum=None, _frame=None): - logging.fatal(Interrupted; exiting...) - if signum is None: - sys.exit(1) - else: - sys.exit(128 + signum) - - -signal.signal(signal.SIGINT, exithandler) - - options, arguments = parse_args( sys.argv, qahelp, repoman_settings.get(REPOMAN_DEFAULT_OPTS, )) @@ -205,12 +193,13 @@ if options.mode == 'commit': # Make startdir relative to the canonical repodir, so that we can pass # it to digestgen and it won't have to be canonicalized again. +print(REPOLEVEL:, repolevel) if repolevel == 1: startdir = repo_settings.repodir else: startdir = normalize_path(mydir) startdir = os.path.join(repo_settings.repodir, *startdir.split(os.sep)[-2 - repolevel + 3:]) - +print(STARTDIR:, startdir) ### # get lists of valid keywords, licenses, and use @@ -299,7 +288,7 @@ for xpkg in effective_scanlist: if manifester.run(checkdir, portdb): continue if not manifester.generated_manifest: -manifester.digest_check(checkdir) +manifester.digest_check(xpkg, checkdir) ## if options.mode == 'manifest-check':
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/
commit: aaa087d7f65f7fe32d48b43b46c5ab16a99bfb2d Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 14:16:22 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 14:23:54 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=aaa087d7 repoman/checks/ebuilds/manifests.py: add an extra generated_manifest = False This is a pre-emptive commit. I plan to re-use the same class instances for multiple checks. --- pym/repoman/checks/ebuilds/manifests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pym/repoman/checks/ebuilds/manifests.py b/pym/repoman/checks/ebuilds/manifests.py index c9eda54..fb08c5e 100644 --- a/pym/repoman/checks/ebuilds/manifests.py +++ b/pym/repoman/checks/ebuilds/manifests.py @@ -21,6 +21,7 @@ class Manifests(object): def run(self, checkdir, portdb): + self.generated_manifest = False if self.options.pretend: return False if self.options.mode in (manifest, 'commit', 'fix') or self.digest_only: @@ -93,7 +94,7 @@ class Manifests(object): portage._doebuild_manifest_exempt_depend -= 1 - def digest_check(self, checkdir): + def digest_check(self, xpkg, checkdir): self.repoman_settings['O'] = checkdir self.repoman_settings['PORTAGE_QUIET'] = '1' if not portage.digestcheck([], self.repoman_settings, strict=1):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/directories/
commit: 73e780a802ba843d5778be44c81644a9f909a7bf Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 15:00:12 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Mon Jun 2 15:00:12 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=73e780a8 repoman: Fix up files check's changeset variable propagation --- pym/repoman/checks/directories/files.py | 6 -- pym/repoman/main.py | 10 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py index 62f6169..71c01d0 100644 --- a/pym/repoman/checks/directories/files.py +++ b/pym/repoman/checks/directories/files.py @@ -28,7 +28,7 @@ class FileChecks(object): self.vcs_new_changed = vcs_new_changed - def check(self, checkdir, checkdirlist, checkdir_relative): + def check(self, checkdir, checkdirlist, checkdir_relative, changed, new): '''Checks the ebuild sources and files for errors @param xpkg: the pacakge being checked @@ -39,7 +39,9 @@ class FileChecks(object): index = self.repo_settings.repo_config.find_invalid_path_char(y_file) if index != -1: y_relative = os.path.join(checkdir_relative, y_file) - if self.vcs_settings.vcs is not None and not self.vcs_new_changed(y_relative): + invcs = self.vcs_settings.vcs is not None + inchangeset = self.vcs_new_changed(y_relative, changed, new) + if invcs and not inchangeset: # If the file isn't in the VCS new or changed set, then # assume that it's an irrelevant temporary file (Manifest # entries are not generated for file names containing diff --git a/pym/repoman/main.py b/pym/repoman/main.py index c5a6ea6..90cf85b 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -315,10 +315,6 @@ for xpkg in effective_scanlist: ebuildlist = sorted(pkgs.values()) ebuildlist = [pkg.pf for pkg in ebuildlist] ### - filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb, - vcs_settings, vcs_new_changed) - filescheck.check(checkdir, checkdirlist, checkdir_relative) -### status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker) status_check.check(check_ebuild_notadded) eadded.extend(status_check.eadded) @@ -1220,6 +1216,12 @@ else: print() sys.exit(1) + ### + filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb, + vcs_settings, vcs_new_changed) + filescheck.check(checkdir, checkdirlist, checkdir_relative, mychanged, mynew) + ### + # Manifests need to be regenerated after all other commits, so don't commit # them now even if they have changed. mymanifests = set()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/
commit: d38db2e886636f067f5679138356b76aee83dee2 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 14:16:22 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 15:35:13 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d38db2e8 repoman/checks/ebuilds/manifests.py: Fix a missed xpkg parameter in digest_check() Add an extra generated_manifest = False This is a pre-emptive commit. I plan to re-use the same class instances for multiple checks. --- pym/repoman/checks/ebuilds/manifests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pym/repoman/checks/ebuilds/manifests.py b/pym/repoman/checks/ebuilds/manifests.py index c9eda54..fb08c5e 100644 --- a/pym/repoman/checks/ebuilds/manifests.py +++ b/pym/repoman/checks/ebuilds/manifests.py @@ -21,6 +21,7 @@ class Manifests(object): def run(self, checkdir, portdb): + self.generated_manifest = False if self.options.pretend: return False if self.options.mode in (manifest, 'commit', 'fix') or self.digest_only: @@ -93,7 +94,7 @@ class Manifests(object): portage._doebuild_manifest_exempt_depend -= 1 - def digest_check(self, checkdir): + def digest_check(self, xpkg, checkdir): self.repoman_settings['O'] = checkdir self.repoman_settings['PORTAGE_QUIET'] = '1' if not portage.digestcheck([], self.repoman_settings, strict=1):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/directories/, pym/repoman/checks/ebuilds/
commit: 809942064a805e66b7c63ac2e3a5b00287a1fe8b Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 15:27:32 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 15:42:51 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=80994206 Repoman: Fix previous errors introduced I mistakenly used vcs_new_changed as a boolean value, passing it around to newly split out code. This corrects it's use to an imported function. This also correct the mychanged, mynew values that were moved to the Changes class. Reverse moving the filescheck to later in the code when mychanged, mynew was defined. Those were different vlaues than what was original for that check. commit: 73e780a802ba843d5778be44c81644a9f909a7bf Subject: repoman: Fix up files check's changeset variable propagation Author: Tom Wijsman tomwij AT gentoo.org (Mon 02 Jun 2014 08:00:12 AM PDT) --- pym/repoman/checks/directories/files.py | 4 ++-- pym/repoman/checks/ebuilds/fetches.py | 9 + pym/repoman/main.py | 17 - 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py index 71c01d0..5dfca25 100644 --- a/pym/repoman/checks/directories/files.py +++ b/pym/repoman/checks/directories/files.py @@ -8,12 +8,13 @@ import io from portage import _encodings, _unicode_encode from portage import os +from repoman.vcs.vcs import vcs_new_changed class FileChecks(object): def __init__(self, qatracker, repoman_settings, repo_settings, portdb, - vcs_settings, vcs_new_changed): + vcs_settings): ''' @param qatracker: QATracker instance @param repoman_settings: settings instance @@ -25,7 +26,6 @@ class FileChecks(object): self.repo_settings = repo_settings self.repoman_settings = repoman_settings self.vcs_settings = vcs_settings - self.vcs_new_changed = vcs_new_changed def check(self, checkdir, checkdirlist, checkdir_relative, changed, new): diff --git a/pym/repoman/checks/ebuilds/fetches.py b/pym/repoman/checks/ebuilds/fetches.py index 3d59339..ccf9ff9 100644 --- a/pym/repoman/checks/ebuilds/fetches.py +++ b/pym/repoman/checks/ebuilds/fetches.py @@ -8,12 +8,14 @@ from stat import S_ISDIR import portage from portage import os +from repoman.vcs.vcs import vcs_new_changed + class FetchChecks(object): '''Performs checks on the files needed for the ebuild''' def __init__(self, qatracker, repoman_settings, repo_settings, portdb, - vcs_settings, vcs_new_changed): + vcs_settings): ''' @param qatracker: QATracker instance @param repoman_settings: settings instance @@ -25,11 +27,10 @@ class FetchChecks(object): self.repo_settings = repo_settings self.repoman_settings = repoman_settings self.vcs_settings = vcs_settings - self.vcs_new_changed = vcs_new_changed self._digests = None - def check(self, xpkg, checkdir, checkdir_relative): + def check(self, xpkg, checkdir, checkdir_relative, mychanged, mynew): '''Checks the ebuild sources and files for errors @param xpkg: the pacakge being checked @@ -108,7 +109,7 @@ class FetchChecks(object): index = self.repo_settings.repo_config.find_invalid_path_char(y) if index != -1: y_relative = os.path.join(checkdir_relative, files, y) - if self.vcs_settings.vcs is not None and not self.vcs_new_changed(y_relative): + if self.vcs_settings.vcs is not None and not vcs_new_changed(y_relative, mychanged, mynew): # If the file isn't in the VCS new or changed set, then # assume that it's an irrelevant temporary file (Manifest # entries are not generated for file names containing diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 4f25adb..fcf60f7 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -66,7 +66,7 @@ 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, - vcs_new_changed, VCSSettings) + VCSSettings) from repoman.vcs.vcsstatus import VCSStatus @@ -313,14 +313,19 @@ for xpkg in effective_scanlist: ebuildlist = sorted(pkgs.values()) ebuildlist = [pkg.pf for pkg in ebuildlist]
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/directories/
commit: 4dab973e26b91724087899e2adfdf41a6add01ca Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 15:00:12 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 15:42:51 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4dab973e repoman: Fix up files check's changeset variable propagation --- pym/repoman/checks/directories/files.py | 6 -- pym/repoman/main.py | 10 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py index 62f6169..71c01d0 100644 --- a/pym/repoman/checks/directories/files.py +++ b/pym/repoman/checks/directories/files.py @@ -28,7 +28,7 @@ class FileChecks(object): self.vcs_new_changed = vcs_new_changed - def check(self, checkdir, checkdirlist, checkdir_relative): + def check(self, checkdir, checkdirlist, checkdir_relative, changed, new): '''Checks the ebuild sources and files for errors @param xpkg: the pacakge being checked @@ -39,7 +39,9 @@ class FileChecks(object): index = self.repo_settings.repo_config.find_invalid_path_char(y_file) if index != -1: y_relative = os.path.join(checkdir_relative, y_file) - if self.vcs_settings.vcs is not None and not self.vcs_new_changed(y_relative): + invcs = self.vcs_settings.vcs is not None + inchangeset = self.vcs_new_changed(y_relative, changed, new) + if invcs and not inchangeset: # If the file isn't in the VCS new or changed set, then # assume that it's an irrelevant temporary file (Manifest # entries are not generated for file names containing diff --git a/pym/repoman/main.py b/pym/repoman/main.py index dfdf6ad..4f25adb 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -313,10 +313,6 @@ for xpkg in effective_scanlist: ebuildlist = sorted(pkgs.values()) ebuildlist = [pkg.pf for pkg in ebuildlist] ### - filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb, - vcs_settings, vcs_new_changed) - filescheck.check(checkdir, checkdirlist, checkdir_relative) -### status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker) status_check.check(check_ebuild_notadded) eadded.extend(status_check.eadded) @@ -1218,6 +1214,12 @@ else: print() sys.exit(1) + ### + filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb, + vcs_settings, vcs_new_changed) + filescheck.check(checkdir, checkdirlist, checkdir_relative, mychanged, mynew) + ### + # Manifests need to be regenerated after all other commits, so don't commit # them now even if they have changed. mymanifests = set()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: b5a4e8484f042e453e9038181aedd06f0b1a6427 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 14:56:29 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 15:42:51 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b5a4e848 repoman/scan.py: Fix an AttributeError for vcs == None --- pym/repoman/scan.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pym/repoman/scan.py b/pym/repoman/scan.py index 051f170..e7ce8ff 100644 --- a/pym/repoman/scan.py +++ b/pym/repoman/scan.py @@ -85,8 +85,9 @@ class Changes(object): def scan(self, vcs_settings): self._reset() - vcscheck = getattr(self, 'scan_%s' % vcs_settings.vcs) - vcscheck() + if vcs_settings.vcs: + vcscheck = getattr(self, 'scan_%s' % vcs_settings.vcs) + vcscheck() if vcs_settings.vcs: self.new_ebuilds.update(x for x in self.new if x.endswith(.ebuild))
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: 5d371987379f32b84651992846fed8f50a59254e Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 14:23:26 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 15:42:43 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5d371987 repoman/main.py: Remove the exit_handler() and intialization This script is no longer the start script. There is a handler in the new start script. --- pym/repoman/main.py | 15 +-- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index dfe188d..dfdf6ad 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -96,18 +96,6 @@ if repoman_settings.get(NOCOLOR, ).lower() in (yes, true) or \ not sys.stdout.isatty(): nocolor() - -def exithandler(signum=None, _frame=None): - logging.fatal(Interrupted; exiting...) - if signum is None: - sys.exit(1) - else: - sys.exit(128 + signum) - - -signal.signal(signal.SIGINT, exithandler) - - options, arguments = parse_args( sys.argv, qahelp, repoman_settings.get(REPOMAN_DEFAULT_OPTS, )) @@ -210,7 +198,6 @@ if repolevel == 1: else: startdir = normalize_path(mydir) startdir = os.path.join(repo_settings.repodir, *startdir.split(os.sep)[-2 - repolevel + 3:]) - ### # get lists of valid keywords, licenses, and use @@ -299,7 +286,7 @@ for xpkg in effective_scanlist: if manifester.run(checkdir, portdb): continue if not manifester.generated_manifest: -manifester.digest_check(checkdir) +manifester.digest_check(xpkg, checkdir) ## if options.mode == 'manifest-check':
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: fe8b1f48236ac32bb5ab82e4e7bb02f95c3859b3 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 14:56:43 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 15:42:51 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fe8b1f48 repoman/{argparser,metadata}.py: Fix up missing imports and definition --- pym/repoman/argparser.py | 1 + pym/repoman/metadata.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/pym/repoman/argparser.py b/pym/repoman/argparser.py index 5005798..19ec6e9 100644 --- a/pym/repoman/argparser.py +++ b/pym/repoman/argparser.py @@ -4,6 +4,7 @@ This module contains functions used in Repoman to parse CLI arguments. +import logging import portage from portage import util from portage.util._argparse import ArgumentParser diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py index f281523..b4950ad 100644 --- a/pym/repoman/metadata.py +++ b/pym/repoman/metadata.py @@ -1,6 +1,7 @@ import errno import logging +import sys import tempfile import time @@ -15,6 +16,8 @@ from portage import exception from portage import os from portage.output import green +if sys.hexversion = 0x300: + basestring = str metadata_xml_encoding = 'UTF-8' metadata_xml_declaration = '?xml version=1.0 encoding=%s?' \
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/directories/
commit: 866098ac59e77b1ca68b68f0a9abb2a721475a1c Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 15:58:38 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Mon Jun 2 15:58:38 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=866098ac repoman/checks/directories/files.py: Fix to use global vcs_new_changed --- pym/repoman/checks/directories/files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py index 5dfca25..87220c0 100644 --- a/pym/repoman/checks/directories/files.py +++ b/pym/repoman/checks/directories/files.py @@ -40,7 +40,7 @@ class FileChecks(object): if index != -1: y_relative = os.path.join(checkdir_relative, y_file) invcs = self.vcs_settings.vcs is not None - inchangeset = self.vcs_new_changed(y_relative, changed, new) + inchangeset = vcs_new_changed(y_relative, changed, new) if invcs and not inchangeset: # If the file isn't in the VCS new or changed set, then # assume that it's an irrelevant temporary file (Manifest
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/
commit: 5a5720b98aac27929a6c6485aee109a2cae30cf9 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 16:24:03 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Mon Jun 2 16:24:03 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5a5720b9 repoman/checks/ebuild/thirdpartymirrors.py: Fix logic --- pym/repoman/checks/ebuilds/thirdpartymirrors.py | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pym/repoman/checks/ebuilds/thirdpartymirrors.py b/pym/repoman/checks/ebuilds/thirdpartymirrors.py index cce61f6..f867c19 100644 --- a/pym/repoman/checks/ebuilds/thirdpartymirrors.py +++ b/pym/repoman/checks/ebuilds/thirdpartymirrors.py @@ -5,13 +5,15 @@ import portage class ThirdPartyMirrors(object): def __init__(self, repoman_settings, qatracker): - # Build a regex from thirdpartymirrors for the SRC_URI.mirror check. + # TODO: Build a regex instead here, for the SRC_URI.mirror check. self.thirdpartymirrors = {} - for k, v in repoman_settings.thirdpartymirrors().items(): - for v in v: - if not v.endswith(/): - v += / - self.thirdpartymirrors[v] = k + profile_thirdpartymirrors = repoman_settings.thirdpartymirrors().items() + for mirror_alias, mirrors in profile_thirdpartymirrors: + for mirror in mirrors: + if not mirror.endswith(/): + mirror += / + self.thirdpartymirrors[mirror] = mirror_alias + self.qatracker = qatracker
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/vcs/
commit: a694c550f5a43222a135ee65e4fead1bc544feba Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 16:23:20 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Mon Jun 2 16:23:20 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a694c550 repoman/vcs/vcsstatus.py: Only check VCS status in a VCS --- pym/repoman/vcs/vcsstatus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py index eedf866..f984832 100644 --- a/pym/repoman/vcs/vcsstatus.py +++ b/pym/repoman/vcs/vcsstatus.py @@ -22,7 +22,7 @@ class VCSStatus(object): def check(self, check_not_added): - if check_not_added: + if self.vcs and check_not_added: vcscheck = getattr(self, 'check_%s' % self.vcs) vcscheck()
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: f2b67b8b0f08272ee841c3cde4ebe4c4e682383a Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 17:00:53 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Mon Jun 2 17:00:53 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f2b67b8b repoman/main.py: Add global_pmaskdict param to has_global_mask call --- pym/repoman/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index fcf60f7..f32ddcd 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -481,7 +481,7 @@ for xpkg in effective_scanlist: (xpkg, y_ebuild, bad_stable_keywords)) del bad_stable_keywords - if keywords and not has_global_mask(pkg): + if keywords and not has_global_mask(pkg, global_pmaskdict): qatracker.add_error(LIVEVCS.unmasked, ebuild.relative_path) if options.ignore_arches:
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/commit/
commit: 40dfedf8607e2c43241b72fe6d5f9b4c7f8ddea9 Author: Tom Wijsman tomwij AT gentoo DOT org AuthorDate: Mon Jun 2 18:28:34 2014 + Commit: Tom Wijsman tomwij AT gentoo DOT org CommitDate: Mon Jun 2 18:28:34 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=40dfedf8 repoman: Fix up commit imports and calls --- pym/repoman/argparser.py | 3 ++- pym/repoman/copyrights.py| 2 +- pym/repoman/main.py | 24 ++-- pym/repoman/modules/commit/repochecks.py | 3 ++- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/pym/repoman/argparser.py b/pym/repoman/argparser.py index 19ec6e9..393d755 100644 --- a/pym/repoman/argparser.py +++ b/pym/repoman/argparser.py @@ -6,6 +6,7 @@ import logging import portage +import sys from portage import util from portage.util._argparse import ArgumentParser @@ -167,7 +168,7 @@ def parse_args(argv, qahelp, repoman_default_opts): opts, args = parser.parse_known_args(argv[1:]) if not opts.ignore_default_opts: - default_opts = portage.util.shlex_split(repoman_default_opts) + default_opts = util.shlex_split(repoman_default_opts) if default_opts: opts, args = parser.parse_known_args(default_opts + sys.argv[1:]) diff --git a/pym/repoman/copyrights.py b/pym/repoman/copyrights.py index 231857f..01ce42f 100644 --- a/pym/repoman/copyrights.py +++ b/pym/repoman/copyrights.py @@ -83,7 +83,7 @@ def update_copyright(fn_path, year, pretend=False): new_header.append(line) break - line = _update_copyright_year(year, line) + line = update_copyright_year(year, line) new_header.append(line) difflines = 0 diff --git a/pym/repoman/main.py b/pym/repoman/main.py index f32ddcd..ac36132 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -55,7 +55,7 @@ from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.ebuild import Ebuild from repoman.errors import err -from repoman.modules import commit +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, qawarnings, qacats, max_desc_len, missingvars, @@ -186,8 +186,8 @@ repolevel = len(reposplit) ### if options.mode == 'commit': - commit.repochecks.commit_check(repolevel, reposplit) - commit.repochecks.conflict_check(vcs_settings, options) + repochecks.commit_check(repolevel, reposplit) + repochecks.conflict_check(vcs_settings, options) ### @@ -264,7 +264,8 @@ check_ebuild_notadded = not \ effective_scanlist = scanlist if options.if_modified == y: effective_scanlist = sorted(vcs_files_to_cps( - chain(changed.changed, changed.new, changed.removed))) + chain(changed.changed, changed.new, changed.removed), + repolevel, reposplit, categories)) for xpkg in effective_scanlist: # ebuilds and digests added to cvs respectively. @@ -1263,7 +1264,8 @@ else: else: commitmessage = utilities.get_commit_message_with_stdin() except KeyboardInterrupt: - exithandler() + logging.fatal(Interrupted; exiting...) + sys.exit(1) if not commitmessage or not commitmessage.strip(): print(* no commit message? aborting commit.) sys.exit(1) @@ -1323,7 +1325,8 @@ else: logging.info(checking for unmodified ChangeLog files) committer_name = utilities.get_committer_name(env=repoman_settings) for x in sorted(vcs_files_to_cps( - chain(myupdates, mymanifests, myremoved))): + chain(myupdates, mymanifests, myremoved), + repolevel, reposplit, categories)): catdir, pkgdir = x.split(/) checkdir = repo_settings.repodir + / + x checkdir_relative = @@ -1463,7 +1466,7 @@ else: print(%s have headers that will change. % green(str(len(myheaders print( - * Files with headers will + * Files with headers will cause the manifests to be changed and committed separately.) logging.info(myupdates: %s, myupdates) @@ -1617,9 +1620,9 @@ else: doing the entire repository.\\n) if vcs_settings.vcs in ('cvs', 'svn') and (myupdates or myremoved): - for x in
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/, pym/repoman/checks/ebuilds/
commit: 94e326c7c6a443fd6b5df0c6a665da42548f1bf1 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue Jun 3 05:38:19 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue Jun 3 05:38:19 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=94e326c7 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 | 18 - 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(+), 30 deletions(-) diff --git a/pym/repoman/_portage.py b/pym/repoman/_portage.py new file mode 100644 index 000..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 83c2c3b..f6d9f79 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,
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/
commit: 7b48d08d50a9da5514190abc3c70a30372bd7c5d Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 01:00:05 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 01:00:05 2014 + 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 000..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
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: 1a270403eb361c287a09be622242f4d3ae316c4f Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 01:06:33 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 01:08:17 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1a270403 Repoman: Optimize, consolidate some XmlLint class useage --- pym/repoman/_xml.py | 4 ++-- pym/repoman/main.py | 7 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py index 1b98ede..513b62a 100644 --- a/pym/repoman/_xml.py +++ b/pym/repoman/_xml.py @@ -47,8 +47,8 @@ class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder): class XmlLint(object): - def __init__(self, metadata_dtd, options, repolevel, repoman_settings): - self.metadata_dtd = metadata_dtd + def __init__(self, options, repolevel, repoman_settings): + self.metadata_dtd = os.path.join(repoman_settings[DISTDIR], 'metadata.dtd') self._is_capable = False self.binary = None self._check_capable(options, repolevel, repoman_settings) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index f8bd264..af7c52b 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -259,12 +259,6 @@ dev_keywords = dev_keywords(profiles) qatracker = QATracker() - - -metadata_dtd = os.path.join(repoman_settings[DISTDIR], 'metadata.dtd') -xmllint = XmlLint(metadata_dtd, options, repolevel, repoman_settings) - -# if options.mode == manifest: pass @@ -607,6 +601,7 @@ for xpkg in effective_scanlist: # # Only carry out if in package directory or check forced if not metadata_bad: + xmllint = XmlLint(options, repolevel, repoman_settings) if not xmllint.check(checkdir): qatracker.add_error(metadata.bad, xpkg + /metadata.xml)
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: 3f96a3f6f4e7192110b0d5b51d1a1188ae0fbecb Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 01:01:31 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 01:01:31 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3f96a3f6 repoman/main.py: Rename manifester return variable 'skip' to 'continue_' --- pym/repoman/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 6a7ada7..f8bd264 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -333,8 +333,8 @@ for xpkg in effective_scanlist: # manifester = Manifests(options, repoman_settings) - skip = manifester.run(checkdir, portdb) - if skip: + continue_ = manifester.run(checkdir, portdb) + if continue_: continue ##
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/
commit: b808cf28d451235f53d38d70d04a30838dce07a7 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 01:48:31 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 01:48:31 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b808cf28 Repoman Manifests: Move some additional code to manifests.py Move the digest check to the Manifests class. Optimize usage to use the new qatracker system. --- pym/repoman/checks/ebuilds/manifests.py | 20 +++- pym/repoman/main.py | 14 -- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/pym/repoman/checks/ebuilds/manifests.py b/pym/repoman/checks/ebuilds/manifests.py index 53c3136..c9eda54 100644 --- a/pym/repoman/checks/ebuilds/manifests.py +++ b/pym/repoman/checks/ebuilds/manifests.py @@ -11,8 +11,9 @@ from portage.util import writemsg_level class Manifests(object): - def __init__(self, options, repoman_settings): + def __init__(self, options, qatracker, repoman_settings): self.options = options + self.qatracker = qatracker self.repoman_settings = repoman_settings self.digest_only = options.mode != 'manifest-check' and options.digest == 'y' @@ -41,7 +42,8 @@ class Manifests(object): level=logging.ERROR, noiselevel=-1) if not self.generated_manifest: - print(Unable to generate manifest.) + writemsg_level(Unable to generate manifest., + level=logging.ERROR, noiselevel=-1) failed = True if self.options.mode == manifest: @@ -64,11 +66,11 @@ class Manifests(object): if distfile in self.auto_assumed: portage.writemsg_stdout( %s::%s\n % (pf, distfile)) - - return True # continue, skip remaining loop code + # continue, skip remaining main loop code + return True elif failed: sys.exit(1) - return False # stay in the loop + return False def create_manifest(self, checkdir, fetchlist_dict): @@ -89,3 +91,11 @@ class Manifests(object): mf.write() finally: portage._doebuild_manifest_exempt_depend -= 1 + + + def digest_check(self, checkdir): + self.repoman_settings['O'] = checkdir + self.repoman_settings['PORTAGE_QUIET'] = '1' + if not portage.digestcheck([], self.repoman_settings, strict=1): + self.qatracker.add_error(manifest.bad, os.path.join(xpkg, 'Manifest')) + self.repoman_settings.pop('PORTAGE_QUIET', None) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index af7c52b..1649c9f 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -326,18 +326,12 @@ for xpkg in effective_scanlist: checkdir_relative = os.path.join(., checkdir_relative) # - manifester = Manifests(options, repoman_settings) - continue_ = manifester.run(checkdir, portdb) - if continue_: + manifester = Manifests(options, qatracker, repoman_settings) + if manifester.run(checkdir, portdb): continue -## - if not manifester.generated_manifest: - repoman_settings['O'] = checkdir - repoman_settings['PORTAGE_QUIET'] = '1' - if not portage.digestcheck([], repoman_settings, strict=1): - qatracker.add_error(manifest.bad, os.path.join(xpkg, 'Manifest')) - repoman_settings.pop('PORTAGE_QUIET', None) +manifester.digest_check(checkdir) +## if options.mode == 'manifest-check': continue
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/herds/, pym/repoman/checks/ebuilds/
commit: 299745b29c06427fa0968b168f6fa60f91390be7 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Mon Jun 2 03:35:06 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Mon Jun 2 03:35:06 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=299745b2 Repoman metadata.xml: Create a new PkgMetadata class Move the metadata.xml checks to its own class in checks/ebuilds/pkgmetadata.py. Move the herd_base determination to checks/herds/herdbase.py in get_herd_base(). --- pym/repoman/checks/ebuilds/pkgmetadata.py | 170 ++ pym/repoman/checks/herds/herdbase.py | 16 ++- pym/repoman/main.py | 148 +- 3 files changed, 190 insertions(+), 144 deletions(-) diff --git a/pym/repoman/checks/ebuilds/pkgmetadata.py b/pym/repoman/checks/ebuilds/pkgmetadata.py new file mode 100644 index 000..d40691d --- /dev/null +++ b/pym/repoman/checks/ebuilds/pkgmetadata.py @@ -0,0 +1,170 @@ + +'''Package Metadata Checks operations''' + +import sys + +from itertools import chain + +try: + import xml.etree.ElementTree + from xml.parsers.expat import ExpatError +except (SystemExit, KeyboardInterrupt): + raise +except (ImportError, SystemError, RuntimeError, Exception): + # broken or missing xml support + # http://bugs.python.org/issue14988 + msg = [Please enable python's \xml\ USE flag in order to use repoman.] + from portage.output import EOutput + out = EOutput() + for line in msg: + out.eerror(line) + sys.exit(1) + +import portage +from portage.exception import InvalidAtom +from portage import os +from portage import _encodings, _unicode_encode +from portage.dep import Atom + +from repoman.metadata import (metadata_xml_encoding, metadata_doctype_name, + metadata_dtd_uri, metadata_xml_declaration, parse_metadata_use) +from repoman.checks.herds.herdbase import get_herd_base +from repoman.checks.herds.metadata import check_metadata, UnknownHerdsError +from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint + + +class PkgMetadata(object): + '''Package metadata.xml checks''' + + def __init__(self, options, qatracker, repolevel, repoman_settings): + '''PkgMetadata init function + + @param options: ArgumentParser.parse_known_args(argv[1:]) options + @param qatracker: QATracker instance + @param repolevel: integer + @param repoman_settings: settings instance + ''' + self.options = options + self.qatracker = qatracker + self.repolevel = repolevel + self.repoman_settings = repoman_settings + self.musedict = {} + + + def check(self, xpkg, checkdir, checkdirlist): + '''Performs the checks on the metadata.xml for the package + + @param xpkg: the pacakge being checked + @param checkdir: string, directory path + @param checkdirlist: list of checkdir's + ''' + + self.musedict = {} + # metadata.xml file check + if metadata.xml not in checkdirlist: + self.qatracker.add_error(metadata.missing, xpkg + /metadata.xml) + # metadata.xml parse check + else: + metadata_bad = False + xml_info = {} + xml_parser = _XMLParser(xml_info, target=_MetadataTreeBuilder()) + + # read metadata.xml into memory + try: + _metadata_xml = xml.etree.ElementTree.parse( + _unicode_encode( + os.path.join(checkdir, metadata.xml), + encoding=_encodings['fs'], errors='strict'), + parser=xml_parser) + except (ExpatError, SyntaxError, EnvironmentError) as e: + metadata_bad = True + self.qatracker.add_error(metadata.bad, %s/metadata.xml: %s % (xpkg, e)) + del e + else: + if not hasattr(xml_parser, 'parser') or \ + sys.hexversion 0x207 or \ + (sys.hexversion 0x300 and sys.hexversion 0x302): + # doctype is not parsed with python 2.6 or 3.1 + pass + else: + if XML_DECLARATION not in xml_info: + self.qatracker.add_error(metadata.bad, +
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: b3f8adf37c195420511ebe3849ea0dffe14bd270 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Thu May 29 20:32:44 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Thu May 29 20:32:44 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b3f8adf3 repoman/main.py: Rename x variable in loop to xpkg This will help clarify what it is better. --- pym/repoman/main.py | 82 ++--- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 46cdefd..99238d9 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -321,14 +321,14 @@ if options.if_modified == y: effective_scanlist = sorted(vcs_files_to_cps( chain(changed.changed, changed.new, changed.removed))) -for x in effective_scanlist: +for xpkg in effective_scanlist: # ebuilds and digests added to cvs respectively. - logging.info(checking package %s % x) + logging.info(checking package %s % xpkg) # save memory by discarding xmatch caches from previous package(s) arch_xmatch_caches.clear() eadded = [] - catdir, pkgdir = x.split(/) - checkdir = repo_settings.repodir + / + x + catdir, pkgdir = xpkg.split(/) + checkdir = repo_settings.repodir + / + xpkg checkdir_relative = if repolevel 3: checkdir_relative = os.path.join(pkgdir, checkdir_relative) @@ -348,7 +348,7 @@ for x in effective_scanlist: repoman_settings['PORTAGE_QUIET'] = '1' if not portage.digestcheck([], repoman_settings, strict=1): stats[manifest.bad] += 1 - fails[manifest.bad].append(os.path.join(x, 'Manifest')) + fails[manifest.bad].append(os.path.join(xpkg, 'Manifest')) repoman_settings.pop('PORTAGE_QUIET', None) if options.mode == 'manifest-check': @@ -378,17 +378,17 @@ for x in effective_scanlist: except KeyError: allvalid = False stats[ebuild.syntax] += 1 - fails[ebuild.syntax].append(os.path.join(x, y)) + fails[ebuild.syntax].append(os.path.join(xpkg, y)) continue except IOError: allvalid = False stats[ebuild.output] += 1 - fails[ebuild.output].append(os.path.join(x, y)) + fails[ebuild.output].append(os.path.join(xpkg, y)) continue if not portage.eapi_is_supported(myaux[EAPI]): allvalid = False stats[EAPI.unsupported] += 1 - fails[EAPI.unsupported].append(os.path.join(x, y)) + fails[EAPI.unsupported].append(os.path.join(xpkg, y)) continue pkgs[pf] = Package( cpv=cpv, metadata=myaux, root_config=root_config, @@ -462,7 +462,7 @@ for x in effective_scanlist: if l[:-1][-7:] == .ebuild: stats[ebuild.notadded] += 1 fails[ebuild.notadded].append( - os.path.join(x, os.path.basename(l[:-1]))) + os.path.join(xpkg, os.path.basename(l[:-1]))) myf.close() if vcs_settings.vcs in (cvs, svn, bzr) and check_ebuild_notadded: @@ -570,7 +570,7 @@ for x in effective_scanlist: # so people can't hide 20k files in a subdirectory. while filesdirlist: y = filesdirlist.pop(0) - relative_path = os.path.join(x, files, y) + relative_path = os.path.join(xpkg, files, y) full_path = os.path.join(repo_settings.repodir, relative_path) try: mystat = os.stat(full_path) @@ -594,11 +594,11 @@ for x in effective_scanlist: elif mystat.st_size 61440: stats[file.size.fatal] += 1 fails[file.size.fatal].append( - (%d KiB) %s/files/%s % (mystat.st_size // 1024, x, y)) + (%d KiB) %s/files/%s % (mystat.st_size // 1024, xpkg, y)) elif mystat.st_size 20480: stats[file.size] += 1 fails[file.size].append( - (%d KiB) %s/files/%s % (mystat.st_size // 1024,
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/
commit: 3418e0f2e3fd983c61a1731eee6bb737325f9cba Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Thu May 29 22:29:13 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Thu May 29 22:36:21 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3418e0f2 repoman/main.py: Split out vcsstatus.py with VCSStatus class This class scans the vcs to determine ebuilds not added. --- pym/repoman/main.py | 81 +++-- pym/repoman/vcs/vcsstatus.py | 137 +++ 2 files changed, 146 insertions(+), 72 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index ee70735..f48c8ba 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -83,6 +83,7 @@ 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, vcs_new_changed, VCSSettings) +from repoman.vcs.vcsstatus import VCSStatus from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint @@ -449,78 +450,14 @@ for xpkg in effective_scanlist: if f is not None: f.close() - if vcs_settings.vcs in (git, hg) and check_ebuild_notadded: - if vcs_settings.vcs == git: - myf = repoman_popen( - git ls-files --others %s % - (portage._shell_quote(checkdir_relative),)) - if vcs_settings.vcs == hg: - myf = repoman_popen( - hg status --no-status --unknown %s % - (portage._shell_quote(checkdir_relative),)) - for l in myf: - if l[:-1][-7:] == .ebuild: - stats[ebuild.notadded] += 1 - fails[ebuild.notadded].append( - os.path.join(xpkg, os.path.basename(l[:-1]))) - myf.close() - - if vcs_settings.vcs in (cvs, svn, bzr) and check_ebuild_notadded: - try: - if vcs_settings.vcs == cvs: - myf = open(checkdir + /CVS/Entries, r) - if vcs_settings.vcs == svn: - myf = repoman_popen( - svn status --depth=files --verbose + - portage._shell_quote(checkdir)) - if vcs_settings.vcs == bzr: - myf = repoman_popen( - bzr ls -v --kind=file + - portage._shell_quote(checkdir)) - myl = myf.readlines() - myf.close() - for l in myl: - if vcs_settings.vcs == cvs: - if l[0] != /: - continue - splitl = l[1:].split(/) - if not len(splitl): - continue - if splitl[0][-7:] == .ebuild: - eadded.append(splitl[0][:-7]) - if vcs_settings.vcs == svn: - if l[:1] == ?: - continue - if l[:7] == ' ': - # tree conflict, new in subversion 1.6 - continue - l = l.split()[-1] - if l[-7:] == .ebuild: - eadded.append(os.path.basename(l[:-7])) - if vcs_settings.vcs == bzr: - if l[1:2] == ?: - continue - l = l.split()[-1] - if l[-7:] == .ebuild: - eadded.append(os.path.basename(l[:-7])) - if vcs_settings.vcs == svn: - myf = repoman_popen( - svn status + - portage._shell_quote(checkdir)) - myl = myf.readlines() - myf.close() - for l in myl: - if l[0] == A: - l = l.rstrip().split(' ')[-1] - if l[-7:] ==
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: 71f8e844940eba8ba73d833e9e786a7ea65f2bfd Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue May 27 17:31:19 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue May 27 17:31:19 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=71f8e844 repoman/main.py: Create ebuild.py and Ebuild class This moves all relavent data to a class for a common access point. It also adds an untracked function. --- pym/repoman/ebuild.py | 30 ++ pym/repoman/main.py | 88 --- 2 files changed, 71 insertions(+), 47 deletions(-) diff --git a/pym/repoman/ebuild.py b/pym/repoman/ebuild.py new file mode 100644 index 000..fbe25a9 --- /dev/null +++ b/pym/repoman/ebuild.py @@ -0,0 +1,30 @@ + + +from portage import os + + +class Ebuild(object): + '''Class to run primary checks on ebuilds''' + + def __init__(self, repo_settings, repolevel, pkgdir, catdir, vcs_settings, x, y): + self.vcs_settings = vcs_settings + self.relative_path = os.path.join(x, y + .ebuild) + self.full_path = os.path.join(repo_settings.repodir, self.relative_path) + self.ebuild_path = y + .ebuild + if repolevel 3: + self.ebuild_path = os.path.join(pkgdir, self.ebuild_path) + if repolevel 2: + self.ebuild_path = os.path.join(catdir, self.ebuild_path) + self.ebuild_path = os.path.join(., self.ebuild_path) + + + def untracked(self, check_ebuild_notadded, y, eadded): + do_check = self.vcs_settings.vcs in (cvs, svn, bzr) + really_notadded = check_ebuild_notadded and y not in eadded + + if do_check and really_notadded: + # ebuild not added to vcs + return True + return False + + diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 158323e..9e2ba76 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -67,6 +67,7 @@ from repoman.argparser import parse_args from repoman.checks.ebuilds.checks import run_checks, checks_init from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors from repoman.checks.herds.herdbase import make_herd_base +from repoman.ebuild import Ebuild from repoman.errors import err from repoman.metadata import (metadata_xml_encoding, metadata_doctype_name, metadata_dtd_uri, metadata_xml_declaration) @@ -806,22 +807,16 @@ for x in effective_scanlist: used_useflags = set() for y in ebuildlist: - relative_path = os.path.join(x, y + .ebuild) - full_path = os.path.join(repo_settings.repodir, relative_path) - ebuild_path = y + .ebuild - if repolevel 3: - ebuild_path = os.path.join(pkgdir, ebuild_path) - if repolevel 2: - ebuild_path = os.path.join(catdir, ebuild_path) - ebuild_path = os.path.join(., ebuild_path) +## + ebuild = Ebuild(repo_settings, repolevel, pkgdir, catdir, vcs_settings, x, y) +## + if check_changelog and not changelog_modified \ - and ebuild_path in changed.new_ebuilds: + and ebuild.ebuild_path in changed.new_ebuilds: stats['changelog.ebuildadded'] += 1 - fails['changelog.ebuildadded'].append(relative_path) + fails['changelog.ebuildadded'].append(ebuild.relative_path) - vcs_settings.vcs_is_cvs_or_svn_or_bzr = vcs_settings.vcs in (cvs, svn, bzr) - check_ebuild_really_notadded = check_ebuild_notadded and y not in eadded - if vcs_settings.vcs_is_cvs_or_svn_or_bzr and check_ebuild_really_notadded: + if ebuild.untracked(check_ebuild_notadded, y, eadded): # ebuild not added to vcs stats[ebuild.notadded] += 1 fails[ebuild.notadded].append(x + / + y + .ebuild) @@ -850,7 +845,7 @@ for x in effective_scanlist: for k, msgs in pkg.invalid.items(): for msg in msgs: stats[k] += 1 - fails[k].append(%s: %s % (relative_path, msg)) + fails[k].append(%s: %s % (ebuild.relative_path, msg)) continue myaux = pkg._metadata @@ -861,12 +856,12 @@ for x in effective_scanlist: if repo_settings.repo_config.eapi_is_banned(eapi): stats[repo.eapi.banned] += 1 fails[repo.eapi.banned].append( - %s: %s % (relative_path, eapi)) +
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/
commit: 750404bb3e8ab5bccdf9d653e8587610fd034e89 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue May 27 07:13:32 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue May 27 07:13:32 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=750404bb repoman/main.py: Break out a new ebuild check, ThirdPartyMirrors Consolodate the code from 2 locations into one class. --- pym/repoman/checks/ebuilds/thirdpartymirrors.py | 40 + pym/repoman/main.py | 32 +--- 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/pym/repoman/checks/ebuilds/thirdpartymirrors.py b/pym/repoman/checks/ebuilds/thirdpartymirrors.py new file mode 100644 index 000..976a62c --- /dev/null +++ b/pym/repoman/checks/ebuilds/thirdpartymirrors.py @@ -0,0 +1,40 @@ + +import portage + + +class ThirdPartyMirrors(object): + + def __init__(self, repoman_settings): + # Build a regex from thirdpartymirrors for the SRC_URI.mirror check. + self.thirdpartymirrors = {} + for k, v in repoman_settings.thirdpartymirrors().items(): + for v in v: + if not v.endswith(/): + v += / + self.thirdpartymirrors[v] = k + self.stats = 0 + self.fails = [] + + + def check(self, myaux, relative_path): + # reset our stats in case this is a repeat run + self.stats = 0 + self.fails = [] + # Check that URIs don't reference a server from thirdpartymirrors. + for uri in portage.dep.use_reduce( + myaux[SRC_URI], matchall=True, is_src_uri=True, + eapi=myaux[EAPI], flat=True): + contains_mirror = False + for mirror, mirror_alias in self.thirdpartymirrors.items(): + if uri.startswith(mirror): + contains_mirror = True + break + if not contains_mirror: + continue + + new_uri = mirror://%s/%s % (mirror_alias, uri[len(mirror):]) + self.stats += 1 + self.fails.append( + %s: '%s' found in thirdpartymirrors, use '%s' % + (relative_path, mirror, new_uri)) + return diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 49ad79d..158323e 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -65,6 +65,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.thirdpartymirrors import ThirdPartyMirrors from repoman.checks.herds.herdbase import make_herd_base from repoman.errors import err from repoman.metadata import (metadata_xml_encoding, metadata_doctype_name, @@ -303,14 +304,6 @@ if options.include_arches: check_ebuild_notadded = not \ (vcs_settings.vcs == svn and repolevel 3 and options.mode != commit) -# Build a regex from thirdpartymirrors for the SRC_URI.mirror check. -thirdpartymirrors = {} -for k, v in repoman_settings.thirdpartymirrors().items(): - for v in v: - if not v.endswith(/): - v += / - thirdpartymirrors[v] = k - try: herd_base = make_herd_base( os.path.join(repoman_settings[PORTDIR], metadata/herds.xml)) @@ -887,23 +880,12 @@ for x in effective_scanlist: (relative_path, k, m.start() + 1)) if not src_uri_error: - # Check that URIs don't reference a server from thirdpartymirrors. - for uri in portage.dep.use_reduce( - myaux[SRC_URI], matchall=True, is_src_uri=True, eapi=eapi, flat=True): - contains_mirror = False - for mirror, mirror_alias in thirdpartymirrors.items(): - if uri.startswith(mirror): - contains_mirror = True - break - if not contains_mirror: - continue - - new_uri = mirror://%s/%s % (mirror_alias, uri[len(mirror):]) - stats[SRC_URI.mirror] += 1 - fails[SRC_URI.mirror].append( - %s: '%s' found in thirdpartymirrors, use '%s' % - (relative_path,
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/
commit: c74159c33da8945c45b98974274d3db17b882b44 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue May 27 17:33:12 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue May 27 17:47:48 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c74159c3 repoman/main.py: Create checks/ebuilds/manifests.py and Manifests class This moves manifest checks and creation to it's own class --- pym/repoman/checks/ebuilds/manifests.py | 91 + pym/repoman/main.py | 76 +++ 2 files changed, 99 insertions(+), 68 deletions(-) diff --git a/pym/repoman/checks/ebuilds/manifests.py b/pym/repoman/checks/ebuilds/manifests.py new file mode 100644 index 000..53c3136 --- /dev/null +++ b/pym/repoman/checks/ebuilds/manifests.py @@ -0,0 +1,91 @@ + +import logging +import sys + +import portage +from portage import os +from portage.package.ebuild.digestgen import digestgen +from portage.util import writemsg_level + + +class Manifests(object): + + + def __init__(self, options, repoman_settings): + self.options = options + 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): + if self.options.pretend: + return False + if self.options.mode in (manifest, 'commit', 'fix') or self.digest_only: + failed = False + self.auto_assumed = set() + fetchlist_dict = portage.FetchlistDict( + checkdir, self.repoman_settings, portdb) + if self.options.mode == 'manifest' and self.options.force: + portage._doebuild_manifest_exempt_depend += 1 + self.create_manifest(checkdir, fetchlist_dict) + self.repoman_settings[O] = checkdir + try: + self.generated_manifest = digestgen( + mysettings=self.repoman_settings, myportdb=portdb) + except portage.exception.PermissionDenied as e: + self.generated_manifest = False + writemsg_level( + !!! Permission denied: '%s'\n % (e,), + level=logging.ERROR, noiselevel=-1) + + if not self.generated_manifest: + print(Unable to generate manifest.) + failed = True + + if self.options.mode == manifest: + if not failed and self.options.force and self.auto_assumed and \ + 'assume-digests' in self.repoman_settings.features: + # Show which digests were assumed despite the --force option + # being given. This output will already have been shown by + # digestgen() if assume-digests is not enabled, so only show + # it here if assume-digests is enabled. + pkgs = list(fetchlist_dict) + pkgs.sort() + portage.writemsg_stdout( + digest.assumed %s % + portage.output.colorize( + WARN, str(len(self.auto_assumed)).rjust(18)) + \n) + for cpv in pkgs: + fetchmap = fetchlist_dict[cpv] + pf = portage.catsplit(cpv)[1] + for distfile in sorted(fetchmap): + if distfile in self.auto_assumed: + portage.writemsg_stdout( + %s::%s\n % (pf, distfile)) + + return True # continue, skip remaining loop code + elif failed: + sys.exit(1) + return False # stay in the loop + + + def create_manifest(self, checkdir, fetchlist_dict): + try: + distdir = self.repoman_settings['DISTDIR'] + mf = self.repoman_settings.repositories.get_repo_for_location( +
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: ccaae712e8d42f5d9bbcc38195d8c072a7b9bc41 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Thu May 29 20:57:39 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Thu May 29 20:57:39 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ccaae712 repoman/main.py: Replace y with y_ebuild in the loop This too helps clarify what it is. --- pym/repoman/main.py | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 99238d9..ee70735 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -746,9 +746,9 @@ for xpkg in effective_scanlist: # detect unused local USE-descriptions used_useflags = set() - for y in ebuildlist: + for y_ebuild in ebuildlist: ## - ebuild = Ebuild(repo_settings, repolevel, pkgdir, catdir, vcs_settings, xpkg, y) + ebuild = Ebuild(repo_settings, repolevel, pkgdir, catdir, vcs_settings, xpkg, y_ebuild) ## if check_changelog and not changelog_modified \ @@ -756,11 +756,11 @@ for xpkg in effective_scanlist: stats['changelog.ebuildadded'] += 1 fails['changelog.ebuildadded'].append(ebuild.relative_path) - if ebuild.untracked(check_ebuild_notadded, y, eadded): + if ebuild.untracked(check_ebuild_notadded, y_ebuild, eadded): # ebuild not added to vcs stats[ebuild.notadded] += 1 - fails[ebuild.notadded].append(xpkg + / + y + .ebuild) - myesplit = portage.pkgsplit(y) + fails[ebuild.notadded].append(xpkg + / + y_ebuild + .ebuild) + myesplit = portage.pkgsplit(y_ebuild) is_bad_split = myesplit is None or myesplit[0] != xpkg.split(/)[-1] @@ -770,15 +770,15 @@ for xpkg in effective_scanlist: if is_pv_toolong or is_pv_toolong2: stats[ebuild.invalidname] += 1 - fails[ebuild.invalidname].append(xpkg + / + y + .ebuild) + fails[ebuild.invalidname].append(xpkg + / + y_ebuild + .ebuild) continue elif myesplit[0] != pkgdir: print(pkgdir, myesplit[0]) stats[ebuild.namenomatch] += 1 - fails[ebuild.namenomatch].append(xpkg + / + y + .ebuild) + fails[ebuild.namenomatch].append(xpkg + / + y_ebuild + .ebuild) continue - pkg = pkgs[y] + pkg = pkgs[y_ebuild] if pkg.invalid: allvalid = False @@ -834,7 +834,7 @@ for xpkg in effective_scanlist: continue myqakey = missingvars[pos] + .missing stats[myqakey] += 1 - fails[myqakey].append(xpkg + / + y + .ebuild) + fails[myqakey].append(xpkg + / + y_ebuild + .ebuild) if catdir == virtual: for var in (HOMEPAGE, LICENSE): @@ -868,7 +868,7 @@ for xpkg in effective_scanlist: stats[KEYWORDS.stable] += 1 fails[KEYWORDS.stable].append( %s/%s.ebuild added with stable keywords: %s % - (xpkg, y, .join(stable_keywords))) + (xpkg, y_ebuild, .join(stable_keywords))) ebuild_archs = set( kw.lstrip(~) for kw in keywords if not kw.startswith(-)) @@ -897,7 +897,7 @@ for xpkg in effective_scanlist: haskeyword = True if not haskeyword: stats[KEYWORDS.stupid] += 1 - fails[KEYWORDS.stupid].append(xpkg + / + y + .ebuild) + fails[KEYWORDS.stupid].append(xpkg + / + y_ebuild + .ebuild) Ebuilds that inherit a Live eclass (darcs,subversion,git,cvs,etc..) should @@ -914,7 +914,7 @@ for xpkg in effective_scanlist: stats[LIVEVCS.stable] += 1 fails[LIVEVCS.stable].append( %s/%s.ebuild with stable keywords:%s % - (xpkg, y, bad_stable_keywords)) + (xpkg, y_ebuild, bad_stable_keywords)) del bad_stable_keywords if keywords and not has_global_mask(pkg): @@ -959,7 +959,7 @@ for xpkg in
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/, pym/repoman/checks/ebuilds/
commit: 807324e57f63918e0ee64837608caaa28a0e53a6 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Fri May 30 18:36:11 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Fri May 30 19:22:51 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=807324e5 Repoman: Create a new QATracker class Make use of the new QATracker class to track all fails. Use the length of each tracker for stats count. Only store trackers if they occurred. QATracker roughed in for tracking warnings as well as errors. --- pym/repoman/checks/ebuilds/thirdpartymirrors.py | 11 +- pym/repoman/main.py | 261 +--- pym/repoman/qa_data.py | 16 +- pym/repoman/qa_tracker.py | 46 + pym/repoman/vcs/vcsstatus.py| 23 +-- 5 files changed, 161 insertions(+), 196 deletions(-) diff --git a/pym/repoman/checks/ebuilds/thirdpartymirrors.py b/pym/repoman/checks/ebuilds/thirdpartymirrors.py index 976a62c..cce61f6 100644 --- a/pym/repoman/checks/ebuilds/thirdpartymirrors.py +++ b/pym/repoman/checks/ebuilds/thirdpartymirrors.py @@ -4,7 +4,7 @@ import portage class ThirdPartyMirrors(object): - def __init__(self, repoman_settings): + def __init__(self, repoman_settings, qatracker): # Build a regex from thirdpartymirrors for the SRC_URI.mirror check. self.thirdpartymirrors = {} for k, v in repoman_settings.thirdpartymirrors().items(): @@ -12,14 +12,10 @@ class ThirdPartyMirrors(object): if not v.endswith(/): v += / self.thirdpartymirrors[v] = k - self.stats = 0 - self.fails = [] + self.qatracker = qatracker def check(self, myaux, relative_path): - # reset our stats in case this is a repeat run - self.stats = 0 - self.fails = [] # Check that URIs don't reference a server from thirdpartymirrors. for uri in portage.dep.use_reduce( myaux[SRC_URI], matchall=True, is_src_uri=True, @@ -33,8 +29,7 @@ class ThirdPartyMirrors(object): continue new_uri = mirror://%s/%s % (mirror_alias, uri[len(mirror):]) - self.stats += 1 - self.fails.append( + self.qatracker.add_error(SRC_URI.mirror, %s: '%s' found in thirdpartymirrors, use '%s' % (relative_path, mirror, new_uri)) return diff --git a/pym/repoman/main.py b/pym/repoman/main.py index f48c8ba..3a1ff7a 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -77,6 +77,7 @@ 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, ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict) +from qa_tracker import QATracker from repoman.repos import has_global_mask, RepoSettings, repo_metadata from repoman.scan import Changes, scan from repoman._subprocess import repoman_popen, repoman_getstatusoutput @@ -258,12 +259,7 @@ scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings) dev_keywords = dev_keywords(profiles) -stats = {} -fails = {} - -for x in qacats: - stats[x] = 0 - fails[x] = [] +qatracker = QATracker() @@ -348,8 +344,7 @@ for xpkg in effective_scanlist: repoman_settings['O'] = checkdir repoman_settings['PORTAGE_QUIET'] = '1' if not portage.digestcheck([], repoman_settings, strict=1): - stats[manifest.bad] += 1 - fails[manifest.bad].append(os.path.join(xpkg, 'Manifest')) + qatracker.add_error(manifest.bad, os.path.join(xpkg, 'Manifest')) repoman_settings.pop('PORTAGE_QUIET', None) if options.mode == 'manifest-check': @@ -368,8 +363,7 @@ for xpkg in effective_scanlist: os.stat(os.path.join(checkdir, y)).st_mode) 0o111 if file_is_executable: - stats[file.executable] += 1 - fails[file.executable].append(os.path.join(checkdir, y)) + qatracker.add_error(file.executable, os.path.join(checkdir, y)) if file_is_ebuild: pf = y[:-7] ebuildlist.append(pf) @@ -378,18 +372,15 @@ for xpkg in effective_scanlist: myaux = dict(zip(allvars, portdb.aux_get(cpv, allvars)))
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: 9b19b5835abf159a95a242719400c47fd96f4aa3 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue May 27 03:54:32 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue May 27 06:04:24 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9b19b583 repoman/main/py: Create new scan.py and scan() This moves the main scan code out to a function. Comment out some unused variables. --- pym/repoman/main.py | 45 + pym/repoman/scan.py | 50 ++ 2 files changed, 55 insertions(+), 40 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 8e15e76..2697b1b 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -66,15 +66,16 @@ 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.herds.herdbase import make_herd_base -from repoman.errors import caterror, err from repoman.metadata import (fetch_metadata_dtd, metadata_xml_encoding, metadata_doctype_name, metadata_dtd_uri, metadata_xml_declaration) +from repoman.errors import err 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, ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.repos import has_global_mask, RepoSettings, repo_metadata +from repoman.scan import 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, @@ -264,47 +265,11 @@ if not uselist: logging.fatal(Couldn't find use.desc?) sys.exit(1) -scanlist = [] -if repolevel == 2: - # we are inside a category directory - catdir = reposplit[-1] - if catdir not in categories: - caterror(catdir, repo_settings.repodir) - mydirlist = os.listdir(startdir) - for x in mydirlist: - if x == CVS or x.startswith(.): - continue - if os.path.isdir(startdir + / + x): - scanlist.append(catdir + / + x) - repo_subdir = catdir + os.sep -elif repolevel == 1: - for x in categories: - if not os.path.isdir(startdir + / + x): - continue - for y in os.listdir(startdir + / + x): - if y == CVS or y.startswith(.): - continue - if os.path.isdir(startdir + / + x + / + y): - scanlist.append(x + / + y) - repo_subdir = -elif repolevel == 3: - catdir = reposplit[-2] - if catdir not in categories: - caterror(catdir,repo_settings.repodir) - scanlist.append(catdir + / + reposplit[-1]) - repo_subdir = scanlist[-1] + os.sep -else: - msg = 'Repoman is unable to determine PORTDIR or PORTDIR_OVERLAY' + \ - ' from the current working directory' - logging.critical(msg) - sys.exit(1) - -repo_subdir_len = len(repo_subdir) -scanlist.sort() + -logging.debug( - Found the following packages to scan:\n%s % '\n'.join(scanlist)) +scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings) + dev_keywords = dev_keywords(profiles) diff --git a/pym/repoman/scan.py b/pym/repoman/scan.py new file mode 100644 index 000..575069f --- /dev/null +++ b/pym/repoman/scan.py @@ -0,0 +1,50 @@ + +import logging +import os +import sys + +from repoman.errors import caterror + +def scan(repolevel, reposplit, startdir, categories, repo_settings): + scanlist = [] + if repolevel == 2: + # we are inside a category directory + catdir = reposplit[-1] + if catdir not in categories: + caterror(catdir, repo_settings.repodir) + mydirlist = os.listdir(startdir) + for x in mydirlist: + if x == CVS or x.startswith(.): + continue + if os.path.isdir(startdir + / + x): + scanlist.append(catdir + / + x) + #repo_subdir = catdir + os.sep + elif repolevel == 1: + for x in categories: + if not os.path.isdir(startdir + / + x): + continue + for y in os.listdir(startdir + / + x): + if y == CVS or y.startswith(.): + continue + if
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: d9feded23ad346756be0d6e55568a1a9ff1dfbe5 Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue May 27 04:09:27 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue May 27 06:04:40 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d9feded2 repoman/main.pt: Move some additional code to repos.py --- pym/repoman/main.py | 23 ++- pym/repoman/repos.py | 24 ++-- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 2697b1b..836ca1e 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -232,8 +232,8 @@ else: ### # get lists of valid keywords, licenses, and use -new_data = repo_metadata(repo_settings.portdb) -kwlist, liclist, uselist, profile_list, global_pmaskdict = new_data +new_data = repo_metadata(repo_settings.portdb, repoman_settings) +kwlist, liclist, uselist, profile_list, global_pmaskdict, liclist_deprecated = new_data repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist)) repoman_settings.backup_changes('PORTAGE_ARCHLIST') @@ -248,25 +248,6 @@ check_profiles(profiles, repoman_settings.archlist()) -liclist_deprecated = set() -if DEPRECATED in repoman_settings._license_manager._license_groups: - liclist_deprecated.update( - repoman_settings._license_manager.expandLicenseTokens([@DEPRECATED])) - -if not liclist: - logging.fatal(Couldn't find licenses?) - sys.exit(1) - -if not kwlist: - logging.fatal(Couldn't read KEYWORDS from arch.list) - sys.exit(1) - -if not uselist: - logging.fatal(Couldn't find use.desc?) - sys.exit(1) - - - scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings) diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py index d5eaf60..16de8bf 100644 --- a/pym/repoman/repos.py +++ b/pym/repoman/repos.py @@ -148,8 +148,27 @@ class RepoSettings(object): logging.error(line) sys.exit(1) +def list_checks(kwlist, liclist, uselist, repoman_settings): + liclist_deprecated = set() + if DEPRECATED in repoman_settings._license_manager._license_groups: + liclist_deprecated.update( + repoman_settings._license_manager.expandLicenseTokens([@DEPRECATED])) -def repo_metadata(portdb): + if not liclist: + logging.fatal(Couldn't find licenses?) + sys.exit(1) + + if not kwlist: + logging.fatal(Couldn't read KEYWORDS from arch.list) + sys.exit(1) + + if not uselist: + logging.fatal(Couldn't find use.desc?) + sys.exit(1) + return liclist_deprecated + + +def repo_metadata(portdb, repoman_settings): # get lists of valid keywords, licenses, and use kwlist = set() liclist = set() @@ -236,7 +255,8 @@ def repo_metadata(portdb): global_pmaskdict.setdefault(x.cp, []).append(x) del global_pmasklines - return (kwlist, liclist, uselist, profile_list, global_pmaskdict) + return (kwlist, liclist, uselist, profile_list, global_pmaskdict, + list_checks(kwlist, liclist, uselist, repoman_settings)) def has_global_mask(pkg, global_pmaskdict):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: d82b7a95d697435dffd80028df21517e8c5fda7d Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue May 27 06:03:33 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue May 27 06:04:40 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d82b7a95 repoman/main.py: Create a new Changes class This new class is to scan for and hold the changes in the repo. Later it will act as a manager class to run the individual VCS plugin modules scan function. --- pym/repoman/main.py | 103 +- pym/repoman/scan.py | 127 2 files changed, 139 insertions(+), 91 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index e03788f..49ad79d 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -75,7 +75,7 @@ from repoman.qa_data import (format_qa_output, format_qa_output_column, qahelp, qawarnings, qacats, no_exec, allvars, max_desc_len, missingvars, ruby_deprecated, suspect_virtual, suspect_rdepend, valid_restrict) from repoman.repos import has_global_mask, RepoSettings, repo_metadata -from repoman.scan import scan +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, @@ -275,91 +275,12 @@ elif options.pretend: else: print(green(\nRepoMan scours the neighborhood...)) -new_ebuilds = set() -modified_ebuilds = set() -modified_changelogs = set() -mychanged = [] -mynew = [] -myremoved = [] - -if vcs_settings.vcs == cvs: - mycvstree = cvstree.getentries(./, recursive=1) - mychanged = cvstree.findchanged(mycvstree, recursive=1, basedir=./) - mynew = cvstree.findnew(mycvstree, recursive=1, basedir=./) - if options.if_modified == y: - myremoved = cvstree.findremoved(mycvstree, recursive=1, basedir=./) - -elif vcs_settings.vcs == svn: - with repoman_popen(svn status) as f: - svnstatus = f.readlines() - mychanged = [ - ./ + elem.split()[-1:][0] - for elem in svnstatus - if elem and elem[:1] in MR] - mynew = [ - ./ + elem.split()[-1:][0] - for elem in svnstatus - if elem.startswith(A)] - if options.if_modified == y: - myremoved = [ - ./ + elem.split()[-1:][0] - for elem in svnstatus - if elem.startswith(D)] - -elif vcs_settings.vcs == git: - with repoman_popen( - git diff-index --name-only - --relative --diff-filter=M HEAD) as f: - mychanged = f.readlines() - mychanged = [./ + elem[:-1] for elem in mychanged] - - with repoman_popen( - git diff-index --name-only - --relative --diff-filter=A HEAD) as f: - mynew = f.readlines() - mynew = [./ + elem[:-1] for elem in mynew] - if options.if_modified == y: - with repoman_popen( - git diff-index --name-only - --relative --diff-filter=D HEAD) as f: - myremoved = f.readlines() - myremoved = [./ + elem[:-1] for elem in myremoved] - -elif vcs_settings.vcs == bzr: - with repoman_popen(bzr status -S .) as f: - bzrstatus = f.readlines() - mychanged = [ - ./ + elem.split()[-1:][0].split('/')[-1:][0] - for elem in bzrstatus - if elem and elem[1:2] == M] - mynew = [ - ./ + elem.split()[-1:][0].split('/')[-1:][0] - for elem in bzrstatus - if elem and (elem[1:2] == NK or elem[0:1] == R)] - if options.if_modified == y: - myremoved = [ - ./ + elem.split()[-3:-2][0].split('/')[-1:][0] - for elem in bzrstatus - if elem and (elem[1:2] == K or elem[0:1] == R)] +# -elif vcs_settings.vcs == hg: - with repoman_popen(hg status --no-status --modified .) as f: - mychanged = f.readlines() - mychanged = [./ + elem.rstrip() for elem in mychanged] - with repoman_popen(hg status --no-status --added .) as f: - mynew = f.readlines() - mynew = [./ + elem.rstrip() for elem in mynew] - if options.if_modified == y: - with repoman_popen(hg status --no-status --removed .) as f: - myremoved = f.readlines() - myremoved = [./ + elem.rstrip() for elem in myremoved] +changed = Changes(options) +changed.scan(vcs_settings) -if vcs_settings.vcs: - new_ebuilds.update(x for x in mynew if x.endswith(.ebuild)) - modified_ebuilds.update(x for x in mychanged if
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: 10d674e542d54980eea6bcede2819af3504fc85a Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue May 27 04:09:27 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue May 27 05:04:00 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=10d674e5 repoman/main.pt: Move some additional code to repos.py --- pym/repoman/main.py | 23 ++- pym/repoman/repos.py | 24 ++-- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 2697b1b..836ca1e 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -232,8 +232,8 @@ else: ### # get lists of valid keywords, licenses, and use -new_data = repo_metadata(repo_settings.portdb) -kwlist, liclist, uselist, profile_list, global_pmaskdict = new_data +new_data = repo_metadata(repo_settings.portdb, repoman_settings) +kwlist, liclist, uselist, profile_list, global_pmaskdict, liclist_deprecated = new_data repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist)) repoman_settings.backup_changes('PORTAGE_ARCHLIST') @@ -248,25 +248,6 @@ check_profiles(profiles, repoman_settings.archlist()) -liclist_deprecated = set() -if DEPRECATED in repoman_settings._license_manager._license_groups: - liclist_deprecated.update( - repoman_settings._license_manager.expandLicenseTokens([@DEPRECATED])) - -if not liclist: - logging.fatal(Couldn't find licenses?) - sys.exit(1) - -if not kwlist: - logging.fatal(Couldn't read KEYWORDS from arch.list) - sys.exit(1) - -if not uselist: - logging.fatal(Couldn't find use.desc?) - sys.exit(1) - - - scanlist = scan(repolevel, reposplit, startdir, categories, repo_settings) diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py index d5eaf60..16de8bf 100644 --- a/pym/repoman/repos.py +++ b/pym/repoman/repos.py @@ -148,8 +148,27 @@ class RepoSettings(object): logging.error(line) sys.exit(1) +def list_checks(kwlist, liclist, uselist, repoman_settings): + liclist_deprecated = set() + if DEPRECATED in repoman_settings._license_manager._license_groups: + liclist_deprecated.update( + repoman_settings._license_manager.expandLicenseTokens([@DEPRECATED])) -def repo_metadata(portdb): + if not liclist: + logging.fatal(Couldn't find licenses?) + sys.exit(1) + + if not kwlist: + logging.fatal(Couldn't read KEYWORDS from arch.list) + sys.exit(1) + + if not uselist: + logging.fatal(Couldn't find use.desc?) + sys.exit(1) + return liclist_deprecated + + +def repo_metadata(portdb, repoman_settings): # get lists of valid keywords, licenses, and use kwlist = set() liclist = set() @@ -236,7 +255,8 @@ def repo_metadata(portdb): global_pmaskdict.setdefault(x.cp, []).append(x) del global_pmasklines - return (kwlist, liclist, uselist, profile_list, global_pmaskdict) + return (kwlist, liclist, uselist, profile_list, global_pmaskdict, + list_checks(kwlist, liclist, uselist, repoman_settings)) def has_global_mask(pkg, global_pmaskdict):
[gentoo-commits] proj/portage:repoman commit in: pym/repoman/
commit: 541d7d9325ef3481ef03cb129477ad10e865c5ab Author: Brian Dolbec dolsen AT gentoo DOT org AuthorDate: Tue May 27 05:03:10 2014 + Commit: Brian Dolbec brian.dolbec AT gmail DOT com CommitDate: Tue May 27 05:04:00 2014 + URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=541d7d93 repoman/main.py: Create a new XmlLint class Create the new class in _xml.py. Consolodate all the xmllint code in this one class. --- pym/repoman/_xml.py | 57 + pym/repoman/main.py | 40 +++-- 2 files changed, 68 insertions(+), 29 deletions(-) diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py index e59f357..1b98ede 100644 --- a/pym/repoman/_xml.py +++ b/pym/repoman/_xml.py @@ -1,6 +1,15 @@ +import sys import xml +import portage +from portage import os +from portage.output import red +from portage.process import find_binary + +from repoman.metadata import fetch_metadata_dtd +from repoman._subprocess import repoman_getstatusoutput + class _XMLParser(xml.etree.ElementTree.XMLParser): def __init__(self, data, **kwargs): @@ -34,3 +43,51 @@ class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder): def doctype(self, name, pubid, system): pass + + +class XmlLint(object): + + def __init__(self, metadata_dtd, options, repolevel, repoman_settings): + self.metadata_dtd = metadata_dtd + self._is_capable = False + self.binary = None + self._check_capable(options, repolevel, repoman_settings) + + + def _check_capable(self, options, repolevel, repoman_settings): + if options.mode == manifest: + return + self.binary = find_binary('xmllint') + if not self.binary: + print(red(!!! xmllint not found. Can't check metadata.xml.\n)) + if options.xml_parse or repolevel == 3: + print(%s sorry, xmllint is needed. failing\n % red(!!!)) + sys.exit(1) + else: + if not fetch_metadata_dtd(self.metadata_dtd, repoman_settings): + sys.exit(1) + # this can be problematic if xmllint changes their output + self._is_capable = True + + + @property + def capable(self): + return self._is_capable + + + def check(self, checkdir): + if not self.capable: + return true + # xmlint can produce garbage output even on success, so only dump + # the ouput when it fails. + st, out = repoman_getstatusoutput( + self.binary + --nonet --noout --dtdvalid %s %s % ( + portage._shell_quote(self.metadata_dtd), + portage._shell_quote( + os.path.join(checkdir, metadata.xml + if st != os.EX_OK: + print(red(!!!) + metadata.xml is invalid:) + for z in out.splitlines(): + print(red(!!! ) + z) + return False + return True diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 836ca1e..e03788f 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -66,9 +66,9 @@ 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.herds.herdbase import make_herd_base -from repoman.metadata import (fetch_metadata_dtd, metadata_xml_encoding, - metadata_doctype_name, metadata_dtd_uri, metadata_xml_declaration) from repoman.errors import err +from repoman.metadata import (metadata_xml_encoding, metadata_doctype_name, + metadata_dtd_uri, metadata_xml_declaration) 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, @@ -80,7 +80,7 @@ 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, vcs_new_changed, VCSSettings) -from repoman._xml import _XMLParser, _MetadataTreeBuilder +from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint if sys.hexversion = 0x300: @@ -261,22 +261,12 @@ for x in qacats: stats[x] = 0 fails[x] = [] -xmllint_capable = False -metadata_dtd = os.path.join(repoman_settings[DISTDIR], 'metadata.dtd') + -if options.mode == manifest: - pass -elif not find_binary('xmllint'): - print(red(!!! xmllint not