From: "Zac Medico (zmedico)" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] portage r10616 - main/branches/2.1.2/bin
Date: Mon, 09 Jun 2008 15:08:02 +0000 [thread overview]
Message-ID: <E1K5iyY-0007NA-Du@stork.gentoo.org> (raw)
Author: zmedico
Date: 2008-06-09 15:08:01 +0000 (Mon, 09 Jun 2008)
New Revision: 10616
Modified:
main/branches/2.1.2/bin/emerge
main/branches/2.1.2/bin/repoman
Log:
Make repoman pass Package instances into run_checks(), so that the checks
can use the Package.mtime and inherited attributes. (trunk r10599:10601)
Modified: main/branches/2.1.2/bin/emerge
===================================================================
--- main/branches/2.1.2/bin/emerge 2008-06-09 14:36:04 UTC (rev 10615)
+++ main/branches/2.1.2/bin/emerge 2008-06-09 15:08:01 UTC (rev 10616)
@@ -1422,7 +1422,8 @@
__slots__ = ("built", "cpv", "depth",
"installed", "metadata", "onlydeps", "operation",
"root_config", "type_name",
- "category", "counter", "cp", "cpv_split", "iuse", "mtime",
+ "category", "counter", "cp", "cpv_split",
+ "inherited", "iuse", "mtime",
"pf", "pv_split", "root", "slot", "slot_atom", "use")
metadata_keys = [
@@ -1473,7 +1474,7 @@
Detect metadata updates and synchronize Package attributes.
"""
_wrapped_keys = frozenset(
- ["COUNTER", "IUSE", "SLOT", "USE", "_mtime_"])
+ ["COUNTER", "INHERITED", "IUSE", "SLOT", "USE", "_mtime_"])
def __init__(self, pkg, metadata):
dict.__init__(self)
@@ -1491,6 +1492,11 @@
if k in self._wrapped_keys:
getattr(self, "_set_" + k.lower())(k, v)
+ def _set_inherited(self, k, v):
+ if isinstance(v, basestring):
+ v = frozenset(v.split())
+ self._pkg.inherited = v
+
def _set_iuse(self, k, v):
self._pkg.iuse = self._pkg._iuse(v.split())
Modified: main/branches/2.1.2/bin/repoman
===================================================================
--- main/branches/2.1.2/bin/repoman 2008-06-09 14:36:04 UTC (rev 10615)
+++ main/branches/2.1.2/bin/repoman 2008-06-09 15:08:01 UTC (rev 10616)
@@ -52,6 +52,12 @@
import portage
del os.environ["PORTAGE_LEGACY_GLOBALS"]
+import imp
+emerge_filename = os.path.join(os.path.dirname(__file__), 'emerge')
+_emerge = imp.load_module('_emerge', open(emerge_filename, 'rb'),
+ emerge_filename, ('', 'rb', imp.PY_SOURCE))
+from _emerge import Package, RootConfig, SetConfig
+
import portage_checksum
import portage_const
import portage_dep
@@ -264,7 +270,9 @@
]
missingvars=["KEYWORDS","LICENSE","DESCRIPTION","HOMEPAGE","SLOT"]
-allvars=portage.auxdbkeys
+allvars = set(portage.auxdbkeys)
+allvars.update(Package.metadata_keys)
+allvars = sorted(allvars)
commitmessage=None
commitmessagefile=None
for x in missingvars:
@@ -735,6 +743,8 @@
trees["/"]["porttree"].settings = repoman_settings
portdb = trees["/"]["porttree"].dbapi
portdb.mysettings = repoman_settings
+setconfig = SetConfig(repoman_settings, trees["/"])
+root_config = RootConfig(repoman_settings, trees["/"], setconfig)
# We really only need to cache the metadata that's necessary for visibility
# filtering. Anything else can be discarded to reduce memory consumption.
for k in ("DEPEND", "IUSE", "LICENCE", "PDEPEND",
@@ -1116,9 +1126,9 @@
_comment_re = re.compile(r'(^|\s*)#')
_autotools_func_re = re.compile(r'(^|\s)(eautomake|eautoconf|eautoreconf)(\s|$)')
-def run_checks(contents, inherited=None):
+def run_checks(contents, pkg):
iuse_def = None
- inherit_autotools = inherited and "autotools" in inherited
+ inherit_autotools = "autotools" in pkg.inherited
autotools_func_call = None
for num, line in enumerate(contents):
comment = _comment_re.match(line)
@@ -1216,7 +1226,7 @@
checkdirlist=os.listdir(checkdir)
ebuildlist=[]
- ebuild_metadata = {}
+ pkgs = {}
for y in checkdirlist:
if y in no_exec and \
stat.S_IMODE(os.stat(os.path.join(checkdir, y)).st_mode) & 0111:
@@ -1240,7 +1250,8 @@
stats["EAPI.unsupported"] += 1
fails["EAPI.unsupported"].append(os.path.join(x, y))
continue
- ebuild_metadata[pf] = myaux
+ pkgs[pf] = Package(cpv=cpv, metadata=myaux,
+ root_config=root_config)
# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
pkgsplits = {}
@@ -1255,7 +1266,7 @@
slot_keywords = {}
- if len(ebuild_metadata) != len(ebuildlist):
+ 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
@@ -1542,9 +1553,10 @@
fails["ebuild.namenomatch"].append(x+"/"+y+".ebuild")
continue
- myaux = ebuild_metadata[y]
+ pkg = pkgs[y]
+ myaux = pkg.metadata
eapi = myaux["EAPI"]
- inherited = frozenset(myaux["INHERITED"].split())
+ inherited = pkg.inherited
# Test for negative logic and bad words in the RESTRICT var.
#for x in myaux[allvars.index("RESTRICT")].split():
@@ -1845,7 +1857,7 @@
f = open(full_path, 'rb')
try:
contents = f.readlines()
- for check_name, e in run_checks(contents, inherited=inherited):
+ for check_name, e in run_checks(contents, pkg):
stats[check_name] += 1
fails[check_name].append(relative_path + ': %s' % e)
finally:
--
gentoo-commits@lists.gentoo.org mailing list
reply other threads:[~2008-06-09 15:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1K5iyY-0007NA-Du@stork.gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox