From fe9608d8517ed29ede9445df7eb028040dfb5fac Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sat, 6 Nov 2010 22:03:55 +0100 Subject: Support use.unsatisfiable and package.use.unsatisfiable files. --- man/portage.5 | 41 +++++++++++++++++++++++- pym/portage/dep/dep_check.py | 1 + pym/portage/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 f138f0045..983deb4dd 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 @@ -336,6 +338,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 @@ -372,6 +394,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) @@ -971,6 +1009,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 8b3e44b38..11e30291f 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 0023b3f68..922116a5e 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -232,6 +232,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 @@ -532,6 +533,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", "")) @@ -940,6 +942,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): @@ -1179,6 +1182,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: @@ -1410,6 +1418,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 @@ -1421,7 +1432,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"]) @@ -1437,7 +1448,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) -- cgit v1.2.3-1-g7c22