Re: [gentoo-portage-dev] [PATCH 4/4] sync: Add backwards compat with SYNC_{UMASK,USER} variables

2014-12-06 Thread Zac Medico
On 12/05/2014 04:03 PM, Michał Górny wrote:
> Support SYNC_UMASK and SYNC_USER variables that were used in Funtoo
> Portage, as fallbacks to sync-umask and sync-user repo keys.
> ---
>  pym/portage/package/ebuild/_config/special_env_vars.py |  2 +-
>  pym/portage/package/ebuild/config.py   | 12 
>  pym/portage/repository/config.py   | 13 +
>  3 files changed, 26 insertions(+), 1 deletion(-)

Why should we add backward compatibility code for something that was
never supported in the master branch?

Wouldn't it make more sense to have the Funtoo ebuild run some code that
generates a config update for repos.conf?
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH 3/4] sync: ensure sync_{umask,user} is respected when creating repo

2014-12-06 Thread Zac Medico
On 12/05/2014 04:03 PM, Michał Górny wrote:
> ---
>  pym/portage/sync/controller.py | 24 ++--
>  1 file changed, 18 insertions(+), 6 deletions(-)

LGTM.
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH 2/4] sync: allow overriding sync-user for the repository

2014-12-06 Thread Zac Medico
On 12/05/2014 04:03 PM, Michał Górny wrote:
> + if len(spl) > 1:
> + group = spl[1]
> + try:
> + try:
> + # maybe it's a gid?
> + gid = int(group)
> + except ValueError:
> + gp = grp.getgrnam(group)
> + else:
> + pw = grp.getgrgid(gid)

Does this behave the same as other tools (like chown) for strings like "12345" 
? I vaguely recall
someone saying that chown tries a string lookup first, and if that fails then 
it tries an integer
lookup.

> + except KeyError:
> + writemsg("!!! Group '%s' 
> invalid or does not exist\n"
> + % group, 
> noiselevel=-1)
> + return ()
> +
> + gr = gp.gr_gid
> + else:
> + gr = pw.pw_gid
> +
> + return (pw.pw_uid, gr, pw.pw_dir)
> +
> + # user or user:group
> + (uid, gid, home) = get_sync_user_data(repo.sync_user)

If it returns () above, this will raise a ValueError, right?

>>> (x, y, z) = ()
Traceback (most recent call last):
  File "", line 1, in 
ValueError: need more than 0 values to unpack

Otherwise, LGTM.
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH 1/4] sync: allow overriding sync-umask for the repository

2014-12-06 Thread Zac Medico
On 12/05/2014 04:03 PM, Michał Górny wrote:
> ---
>  pym/portage/repository/config.py | 16 
>  pym/portage/sync/controller.py   |  3 +++
>  2 files changed, 15 insertions(+), 4 deletions(-)

LGTM.
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH] Allow virtuals in package.provided

2014-12-06 Thread Zac Medico
@Robin: This patch reverts the changes from bug 161003. Maybe this
constraint is not needed anymore?

