Skip to content

Conversation

@mbauman
Copy link
Member

@mbauman mbauman commented Jun 20, 2025

The appbundle's .juliabundleignore was previously not picking up for files in the same directory. This is a simple change to effectively make the loop a do-while.

Fix #100.

The appbundle's `.juliabundleignore` was previously not picking up for files in the same directory.  This is a simple change to effectively make the loop a do-while.
@mbauman
Copy link
Member Author

mbauman commented Jun 20, 2025

It'd probably be good to update the tests to ensure they look for a .juliabundleignore (and ignore siblings) in the bundles top level. The existing tests miss this case as the ignore files (and a sibling file) are not at the bundle root.

@test !isfile(joinpath(dir, bundle, ".bundle", "dev", "Pkg1", "README.md")) # in .juliabundleignore

@ranjanan ranjanan requested a review from pfitzseb June 23, 2025 23:59
@mortenpi
Copy link
Member

This looks correct to me. The bundling actually works okay, since we run it on the parent directory of the user files, and the top level will then never have a .juliabundleignore. But we are re-using the path_filterer here, where we pass the user directory directly to it, and then it fails to pick up the ignore file on the top level.

JuliaHub.jl/src/utils.jl

Lines 306 to 323 in 33e3ba0

# Estimates the size of the bundle directory
function _max_appbundle_dir_size(dir; maxsize=100 * 1024 * 1024)
sz = 0
pred = _PackageBundler.path_filterer(dir)
for (root, _, files) in walkdir(dir)
for file in files
file = joinpath(root, file)
if !pred(file)
@debug "ignoring $file in dir size measurement"
continue
end
sz > maxsize && return sz, false
sz += filesize(file)
end
end
return sz, sz < maxsize
end

I think it's fine to allow path_filterer to go one more level up. Since we control the parent directory in .bundle, we know there should not be a .juliabundleignore there, so this should create any behavior change.

@mortenpi
Copy link
Member

Okay, the _max_appbundle_dir_size was generally a bit incorrect. Namely, it looks path_filterer won't say that a file is excluded even if there is a rule that matches a parent directory (so, if test/bar is excluded, path_filterer still says that test/bar/foo should be included). In other words, you need to use the predicate recursively, and not recurse into excluded subdirectories, which the new implementation does.

@mortenpi mortenpi enabled auto-merge (squash) August 28, 2025 13:15
@mortenpi mortenpi merged commit 422d504 into main Aug 29, 2025
11 of 22 checks passed
@mortenpi mortenpi deleted the mb/bundle-ignore-toplevel branch August 29, 2025 07:56
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

Successfully merging this pull request may close these issues.

.juliabundleignore doesn't work?

4 participants