From 047dfc77141e3eb07b9e392e75879ebc0b4bcd6c Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Fri, 2 May 2014 13:23:47 +0200 Subject: [PATCH 1/3] romfs pruner: do not try to prune .swp files --- Tools/px_romfs_pruner.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Tools/px_romfs_pruner.py b/Tools/px_romfs_pruner.py index ceef9f9be7..9c88ec3726 100644 --- a/Tools/px_romfs_pruner.py +++ b/Tools/px_romfs_pruner.py @@ -43,29 +43,30 @@ from __future__ import print_function import argparse import os + def main(): - + # Parse commandline arguments parser = argparse.ArgumentParser(description="ROMFS pruner.") parser.add_argument('--folder', action="store", help="ROMFS scratch folder.") args = parser.parse_args() - + print("Pruning ROMFS files.") - - # go through + + # go through for (root, dirs, files) in os.walk(args.folder): for file in files: # only prune text files - if ".zip" in file or ".bin" in file: + if ".zip" in file or ".bin" or ".swp" in file: continue - - file_path = os.path.join(root, file) - + + file_path = os.path.join(root, file) + # read file line by line pruned_content = "" with open(file_path, "r") as f: - for line in f: - + for line in f: + # handle mixer files differently than startup files if file_path.endswith(".mix"): if line.startswith(("Z:", "M:", "R: ", "O:", "S:")): @@ -73,11 +74,11 @@ def main(): else: if not line.isspace() and not line.strip().startswith("#"): pruned_content += line - + # overwrite old scratch file with open(file_path, "w") as f: f.write(pruned_content) - - + + if __name__ == '__main__': - main() \ No newline at end of file + main() From de87d6df69fd797fd3dfb8ac41d2c75e468dffc0 Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Fri, 2 May 2014 14:23:22 +0200 Subject: [PATCH 2/3] do not copy hidden files to ROMFS --- makefiles/firmware.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 1b646d9e00..69c975acd2 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -113,7 +113,7 @@ endif $(info % GIT_DESC = $(GIT_DESC)) # -# Set a default target so that included makefiles or errors here don't +# Set a default target so that included makefiles or errors here don't # cause confusion. # # XXX We could do something cute here with $(DEFAULT_GOAL) if it's not one @@ -177,7 +177,7 @@ GLOBAL_DEPS += $(MAKEFILE_LIST) # # Extra things we should clean # -EXTRA_CLEANS = +EXTRA_CLEANS = # @@ -371,6 +371,8 @@ $(ROMFS_IMG): $(ROMFS_SCRATCH) $(ROMFS_DEPS) $(GLOBAL_DEPS) $(ROMFS_SCRATCH): $(ROMFS_DEPS) $(GLOBAL_DEPS) $(Q) $(MKDIR) -p $(ROMFS_SCRATCH) $(Q) $(COPYDIR) $(ROMFS_ROOT)/* $(ROMFS_SCRATCH) +# delete all files in ROMFS_SCRATCH which start with a . + $(Q) $(RM) $(ROMFS_SCRATCH)/*/.[!.]* $(ROMFS_SCRATCH)/*/*~ ifneq ($(ROMFS_EXTRA_FILES),) $(Q) $(MKDIR) -p $(ROMFS_SCRATCH)/extras $(Q) $(COPY) $(ROMFS_EXTRA_FILES) $(ROMFS_SCRATCH)/extras From 3424a65e3229a0bc5a1d78979356436392def264 Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Fri, 2 May 2014 14:28:47 +0200 Subject: [PATCH 3/3] update comment in makefile --- makefiles/firmware.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 69c975acd2..60602e76fe 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -371,7 +371,7 @@ $(ROMFS_IMG): $(ROMFS_SCRATCH) $(ROMFS_DEPS) $(GLOBAL_DEPS) $(ROMFS_SCRATCH): $(ROMFS_DEPS) $(GLOBAL_DEPS) $(Q) $(MKDIR) -p $(ROMFS_SCRATCH) $(Q) $(COPYDIR) $(ROMFS_ROOT)/* $(ROMFS_SCRATCH) -# delete all files in ROMFS_SCRATCH which start with a . +# delete all files in ROMFS_SCRATCH which start with a . or end with a ~ $(Q) $(RM) $(ROMFS_SCRATCH)/*/.[!.]* $(ROMFS_SCRATCH)/*/*~ ifneq ($(ROMFS_EXTRA_FILES),) $(Q) $(MKDIR) -p $(ROMFS_SCRATCH)/extras