On 12/05/2014 08:43 AM, Michał Górny wrote:
> With new-style virtuals, there is no reason to enforce special rules to
> virtuals in package.provided. If user wishes to implicitly provide
> the virual package, we should not forbid him. Of course, he knows
> the implications.
> ---
>  man/portage.5| 7 ---
>  pym/portage/package/ebuild/config.py | 6 --
>  2 files changed, 13 deletions(-)
> 
> diff --git a/man/portage.5 b/man/portage.5
> index 150294b..46835b5 100644
> --- a/man/portage.5
> +++ b/man/portage.5
> @@ -400,13 +400,6 @@ entries may cause installed packages satisfying 
> equivalent dependencies
>  to be removed by \fBemerge\fR(1) \fB\-\-depclean\fR actions (see the
>  \fBACTIONS\fR section of the \fBemerge\fR(1) man page for more information).
>  
> -Virtual packages (virtual/*) should not be specified in package.provided,
> -since virtual packages themselves do not provide any files, and
> -package.provided is intended to represent packages that do provide files.
> -Depending on the type of virtual, it may be necessary to add an entry to the
> -virtuals file and/or add a package that satisfies a virtual to
> -package.provided.

LGTM. I guess we can mark bug 161003 resolved as "OBSOLETE".

[1] https://bugs.gentoo.org/show_bug.cgi?id=161003
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH] bin/ebuild: fix --color=n for bug #531690

2014-12-06 Thread Brian Dolbec
On Sat,  6 Dec 2014 11:24:47 -0800
Zac Medico  wrote:

> When the NOCOLOR variable is overridden in portage.settings, it's
> necessary to call the config.backup_changes method in order for the
> change to persist through config.reset calls.
> 
> X-Gentoo-Bug: 531690
> X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=531690
> ---
>  bin/ebuild | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/bin/ebuild b/bin/ebuild
> index a62aa20..ad52ed5 100755
> --- a/bin/ebuild
> +++ b/bin/ebuild
> @@ -110,6 +110,7 @@ if not opts.color == 'y' and \
>   portage.output.nocolor()
>   portage.settings.unlock()
>   portage.settings['NOCOLOR'] = 'true'
> + portage.settings.backup_changes('NOCOLOR')
>   portage.settings.lock()
>  
>  ebuild = pargs.pop(0)


that looks like a "DOH!" fix patch ;)

merge please

-- 
Brian Dolbec 




Re: [gentoo-portage-dev] [PATCH v2] Install a verbose example postsync.d script

2014-12-06 Thread Brian Dolbec
On Fri,  5 Dec 2014 17:12:17 +0100
Michał Górny  wrote:

> ---
>  cnf/postsync.d/example | 63
> ++
> setup.py   |  1 + 2 files changed, 64 insertions(+)
>  create mode 100644 cnf/postsync.d/example
> 
> diff --git a/cnf/postsync.d/example b/cnf/postsync.d/example
> new file mode 100644
> index 000..773e519
> --- /dev/null
> +++ b/cnf/postsync.d/example
> @@ -0,0 +1,63 @@
> +#!/bin/sh
> +# Example /etc/portage/postsync.d script. Make it executable (chmod
> +x) for +# Portage to process it.
> +#
> +# With portage-2.2.16 and newer, all hooks will be called multiple
> +# times:
> +# 1. after syncing each repository,
> +# 2. one more time after syncing all the repositories.
> +#
> +# Older versions of Portage support syncing only one repository.
> +# In those versions, the hooks will be called only once, and they
> will +# not be passed any parameters.
> +
> +# On a per-repository hook call, positional parameters contain
> +# information about the just-synced repository. On the final hook
> call, +# the parameters are empty.
> +
> +# The repository name (or null in the final hook).
> +repository_name=${1}
> +# The URI to which the repository was synced.
> +sync_uri=${2}
> +# The path to the repository.
> +repository_path=${3}
> +
> +# Portage assumes that a hook succeeded if it exits with 0 code. If
> no +# explicit exit is done, the exit code is the exit code of last
> spawned +# command. Since our script is a bit more complex, we want
> to control +# the exit code explicitly.
> +ret=0
> +
> +if [ -n "${repository_name}" ]; then
> + # Repository name was provided, so we're in a
> post-repository hook.
> + echo "* In post-repository hook for ${repository_name}"
> + echo "** synced from remote repository ${sync_uri}"
> + echo "** synced into ${repository_path}"
> +
> + # Gentoo comes with pregenerated cache but the other
> repositories
> + # usually don't. Generate them to improve performance.
> + if [ "${repository_name}" != "gentoo" ]; then
> + if ! egencache --update --repo="${repository_name}"
> --jobs=4
> + then
> + echo "!!! egencache failed!"
> + ret=1
> + fi
> + fi
> +else
> + # No repository name provided, so we've synced all
> repositories.
> + # Now it's time to run commands that work on all repositories
> + # simultaneously.
> +
> + echo "* In final post-sync hook"
> +
> + # Run eix-update if eix is installed.
> + if [ -n "$(type -p eix-update)" ]; then
> + if ! eix-update; then
> + echo "!!! eix-update failed"
> + ret=1
> + fi
> + fi
> +fi
> +
> +# Return explicit status.
> +exit "${ret}"
> diff --git a/setup.py b/setup.py
> index 4388a99..367cdb4 100755
> --- a/setup.py
> +++ b/setup.py
> @@ -629,6 +629,7 @@ setup(
>   ['$portage_setsdir', ['cnf/sets/portage.conf']],
>   ['$docdir', ['NEWS', 'RELEASE-NOTES']],
>   ['$portage_base/bin', ['bin/deprecated-path']],
> + ['$sysconfdir/portage/postsync.d',
> ['cnf/postsync.d/example']], ],
>  
>   cmdclass = {


I committed a trimmed down slightly re-worded version which installs to
repo.postsync.d/example.

This new repo.postsync.d directory and system is strictly for per-repo
hooks.  In this way, the original postsync.d directory hooks are only
run once after all repos are run.  It also does not break compatibility
with existing hooks.

-- 
Brian Dolbec 




Re: [gentoo-portage-dev] [PATCH 2/2] portage/sync/controller.py: Make a per-repo postsync.d subdir

2014-12-06 Thread Brian Dolbec
On Sat, 6 Dec 2014 20:51:38 -0800
Brian Dolbec  wrote:

> On Sat, 06 Dec 2014 18:04:28 -0800
> Zac Medico  wrote:
> 
> > On 12/06/2014 05:54 PM, Brian Dolbec wrote:
> > > From b02b4dff30a7930d5308e400a46c3e59bbee0350 Mon Sep 17 00:00:00
> > > 2001 From: Brian Dolbec 
> > > Date: Sat, 6 Dec 2014 14:54:36 -0800
> > > Subject: [PATCH] portage/sync/controller.py: Make a
> > > repo.postsync.d directory
> > > 
> > > This then runs per-repo postsync hooks only on scripts in the
> > > repo.postsync.d directory. This also maintains compatibility with
> > > existing scripts in the postsync.d dir or other sub-directories.
> > > Both postsync.d directories support subdirectories.
> > > Scripts are run in sorted order.
> > 
> > Thanks, LGTM.
> > 
> > As an alternative to os.walk, we could use the
> > portage.util._recursive_file_list function, which filters out VCS
> > directories, hidden files, and files ending with ~. It yields the
> > file names in sorted order, so it would make sense to store them in
> > an OrderedDict so that they don't have to be sorted again later.
> 
> and again... ;)  grumble, grumble
> 
> From c005006b290ff6b2c72c94aaa29b033a57c4414a Mon Sep 17 00:00:00 2001
> From: Brian Dolbec 
> Date: Sat, 6 Dec 2014 14:54:36 -0800
> Subject: [PATCH] portage/sync/controller.py: Make a repo.postsync.d
> directory
> 
> This then runs per-repo postsync hooks only on scripts in the
> repo.postsync.d directory. This also maintains compatibility with
> existing scripts in the postsync.d dir or other sub-directories.
> Both postsync.d directories support subdirectories.
> Scripts are run in sorted order.
> ---
>  pym/portage/sync/controller.py | 36
> ++-- 1 file changed, 22
> insertions(+), 14 deletions(-)
> 
> diff --git a/pym/portage/sync/controller.py
> b/pym/portage/sync/controller.py index 21aa7a7..462b2c0 100644
> --- a/pym/portage/sync/controller.py
> +++ b/pym/portage/sync/controller.py
> @@ -7,6 +7,7 @@ from __future__ import print_function
>  import sys
>  import logging
>  import pwd
> +from collections import OrderedDict

ok, used:
from portage import OrderedDict

which will maintain py2.6 compatibility

merged.

-- 
Brian Dolbec 




Re: [gentoo-portage-dev] [PATCH 2/2] portage/sync/controller.py: Make a per-repo postsync.d subdir

2014-12-06 Thread Brian Dolbec
On Sat, 06 Dec 2014 18:04:28 -0800
Zac Medico  wrote:

> On 12/06/2014 05:54 PM, Brian Dolbec wrote:
> > From b02b4dff30a7930d5308e400a46c3e59bbee0350 Mon Sep 17 00:00:00
> > 2001 From: Brian Dolbec 
> > Date: Sat, 6 Dec 2014 14:54:36 -0800
> > Subject: [PATCH] portage/sync/controller.py: Make a repo.postsync.d
> > directory
> > 
> > This then runs per-repo postsync hooks only on scripts in the
> > repo.postsync.d directory. This also maintains compatibility with
> > existing scripts in the postsync.d dir or other sub-directories.
> > Both postsync.d directories support subdirectories.
> > Scripts are run in sorted order.
> 
> Thanks, LGTM.
> 
> As an alternative to os.walk, we could use the
> portage.util._recursive_file_list function, which filters out VCS
> directories, hidden files, and files ending with ~. It yields the file
> names in sorted order, so it would make sense to store them in an
> OrderedDict so that they don't have to be sorted again later.

and again... ;)  grumble, grumble

From c005006b290ff6b2c72c94aaa29b033a57c4414a Mon Sep 17 00:00:00 2001
From: Brian Dolbec 
Date: Sat, 6 Dec 2014 14:54:36 -0800
Subject: [PATCH] portage/sync/controller.py: Make a repo.postsync.d directory

This then runs per-repo postsync hooks only on scripts in the repo.postsync.d 
directory.
This also maintains compatibility with existing scripts in the postsync.d dir 
or other
sub-directories.
Both postsync.d directories support subdirectories.
Scripts are run in sorted order.
---
 pym/portage/sync/controller.py | 36 ++--
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 21aa7a7..462b2c0 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -7,6 +7,7 @@ from __future__ import print_function
 import sys
 import logging
 import pwd
+from collections import OrderedDict
 
 import portage
 from portage import os
@@ -21,6 +22,7 @@ warn = create_color_func("WARN")
 from portage.package.ebuild.doebuild import _check_temp_dir
 from portage.metadata import action_metadata
 from portage import _unicode_decode
+from portage import util
 
 
 class TaskHandler(object):
@@ -88,19 +90,21 @@ class SyncManager(object):
 
self.module_controller = portage.sync.module_controller
self.module_names = self.module_controller.module_names
-   postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
-   portage.USER_CONFIG_PATH, "postsync.d")
-   hooks = []
-   for root, dirs, names in os.walk(postsync_dir, topdown=True):
-   #print("root:", root, "dirs:", dirs, "names:", names)
-   for name in names:
-   filepath = os.path.join(root, name)
+   self.hooks = {}
+   for _dir in ["repo.postsync.d", "postsync.d"]:
+   postsync_dir = 
os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+   portage.USER_CONFIG_PATH, _dir)
+   hooks = OrderedDict()
+   for filepath in util._recursive_file_list(postsync_dir):
+   name = 
filepath.split(postsync_dir)[1].lstrip(os.sep)
if os.access(filepath, os.X_OK):
-   hooks.append((filepath, name))
+   hooks[filepath] = name
else:
-   writemsg_level(" %s postsync.d hook: 
'%s' is not executable\n"
-   % (warn("*"), 
_unicode_decode(name),), level=logging.WARN, noiselevel=2)
-   self.hooks = hooks
+   writemsg_level(" %s %s hook: '%s' is 
not executable\n"
+   % (warn("*"), _dir, 
_unicode_decode(name),),
+   level=logging.WARN, 
noiselevel=2)
+   self.hooks[_dir] = hooks
+   print(self.hooks)
 
 
def get_module_descriptions(self, mod):
@@ -159,15 +163,19 @@ class SyncManager(object):
 
def perform_post_sync_hook(self, reponame, dosyncuri='', 
repolocation=''):
succeeded = os.EX_OK
-   for filepath, hook in self.hooks:
+   if reponame:
+   _hooks = self.hooks["repo.postsync.d"]
+   else:
+   _hooks = self.hooks["postsync.d"]
+   for filepath in _hooks:
writemsg_level("Spawning post_sync hook: %s\n"
-   % (_unicode_decode(hook)),
+   % (_unicode_decode(_hooks[filepath])),
level=logging.ERROR, noiselevel=4)
retval = portage.process.spawn([filepa

Re: [gentoo-portage-dev] [PATCH 2/2] portage/sync/controller.py: Make a per-repo postsync.d subdir

2014-12-06 Thread Zac Medico
On 12/06/2014 05:54 PM, Brian Dolbec wrote:
> From b02b4dff30a7930d5308e400a46c3e59bbee0350 Mon Sep 17 00:00:00 2001
> From: Brian Dolbec 
> Date: Sat, 6 Dec 2014 14:54:36 -0800
> Subject: [PATCH] portage/sync/controller.py: Make a repo.postsync.d directory
> 
> This then runs per-repo postsync hooks only on scripts in the repo.postsync.d 
> directory.
> This also maintains compatibility with existing scripts in the postsync.d dir 
> or other
> sub-directories.
> Both postsync.d directories support subdirectories.
> Scripts are run in sorted order.

Thanks, LGTM.

As an alternative to os.walk, we could use the
portage.util._recursive_file_list function, which filters out VCS
directories, hidden files, and files ending with ~. It yields the file
names in sorted order, so it would make sense to store them in an
OrderedDict so that they don't have to be sorted again later.
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH 2/2] portage/sync/controller.py: Make a per-repo postsync.d subdir

2014-12-06 Thread Brian Dolbec
On Sat, 06 Dec 2014 17:39:45 -0800
Zac Medico  wrote:

> On 12/06/2014 04:53 PM, Brian Dolbec wrote:
> > 
> > From cd6ef521f930578763ae043a4bc43281bba3bf0e Mon Sep 17 00:00:00
> > 2001 From: Brian Dolbec 
> > Date: Sat, 6 Dec 2014 14:54:36 -0800
> > Subject: [PATCH 2/2] portage/sync/controller.py: Make a per-repo
> > postsync.d subdir
> > 
> > This then runs per-repo postsync hooks only on scripts in the
> > per-repo subdir. This also maintains compatibility with existing
> > scripts in the postsync.d dir or other sub-directories.
> 
> I think a separate repo.postsync.d directory would be a nicer way to
> organize things.

your wish is my...

From b02b4dff30a7930d5308e400a46c3e59bbee0350 Mon Sep 17 00:00:00 2001
From: Brian Dolbec 
Date: Sat, 6 Dec 2014 14:54:36 -0800
Subject: [PATCH] portage/sync/controller.py: Make a repo.postsync.d directory

This then runs per-repo postsync hooks only on scripts in the repo.postsync.d 
directory.
This also maintains compatibility with existing scripts in the postsync.d dir 
or other
sub-directories.
Both postsync.d directories support subdirectories.
Scripts are run in sorted order.
---
 pym/portage/sync/controller.py | 35 +--
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 21aa7a7..1127b75 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -88,19 +88,22 @@ class SyncManager(object):
 
self.module_controller = portage.sync.module_controller
self.module_names = self.module_controller.module_names
-   postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
-   portage.USER_CONFIG_PATH, "postsync.d")
-   hooks = []
-   for root, dirs, names in os.walk(postsync_dir, topdown=True):
-   #print("root:", root, "dirs:", dirs, "names:", names)
-   for name in names:
-   filepath = os.path.join(root, name)
-   if os.access(filepath, os.X_OK):
-   hooks.append((filepath, name))
-   else:
-   writemsg_level(" %s postsync.d hook: 
'%s' is not executable\n"
-   % (warn("*"), 
_unicode_decode(name),), level=logging.WARN, noiselevel=2)
-   self.hooks = hooks
+   self.hooks = {}
+   for _dir in ["repo.postsync.d", "postsync.d"]:
+   postsync_dir = 
os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+   portage.USER_CONFIG_PATH, _dir)
+   hooks = {}
+   for root, dirs, names in os.walk(postsync_dir, 
topdown=True):
+   #print("root:", root, "dirs:", dirs, "names:", 
names)
+   for name in names:
+   filepath = os.path.join(root, name)
+   if os.access(filepath, os.X_OK):
+   hooks[filepath] = name
+   else:
+   writemsg_level(" %s %s hook: 
'%s' is not executable\n"
+   % (warn("*"), _dir, 
_unicode_decode(name),),
+   level=logging.WARN, 
noiselevel=2)
+   self.hooks[_dir] = hooks
 
 
def get_module_descriptions(self, mod):
@@ -159,7 +162,11 @@ class SyncManager(object):
 
def perform_post_sync_hook(self, reponame, dosyncuri='', 
repolocation=''):
succeeded = os.EX_OK
-   for filepath, hook in self.hooks:
+   if reponame:
+   _hooks = self.hooks["repo.postsync.d"]
+   else:
+   _hooks = self.hooks["postsync.d"]
+   for filepath, hook in [(f,_hooks[f]) for f in sorted(_hooks)]:
writemsg_level("Spawning post_sync hook: %s\n"
% (_unicode_decode(hook)),
level=logging.ERROR, noiselevel=4)
-- 
2.1.2



-- 
Brian Dolbec 




Re: [gentoo-portage-dev] [PATCH 2/2] portage/sync/controller.py: Make a per-repo postsync.d subdir

2014-12-06 Thread Zac Medico
On 12/06/2014 04:53 PM, Brian Dolbec wrote:
> 
> From cd6ef521f930578763ae043a4bc43281bba3bf0e Mon Sep 17 00:00:00 2001
> From: Brian Dolbec 
> Date: Sat, 6 Dec 2014 14:54:36 -0800
> Subject: [PATCH 2/2] portage/sync/controller.py: Make a per-repo postsync.d 
> subdir
> 
> This then runs per-repo postsync hooks only on scripts in the per-repo subdir.
> This also maintains compatibility with existing scripts in the postsync.d dir 
> or other
> sub-directories.

I think a separate repo.postsync.d directory would be a nicer way to
organize things.
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH 1/2] bin/phase-helpers.shL Fix unpack() for deb2targz .xz types

2014-12-06 Thread Zac Medico
On 12/06/2014 04:52 PM, Brian Dolbec wrote:
> 
> From 4cb661d994cf8503c4459b8f7da7ee0f739a9826 Mon Sep 17 00:00:00 2001
> From: Brian Dolbec 
> Date: Sat, 6 Dec 2014 14:51:13 -0800
> Subject: [PATCH 1/2] bin/phase-helpers.shL Fix unpack() for deb2targz .xz 
> types
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Issue reported by: mva in irc
> 
 Unpacking source...
 Unpacking 2gis_4.14.11-0trusty1+shv139+r191_amd64.deb to 
 /var/tmp/portage/app-misc/2gis-4.14.11.139.191/work
> deb2targz: converting '2gis_4.14.11-0trusty1+shv139+r191_amd64.deb' ...
> deb2targz: skipping section 'debian-binary'
> deb2targz: skipping section 'control.tar.gz'
> deb2targz: wrote '2gis_4.14.11-0trusty1+shv139+r191_amd64.tar.xz'
> mv: cannot stat ‘2gis_4.14.11-0trusty1+shv139+r191_amd64.tar.gz’: No such 
> file or directory
> ---
>  bin/phase-helpers.sh | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
> index 6e437da..91f80c9 100644
> --- a/bin/phase-helpers.sh
> +++ b/bin/phase-helpers.sh
> @@ -475,8 +475,9 @@ unpack() {
>   rm -f "$y"
>   fi
>   if ! mv -f "${y%.deb}".tar.gz 
> data.tar.gz; then
> - __helpers_die "$myfail"
> - return 1
> + if ! mv -f "${y%.deb}".tar.xz 
> data.tar.xz; then
> + __helpers_die "$myfail"
> + return 1
>   fi
>   else
>   if ! ar x "$srcdir$x"; then
> 

The PMS people should be *very* interested in any changes to unpack
behavior like this. It supports behavior that will lead to failures for
older versions of portage and other package managers.
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH] dblink._protect: disable config protect for identical files (531854)

2014-12-06 Thread Brian Dolbec
On Sat,  6 Dec 2014 16:46:55 -0800
Zac Medico  wrote:

> Since commit 02417188225758b1822d176abd8902a92300a371, config
> protection was triggered for identical files if
> config-protect-if-modified was not enabled in FEATURES. Fix it
> to skip config protection in this case.
> 
> Fixes: 024171882257 ("CONFIG_PROTECT: protect symlinks, bug #485598")
> X-Gentoo-Bug: 531854
> X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=531854
> ---
>  pym/portage/dbapi/vartree.py | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/pym/portage/dbapi/vartree.py
> b/pym/portage/dbapi/vartree.py index df031cd..4840492 100644
> --- a/pym/portage/dbapi/vartree.py
> +++ b/pym/portage/dbapi/vartree.py
> @@ -4856,8 +4856,10 @@ class dblink(object):
>  
>   if protected and dest_mode is not None:
>   # we have a protection path; enable config
> file management.
> - if src_md5 != dest_md5 and \
> - src_md5 ==
> cfgfiledict.get(dest_real, [None])[0]:
> + if src_md5 == dest_md5:
> + protected = False
> +
> + elif src_md5 == cfgfiledict.get(dest_real,
> [None])[0]: # An identical update has previously been
>   # merged.  Skip it unless the user
> has chosen # --noconfmem.

LGTM

-- 
Brian Dolbec 




[gentoo-portage-dev] [PATCH 2/2] portage/sync/controller.py: Make a per-repo postsync.d subdir

2014-12-06 Thread Brian Dolbec

From cd6ef521f930578763ae043a4bc43281bba3bf0e Mon Sep 17 00:00:00 2001
From: Brian Dolbec 
Date: Sat, 6 Dec 2014 14:54:36 -0800
Subject: [PATCH 2/2] portage/sync/controller.py: Make a per-repo postsync.d 
subdir

This then runs per-repo postsync hooks only on scripts in the per-repo subdir.
This also maintains compatibility with existing scripts in the postsync.d dir 
or other
sub-directories.
---
 pym/portage/sync/controller.py | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py
index 21aa7a7..c9ae5b4 100644
--- a/pym/portage/sync/controller.py
+++ b/pym/portage/sync/controller.py
@@ -88,15 +88,15 @@ class SyncManager(object):
 
self.module_controller = portage.sync.module_controller
self.module_names = self.module_controller.module_names
-   postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"],
+   self.postsync_dir = 
os.path.join(self.settings["PORTAGE_CONFIGROOT"],
portage.USER_CONFIG_PATH, "postsync.d")
-   hooks = []
-   for root, dirs, names in os.walk(postsync_dir, topdown=True):
+   hooks = {}
+   for root, dirs, names in os.walk(self.postsync_dir, 
topdown=True):
#print("root:", root, "dirs:", dirs, "names:", names)
for name in names:
filepath = os.path.join(root, name)
if os.access(filepath, os.X_OK):
-   hooks.append((filepath, name))
+   hooks[filepath] = name
else:
writemsg_level(" %s postsync.d hook: 
'%s' is not executable\n"
% (warn("*"), 
_unicode_decode(name),), level=logging.WARN, noiselevel=2)
@@ -159,7 +159,11 @@ class SyncManager(object):
 
def perform_post_sync_hook(self, reponame, dosyncuri='', 
repolocation=''):
succeeded = os.EX_OK
-   for filepath, hook in self.hooks:
+   if reponame:
+   hooks = [(f,self.hooks[f]) for f in sorted(self.hooks) 
if 'per-repo' in f]
+   else:
+   hooks = [(f,self.hooks[f]) for f in sorted(self.hooks) 
if 'per-repo' not in f]
+   for filepath, hook in hooks:
writemsg_level("Spawning post_sync hook: %s\n"
% (_unicode_decode(hook)),
level=logging.ERROR, noiselevel=4)
-- 
2.1.2


-- 
Brian Dolbec 




[gentoo-portage-dev] [PATCH 1/2] bin/phase-helpers.shL Fix unpack() for deb2targz .xz types

2014-12-06 Thread Brian Dolbec

From 4cb661d994cf8503c4459b8f7da7ee0f739a9826 Mon Sep 17 00:00:00 2001
From: Brian Dolbec 
Date: Sat, 6 Dec 2014 14:51:13 -0800
Subject: [PATCH 1/2] bin/phase-helpers.shL Fix unpack() for deb2targz .xz types
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Issue reported by: mva in irc

>>> Unpacking source...
>>> Unpacking 2gis_4.14.11-0trusty1+shv139+r191_amd64.deb to 
>>> /var/tmp/portage/app-misc/2gis-4.14.11.139.191/work
deb2targz: converting '2gis_4.14.11-0trusty1+shv139+r191_amd64.deb' ...
deb2targz: skipping section 'debian-binary'
deb2targz: skipping section 'control.tar.gz'
deb2targz: wrote '2gis_4.14.11-0trusty1+shv139+r191_amd64.tar.xz'
mv: cannot stat ‘2gis_4.14.11-0trusty1+shv139+r191_amd64.tar.gz’: No such file 
or directory
---
 bin/phase-helpers.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 6e437da..91f80c9 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -475,8 +475,9 @@ unpack() {
rm -f "$y"
fi
if ! mv -f "${y%.deb}".tar.gz 
data.tar.gz; then
-   __helpers_die "$myfail"
-   return 1
+   if ! mv -f "${y%.deb}".tar.xz 
data.tar.xz; then
+   __helpers_die "$myfail"
+   return 1
fi
else
if ! ar x "$srcdir$x"; then
-- 
2.1.2

-- 
Brian Dolbec 




[gentoo-portage-dev] [PATCH] dblink._protect: disable config protect for identical files (531854)

2014-12-06 Thread Zac Medico
Since commit 02417188225758b1822d176abd8902a92300a371, config
protection was triggered for identical files if
config-protect-if-modified was not enabled in FEATURES. Fix it
to skip config protection in this case.

Fixes: 024171882257 ("CONFIG_PROTECT: protect symlinks, bug #485598")
X-Gentoo-Bug: 531854
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=531854
---
 pym/portage/dbapi/vartree.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index df031cd..4840492 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -4856,8 +4856,10 @@ class dblink(object):
 
if protected and dest_mode is not None:
# we have a protection path; enable config file 
management.
-   if src_md5 != dest_md5 and \
-   src_md5 == cfgfiledict.get(dest_real, 
[None])[0]:
+   if src_md5 == dest_md5:
+   protected = False
+
+   elif src_md5 == cfgfiledict.get(dest_real, [None])[0]:
# An identical update has previously been
# merged.  Skip it unless the user has chosen
# --noconfmem.
-- 
2.0.4




[gentoo-portage-dev] [PATCH] bin/ebuild: fix --color=n for bug #531690

2014-12-06 Thread Zac Medico
When the NOCOLOR variable is overridden in portage.settings, it's
necessary to call the config.backup_changes method in order for the
change to persist through config.reset calls.

X-Gentoo-Bug: 531690
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=531690
---
 bin/ebuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bin/ebuild b/bin/ebuild
index a62aa20..ad52ed5 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -110,6 +110,7 @@ if not opts.color == 'y' and \
portage.output.nocolor()
portage.settings.unlock()
portage.settings['NOCOLOR'] = 'true'
+   portage.settings.backup_changes('NOCOLOR')
portage.settings.lock()
 
 ebuild = pargs.pop(0)
-- 
2.0.4