[gentoo-portage-dev] [PATCH/RFC] userinstall: new feature for running src_install as non root

2015-11-24 Thread Mike Frysinger
This does not support fowners just yet as we'll need to queue/dequeue
the accounts on the fly.

X-Gentoo-Bug: 566614
X-Gentoo-Bug-URL: https://bugs.gentoo.org/566614
---
 man/make.conf.5|  4 
 pym/portage/const.py   |  1 +
 pym/portage/package/ebuild/config.py   | 22 +-
 pym/portage/package/ebuild/doebuild.py |  9 ++---
 4 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/man/make.conf.5 b/man/make.conf.5
index 1d1cfeb..0c575db 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -648,6 +648,10 @@ checksum differs from the file that was originally 
installed.
 When portage is run as root, drop privileges to portage:portage during the
 fetching of package sources.
 .TP
+.B userinstall
+When portage is run as root, drop privileges to portage:portage during the
+install of package sources.
+.TP
 .B userpriv
 Allow portage to drop root privileges and compile packages as
 portage:portage without a sandbox (unless \fIusersandbox\fR is also used).
diff --git a/pym/portage/const.py b/pym/portage/const.py
index 6c4f613..d895633 100644
--- a/pym/portage/const.py
+++ b/pym/portage/const.py
@@ -195,6 +195,7 @@ SUPPORTED_FEATURES   = frozenset([
"unmerge-orphans",
"unprivileged",
"userfetch",
+   "userinstall",
"userpriv",
"usersandbox",
"usersync",
diff --git a/pym/portage/package/ebuild/config.py 
b/pym/portage/package/ebuild/config.py
index 40aa99d..70f2276 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1152,21 +1152,17 @@ class config(object):
"fakeroot binary is not installed.\n"), 
noiselevel=-1)
 
if os.getuid() == 0 and not hasattr(os, "setgroups"):
-   warning_shown = False
-
-   if "userpriv" in self.features:
-   writemsg(_("!!! FEATURES=userpriv is enabled, 
but "
-   "os.setgroups is not available.\n"), 
noiselevel=-1)
-   warning_shown = True
-
-   if "userfetch" in self.features:
-   writemsg(_("!!! FEATURES=userfetch is enabled, 
but "
-   "os.setgroups is not available.\n"), 
noiselevel=-1)
+   userfeatures = {'userfetch', 'userinstall', 'userpriv'}
+   enabled = userfeatures & self.features
+   if enabled:
+   writemsg(
+   _('!!! FEATURES="%s" is enabled, but 
os.setgroups is not available.\n'),
+   ' '.join(enabled), noiselevel=-1)
warning_shown = True
 
-   if warning_shown and platform.python_implementation() 
== 'PyPy':
-   writemsg(_("!!! See 
https://bugs.pypy.org/issue833 for details.\n"),
-   noiselevel=-1)
+   if platform.python_implementation() == 'PyPy':
+   writemsg(_("!!! See 
https://bugs.pypy.org/issue833 for details.\n"),
+   noiselevel=-1)
 
def load_best_module(self,property_string):
best_mod = 
best_from_dict(property_string,self.modules,self.module_priority)
diff --git a/pym/portage/package/ebuild/doebuild.py 
b/pym/portage/package/ebuild/doebuild.py
index ff8958e..0fa5c20 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1350,6 +1350,9 @@ def _spawn_actionmap(settings):
droppriv = "userpriv" in features and \
"userpriv" not in restrict and \
secpass >= 2
+   instpriv = "userinstall" in features and \
+   "userinstall" not in restrict and \
+   secpass >= 2
 
fakeroot = "fakeroot" in features
 
@@ -1370,9 +1373,9 @@ def _spawn_actionmap(settings):
 "configure":{"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, 
"sesandbox":sesandbox, "fakeroot":0}},
 "compile":  {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, 
"sesandbox":sesandbox, "fakeroot":0}},
 "test": {"cmd":ebuild_sh, "args":{"droppriv":droppriv, "free":nosandbox, 
"sesandbox":sesandbox, "fakeroot":0}},
-"install":  {"cmd":ebuild_sh, "args":{"droppriv":0,"free":0, 
"sesandbox":sesandbox, "fakeroot":fakeroot}},
-"rpm":  {"cmd":misc_sh,   "args":{"droppriv":0,"free":0, 
"sesandbox":0, "fakeroot":fakeroot}},
-"package":  {"cmd":misc_sh,   "args":{"droppriv":0,"free":0, 
"sesandbox":0, "fakeroot":fakeroot}},
+"install":  {"cmd":ebuild_sh, "args":{"droppriv":instpriv, "free":0, 
"sesandbox":sesandbox, "fakeroot":fakeroot}},
+"rpm":  

Re: [gentoo-portage-dev] [PATCH/RFC] userinstall: new feature for running src_install as non root

2015-11-24 Thread Zac Medico
On 11/24/2015 03:11 PM, Mike Frysinger wrote:
> This does not support fowners just yet as we'll need to queue/dequeue
> the accounts on the fly.
> 
> X-Gentoo-Bug: 566614
> X-Gentoo-Bug-URL: https://bugs.gentoo.org/566614
> ---
>  man/make.conf.5|  4 
>  pym/portage/const.py   |  1 +
>  pym/portage/package/ebuild/config.py   | 22 +-
>  pym/portage/package/ebuild/doebuild.py |  9 ++---
>  4 files changed, 20 insertions(+), 16 deletions(-)

In pym/repoman/qa_data.py you need to add userinstall to valid_restrict.

Otherwise, looks good.
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH/RFC] userinstall: new feature for running src_install as non root

