From 80a3d9724956078921dc1b0956665d81eea7d679 Mon Sep 17 00:00:00 2001 From: no92 Date: Thu, 7 Nov 2024 12:16:42 +0100 Subject: [PATCH 1/2] base: fix flake8 complaints --- setup.cfg | 2 +- xbstrap/base.py | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/setup.cfg b/setup.cfg index 4f6aacb..20bfd4d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,6 +2,6 @@ description-file = README.md [flake8] -ignore = E203,W503,C +ignore = E203,W503,C,E731 max-line-length = 99 select = E,F,W,N,I,E504 diff --git a/xbstrap/base.py b/xbstrap/base.py index c765225..e71c38e 100644 --- a/xbstrap/base.py +++ b/xbstrap/base.py @@ -94,9 +94,8 @@ def try_rmtree(path): def stat_mtime(path): try: - with open(path) as f: - stat = os.stat(path) - return stat.st_mtime + stat = os.stat(path) + return stat.st_mtime except FileNotFoundError: return None @@ -2351,7 +2350,7 @@ def run_program( ) else: if verbosity: - _util.log_info(f"Sysroot is not bind mounted") + _util.log_info("Sysroot is not bind mounted") with tempfile.NamedTemporaryFile("w+") as f: json.dump(cbuild_json, f) @@ -3564,12 +3563,12 @@ def _do_ordering(self): item.reverse_edge_list.append(target_item) # Sort all edge lists to make the order deterministic. - def sort_items(l): - l.sort(key=PlanItem.get_ordering_key) + def sort_items(items): + items.sort(key=PlanItem.get_ordering_key) # Alternatively, shuffle the edge lists to randomize the order. # Note that sorting them first ensures that the order is deterministic. if self.ordering_prng: - self.ordering_prng.shuffle(l) + self.ordering_prng.shuffle(items) root_list = list(self._items.values()) sort_items(root_list) From 4b7344b72c55d9f938b29995f8e703ee8d8f7c1b Mon Sep 17 00:00:00 2001 From: no92 Date: Thu, 7 Nov 2024 12:17:08 +0100 Subject: [PATCH 2/2] base: implement `patch_keep_crlf` option for git sources --- xbstrap/base.py | 1 + xbstrap/schema.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/xbstrap/base.py b/xbstrap/base.py index e71c38e..00f4b3b 100644 --- a/xbstrap/base.py +++ b/xbstrap/base.py @@ -2552,6 +2552,7 @@ def patch_src(cfg, src): "git", "am", "-3", + "--keep-cr" if source.get("patch_keep_crlf", False) else "--no-keep-cr", "--no-gpg-sign", "--committer-date-is-author-date", os.path.join(src.patch_dir, patch), diff --git a/xbstrap/schema.yml b/xbstrap/schema.yml index 598afca..93f5161 100644 --- a/xbstrap/schema.yml +++ b/xbstrap/schema.yml @@ -106,6 +106,8 @@ definitions: type: boolean 'submodules': type: boolean + 'patch_keep_crlf': + type: boolean 'regenerate': { $ref: '#/definitions/build_steps' } 'sources_required': { $ref: '#/definitions/source_deps' } 'tools_required': { $ref: '#/definitions/tool_deps' }