commit:     40e3bbe96c522eb02870550b0f976efdbdd0c033
Author:     hackers.terabit <terabit.funtoo <AT> Yandex <DOT> com>
AuthorDate: Thu Oct 27 03:29:16 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Dec  5 05:13:14 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=40e3bbe9

_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 ee6cf68..cb12b05 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -8247,6 +8247,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 is 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
 

Reply via email to