From 9ed6332f2015e41f072f897764f550c5574ea96f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 22 Nov 2010 17:22:04 -0800 Subject: repoman: enable dep check with empty KEYWORDS Since no KEYWORDS are set, and those are normally used to decide which profiles to check, we use an empty profile with effective ACCEPT_KEYWORDS set to **. --- bin/repoman | 62 +++++++++++++++++----- .../package/ebuild/_config/LocationsManager.py | 8 ++- 2 files changed, 56 insertions(+), 14 deletions(-) diff --git a/bin/repoman b/bin/repoman index ddeadca77..2b8156e03 100755 --- a/bin/repoman +++ b/bin/repoman @@ -638,9 +638,19 @@ class ProfileDesc(object): def __init__(self, arch, status, sub_path, tree_path): self.arch = arch self.status = status - self.sub_path = normalize_path(sub_path.lstrip(os.sep)) + if sub_path: + sub_path = normalize_path(sub_path.lstrip(os.sep)) + self.sub_path = sub_path self.tree_path = tree_path - self.abs_path = os.path.join(tree_path, 'profiles', self.sub_path) + if tree_path: + self.abs_path = os.path.join(tree_path, 'profiles', self.sub_path) + else: + self.abs_path = tree_path + + def __str__(self): + if self.sub_path: + return self.sub_path + return 'empty profile' profile_list = [] valid_profile_types = frozenset(['dev', 'exp', 'stable']) @@ -745,6 +755,11 @@ for prof in profile_list: profile_sub_paths.add(prof.sub_path) profiles.setdefault(prof.arch, []).append(prof) +# Use an empty profile for checking dependencies of +# packages that have empty KEYWORDS. +prof = ProfileDesc('**', 'stable', '', '') +profiles.setdefault(prof.arch, []).append(prof) + for x in repoman_settings.archlist(): if x[0] == "~": continue @@ -1568,7 +1583,7 @@ for x in scanlist: previous_keywords = slot_keywords.get(myaux["SLOT"]) if previous_keywords is None: slot_keywords[myaux["SLOT"]] = set() - elif not live_ebuild: + elif ebuild_archs and not live_ebuild: dropped_keywords = previous_keywords.difference(ebuild_archs) if dropped_keywords: stats["KEYWORDS.dropped"] += 1 @@ -1625,6 +1640,10 @@ for x in scanlist: else: arches.append([keyword, keyword, [keyword]]) allmasked = False + if not arches: + # Use an empty profile for checking dependencies of + # packages that have empty KEYWORDS. + arches.append(['**', '**', ['**']]) baddepsyntax = False badlicsyntax = False @@ -1869,15 +1888,22 @@ for x in scanlist: # just in case, prevent config.reset() from nuking these. dep_settings.backup_changes("ACCEPT_KEYWORDS") - for prov_cp in provide_cps: - if prov_cp not in dep_settings.getvirtuals(): - stats["virtual.unavailable"]+=1 - fails["virtual.unavailable"].append("%s: %s(%s) %s" % \ - (relative_path, keyword, prof.sub_path, prov_cp)) + if prof.sub_path: + # old-style virtuals currently aren't + # resolvable with empty profile, since + # mappings from 'virtuals' files are + # unavailable (it would be expensive to + # search for PROVIDE in all ebuilds) + for prov_cp in provide_cps: + if prov_cp not in dep_settings.getvirtuals(): + stats["virtual.unavailable"] += 1 + fails["virtual.unavailable"].append( + "%s: %s(%s) %s" % (relative_path, keyword, + prof.sub_path, prov_cp)) if not baddepsyntax: - ismasked = os.path.join(catdir, y) not in \ - portdb.xmatch("list-visible", x) + ismasked = not ebuild_archs or \ + pkg.cp not in portdb.xmatch("list-visible", x) if ismasked: if not have_pmasked: have_pmasked = bool(dep_settings._getMaskAtom( @@ -1911,22 +1937,34 @@ for x in scanlist: if success: if atoms: + + if not prof.sub_path: + # old-style virtuals currently aren't + # resolvable with empty profile, since + # 'virtuals' mappings are unavailable + # (it would be expensive to search + # for PROVIDE in all ebuilds) + atoms = [atom for atom in atoms if not \ + (atom.cp.startswith('virtual/') and \ + not portdb.cp_list(atom.cp))] + #we have some unsolvable deps #remove ! deps, which always show up as unsatisfiable atoms = [str(atom.unevaluated_atom) \ for atom in atoms if not atom.blocker] + #if we emptied out our list, continue: if not atoms: continue stats[mykey]=stats[mykey]+1 fails[mykey].append("%s: %s(%s) %s" % \ (relative_path, keyword, - prof.sub_path, repr(atoms))) + prof, repr(atoms))) else: stats[mykey]=stats[mykey]+1 fails[mykey].append("%s: %s(%s) %s" % \ (relative_path, keyword, - prof.sub_path, repr(atoms))) + prof, repr(atoms))) # Check for 'all unstable' or 'all masked' -- ACCEPT_KEYWORDS is stripped # XXX -- Needs to be implemented in dep code. Can't determine ~arch nicely. diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py index b857f3262..14cfaa672 100644 --- a/pym/portage/package/ebuild/_config/LocationsManager.py +++ b/pym/portage/package/ebuild/_config/LocationsManager.py @@ -38,7 +38,7 @@ class LocationsManager(object): self._check_var_directory("PORTAGE_CONFIGROOT", self.config_root) self.abs_user_config = os.path.join(self.config_root, USER_CONFIG_PATH) - if not config_profile_path: + if config_profile_path is None: config_profile_path = \ os.path.join(self.config_root, PROFILE_PATH) if os.path.isdir(config_profile_path): @@ -51,12 +51,16 @@ class LocationsManager(object): else: self.profile_path = None else: + # NOTE: repoman may pass in an empty string + # here, in order to create an empty profile + # for checking dependencies of packages with + # empty KEYWORDS. self.profile_path = config_profile_path # The symlink might not exist or might not be a symlink. self.profiles = [] - if self.profile_path is not None: + if self.profile_path: try: self._addProfile(os.path.realpath(self.profile_path)) except ParseError as e: -- cgit v1.2.3-1-g7c22