2015-11-24 Thread Mike Frysinger
On 24 Nov 2015 15:58, Zac Medico wrote:
> On 11/24/2015 03:11 PM, Mike Frysinger wrote:
> > This does not support fowners just yet as we'll need to queue/dequeue
> > the accounts on the fly.
> > 
> > X-Gentoo-Bug: 566614
> > X-Gentoo-Bug-URL: https://bugs.gentoo.org/566614
> > ---
> >  man/make.conf.5|  4 
> >  pym/portage/const.py   |  1 +
> >  pym/portage/package/ebuild/config.py   | 22 +-
> >  pym/portage/package/ebuild/doebuild.py |  9 ++---
> >  4 files changed, 20 insertions(+), 16 deletions(-)
> 
> In pym/repoman/qa_data.py you need to add userinstall to valid_restrict.
> 
> Otherwise, looks good.

suggestions for having fowners queue data ?  should it just write to
a file in $T and then have portage read commands out of that ?
-mike


signature.asc
Description: Digital signature


Re: [gentoo-portage-dev] [PATCH/RFC] userinstall: new feature for running src_install as non root

2015-11-24 Thread Zac Medico
On 11/24/2015 04:06 PM, Mike Frysinger wrote:
> On 24 Nov 2015 15:58, Zac Medico wrote:
>> On 11/24/2015 03:11 PM, Mike Frysinger wrote:
>>> This does not support fowners just yet as we'll need to queue/dequeue
>>> the accounts on the fly.
>>>
>>> X-Gentoo-Bug: 566614
>>> X-Gentoo-Bug-URL: https://bugs.gentoo.org/566614
>>> ---
>>>  man/make.conf.5|  4 
>>>  pym/portage/const.py   |  1 +
>>>  pym/portage/package/ebuild/config.py   | 22 +-
>>>  pym/portage/package/ebuild/doebuild.py |  9 ++---
>>>  4 files changed, 20 insertions(+), 16 deletions(-)
>>
>> In pym/repoman/qa_data.py you need to add userinstall to valid_restrict.
>>
>> Otherwise, looks good.
> 
> suggestions for having fowners queue data ?  should it just write to
> a file in $T and then have portage read commands out of that ?
> -mike
> 

Yeah, that sounds good. A list of fowners/fperms calls should suffice.
We can parse it and translate it to python calls.

The data should be dequeued inside ${D}, so that the merge code can
handle things like administrative overrides:

https://bugs.gentoo.org/show_bug.cgi?id=396153
-- 
Thanks,
Zac



[gentoo-portage-dev] Adding sets to @world in custom profile?

2015-11-24 Thread Joakim Tjernlund
I have created my own set, @cusfpv3, and now I want to
include this set in @world using my custom profile.
How can I do that?

I can add it in overlay/sets.conf:
[CUSFPv3 sets]
class = portage.sets.files.StaticFileSet
multiset = true
directory = %(PORTAGE_CONFIGROOT)s${repository:tmv3-target-overlay}/sets/

[world]
class = portage.sets.base.DummyPackageSet
packages =  @cusfpv3 @profile @selected @system

But then this set becomes active as soon as one add the overlay to
a machine and I do not want that.

  Jocke


Re: [gentoo-portage-dev] [PATCH] depgraph: autounmask for conditional USE deps (bug 566704)

2015-11-24 Thread Zac Medico
On 11/24/2015 03:47 AM, Alexander Berntsen wrote:
> What's up with the pargs/kwargs stuff? I don't remember that stuff.
> 
> Specifically, what does
> On 24/11/15 10:30, Zac Medico wrote:
>> +pargs, kwargs = item
>> +kwargs = kwargs.copy()
>> +kwargs['collect_use_changes'] = True
>> +if not self._show_unsatisfied_dep(*pargs,
>> +**portage._native_kwargs(kwargs))
> 
> really do line by line?

Oh, let me explain better. The args and kwargs contain arguments for
_show_unsatisfied_dep that have been queued for later display. Instead
of actually displaying the unsatisfied deps, this code passes an extra
collect_use_changes argument to _show_unsatisfied_dep, causing it to
create appropriate autounmask changes to solve these unsatisfied deps.
-- 
Thanks,
Zac



[gentoo-portage-dev] [PATCH] depgraph: autounmask for conditional USE deps (bug 566704)

2015-11-24 Thread Zac Medico
For parents with unsatisfied conditional dependencies, translate
USE change suggestions into autounmask changes.

X-Gentoo-Bug: 566704
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=566704
---
 pym/_emerge/depgraph.py| 36 +++-
 .../tests/resolver/test_autounmask_parent.py   | 38 ++
 2 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 pym/portage/tests/resolver/test_autounmask_parent.py

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 57040ab..0fba4c9 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -4075,6 +4075,7 @@ class depgraph(object):
# Now that the root packages have been added to the graph,
# process the dependencies.
if not self._create_graph():
+   self._apply_parent_use_changes()
return 0, myfavorites
 
try:
@@ -4162,6 +4163,24 @@ class depgraph(object):
# We're true here unless we are missing binaries.
return (True, myfavorites)
 
+   def _apply_parent_use_changes(self):
+   """
+   For parents with unsatisfied conditional dependencies, translate
+   USE change suggestions into autounmask changes.
+   """
+   if (self._dynamic_config._unsatisfied_deps_for_display and
+   self._dynamic_config._autounmask):
+   remaining_items = []
+   for item in 
self._dynamic_config._unsatisfied_deps_for_display:
+   pargs, kwargs = item
+   kwargs = kwargs.copy()
+   kwargs['collect_use_changes'] = True
+   if not self._show_unsatisfied_dep(*pargs,
+   **portage._native_kwargs(kwargs)):
+   remaining_items.append(item)
+   if len(remaining_items) != 
len(self._dynamic_config._unsatisfied_deps_for_display):
+   
self._dynamic_config._unsatisfied_deps_for_display = remaining_items
+
def _set_args(self, args):
"""
Create the "__non_set_args__" package set from atoms and 
packages given as
@@ -4718,7 +4737,8 @@ class depgraph(object):
 
 
def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None,
-   check_backtrack=False, check_autounmask_breakage=False, 
show_req_use=None):
+   check_backtrack=False, check_autounmask_breakage=False, 
show_req_use=None,
+   collect_use_changes=False):
"""
When check_backtrack=True, no output is produced and
the method either returns or raises _backtrack_mask if
@@ -4867,6 +4887,7 @@ class depgraph(object):
else:
return
 
+   found_use_changes = False
missing_use_reasons = []
missing_iuse_reasons = []
for pkg in missing_use:
@@ -4962,15 +4983,28 @@ class depgraph(object):

"defined by %s: '%s'" % (myparent.cpv, \

human_readable_required_use(required_use))
 
+   target_use = {}
for flag in involved_flags:
if flag in 
self._pkg_use_enabled(myparent):
+   target_use[flag] = False

changes.append(colorize("blue", "-" + flag))
else:
+   target_use[flag] = True

