提交 279e2013 编写于 作者: P pilipala195 提交者: Gitee

file mode bugfix

上级 b931365e
...@@ -44,7 +44,7 @@ class Packer(): ...@@ -44,7 +44,7 @@ class Packer():
self.fs_tear_down self.fs_tear_down
] ]
self.fs_cfg = None self.fs_cfg = None
self.chmod_dirs = set() self.chmod_dirs = []
def mv_usr_libs(self): def mv_usr_libs(self):
src_path = self.config.out_path src_path = self.config.out_path
...@@ -83,7 +83,8 @@ class Packer(): ...@@ -83,7 +83,8 @@ class Packer():
target_path = os.path.join(fs_path, target_dir) target_path = os.path.join(fs_path, target_dir)
if source_dir == '' or not os.path.isdir(source_path): if source_dir == '' or not os.path.isdir(source_path):
makedirs(target_path, exist_ok=exist_ok, with_rm=with_rm) makedirs(target_path, exist_ok=exist_ok, with_rm=with_rm)
self.chmod_dirs.add((target_path, fs_dir.get('dir_mode', 755))) target_mode_tuple = (target_path, fs_dir.get('dir_mode', 755))
self.chmod_dirs.append(target_mode_tuple)
continue continue
self.copy_files(source_path, target_path, fs_dir) self.copy_files(source_path, target_path, fs_dir)
...@@ -97,14 +98,14 @@ class Packer(): ...@@ -97,14 +98,14 @@ class Packer():
tdirname = srelpath.replace(spath, tpath) tdirname = srelpath.replace(spath, tpath)
if not os.path.isdir(tdirname): if not os.path.isdir(tdirname):
makedirs(tdirname) makedirs(tdirname)
self.chmod_dirs.add((tdirname, dir_mode)) self.chmod_dirs.append((tdirname, dir_mode))
tfile = os.path.join(tdirname, os.path.basename(sfile)) tfile = os.path.join(tdirname, os.path.basename(sfile))
shutil.copy(sfile, tfile) shutil.copy(sfile, tfile)
self.chmod_dirs.add((tfile, file_mode)) self.chmod_dirs.append((tfile, file_mode))
def chmod(self, file, mode): def chmod(self, file, mode):
mode = int(str(mode), base=8) mode = int(str(mode), base=8)
if os.path.isfile(file): if os.path.exists(file):
os.chmod(file, mode) os.chmod(file, mode)
def filter(self, files, ignore_list): def filter(self, files, ignore_list):
...@@ -150,11 +151,9 @@ class Packer(): ...@@ -150,11 +151,9 @@ class Packer():
filestat.get('file_dir', '')) filestat.get('file_dir', ''))
file_mode = filestat.get('file_mode', 0) file_mode = filestat.get('file_mode', 0)
if os.path.exists(file_dir) and file_mode > 0: if os.path.exists(file_dir) and file_mode > 0:
self.chmod_dirs.add((file_dir, file_mode)) self.chmod_dirs.append((file_dir, file_mode))
for filestat in self.chmod_dirs: for file_dir, file_mode in self.chmod_dirs:
file_dir = filestat[0]
file_mode = filestat[1]
self.chmod(file_dir, file_mode) self.chmod(file_dir, file_mode)
def fs_make_cmd(self): def fs_make_cmd(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册