Lines Matching refs:self

33     def __init__(self, packer_args) -> None:
34 self.config = Config()
35 self.replace_items = {
36 r'${product_name}': self.config.product,
37 r'${root_path}': self.config.root_path,
38 r'${out_path}': self.config.out_path
40 self.packing_process = [
41 self.mv_usr_libs, self.create_fs_dirs, self.fs_link,
42 self.fs_filemode, self.fs_make_cmd, self.fs_tear_down
44 self.fs_cfg = None
45 self.chmod_dirs = []
78 def mv_usr_libs(self):
79 src_path = self.config.out_path
80 libs = [lib for lib in os.listdir(src_path) if self.is_lib(lib)]
89 def create_fs_dirs(self):
90 fs_path = os.path.join(self.config.out_path,
91 self.fs_cfg.get('fs_dir_name', 'rootfs'))
92 exist_ok, with_rm = self.is_incr(self.fs_cfg.get('fs_incr', None))
96 self.replace_items[r'${fs_dir}'] = fs_path
98 for fs_dir in self.fs_cfg.get('fs_dirs', []):
104 source_path = self.fs_dirs_replace(source_dir,
105 self.config.out_path)
106 target_path = self.fs_dirs_replace(target_dir, fs_path)
111 self.chmod_dirs.append(target_mode_tuple)
114 self.copy_files(source_path, target_path, fs_dir)
116 def fs_dirs_replace(self, path, default_path):
117 source_path, is_changed = self.replace(path)
122 def copy_files(self, spath, tpath, fs_dir):
130 self.chmod_dirs.append((target_path, dir_mode))
134 self.chmod_dirs.append((tfile, file_mode))
143 for srelpath, sfile in self.list_all_files(spath, ignore_files):
147 def list_all_files(self, path, ignore_list=None):
149 files = self.filter(files, ignore_list)
155 def replace(self, raw_str):
157 for old, new in self.replace_items.items():
161 def fs_link(self):
162 fs_symlink = self.fs_cfg.get('fs_symlink', [])
164 source, _ = self.replace(symlink.get('source', ''))
165 link_name, _ = self.replace(symlink.get('link_name', ''))
170 def fs_filemode(self):
171 fs_filemode = self.fs_cfg.get('fs_filemode', [])
173 file_dir = os.path.join(self.replace_items.get(r'${fs_dir}', ""),
177 self.chmod_dirs.append((file_dir, file_mode))
179 for file_dir, file_mode in self.chmod_dirs:
180 self.chmod(file_dir, file_mode)
182 def fs_make_cmd(self):
183 fs_make_cmd = self.fs_cfg.get('fs_make_cmd', [])
184 log_path = self.config.log_path
187 cmd, _ = self.replace(cmd)
191 def fs_tear_down(self):
192 while len(self.chmod_dirs):
193 tfile = self.chmod_dirs.pop()[0]
196 self.chmod(tfile, 555)
198 self.chmod(tfile, 755)
200 def fs_attr_process(self, fs_cfg):
203 if attr_key in self.config.fs_attr:
212 def fs_make(self, cmd_args):
213 fs_cfg_path = os.path.join(self.config.product_path, 'fs.yml')
218 if self.config.fs_attr is None:
224 self.fs_cfg = self.fs_attr_process(fs_cfg)
225 if self.fs_cfg.get('fs_dir_name', None) is None:
228 for fs_process_func in self.packing_process: