Re: [gentoo-portage-dev] [PATCH] _emerge/depgraph.py: Autounmask-write fails when there isn't a file in package.*/ bug 598116

2016-12-04 Thread Brian Dolbec
On Sat, 3 Dec 2016 14:20:05 -0800
Zac Medico  wrote:

> On 12/03/2016 01:48 PM, Brian Dolbec wrote:
> > 
> > From c4a61bebca1cfeb0833cefb2c64be6156bdb8e8d Mon Sep 17 00:00:00
> > 2001 From: "hackers.terabit" 
> > Date: Thu, 27 Oct 2016 03:29:16 +
> > Subject: [PATCH] _emerge/depgraph.py: Autounmask-write fails when
> > there isn't a file in package.*/ bug 598116
> > 
> > Instead of outputting "!!! No file to write for ..." error message,
> > Use a sane default filename.
> > Add zz- prefix to ensure it remains the last file in sorted order.
> > 
> > X-Gentoo-bug: 598116
> > X-Gentoo-bug-url: https://bugs.gentoo.org/598116
> > ---
> >  pym/_emerge/depgraph.py | 6 ++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
> > index 9161914..7dc1f55 100644
> > --- a/pym/_emerge/depgraph.py
> > +++ b/pym/_emerge/depgraph.py
> > @@ -8240,6 +8240,12 @@ class depgraph(object):
> > 
> > child.endswith("~"):
> > continue
> > 
> > stack.append(os.path.join(p,
> > child))
> > +   # If the directory is empty add a file
> > with name
> > +   # pattern file_name.default
> > +   if last_file_path == None:
> > +
> > last_file_path=os.path.join(file_path, file_path, "zz-autounmask")
> > +   with open(last_file_path,"a+") as
> > default:
> > +   default.write("# " +
> > file_name) 
> > return last_file_path
> >  
> >   
> 
> Patch looks good except it could use these style tweaks:
> 
> -if last_file_path == None:
> +if last_file_path is None:
> 
> -last_file_path=os.path.join(file_path, file_path, "zz-autounmask")
> +last_file_path = os.path.join(file_path, file_path, "zz-autounmask")
> 
> -with open(last_file_path,"a+") as default:
> +with open(last_file_path, "a+") as default:

Fixed and pushed.

-- 
Brian Dolbec 




Re: [gentoo-portage-dev] [PATCH] _emerge/depgraph.py: Autounmask-write fails when there isn't a file in package.*/ bug 598116

2016-12-03 Thread Zac Medico
On 12/03/2016 01:48 PM, Brian Dolbec wrote:
> 
> From c4a61bebca1cfeb0833cefb2c64be6156bdb8e8d Mon Sep 17 00:00:00 2001
> From: "hackers.terabit" 
> Date: Thu, 27 Oct 2016 03:29:16 +
> Subject: [PATCH] _emerge/depgraph.py: Autounmask-write fails when there isn't
>  a file in package.*/ bug 598116
> 
> Instead of outputting "!!! No file to write for ..." error message,
> Use a sane default filename.
> Add zz- prefix to ensure it remains the last file in sorted order.
> 
> X-Gentoo-bug: 598116
> X-Gentoo-bug-url: https://bugs.gentoo.org/598116
> ---
>  pym/_emerge/depgraph.py | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
> index 9161914..7dc1f55 100644
> --- a/pym/_emerge/depgraph.py
> +++ b/pym/_emerge/depgraph.py
> @@ -8240,6 +8240,12 @@ class depgraph(object):
>   
> child.endswith("~"):
>   continue
>   
> stack.append(os.path.join(p, child))
> + # If the directory is empty add a file with name
> + # pattern file_name.default
> + if last_file_path == None:
> + last_file_path=os.path.join(file_path, 
> file_path, "zz-autounmask")
> + with open(last_file_path,"a+") as default:
> + default.write("# " + file_name)
>  
>   return last_file_path
>  
> 

Patch looks good except it could use these style tweaks:

-if last_file_path == None:
+if last_file_path is None:

-last_file_path=os.path.join(file_path, file_path, "zz-autounmask")
+last_file_path = os.path.join(file_path, file_path, "zz-autounmask")

-with open(last_file_path,"a+") as default:
+with open(last_file_path, "a+") as default:
-- 
Thanks,
Zac



[gentoo-portage-dev] [PATCH] _emerge/depgraph.py: Autounmask-write fails when there isn't a file in package.*/ bug 598116

2016-12-03 Thread Brian Dolbec

From c4a61bebca1cfeb0833cefb2c64be6156bdb8e8d Mon Sep 17 00:00:00 2001
From: "hackers.terabit" 
Date: Thu, 27 Oct 2016 03:29:16 +
Subject: [PATCH] _emerge/depgraph.py: Autounmask-write fails when there isn't
 a file in package.*/ bug 598116

Instead of outputting "!!! No file to write for ..." error message,
Use a sane default filename.
Add zz- prefix to ensure it remains the last file in sorted order.

X-Gentoo-bug: 598116
X-Gentoo-bug-url: https://bugs.gentoo.org/598116
---
 pym/_emerge/depgraph.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 9161914..7dc1f55 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -8240,6 +8240,12 @@ class depgraph(object):

child.endswith("~"):
continue

stack.append(os.path.join(p, child))
+   # If the directory is empty add a file with name
+   # pattern file_name.default
+   if last_file_path == None:
+   last_file_path=os.path.join(file_path, 
file_path, "zz-autounmask")
+   with open(last_file_path,"a+") as default:
+   default.write("# " + file_name)
 
return last_file_path
 
-- 
2.9.3


-- 
Brian Dolbec