Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] _emerge/depgraph.py: Autounmask-write fails when there isn't a file in package.*/ bug 598116
Date: Mon, 05 Dec 2016 05:32:55
Message-Id: 20161204213252.2101ac65.dolsen@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] _emerge/depgraph.py: Autounmask-write fails when there isn't a file in package.*/ bug 598116 by Zac Medico
1 On Sat, 3 Dec 2016 14:20:05 -0800
2 Zac Medico <zmedico@g.o> wrote:
3
4 > On 12/03/2016 01:48 PM, Brian Dolbec wrote:
5 > >
6 > > From c4a61bebca1cfeb0833cefb2c64be6156bdb8e8d Mon Sep 17 00:00:00
7 > > 2001 From: "hackers.terabit" <terabit.funtoo@××××××.com>
8 > > Date: Thu, 27 Oct 2016 03:29:16 +0000
9 > > Subject: [PATCH] _emerge/depgraph.py: Autounmask-write fails when
10 > > there isn't a file in package.*/ bug 598116
11 > >
12 > > Instead of outputting "!!! No file to write for ..." error message,
13 > > Use a sane default filename.
14 > > Add zz- prefix to ensure it remains the last file in sorted order.
15 > >
16 > > X-Gentoo-bug: 598116
17 > > X-Gentoo-bug-url: https://bugs.gentoo.org/598116
18 > > ---
19 > > pym/_emerge/depgraph.py | 6 ++++++
20 > > 1 file changed, 6 insertions(+)
21 > >
22 > > diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
23 > > index 9161914..7dc1f55 100644
24 > > --- a/pym/_emerge/depgraph.py
25 > > +++ b/pym/_emerge/depgraph.py
26 > > @@ -8240,6 +8240,12 @@ class depgraph(object):
27 > > child.endswith("~"):
28 > > continue
29 > > stack.append(os.path.join(p,
30 > > child))
31 > > + # If the directory is empty add a file
32 > > with name
33 > > + # pattern file_name.default
34 > > + if last_file_path == None:
35 > > +
36 > > last_file_path=os.path.join(file_path, file_path, "zz-autounmask")
37 > > + with open(last_file_path,"a+") as
38 > > default:
39 > > + default.write("# " +
40 > > file_name)
41 > > return last_file_path
42 > >
43 > >
44 >
45 > Patch looks good except it could use these style tweaks:
46 >
47 > -if last_file_path == None:
48 > +if last_file_path is None:
49 >
50 > -last_file_path=os.path.join(file_path, file_path, "zz-autounmask")
51 > +last_file_path = os.path.join(file_path, file_path, "zz-autounmask")
52 >
53 > -with open(last_file_path,"a+") as default:
54 > +with open(last_file_path, "a+") as default:
55
56 Fixed and pushed.
57
58 --
59 Brian Dolbec <dolsen>