changes.append(colorize("red", "+" + flag))
+
+   if collect_use_changes and not 
required_use_warning:
+   previous_changes = 
self._dynamic_config._needed_use_config_changes.get(myparent)
+   self._pkg_use_enabled(myparent, 
target_use=target_use)
+   if previous_changes is not 
self._dynamic_config._needed_use_config_changes.get(myparent):
+   return True
+
mreasons.append("Change USE: %s" % " 
".join(changes) + required_use_warning)
if (myparent, mreasons) not in 
missing_use_reasons:

missing_use_reasons.append((myparent, mreasons))
 
+   if collect_use_changes:
+ 

Re: [gentoo-portage-dev] [PATCH] SyncManager: redirect command stderr to stdout (bug 566132)

2015-11-24 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 23/11/15 17:46, Zac Medico wrote:
> Since the sync modules can call a variety of different commands,
> it's hard to predict which ones will unnecessarily write to stderr.
> So, the assumption here is that the process exit status is a more
> reliable indicator for errors. For example, the python code in
> GitSync will write an error message to stderr if the git process
> exits with non-zero status.
OK, then ACK, I suppose.

- -- 
Alexander
berna...@gentoo.org
https://secure.plaimi.net/~alexander
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQIcBAEBCgAGBQJWVEsyAAoJENQqWdRUGk8BbTAP/1t3hz5qFMdYeMe4qAobHupW
isScNSD2xj7edX50HwgSw8tnwRkSpGcQKCM29kkG8NCrtbEel4PuVYbCvlgBLRPP
3DH4VN5xqDGxG5HS8XB9r5DFUTDDdieeDztG0Cw8ItRahOpYXZMMWR31A6fZrd6y
jkWP/FskmjQ2cWs8TC0rQan3U4sa0BY3WwREWFArIcenrH4MIYlpX+PNRhGqm8DA
oePCZDhRGc9u2gNiaevWsRX/JjNYxchLczINEFHpZ0wrgBEI7rOosptBIvPWyo++
5Q4VFWbZMPNoAMA1VFmplB+xBHiDWya9br3IZ91Ak5Se46K4fwgcJFs/2lHyRoKN
+UZBYpRdt8JtGPchGMMgstHdJFGoWbrkWwOn7OIVURIg9QSjjnr8aVBM/sP2dKa5
pX7A5lEwD9xDB4hnTCQuVK4ugsaTXmvUYAqoUVeaD9zIZDnHmjmvWY+K8NrOmYoV
wwOUdhCofmh66+6TwaUYqFzLN5YoUPFl0XxHd58GSObv01sYpVPssGiOKQlYrZWj
MDQbw6Lh8rPMfqFr6+X6qc4SLoA50mhmvQblApzajQcBJqip1z2o13voGgEz7s7O
IAX50HjHYyYaEZG8yrm6oXxF6eC/+JK3P2rWMkx0KiWKof/ZGcnwqmfuumOWMgW0
NoIHiVwymfsoZ2fqNhDe
=cvLG
-END PGP SIGNATURE-



Re: [gentoo-portage-dev] [PATCH] depgraph: autounmask for conditional USE deps (bug 566704)

2015-11-24 Thread Alexander Berntsen
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Woah -- nice!

What's up with the pargs/kwargs stuff? I don't remember that stuff.

Specifically, what does
On 24/11/15 10:30, Zac Medico wrote:
> + pargs, kwargs = item
> + kwargs = kwargs.copy()
> + kwargs['collect_use_changes'] = True
> + if not self._show_unsatisfied_dep(*pargs,
> + **portage._native_kwargs(kwargs))

really do line by line?


ACK, though.
- -- 
Alexander
berna...@gentoo.org
https://secure.plaimi.net/~alexander
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQIcBAEBCgAGBQJWVE46AAoJENQqWdRUGk8BIL8P+wakXj+H5ETwoe5kseggsBr4
eircYV9rzNnaFqcBQ4C7LpZYKEirb4jU0mGY4l7lWwWWn3Brq/XcEFdTeP3L/UP4
OqOqP5ceqc1SSFXKK5iBRDGl2Q+txYrjZAfcsgv9miO+eoKb+eGY+96LzagQuwlP
IiBRK7CBJEKrPqgZo5FwPIFFFrx+Ih51NOhzzqOojJ8SQkphla8ogjBkKbqo4DL7
dZu7p2lDjkbYysCuI+5Jkc3Q9AUs+f//K3cTqUXNE5Swe+lOOWS+mPsj3MMpBnap
PIRA8sLvN8/Y6NgyDipOwnQ/pvTuZk5vKmriTwjJEtPelhu/BFOkL5jyTkS9a9bT
wsmPFtHK/6uiNhvVHwt8qBHloqfH5JmwZV8EcahDWr18zmE9QFEWHnzKhOzvg0n3
dzGk1aOAUQgwfWK4DpoYfhIcVsZVxSZkp1XrARMaBqVTsUoUQ1UPPqsmVOaTFrWF
llkp8KWVz9n2YaW3yDhAXXv/LrqZnTPilNzVZdGHBGIyUyCO2u7KoCyQNrATwLQf
OptyiK8VyTGAzjrOp/13GmQGq4ClFtK35nO34/dPIvlW29iNd27VEMC+7p7O7ZBr
OTuEqPI2rqc7oCHvYZgIAYBVQM7RHXzQJq85BxMO/eYXoT6QUgbgjorTskGAMlb4
bi1R39getrBujU0HKzZE
=mNTE
-END PGP SIGNATURE-



[gentoo-portage-dev] cat/pkg::x-portage ?

2015-11-24 Thread Joakim Tjernlund
Emerging on my embedded gentoo ppc target I see this:
  
  dev-lang/python-exec-2.0.1-r1::x-portage
  sys-apps/install-xattr-0.5::x-portage
  sys-libs/timezone-data-2015f::x-portage

Where does the name x-portage come from? I do not have a repo
named x-portage, it is still named gentoo.

 Jocke