Re: [gentoo-portage-dev] Re: [PATCH v2 3/3] _emerge.Ebuild*: delay creating DISTDIR shadow until src_unpack

2018-01-25 Thread Zac Medico
On 01/25/2018 10:42 PM, Michał Górny wrote:
> W dniu czw, 25.01.2018 o godzinie 21∶30 -0800, użytkownik Zac Medico
> napisał:
>> On 01/25/2018 01:11 AM, Michał Górny wrote:
>>> W dniu czw, 25.01.2018 o godzinie 10∶07 +0100, użytkownik Michael
>>> Haubenwallner napisał:
 Hi,

 ${Subject} ringing a bell here:

 dev-db/oracle-instantclient is fetch restricted. As a binary package with
 multiple USE options there's a bunch of files to download - even for
 multiple archs when multilib is active.

 So in pkg_nofetch() I'm telling the user whether a file to download is
 "already here" or "still absent", by testing if $A exists in $DISTDIR.

 With ${Subject}, I'm wondering if DISTDIR is created for pkg_nofetch too.

>>>
>>> You're doing the wrong thing then. DISTDIR is not allowed
>>> in pkg_nofetch().
>>
>> It seems to be a common assumption that it's allowed, this command
>> currently shows 163 results in the gentoo repo:
>>
>> git grep -l pkg_nofetch | xargs grep 'e\(log\|info\).*DISTDIR' | wc -l
>>
>> We should double check with the PMS maintainers to see if they think
>> it's worthy of an exception. Otherwise, we need to announce the issue on
>> the gentoo-dev mailing list.
> 
> PMS maintainers already verified that back during the first run of those
> patches. However, we believe the only reasonable way to get this out of
> pkg_nofetch() is to actually stop it from working, so people would stop
> using it.

Okay, that works for me. The patches looks good. Please merge.
-- 
Thanks,
Zac



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-portage-dev] Re: [PATCH v2 3/3] _emerge.Ebuild*: delay creating DISTDIR shadow until src_unpack

2018-01-25 Thread Michał Górny
W dniu czw, 25.01.2018 o godzinie 21∶30 -0800, użytkownik Zac Medico
napisał:
> On 01/25/2018 01:11 AM, Michał Górny wrote:
> > W dniu czw, 25.01.2018 o godzinie 10∶07 +0100, użytkownik Michael
> > Haubenwallner napisał:
> > > Hi,
> > > 
> > > ${Subject} ringing a bell here:
> > > 
> > > dev-db/oracle-instantclient is fetch restricted. As a binary package with
> > > multiple USE options there's a bunch of files to download - even for
> > > multiple archs when multilib is active.
> > > 
> > > So in pkg_nofetch() I'm telling the user whether a file to download is
> > > "already here" or "still absent", by testing if $A exists in $DISTDIR.
> > > 
> > > With ${Subject}, I'm wondering if DISTDIR is created for pkg_nofetch too.
> > > 
> > 
> > You're doing the wrong thing then. DISTDIR is not allowed
> > in pkg_nofetch().
> 
> It seems to be a common assumption that it's allowed, this command
> currently shows 163 results in the gentoo repo:
> 
> git grep -l pkg_nofetch | xargs grep 'e\(log\|info\).*DISTDIR' | wc -l
> 
> We should double check with the PMS maintainers to see if they think
> it's worthy of an exception. Otherwise, we need to announce the issue on
> the gentoo-dev mailing list.

PMS maintainers already verified that back during the first run of those
patches. However, we believe the only reasonable way to get this out of
pkg_nofetch() is to actually stop it from working, so people would stop
using it.

> Furthermore, you're touching files whose hashes have
> > not been verified which is twice wrong.
> 
> Checking if files exist is not really a security risk, but yes, we
> should conform to the spec.

There's no technical reason why the ebuild wouldn't have done more than
checking if they exist.

-- 
Best regards,
Michał Górny




Re: [gentoo-portage-dev] [PATCH] install-qa-check.d: Scan build log for CMake unused var warnings

