Gentoo Archives: gentoo-catalyst

From: Mike Frysinger <vapier@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [PATCH 1/9] convert octals to py3 compat
Date: Mon, 12 Oct 2015 04:36:12
Message-Id: 1444624562-26162-1-git-send-email-vapier@gentoo.org
1 ---
2 catalyst/base/clearbase.py | 4 ++--
3 catalyst/base/resume.py | 4 ++--
4 catalyst/base/stagebase.py | 14 +++++++-------
5 catalyst/fileops.py | 2 +-
6 catalyst/targets/netboot2.py | 2 +-
7 catalyst/targets/snapshot.py | 2 +-
8 6 files changed, 14 insertions(+), 14 deletions(-)
9
10 diff --git a/catalyst/base/clearbase.py b/catalyst/base/clearbase.py
11 index 3817196..9a4c625 100644
12 --- a/catalyst/base/clearbase.py
13 +++ b/catalyst/base/clearbase.py
14 @@ -30,13 +30,13 @@ class ClearBase(object):
15 def clear_chroot(self):
16 self.chroot_lock.unlock()
17 log.notice('Clearing the chroot path ...')
18 - clear_dir(self.settings["chroot_path"], 0755, True)
19 + clear_dir(self.settings["chroot_path"], 0o755, True)
20
21
22 def remove_chroot(self):
23 self.chroot_lock.unlock()
24 log.notice('Removing the chroot path ...')
25 - clear_dir(self.settings["chroot_path"], 0755, True, remove=True)
26 + clear_dir(self.settings["chroot_path"], 0o755, True, remove=True)
27
28
29 def clear_packages(self, remove=False):
30 diff --git a/catalyst/base/resume.py b/catalyst/base/resume.py
31 index 99d8abc..70d9a4f 100644
32 --- a/catalyst/base/resume.py
33 +++ b/catalyst/base/resume.py
34 @@ -25,7 +25,7 @@ class AutoResume(object):
35 '''
36
37
38 - def __init__(self, basedir, mode=0755):
39 + def __init__(self, basedir, mode=0o755):
40 self.basedir = basedir
41 ensure_dirs(basedir, mode=mode, fatal=True)
42 self._points = {}
43 @@ -131,7 +131,7 @@ class AutoResume(object):
44 @remove: boolean, passed through to clear_dir()
45 @return boolean
46 '''
47 - if clear_dir(self.basedir, mode=0755, chg_flags=True, remove=remove):
48 + if clear_dir(self.basedir, mode=0o755, chg_flags=True, remove=remove):
49 self._points = {}
50 return True
51 return False
52 diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
53 index 740e05d..a4832ec 100644
54 --- a/catalyst/base/stagebase.py
55 +++ b/catalyst/base/stagebase.py
56 @@ -492,7 +492,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
57 ))
58 if "autoresume" in self.settings["options"]:
59 log.info('The autoresume path is %s', self.settings['autoresume_path'])
60 - self.resume = AutoResume(self.settings["autoresume_path"], mode=0755)
61 + self.resume = AutoResume(self.settings["autoresume_path"], mode=0o755)
62
63 def set_controller_file(self):
64 self.settings["controller_file"]=normpath(self.settings["sharedir"]+\
65 @@ -773,10 +773,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
66 ensure_dirs(self.settings["chroot_path"]+"/tmp",mode=1777)
67
68 if "pkgcache" in self.settings["options"]:
69 - ensure_dirs(self.settings["pkgcache_path"],mode=0755)
70 + ensure_dirs(self.settings["pkgcache_path"],mode=0o755)
71
72 if "kerncache" in self.settings["options"]:
73 - ensure_dirs(self.settings["kerncache_path"],mode=0755)
74 + ensure_dirs(self.settings["kerncache_path"],mode=0o755)
75
76 log.notice('%s', display_msg % unpack_info)
77
78 @@ -848,7 +848,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
79 cleanup_cmd = "rm -rf " + target_portdir
80 log.info('unpack() cleanup_cmd = %s', cleanup_cmd)
81 cmd(cleanup_cmd,cleanup_errmsg,env=self.env)
82 - ensure_dirs(target_portdir, mode=0755)
83 + ensure_dirs(target_portdir, mode=0o755)
84
85 log.notice('Unpacking portage tree (this can take a long time) ...')
86 if not self.decompressor.extract(unpack_info):
87 @@ -936,11 +936,11 @@ class StageBase(TargetBase, ClearBase, GenBase):
88 _cmd = ''
89 log.debug('bind(); x = %s', x)
90 target = normpath(self.settings["chroot_path"] + self.target_mounts[x])
91 - ensure_dirs(target, mode=0755)
92 + ensure_dirs(target, mode=0o755)
93
94 if not os.path.exists(self.mountmap[x]):
95 if self.mountmap[x] not in ["tmpfs", "shmfs"]:
96 - ensure_dirs(self.mountmap[x], mode=0755)
97 + ensure_dirs(self.mountmap[x], mode=0o755)
98
99 src=self.mountmap[x]
100 log.debug('bind(); src = %s', src)
101 @@ -1222,7 +1222,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
102 # the proper perms and ownership
103 mystat=os.stat(myemp)
104 shutil.rmtree(myemp)
105 - ensure_dirs(myemp, mode=0755)
106 + ensure_dirs(myemp, mode=0o755)
107 os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
108 os.chmod(myemp,mystat[ST_MODE])
109 self.resume.enable("empty")
110 diff --git a/catalyst/fileops.py b/catalyst/fileops.py
111 index 8fb2a36..1ef6b4c 100644
112 --- a/catalyst/fileops.py
113 +++ b/catalyst/fileops.py
114 @@ -37,7 +37,7 @@ def ensure_dirs(path, gid=-1, uid=-1, mode=0o755, minimal=True,
115 :param mode: permissions to set any created directories to
116 :param minimal: boolean controlling whether or not the specified mode
117 must be enforced, or is the minimal permissions necessary. For example,
118 - if mode=0755, minimal=True, and a directory exists with mode 0707,
119 + if mode=0o755, minimal=True, and a directory exists with mode 0707,
120 this will restore the missing group perms resulting in 757.
121 :param failback: function to run in the event of a failed attemp
122 to create the directory.
123 diff --git a/catalyst/targets/netboot2.py b/catalyst/targets/netboot2.py
124 index d882a06..8644786 100644
125 --- a/catalyst/targets/netboot2.py
126 +++ b/catalyst/targets/netboot2.py
127 @@ -157,7 +157,7 @@ class netboot2(StageBase):
128 # the proper perms and ownership
129 mystat=os.stat(myemp)
130 shutil.rmtree(myemp)
131 - ensure_dirs(myemp, mode=0755)
132 + ensure_dirs(myemp, mode=0o755)
133 os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
134 os.chmod(myemp,mystat[ST_MODE])
135 self.resume.enable("empty")
136 diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
137 index d19f4ef..dbc4b1c 100644
138 --- a/catalyst/targets/snapshot.py
139 +++ b/catalyst/targets/snapshot.py
140 @@ -106,6 +106,6 @@ class snapshot(TargetBase, GenBase):
141 if os.uname()[0] == "FreeBSD":
142 os.system("chflags -R noschg "+myemp)
143 shutil.rmtree(myemp)
144 - ensure_dirs(myemp, mode=0755)
145 + ensure_dirs(myemp, mode=0o755)
146 os.chown(myemp,mystat[ST_UID],mystat[ST_GID])
147 os.chmod(myemp,mystat[ST_MODE])
148 --
149 2.5.2

Replies