Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkfrogfs.py fails if root dir has subdirectories starting with dot (next branch) #49

Closed
valkuc opened this issue Oct 19, 2023 · 9 comments

Comments

@valkuc
Copy link

valkuc commented Oct 19, 2023

Hello.
The directory structure is like this:
/.test_dot_dir/.test.html

Result:
       - Stage 1
         - test_dot_dir/.test.html
Traceback (most recent call last):
  File "E:\Espressif\workspace\test_proj\managed_components\frogfs\tools\mkfrogfs.py", line 511, in <module>
    dirty |= run_preprocessors(entries)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Espressif\workspace\test_proj\managed_components\frogfs\tools\mkfrogfs.py", line 324, in run_preprocessors
    preprocess(entry)
  File "E:\Espressif\workspace\test_proj\managed_components\frogfs\tools\mkfrogfs.py", line 261, in preprocess
    with open(os.path.join(g_root_dir, path), 'rb') as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '\\test_dot_dir/.test.html'

It looks like the dot is removed from directory name in mkfrogfs.py

@jkent
Copy link
Owner

jkent commented Oct 19, 2023

Hmm, looks like changing .lstrip('.').lstrip('/') to .lstrip('./') on lines 112 and 136, that should solve that problem. Could you try this and report back?

@valkuc
Copy link
Author

valkuc commented Oct 19, 2023

Looks like did not help. Nothing changed, same error. Actually, I'm thinking that it's a good idea to skip files (and directories) with name starting from "." and do not include them in FrogFs image. What do you think?

@valkuc
Copy link
Author

valkuc commented Oct 19, 2023

Btw, I tried to implement such exclusion by adding

    if reldir.startswith('.'):
            continue

at lines 113 and 139, but this not helped and I'm stuck. My Python knowledge is below zero :)

@jkent
Copy link
Owner

jkent commented Oct 19, 2023

fixed in 1a3d571

Thanks!

@jkent jkent closed this as completed Oct 19, 2023
@valkuc
Copy link
Author

valkuc commented Oct 19, 2023

Thanks, now there is no errors and the directory with file is added to FrogFs image. Could you please tell me, is it possible to exclude any or specific directory from image?

@jkent
Copy link
Owner

jkent commented Oct 19, 2023

You can do the following, which glob matches any files and folders with that name:

filters:
  'path/to/.folder_name*':
    - discard

I'll create a bug, because you should be able to just do the following:

filters:
  'path/to/.folder_name':
    - discard

But that is currently broken.

@valkuc
Copy link
Author

valkuc commented Oct 19, 2023

Looks like this doesn't work either.
In the log:

       - Stage 1
         - .test-data/state.json
           - compress deflate... skipped

but actually the file is included as I see it in binary.

@jkent
Copy link
Owner

jkent commented Oct 19, 2023

I'll look into this. In the meantime, can you open a new issue with a snippet of your yaml?

@valkuc
Copy link
Author

valkuc commented Oct 19, 2023

Yep,will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants