From 93ee6a847be949e7752c3c052d3eb0619e408b43 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sat, 6 Nov 2010 22:03:55 +0100 Subject: [PATCH] Support use.unsatisfiable and package.use.unsatisfiable files. --- man/portage.5 | 41 ++++++++++++++++++- pym/portage/dep/dep_check.py | 1 + .../package/ebuild/_config/UseManager.py | 27 +++++++++++- pym/portage/package/ebuild/config.py | 15 ++++++- 4 files changed, 79 insertions(+), 5 deletions(-) diff --git a/man/portage.5 b/man/portage.5 index a0f79928c..d659871c5 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -1,4 +1,4 @@ -.TH "PORTAGE" "5" "Aug 2010" "Portage VERSION" "Portage" +.TH "PORTAGE" "5" "Nov 2010" "Portage VERSION" "Portage" .SH NAME portage \- the heart of Gentoo .SH "DESCRIPTION" @@ -36,10 +36,12 @@ package.unmask package.use package.use.force package.use.mask +package.use.unsatisfiable parent profile.bashrc use.force use.mask +use.unsatisfiable virtuals .fi .TP @@ -337,6 +339,26 @@ a '\-'. x11\-libs/qt \-mysql .fi .TP +.BR package.use.unsatisfiable +Per\-package marking of USE flags as potentially unsatisfiable. + +.I Note: +In a cascading profile setup, you can remove USE flags in children +profiles which were added by parent profiles by prefixing the flag with +a '\-'. + +.I Format: +.nf +\- comments begin with # (no inline comments) +\- one DEPEND atom per line with space-delimited USE flags +.fi + +.I Example: +.nf +# KDE is unstable on this architecture +dev-vcs/subversion kde +.fi +.TP .BR parent This contains a path to the parent profile. It may be either relative or absolute. The paths will be relative to the location of the profile. Most @@ -373,6 +395,22 @@ In a cascading profile setup, you can remove USE flags in children profiles which were added by parent profiles by prefixing the flag with a '\-'. +.I Format: +.nf +\- comments begin with # (no inline comments) +\- one USE flag per line +.fi +.TP +.BR use.unsatisfiable +Some USE flags enable optional dependencies, which are allowed to be +unsatisfiable in some configurations. This is useful for stable packages, +which have optional dependencies on unstable packages. + +.I Note: +In a cascading profile setup, you can remove USE flags in children +profiles which were added by parent profiles by prefixing the flag with +a '\-'. + .I Format: .nf \- comments begin with # (no inline comments) @@ -984,6 +1022,7 @@ Please report bugs via http://bugs.gentoo.org/ Marius Mauch Mike Frysinger Drake Wyrm +Arfrever Frehtes Taifersar Arahesis .fi .SH "SEE ALSO" .BR emerge (1), diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py index fca1594a7..2f6cb7602 100644 --- a/pym/portage/dep/dep_check.py +++ b/pym/portage/dep/dep_check.py @@ -512,6 +512,7 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, # flags from a parent package that is being merged to a $ROOT that is # different from the one that mysettings represents. mymasks.update(mysettings.usemask) + mymasks.update(mysettings.useunsatisfiable) mymasks.update(mysettings.archlist()) mymasks.discard(mysettings["ARCH"]) useforce.update(mysettings.useforce) diff --git a/pym/portage/package/ebuild/_config/UseManager.py b/pym/portage/package/ebuild/_config/UseManager.py index 13f65736f..dbb9b1a8b 100644 --- a/pym/portage/package/ebuild/_config/UseManager.py +++ b/pym/portage/package/ebuild/_config/UseManager.py @@ -21,9 +21,11 @@ class UseManager(object): #-------------------------------- # use.mask _usemask_list # use.force _useforce_list - # package.use.mask _pusemask_list + # use.unsatisfiable _useunsatisfiable_list + # package.use.mask _pusemask_list # package.use _pkgprofileuse - # package.use.force _puseforce_list + # package.use.force _puseforce_list + # package.use.unsatisfiable _puseunsatisfiable_list #-------------------------------- # user config #-------------------------------- @@ -42,9 +44,11 @@ class UseManager(object): self._usemask_list = self._parse_profile_files_to_list("use.mask", profiles) self._useforce_list = self._parse_profile_files_to_list("use.force", profiles) + self._useunsatisfiable_list = self._parse_profile_files_to_list("use.unsatisfiable", profiles) self._pusemask_list = self._parse_profile_files_to_dict("package.use.mask", profiles) self._pkgprofileuse = self._parse_profile_files_to_dict("package.use", profiles, juststrings=True) self._puseforce_list = self._parse_profile_files_to_dict("package.use.force", profiles) + self._puseunsatisfiable_list = self._parse_profile_files_to_dict("package.use.unsatisfiable", profiles) self._pusedict = self._parse_user_files_to_extatomdict("package.use", abs_user_config, user_config) @@ -112,6 +116,25 @@ class UseManager(object): useforce.extend(pkg_useforce) return frozenset(stack_lists(useforce, incremental=True)) + def getUseUnsatisfiable(self, pkg=None): + if pkg is None: + return frozenset(stack_lists( + self._useunsatisfiable_list, incremental=True)) + + cp = getattr(pkg, "cp", None) + if cp is None: + cp = cpv_getkey(remove_slot(pkg)) + useunsatisfiable = [] + for i, punsatisfiable_dict in enumerate(self._puseunsatisfiable_list): + if self._useunsatisfiable_list[i]: + useunsatisfiable.append(self._useunsatisfiable_list[i]) + cpdict = punsatisfiable_dict.get(cp) + if cpdict: + pkg_useunsatisfiable = ordered_by_atom_specificity(cpdict, pkg) + if pkg_useunsatisfiable: + useunsatisfiable.extend(pkg_useunsatisfiable) + return frozenset(stack_lists(useunsatisfiable, incremental=True)) + def getPUSE(self, pkg): cp = getattr(pkg, "cp", None) if cp is None: diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index e50e6446a..0a920b3e8 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -204,6 +204,7 @@ class config(object): self._non_user_variables = clone._non_user_variables self.usemask = clone.usemask self.useforce = clone.useforce + self.useunsatisfiable = clone.useunsatisfiable self.puse = clone.puse self.user_profile_dir = clone.user_profile_dir self.local_config = clone.local_config @@ -519,6 +520,7 @@ class config(object): #Initialize all USE related variables we track ourselves. self.usemask = self._use_manager.getUseMask() self.useforce = self._use_manager.getUseForce() + self.useunsatisfiable = self._use_manager.getUseUnsatisfiable() self.configdict["conf"]["USE"] = \ self._use_manager.extract_global_USE_changes( \ self.configdict["conf"].get("USE", "")) @@ -894,6 +896,7 @@ class config(object): " ".join(self.make_defaults_use) self.usemask = self._use_manager.getUseMask() self.useforce = self._use_manager.getUseForce() + self.useunsatisfiable = self._use_manager.getUseUnsatisfiable() self.regenerate() class _lazy_vars(object): @@ -1133,6 +1136,11 @@ class config(object): self.usemask = usemask has_changed = True + useunsatisfiable = self._use_manager.getUseUnsatisfiable(cpv_slot) + if useunsatisfiable != self.useunsatisfiable: + self.useunsatisfiable = useunsatisfiable + has_changed = True + oldpuse = self.puse self.puse = self._use_manager.getPUSE(cpv_slot) if oldpuse != self.puse: @@ -1364,6 +1372,9 @@ class config(object): def _getUseForce(self, pkg): return self._use_manager.getUseForce(pkg) + def _getUseUnsatisfiable(self, pkg): + return self._use_manager.getUseUnsatisfiable(pkg) + def _getMaskAtom(self, cpv, metadata): """ Take a package and return a matching package.mask atom, or None if no @@ -1375,7 +1386,7 @@ class config(object): @param metadata: A dictionary of raw package metadata @type metadata: dict @rtype: String - @return: An matching atom string or None if one is not found. + @return: A matching atom string or None if one is not found. """ return self._mask_manager.getMaskAtom(cpv, metadata["SLOT"], metadata.get('repository')) @@ -1391,7 +1402,7 @@ class config(object): @param metadata: A dictionary of raw package metadata @type metadata: dict @rtype: String - @return: An matching profile atom string or None if one is not found. + @return: A matching profile atom string or None if one is not found. """ cp = cpv_getkey(cpv) -- 2.26.2