2018-01-25 Thread Michał Górny
W dniu czw, 25.01.2018 o godzinie 20∶49 -0800, użytkownik Zac Medico
napisał:
> On 01/25/2018 01:13 AM, Michał Górny wrote:
> > Scan build log and report verbosely CMake warnings about unused
> > variables. This is a quite common problem, yet currently it is hard
> > to notice it since the warning is mixed with src_configure() output.
> > Repeat it verbosely after the install.
> > 
> > This check outputs warnings such as:
> > 
> >  * One or more CMake variables were not used by the project:
> >  *   CMAKE_USER_MAKE_RULES_OVERRIDE
> > ---
> >  bin/install-qa-check.d/90cmake-warnings | 28 
> >  1 file changed, 28 insertions(+)
> >  create mode 100644 bin/install-qa-check.d/90cmake-warnings
> > 
> > diff --git a/bin/install-qa-check.d/90cmake-warnings 
> > b/bin/install-qa-check.d/90cmake-warnings
> > new file mode 100644
> > index 0..36a09851b
> > --- /dev/null
> > +++ b/bin/install-qa-check.d/90cmake-warnings
> > @@ -0,0 +1,28 @@
> > +# Check for CMake invalid option warnings
> > +
> > +cmake_warn_check() {
> > +   if [[ -n ${PORTAGE_LOG_FILE} && -r ${PORTAGE_LOG_FILE} ]] ; then
> > +   local cat=cat
> > +   [[ ${PORTAGE_LOG_FILE} == *.gz ]] && cat=zcat
> > +
> > +   local vars=()
> > +   while read -r l; do
> > +   vars+=( "${l}" )
> > +   done < <( "${cat}" "${PORTAGE_LOG_FILE}" \
> > +   | sed -n -e '/Manually-specified variables were not 
> > used by the project/,/^--/{/^/p}' \
> > +   | sort -u)
> 
> We should probably use LC_ALL=C sort to ensure locale independence.
> 
> Otherwise, this patch looks good.
> 

Done that and merged, thanks!

-- 
Best regards,
Michał Górny




Re: [gentoo-portage-dev] [PATCH 8/8] eshowkw: Always group Prefix keywords last

2018-01-25 Thread Zac Medico
On 01/23/2018 03:25 PM, Alec Warner wrote:
> 
> 
> On Tue, Jan 23, 2018 at 4:48 PM, Michał Górny  > wrote:
> 
> Always group all Prefix keywords after other types of keywords. This
> not only ensures that fbsd sorts first but more importantly stabilizes
> the LHS output between regular and -P variant -- that is, -P always adds
> additional keywords at the end.
> ---
>  pym/gentoolkit/eshowkw/keywords_header.py | 16 ++--
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/pym/gentoolkit/eshowkw/keywords_header.py
> b/pym/gentoolkit/eshowkw/keywords_header.py
> index 41b8ba4..1b64bfd 100644
> --- a/pym/gentoolkit/eshowkw/keywords_header.py
> +++ b/pym/gentoolkit/eshowkw/keywords_header.py
> @@ -142,12 +142,16 @@ class keywords_header:
>                                         break
> 
>                 # sort by, in order (to match Bugzilla):
> -               # 1. arch, then ~arch
> -               # 2. profile stability
> -               # 3. short keywords, then long (prefix, fbsd)
> -               # 4. keyword name in reverse component order
> -               normal.sort(key=lambda kw: (kw in
> self.__TESTING_KW_ARCHS,
> -                       levels.get(kw, 99), kw.count('-'),
> list(reversed(kw.split('-')
> +               # 1. non-prefix, then prefix (stable output between
> -P and not)
> +               # 2. arch, then ~arch
> +               # 3. profile stability
> +               # 4. short keywords, then long (prefix, fbsd)
> +               # 5. keyword name in reverse component order
> +               normal.sort(key=lambda kw: (self.__isPrefix(kw),
> +                       kw in self.__TESTING_KW_ARCHS,
> +                       levels.get(kw, 99),
> +                       kw.count('-'),
> +                       list(reversed(kw.split('-')
> 
> 
> I'm a bit sad about this lambda because its ended up a bit long.
> 
> What are your thoughts on splitting it out?

The fact that it's a lambda doesn't bother me so much as the
inefficiency of regenerating the key on every call. I've found this cute
little memodict decorator that will optimize it nicely:

http://code.activestate.com/recipes/578231-probably-the-fastest-memoization-decorator-in-the-/

def memodict(f):
class memodict(dict):
def __missing__(self, key):
ret = self[key] = f(key)
return ret
return memodict().__getitem__

-- 
Thanks,
Zac



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-portage-dev] Re: [PATCH v2 3/3] _emerge.Ebuild*: delay creating DISTDIR shadow until src_unpack

2018-01-25 Thread Zac Medico
On 01/25/2018 01:11 AM, Michał Górny wrote:
> W dniu czw, 25.01.2018 o godzinie 10∶07 +0100, użytkownik Michael
> Haubenwallner napisał:
>> Hi,
>>
>> ${Subject} ringing a bell here:
>>
>> dev-db/oracle-instantclient is fetch restricted. As a binary package with
>> multiple USE options there's a bunch of files to download - even for
>> multiple archs when multilib is active.
>>
>> So in pkg_nofetch() I'm telling the user whether a file to download is
>> "already here" or "still absent", by testing if $A exists in $DISTDIR.
>>
>> With ${Subject}, I'm wondering if DISTDIR is created for pkg_nofetch too.
>>
> 
> You're doing the wrong thing then. DISTDIR is not allowed
> in pkg_nofetch().

It seems to be a common assumption that it's allowed, this command
currently shows 163 results in the gentoo repo:

git grep -l pkg_nofetch | xargs grep 'e\(log\|info\).*DISTDIR' | wc -l

We should double check with the PMS maintainers to see if they think
it's worthy of an exception. Otherwise, we need to announce the issue on
the gentoo-dev mailing list.

Furthermore, you're touching files whose hashes have
> not been verified which is twice wrong.

Checking if files exist is not really a security risk, but yes, we
should conform to the spec.
-- 
Thanks,
Zac



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-portage-dev] [PATCH] install-qa-check.d: Scan build log for CMake unused var warnings

2018-01-25 Thread Zac Medico
On 01/25/2018 01:13 AM, Michał Górny wrote:
> Scan build log and report verbosely CMake warnings about unused
> variables. This is a quite common problem, yet currently it is hard
> to notice it since the warning is mixed with src_configure() output.
> Repeat it verbosely after the install.
> 
> This check outputs warnings such as:
> 
>  * One or more CMake variables were not used by the project:
>  *   CMAKE_USER_MAKE_RULES_OVERRIDE
> ---
>  bin/install-qa-check.d/90cmake-warnings | 28 
>  1 file changed, 28 insertions(+)
>  create mode 100644 bin/install-qa-check.d/90cmake-warnings
> 
> diff --git a/bin/install-qa-check.d/90cmake-warnings 
> b/bin/install-qa-check.d/90cmake-warnings
> new file mode 100644
> index 0..36a09851b
> --- /dev/null
> +++ b/bin/install-qa-check.d/90cmake-warnings
> @@ -0,0 +1,28 @@
> +# Check for CMake invalid option warnings
> +
> +cmake_warn_check() {
> + if [[ -n ${PORTAGE_LOG_FILE} && -r ${PORTAGE_LOG_FILE} ]] ; then
> + local cat=cat
> + [[ ${PORTAGE_LOG_FILE} == *.gz ]] && cat=zcat
> +
> + local vars=()
> + while read -r l; do
> + vars+=( "${l}" )
> + done < <( "${cat}" "${PORTAGE_LOG_FILE}" \
> + | sed -n -e '/Manually-specified variables were not 
> used by the project/,/^--/{/^/p}' \
> + | sort -u)
We should probably use LC_ALL=C sort to ensure locale independence.

Otherwise, this patch looks good.

> +
> + if [[ ${vars} ]]; then
> + eqawarn "One or more CMake variables were not used by 
> the project:"
> + local v
> + for v in "${vars[@]}"; do
> + eqawarn "  ${v}"
> + done
> + fi
> + fi
> +}
> +
> +cmake_warn_check
> +: # guarantee successful exit
> +
> +# vim:ft=sh
> 


-- 
Thanks,
Zac



signature.asc
Description: OpenPGP digital signature


[gentoo-portage-dev] [PATCH] install-qa-check.d: Scan build log for CMake unused var warnings

2018-01-25 Thread Michał Górny
Scan build log and report verbosely CMake warnings about unused
variables. This is a quite common problem, yet currently it is hard
to notice it since the warning is mixed with src_configure() output.
Repeat it verbosely after the install.

This check outputs warnings such as:

 * One or more CMake variables were not used by the project:
 *   CMAKE_USER_MAKE_RULES_OVERRIDE
---
 bin/install-qa-check.d/90cmake-warnings | 28 
 1 file changed, 28 insertions(+)
 create mode 100644 bin/install-qa-check.d/90cmake-warnings

diff --git a/bin/install-qa-check.d/90cmake-warnings 
b/bin/install-qa-check.d/90cmake-warnings
new file mode 100644
index 0..36a09851b
--- /dev/null
+++ b/bin/install-qa-check.d/90cmake-warnings
@@ -0,0 +1,28 @@
+# Check for CMake invalid option warnings
+
+cmake_warn_check() {
+   if [[ -n ${PORTAGE_LOG_FILE} && -r ${PORTAGE_LOG_FILE} ]] ; then
+   local cat=cat
+   [[ ${PORTAGE_LOG_FILE} == *.gz ]] && cat=zcat
+
+   local vars=()
+   while read -r l; do
+   vars+=( "${l}" )
+   done < <( "${cat}" "${PORTAGE_LOG_FILE}" \
+   | sed -n -e '/Manually-specified variables were not 
used by the project/,/^--/{/^/p}' \
+   | sort -u)
+
+   if [[ ${vars} ]]; then
+   eqawarn "One or more CMake variables were not used by 
the project:"
+   local v
+   for v in "${vars[@]}"; do
+   eqawarn "  ${v}"
+   done
+   fi
+   fi
+}
+
+cmake_warn_check
+: # guarantee successful exit
+
+# vim:ft=sh
-- 
2.16.1




Re: [gentoo-portage-dev] Re: [PATCH v2 3/3] _emerge.Ebuild*: delay creating DISTDIR shadow until src_unpack

2018-01-25 Thread Michał Górny
W dniu czw, 25.01.2018 o godzinie 10∶07 +0100, użytkownik Michael
Haubenwallner napisał:
> Hi,
> 
> ${Subject} ringing a bell here:
> 
> dev-db/oracle-instantclient is fetch restricted. As a binary package with
> multiple USE options there's a bunch of files to download - even for
> multiple archs when multilib is active.
> 
> So in pkg_nofetch() I'm telling the user whether a file to download is
> "already here" or "still absent", by testing if $A exists in $DISTDIR.
> 
> With ${Subject}, I'm wondering if DISTDIR is created for pkg_nofetch too.
> 

You're doing the wrong thing then. DISTDIR is not allowed
in pkg_nofetch(). Furthermore, you're touching files whose hashes have
not been verified which is twice wrong.

-- 
Best regards,
Michał Górny




[gentoo-portage-dev] Re: [PATCH v2 3/3] _emerge.Ebuild*: delay creating DISTDIR shadow until src_unpack

2018-01-25 Thread Michael Haubenwallner
Hi,

${Subject} ringing a bell here:

dev-db/oracle-instantclient is fetch restricted. As a binary package with
multiple USE options there's a bunch of files to download - even for
multiple archs when multilib is active.

So in pkg_nofetch() I'm telling the user whether a file to download is
"already here" or "still absent", by testing if $A exists in $DISTDIR.

With ${Subject}, I'm wondering if DISTDIR is created for pkg_nofetch too.

/haubi/

On 01/25/2018 09:50 AM, Michał Górny wrote:
> ---
>  pym/_emerge/EbuildExecuter.py | 4 
>  pym/_emerge/EbuildPhase.py| 6 --
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/pym/_emerge/EbuildExecuter.py b/pym/_emerge/EbuildExecuter.py
> index ab79ce901..d387b42be 100644
> --- a/pym/_emerge/EbuildExecuter.py
> +++ b/pym/_emerge/EbuildExecuter.py
> @@ -8,7 +8,6 @@ import portage
>  from portage import os
>  from portage.eapi import eapi_has_src_prepare_and_src_configure, \
>   eapi_exports_replace_vars
> -from portage.package.ebuild.prepare_build_dirs import _prepare_fake_distdir
>  
>  class EbuildExecuter(CompositeTask):
>  
> @@ -25,9 +24,6 @@ class EbuildExecuter(CompositeTask):
>   cleanup = 0
>   portage.prepare_build_dirs(pkg.root, settings, cleanup)
>  
> - alist = settings.configdict["pkg"].get("A", "").split()
> - _prepare_fake_distdir(settings, alist)
> -
>   if eapi_exports_replace_vars(settings['EAPI']):
>   vardb = pkg.root_config.trees['vartree'].dbapi
>   settings["REPLACING_VERSIONS"] = " ".join(
> diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py
> index aa3a66831..d3fada622 100644
> --- a/pym/_emerge/EbuildPhase.py
> +++ b/pym/_emerge/EbuildPhase.py
> @@ -1,4 +1,4 @@
> -# Copyright 1999-2013 Gentoo Foundation
> +# Copyright 1999-2018 Gentoo Foundation
>  # Distributed under the terms of the GNU General Public License v2
>  
>  import gzip
> @@ -12,7 +12,7 @@ from _emerge.MiscFunctionsProcess import 
> MiscFunctionsProcess
>  from _emerge.EbuildProcess import EbuildProcess
>  from _emerge.CompositeTask import CompositeTask
>  from portage.package.ebuild.prepare_build_dirs import (_prepare_workdir,
> - _prepare_fake_filesdir)
> + _prepare_fake_distdir, _prepare_fake_filesdir)
>  from portage.util import writemsg
>  
>  try:
> @@ -171,6 +171,8 @@ class EbuildPhase(CompositeTask):
>   def _start_ebuild(self):
>  
>   if self.phase == "unpack":
> + alist = self.settings.configdict["pkg"].get("A", 
> "").split()
> + _prepare_fake_distdir(self.settings, alist)
>   _prepare_fake_filesdir(self.settings)
>  
>   fd_pipes = self.fd_pipes
> 




[gentoo-portage-dev] [PATCH v2 1/3] portage.package.ebuild: Move _prepare_fake_distdir to .prepare_build_dirs

2018-01-25 Thread Michał Górny
---
 pym/_emerge/EbuildExecuter.py|  4 +--
 pym/portage/package/ebuild/doebuild.py   | 34 ++--
 pym/portage/package/ebuild/prepare_build_dirs.py | 33 ++-
 3 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/pym/_emerge/EbuildExecuter.py b/pym/_emerge/EbuildExecuter.py
index 5587d4eb0..ab79ce901 100644
--- a/pym/_emerge/EbuildExecuter.py
+++ b/pym/_emerge/EbuildExecuter.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from _emerge.EbuildPhase import EbuildPhase
@@ -8,7 +8,7 @@ import portage
 from portage import os
 from portage.eapi import eapi_has_src_prepare_and_src_configure, \
eapi_exports_replace_vars
-from portage.package.ebuild.doebuild import _prepare_fake_distdir
+from portage.package.ebuild.prepare_build_dirs import _prepare_fake_distdir
 
 class EbuildExecuter(CompositeTask):
 
diff --git a/pym/portage/package/ebuild/doebuild.py 
b/pym/portage/package/ebuild/doebuild.py
index f75f11a1a..c8df9b744 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2015 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import unicode_literals
@@ -31,6 +31,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.package.ebuild.digestcheck:digestcheck',
'portage.package.ebuild.digestgen:digestgen',
'portage.package.ebuild.fetch:fetch',
+   'portage.package.ebuild.prepare_build_dirs:_prepare_fake_distdir',
'portage.package.ebuild._ipc.QueryCommand:QueryCommand',
'portage.dep._slot_operator:evaluate_slot_operator_equal_deps',
'portage.package.ebuild._spawn_nofetch:spawn_nofetch',
@@ -1351,37 +1352,6 @@ def _prepare_env_file(settings):
env_extractor.wait()
return env_extractor.returncode
 
-def _prepare_fake_distdir(settings, alist):
-   orig_distdir = settings["DISTDIR"]
-   settings["PORTAGE_ACTUAL_DISTDIR"] = orig_distdir
-   edpath = settings["DISTDIR"] = \
-   os.path.join(settings["PORTAGE_BUILDDIR"], "distdir")
-   portage.util.ensure_dirs(edpath, gid=portage_gid, mode=0o755)
-
-   # Remove any unexpected files or directories.
-   for x in os.listdir(edpath):
-   symlink_path = os.path.join(edpath, x)
-   st = os.lstat(symlink_path)
-   if x in alist and stat.S_ISLNK(st.st_mode):
-   continue
-   if stat.S_ISDIR(st.st_mode):
-   shutil.rmtree(symlink_path)
-   else:
-   os.unlink(symlink_path)
-
-   # Check for existing symlinks and recreate if necessary.
-   for x in alist:
-   symlink_path = os.path.join(edpath, x)
-   target = os.path.join(orig_distdir, x)
-   try:
-   link_target = os.readlink(symlink_path)
-   except OSError:
-   os.symlink(target, symlink_path)
-   else:
-   if link_target != target:
-   os.unlink(symlink_path)
-   os.symlink(target, symlink_path)
-
 def _spawn_actionmap(settings):
features = settings.features
restrict = settings["PORTAGE_RESTRICT"].split()
diff --git a/pym/portage/package/ebuild/prepare_build_dirs.py 
b/pym/portage/package/ebuild/prepare_build_dirs.py
index e3ae318bd..16afc3f98 100644
--- a/pym/portage/package/ebuild/prepare_build_dirs.py
+++ b/pym/portage/package/ebuild/prepare_build_dirs.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import unicode_literals
@@ -409,3 +409,34 @@ def _prepare_fake_filesdir(settings):
if link_target != real_filesdir:
os.unlink(symlink_path)
os.symlink(real_filesdir, symlink_path)
+
+def _prepare_fake_distdir(settings, alist):
+   orig_distdir = settings["DISTDIR"]
+   settings["PORTAGE_ACTUAL_DISTDIR"] = orig_distdir
+   edpath = settings["DISTDIR"] = \
+   os.path.join(settings["PORTAGE_BUILDDIR"], "distdir")
+   portage.util.ensure_dirs(edpath, gid=portage_gid, mode=0o755)
+
+   # Remove any unexpected files or directories.
+   for x in os.listdir(edpath):
+   symlink_path = os.path.join(edpath, x)
+   st = os.lstat(symlink_path)
+   if x in alist and stat.S_ISLNK(st.st_mode):
+   continue
+   if stat.S_ISDIR(st.st_mode):
+   shutil.rmtree(symlink_path)
+   else:
+   os.unlink(symlin

[gentoo-portage-dev] [PATCH v2 2/3] portage.package.ebuild.config: Override DISTDIR unconditionally

2018-01-25 Thread Michał Górny
Ensure that DISTDIR is always defined to the path to the shadow
directory. This ensures that PMS rules for consistent value are
followed, and that no global scope calls should be able to access
the distfile directory. This also ensures that global-scope assignments
(e.g. in PATCHES) do not work around the shadow directory.

Bug: https://bugs.gentoo.org/612972
---
 pym/portage/package/ebuild/config.py | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/pym/portage/package/ebuild/config.py 
b/pym/portage/package/ebuild/config.py
index d0225a311..5624e86d3 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2016 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import unicode_literals
@@ -2848,6 +2848,15 @@ class config(object):
else:
raise AssertionError("C locale did not 
pass the test!")
 
+   try:
+   builddir = mydict["PORTAGE_BUILDDIR"]
+   distdir = mydict["DISTDIR"]
+   except KeyError:
+   pass
+   else:
+   mydict["PORTAGE_ACTUAL_DISTDIR"] = distdir
+   mydict["DISTDIR"] = os.path.join(builddir, "distdir")
+
return mydict
 
def thirdpartymirrors(self):
-- 
2.16.1




[gentoo-portage-dev] [PATCH v2 3/3] _emerge.Ebuild*: delay creating DISTDIR shadow until src_unpack

2018-01-25 Thread Michał Górny
---
 pym/_emerge/EbuildExecuter.py | 4 
 pym/_emerge/EbuildPhase.py| 6 --
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/pym/_emerge/EbuildExecuter.py b/pym/_emerge/EbuildExecuter.py
index ab79ce901..d387b42be 100644
--- a/pym/_emerge/EbuildExecuter.py
+++ b/pym/_emerge/EbuildExecuter.py
@@ -8,7 +8,6 @@ import portage
 from portage import os
 from portage.eapi import eapi_has_src_prepare_and_src_configure, \
eapi_exports_replace_vars
-from portage.package.ebuild.prepare_build_dirs import _prepare_fake_distdir
 
 class EbuildExecuter(CompositeTask):
 
@@ -25,9 +24,6 @@ class EbuildExecuter(CompositeTask):
cleanup = 0
portage.prepare_build_dirs(pkg.root, settings, cleanup)
 
-   alist = settings.configdict["pkg"].get("A", "").split()
-   _prepare_fake_distdir(settings, alist)
-
if eapi_exports_replace_vars(settings['EAPI']):
vardb = pkg.root_config.trees['vartree'].dbapi
settings["REPLACING_VERSIONS"] = " ".join(
diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py
index aa3a66831..d3fada622 100644
--- a/pym/_emerge/EbuildPhase.py
+++ b/pym/_emerge/EbuildPhase.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import gzip
@@ -12,7 +12,7 @@ from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
 from _emerge.EbuildProcess import EbuildProcess
 from _emerge.CompositeTask import CompositeTask
 from portage.package.ebuild.prepare_build_dirs import (_prepare_workdir,
-   _prepare_fake_filesdir)
+   _prepare_fake_distdir, _prepare_fake_filesdir)
 from portage.util import writemsg
 
 try:
@@ -171,6 +171,8 @@ class EbuildPhase(CompositeTask):
def _start_ebuild(self):
 
if self.phase == "unpack":
+   alist = self.settings.configdict["pkg"].get("A", 
"").split()
+   _prepare_fake_distdir(self.settings, alist)
_prepare_fake_filesdir(self.settings)
 
fd_pipes = self.fd_pipes
-- 
2.16.1




[gentoo-portage-dev] [PATCHES v2] DISTDIR shadow updates

2018-01-25 Thread Michał Górny
Hi,

Here's the refurbished patches for DISTDIR shadow updates, with Zac's
feedback implemented. Please review.

--
Best regards,
Michał Górny




Re: [gentoo-portage-dev] [PATCH v4] rsync: Introduce support for running full-tree gemato verification

2018-01-25 Thread Michał Górny
W dniu śro, 24.01.2018 o godzinie 13∶56 -0800, użytkownik Zac Medico
napisał:
> On 01/24/2018 01:36 PM, Michał Górny wrote:
> > Add two new configuration options to rsync repositories:
> > sync-rsync-verify-metamanifest and sync-rsync-openpgp-key-path.
> > The first controls whether gemato verification is run for
> > the repository (defaults to true for ::gentoo, false otherwise),
> > the second makes it possible to override the key path for custom
> > repositories.
> > ---
> >  cnf/repos.conf |  2 ++
> >  man/portage.5  |  9 +
> >  pym/portage/sync/modules/rsync/__init__.py |  4 +++-
> >  pym/portage/sync/modules/rsync/rsync.py| 20 +++-
> >  4 files changed, 33 insertions(+), 2 deletions(-)
> > 
> > v4: also key option to repos.conf
> 
> Looks good.
> 
> I see that the man page currently does not escape hyphens in
> sync-rsync-*, but we can fix those up separately.

Fixed that and pushed. Thanks! Note however that the hyphens
in adjoining entries that I haven't modified are still unescaped.

-- 
Best regards,
Michał Górny