Support use.unsatisfiable and package.use.unsatisfiable files.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Sat, 6 Nov 2010 21:03:55 +0000 (22:03 +0100)
committerZac Medico <zmedico@gentoo.org>
Wed, 24 Nov 2010 01:55:09 +0000 (17:55 -0800)
man/portage.5
pym/portage/dep/dep_check.py
pym/portage/package/ebuild/_config/UseManager.py
pym/portage/package/ebuild/config.py

index f138f0045974ebb85132bdb46d8c7d062898b7f0..983deb4dd95808c53fe2967a0195511a649d86b3 100644 (file)
@@ -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 <genone@gentoo.org>
 Mike Frysinger <vapier@gentoo.org>
 Drake Wyrm <wyrm@haell.com>
+Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
 .fi
 .SH "SEE ALSO"
 .BR emerge (1),
index fca1594a7fe5488c68a7cfc7b9a1745a313b7cdc..2f6cb76022f028d4bad4f59bee6eeddbf29dd661 100644 (file)
@@ -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)
index 8b3e44b380558fb6785c805aa75973b50c8760f7..11e30291fec788b98a03757dd70602378ed100c0 100644 (file)
@@ -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:
index 0023b3f6838bd2b9ea9bf40813cca0ef74450b33..922116a5efff3d994573df9e6b001788839b963e 100644 (file)
@@ -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)