[gentoo-portage-dev] [PATCH] portage/glsa.py: only check for revisions based on GLSA DTD

2019-08-13 Thread Aaron Bauman
* All GLSA's have been converted to use the revision attribute
* Only check that the revision attribute is populated which defaults to 1 from
tooling (e.g. GLSAMaker)
* If there is no count attribute then raise a GlsaFormatException
* Remove 'try' logic as we already check if the attribute is populated
* We only check if the attribute is populated. Whether it is an int or not is
not a concern as it is only significant to security team.

Signed-off-by: Aaron Bauman 
---
 lib/portage/glsa.py | 14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/lib/portage/glsa.py b/lib/portage/glsa.py
index ccf93439d..f0ce34f3f 100644
--- a/lib/portage/glsa.py
+++ b/lib/portage/glsa.py
@@ -528,26 +528,16 @@ class Glsa:
self.synopsis = 
getText(myroot.getElementsByTagName("synopsis")[0], format="strip")
self.announced = 
format_date(getText(myroot.getElementsByTagName("announced")[0], 
format="strip"))
 
-   # Support both formats of revised:
-   # December 30, 2007: 02
+   # Support only format defined in GLSA DTD
# 2007-12-30
revisedEl = myroot.getElementsByTagName("revised")[0]
self.revised = getText(revisedEl, format="strip")
count = revisedEl.getAttribute("count")
if not count:
-   if self.revised.find(":") >= 0:
-   (self.revised, count) = self.revised.split(":")
-   else:
-   count = 1
+   raise GlsaFormatException("Invalid revision attribute 
in GLSA: " + myroot.getAttribute("id"))
 
self.revised = format_date(self.revised)
 
-   try:
-   self.count = int(count)
-   except ValueError:
-   # TODO should this raise a GlsaFormatException?
-   self.count = 1
-
# now the optional and 0-n toplevel, #PCDATA tags and references
try:
self.access = 
getText(myroot.getElementsByTagName("access")[0], format="strip")
-- 
2.22.0




[gentoo-portage-dev] [PATCH v2] portage/glsa.py: only check for revisions based on GLSA DTD

2019-08-13 Thread Aaron Bauman
* All GLSA's have been converted to use the revision attribute
* If there is no count attribute then raise a GlsaFormatException
* Ensure the attribute is an integer

Signed-off-by: Aaron Bauman 
---
 lib/portage/glsa.py | 15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/lib/portage/glsa.py b/lib/portage/glsa.py
index ccf93439d..f94e9834d 100644
--- a/lib/portage/glsa.py
+++ b/lib/portage/glsa.py
@@ -528,25 +528,20 @@ class Glsa:
self.synopsis = 
getText(myroot.getElementsByTagName("synopsis")[0], format="strip")
self.announced = 
format_date(getText(myroot.getElementsByTagName("announced")[0], 
format="strip"))
 
-   # Support both formats of revised:
-   # December 30, 2007: 02
+   # Support only format defined in GLSA DTD
# 2007-12-30
revisedEl = myroot.getElementsByTagName("revised")[0]
self.revised = getText(revisedEl, format="strip")
count = revisedEl.getAttribute("count")
if not count:
-   if self.revised.find(":") >= 0:
-   (self.revised, count) = self.revised.split(":")
-   else:
-   count = 1
-
-   self.revised = format_date(self.revised)
+   raise GlsaFormatException("Invalid revision attribute 
in GLSA: " + myroot.getAttribute("id"))
 
try:
self.count = int(count)
except ValueError:
-   # TODO should this raise a GlsaFormatException?
-   self.count = 1
+   raise GlsaFormatException("Revision attribute in GLSA: 
" + myroot.getAttribute("id") + " is not an integer")
+
+   self.revised = format_date(self.revised)
 
# now the optional and 0-n toplevel, #PCDATA tags and references
try:
-- 
2.22.0




Re: [gentoo-portage-dev] [PATCH] Allow ESYSROOT and BROOT in the pkg_setup phase

2019-08-13 Thread Zac Medico
On 8/11/19 6:51 AM, James Le Cuirot wrote:
> From: Michał Górny 
> 
> This follows a recent change to PMS.
> 
> Signed-off-by: James Le Cuirot 
> ---
>  lib/portage/package/ebuild/config.py | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> Sending this on behalf of mgorny as requested.
> 
> diff --git a/lib/portage/package/ebuild/config.py 
> b/lib/portage/package/ebuild/config.py
> index 83a15b370..e0dda54d4 100644
> --- a/lib/portage/package/ebuild/config.py
> +++ b/lib/portage/package/ebuild/config.py
> @@ -2820,12 +2820,13 @@ class config(object):
>   if not eapi_exports_merge_type(eapi):
>   mydict.pop("MERGE_TYPE", None)
>  
> - src_phase = _phase_func_map.get(phase, '').startswith('src_')
> + src_like_phase = (phase == 'setup' or
> + _phase_func_map.get(phase, 
> '').startswith('src_'))
>  
> - if not (src_phase and eapi_attrs.sysroot):
> + if not (src_like_phase and eapi_attrs.sysroot):
>   mydict.pop("ESYSROOT", None)
>  
> - if not (src_phase and eapi_attrs.broot):
> + if not (src_like_phase and eapi_attrs.broot):
>   mydict.pop("BROOT", None)
>  
>   # Prefix variables are supported beginning with EAPI 3, or when
> 

Thanks, merged:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=f28d32f298d4b089a2e36bebca2a55b6aeabe2a3
-- 
Thanks,
Zac



signature.asc
Description: OpenPGP digital signature