From 7f164c6fd1c47c254b1e1df101edb680492c0c12 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 23 May 2013 21:43:11 -0700 Subject: [PATCH] repoman: check for deprecated EAPIs, bug #470670 This adds support for repo.eapi.banned (fatal) and repo.eapi.deprecated (warning) checks which are controlled by eapis-banned and eapis-deprecated settings in a repository's metadata/layout.conf. --- bin/repoman | 13 +++++++++++++ man/portage.5 | 8 +++++++- man/repoman.1 | 10 +++++++++- pym/portage/repository/config.py | 15 ++++++++++++++- 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/bin/repoman b/bin/repoman index 20832ec8c..c4a5a220d 100755 --- a/bin/repoman +++ b/bin/repoman @@ -380,6 +380,8 @@ qahelp = { "metadata.bad": "Bad metadata.xml files", "metadata.warning": "Warnings in metadata.xml files", "portage.internal": "The ebuild uses an internal Portage function or variable", + "repo.eapi.banned": "The ebuild uses an EAPI which is banned by the repository's metadata/layout.conf settings", + "repo.eapi.deprecated": "The ebuild uses an EAPI which is deprecated by the repository's metadata/layout.conf settings", "virtual.oldstyle": "The ebuild PROVIDEs an old-style virtual (see GLEP 37)", "virtual.suspect": "Ebuild contains a package that usually should be pulled via virtual/, not directly.", "usage.obsolete": "The ebuild makes use of an obsolete construct", @@ -424,6 +426,7 @@ qawarnings = set(( "wxwidgets.eclassnotused", "metadata.warning", "portage.internal", +"repo.eapi.deprecated", "usage.obsolete", "upstream.workaround", "LIVEVCS.stable", @@ -1815,6 +1818,16 @@ for x in effective_scanlist: inherited = pkg.inherited live_ebuild = live_eclasses.intersection(inherited) + if repo_config.eapi_is_banned(eapi): + stats["repo.eapi.banned"] += 1 + fails["repo.eapi.banned"].append( + "%s: %s" % (relative_path, eapi)) + + elif repo_config.eapi_is_deprecated(eapi): + stats["repo.eapi.deprecated"] += 1 + fails["repo.eapi.deprecated"].append( + "%s: %s" % (relative_path, eapi)) + for k, v in myaux.items(): if not isinstance(v, basestring): continue diff --git a/man/portage.5 b/man/portage.5 index 46a64f106..e46226601 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -1,4 +1,4 @@ -.TH "PORTAGE" "5" "Nov 2012" "Portage VERSION" "Portage" +.TH "PORTAGE" "5" "May 2013" "Portage VERSION" "Portage" .SH NAME portage \- the heart of Gentoo .SH "DESCRIPTION" @@ -875,6 +875,12 @@ masters = gentoo java-overlay # indicate that this repo can be used as a substitute for foo-overlay aliases = foo-overlay +# indicate that ebuilds with the specified EAPIs are banned +eapis\-banned = 0 1 + +# indicate that ebuilds with the specified EAPIs are deprecated +eapis\-deprecated = 2 3 + # sign commits in this repo, which requires Git >=1.7.9, and # key configured by `git config user.signingkey key_id` sign\-commits = true diff --git a/man/repoman.1 b/man/repoman.1 index 912ba65d8..bf498d4bd 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -1,4 +1,4 @@ -.TH "REPOMAN" "1" "Oct 2012" "Portage VERSION" "Portage" +.TH "REPOMAN" "1" "May 2013" "Portage VERSION" "Portage" .SH NAME repoman \- Gentoo's program to enforce a minimal level of quality assurance in packages added to the portage tree .SH SYNOPSIS @@ -326,6 +326,14 @@ Missing metadata.xml files .B metadata.warning Warnings in metadata.xml files .TP +.B repo.eapi.banned +The ebuild uses an EAPI which is banned by the repository's +metadata/layout.conf settings. +.TP +.B repo.eapi.deprecated +The ebuild uses an EAPI which is deprecated by the repository's +metadata/layout.conf settings. +.TP .B portage.internal The ebuild uses an internal Portage function or variable .TP diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 969fce43e..da8c36561 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -80,7 +80,8 @@ class RepoConfig(object): 'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name', 'name', 'portage1_profiles', 'portage1_profiles_compat', 'priority', 'profile_formats', 'sign_commit', 'sign_manifest', 'sync', - 'thin_manifest', 'update_changelog', 'user_location') + 'thin_manifest', 'update_changelog', 'user_location', + '_eapis_banned', '_eapis_deprecated') def __init__(self, name, repo_opts): """Build a RepoConfig with options in repo_opts @@ -198,6 +199,15 @@ class RepoConfig(object): self.portage1_profiles_compat = not eapi_allows_directories_on_profile_level_and_repository_level(eapi) and \ layout_data['profile-formats'] == ('portage-1-compat',) + self._eapis_banned = frozenset(layout_data['eapis-banned']) + self._eapis_deprecated = frozenset(layout_data['eapis-deprecated']) + + def eapi_is_banned(self, eapi): + return eapi in self._eapis_banned + + def eapi_is_deprecated(self, eapi): + return eapi in self._eapis_deprecated + def iter_pregenerated_caches(self, auxdbkeys, readonly=True, force=False): """ Reads layout.conf cache-formats from left to right and yields cache @@ -745,6 +755,9 @@ def parse_layout_conf(repo_location, repo_name=None): data['allow-provide-virtual'] = \ layout_data.get('allow-provide-virtuals', 'false').lower() == 'true' + data['eapis-banned'] = tuple(layout_data.get('eapis-banned', '').split()) + data['eapis-deprecated'] = tuple(layout_data.get('eapis-deprecated', '').split()) + data['sign-commit'] = layout_data.get('sign-commits', 'false').lower() \ == 'true' -- 2.26.2