commit:     546e6d6e5654100b481b38e0b664602f5fb63a62
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  8 10:31:01 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Jul  8 10:31:01 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=546e6d6e

grs/Populate.py: restore .keep files

 grs/Populate.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/grs/Populate.py b/grs/Populate.py
index b9c2323..620eaba 100644
--- a/grs/Populate.py
+++ b/grs/Populate.py
@@ -66,16 +66,18 @@ class Populate():
                     else:
                         os.remove(old_file)
 
-    def clean_subdirs(self, dirpath):
-        path = os.path.join(self.portage_configroot, dirpath)
-        if os.path.isdir(path):
-            uid = os.stat(path).st_uid
-            gid = os.stat(path).st_gid
-            mode = os.stat(path).st_mode
-            shutil.rmtree(path)
-            os.mkdir(path)
-            os.chown(path, uid, gid)
-            os.chmod(path, mode)
+    def clean_subdirs(self, reldir):
+        absdir = os.path.join(self.portage_configroot, reldir)
+        if not os.path.isdir(absdir):
+            return
+        uid = os.stat(absdir).st_uid
+        gid = os.stat(absdir).st_gid
+        mode = os.stat(absdir).st_mode
+        shutil.rmtree(absdir)
+        os.mkdir(absdir)
+        os.chown(absdir, uid, gid)
+        os.chmod(absdir, mode)
+        open(os.path.join(absdir, '.keep'),'w').close()
 
 
     def clean(self):

Reply via email to