On 03/03/2011 08:27 AM, Michael wrote:
> Hi,
>
> I'm playing around with writing a patch to allow emerge to automatically
> resolve use deps.
>
> The basics appear to be working:
>
> Calculating dependencies... done!
> [ebuild R ] x11-libs/qt-webkit-4.6.3-r1 USE="dbus exceptions pch* (-
> aqua) -debug -kde*" 0 kB [0]
> [ebuild N ] app-misc/mytest-1.0.0 USE="kde" 0 kB [1]
>
> however, not quite:
>
> The following USE changes are necessary to proceed:
> #required by =app-misc/mytest-1.0.0, required by mytest (argument)
> =x11-libs/qt-webkit-4.6.3-r1 pch
>
>
> Any pointers in the right direction would be much appreciated.
>
>
> -Michael
It seems like you wouldn't have to modify the code that your patch
modifies, since essentially what you want is --autounmask except that
you want to skip the part about editing config files. Also note that
there is an existing feature request to edit config files automatically:
Zac Medico wrote:
>
> It seems like you wouldn't have to modify the code that your patch
> modifies, since essentially what you want is --autounmask except that
> you want to skip the part about editing config files. Also note that
> there is an existing feature request to edit config files automatically:
>
> http://bugs.gentoo.org/show_bug.cgi?id=345775
Interesting, especially #258371 as referenced by the above - it seems to be
exactly what I was after.
If I'm way off even in terms of code location, where would a more
appropriate place for me to hack this be?
-Michael
03-03-2011, 05:23 PM
Zac Medico
Patch problem
On 03/03/2011 09:47 AM, Michael wrote:
> Zac Medico wrote:
>>
>> It seems like you wouldn't have to modify the code that your patch
>> modifies, since essentially what you want is --autounmask except that
>> you want to skip the part about editing config files. Also note that
>> there is an existing feature request to edit config files automatically:
>>
>> http://bugs.gentoo.org/show_bug.cgi?id=345775
>
> Interesting, especially #258371 as referenced by the above - it seems to be
> exactly what I was after.
>
> If I'm way off even in terms of code location, where would a more
> appropriate place for me to hack this be?
Inside depgraph._resolve(), it returns False if
self._dynamic_config._needed_use_config_changes is non-empty. You want
to add an option that causes it to return True instead. Also, you'll
need to propagate these changes to the config.setcpv() method somehow,
so that the changes will be applied by the Scheduler at build time.
Normally, the config.setcpv() method calculates USE based on config
files, but you want it override the config files with whatever values
the depgraph's _needed_use_config_changes contains.
--
Thanks,
Zac
03-04-2011, 01:06 PM
Michael
Patch problem
Zac Medico wrote:
> Inside depgraph._resolve(), it returns False if
> self._dynamic_config._needed_use_config_changes is non-empty. You want
> to add an option that causes it to return True instead. Also, you'll
> need to propagate these changes to the config.setcpv() method somehow,
> so that the changes will be applied by the Scheduler at build time.
> Normally, the config.setcpv() method calculates USE based on config
> files, but you want it override the config files with whatever values
> the depgraph's _needed_use_config_changes contains.
Thanks - much appreciated.
-Michael
03-08-2011, 12:41 PM
Michael
Patch problem
Zac Medico wrote:
> Inside depgraph._resolve(), it returns False if
> self._dynamic_config._needed_use_config_changes is non-empty. You want
> to add an option that causes it to return True instead. Also, you'll
> need to propagate these changes to the config.setcpv() method somehow,
> so that the changes will be applied by the Scheduler at build time.
> Normally, the config.setcpv() method calculates USE based on config
> files, but you want it override the config files with whatever values
> the depgraph's _needed_use_config_changes contains.
I've been able to collect the list of flags required to satisfy the
dependency and apply them, but I'm having difficulty with ensuring that they
do not override the user's settings.
eg. need +foo to satisfy the dependency, but do not do it it USE="-foo".
As suggested by yourself, portage.settings.configdict["conf"]["USE"] indeed
does contain explicit enable/disable information from make.conf, however the
other keys, such as those representing the env or package.use do not.
How can I get this information?
Thanks,
Michael
03-08-2011, 01:57 PM
Brian Dolbec
Patch problem
On Wed, 2011-03-09 at 00:41 +1100, Michael wrote:
> Zac Medico wrote:
> > Inside depgraph._resolve(), it returns False if
> > self._dynamic_config._needed_use_config_changes is non-empty. You want
> > to add an option that causes it to return True instead. Also, you'll
> > need to propagate these changes to the config.setcpv() method somehow,
> > so that the changes will be applied by the Scheduler at build time.
> > Normally, the config.setcpv() method calculates USE based on config
> > files, but you want it override the config files with whatever values
> > the depgraph's _needed_use_config_changes contains.
>
> I've been able to collect the list of flags required to satisfy the
> dependency and apply them, but I'm having difficulty with ensuring that they
> do not override the user's settings.
>
> eg. need +foo to satisfy the dependency, but do not do it it USE="-foo".
>
> As suggested by yourself, portage.settings.configdict["conf"]["USE"] indeed
> does contain explicit enable/disable information from make.conf, however the
> other keys, such as those representing the env or package.use do not.
>
> How can I get this information?
>
>
> Thanks,
> Michael
>
>
I suppose you could get the final environment before you modify the USE
then compare with the portage.settings.configdict["conf"]["USE"] you
already got.
have a look in the public_api branch. there are several functions there
that do that.
http://ln-s.net/8a4K or
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=blob;f=pym/portage/api/flag.py;h=52ea9be0128074dd3a544ea480796f17591232c2 ;hb=refs/heads/public_api
--
Brian Dolbec <brian.dolbec@gmail.com>
03-08-2011, 04:25 PM
Zac Medico
Patch problem
On 03/08/2011 05:41 AM, Michael wrote:
> I've been able to collect the list of flags required to satisfy the
> dependency and apply them, but I'm having difficulty with ensuring that they
> do not override the user's settings.
>
> eg. need +foo to satisfy the dependency, but do not do it it USE="-foo".
>
> As suggested by yourself, portage.settings.configdict["conf"]["USE"] indeed
> does contain explicit enable/disable information from make.conf, however the
> other keys, such as those representing the env or package.use do not.
>
> How can I get this information?
In pym/portage/package/ebuild/_config/UseManager.py there's a getPUSE
method that should give you the negative package.use settings. That's
what setcpv calls to the package.use settings before it applies the
"incremental" stacking that eliminates the negative values.
--
Thanks,
Zac