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

New recipe search logic can produce different results #908

Open
jazzace opened this issue Oct 16, 2023 · 0 comments
Open

New recipe search logic can produce different results #908

jazzace opened this issue Oct 16, 2023 · 0 comments
Assignees
Labels
beta Only for AutoPkg beta releases

Comments

@jazzace
Copy link
Member

jazzace commented Oct 16, 2023

THIS IS ONLY INTENDED FOR AUTOPKG BETAS.

Describe the problem
Upon doing further research on the changes in recipe search logic in 3.0 as compared to 2.7.2 and earlier, the new logic as described in the code comments does not produce the same results in certain circumstances. Here is the logic, as described in the comments:

autopkg/Code/autopkg

Lines 288 to 294 in d72a5a5

# Post Autopkg 3.0.0:
# Rethinking of recipe location logic:
# 1. Look for a path to a file first, return path to file
# 2. If not a path, look for it in recipe map, return path to file
# 3. If not in recipe map, search for it in the search directories, return path to file
# 4. If not in search directories, return none
# 5. If no path to file, error and fail

This essentially changes it so that search directories not in the map have lower priority than those that are. This is why #886 fails in the way I have documented there.

The logic that would provide the same results as AutoPkg 2:

  1. Look for a path to a file first, return path to file
  2. If not a path, search for it in the search directories, one by one:
    • If the directory is a GitHub repo, look for it in the recipe map, return path to file
    • If it is not, search the directory directly, return path to file
  3. If not in search directories, return none
  4. If no path to file, error and fail

I have no idea whether doing it this way would reduce or eliminate the speed gains of the map. But semantically, the two plans for search (v. 2 and v. 3) are not the same.

The alternative would be to split RECIPE_SEARCH_DIRS into two: directories that get mapped and directories that don't. That could be split on GitHub repo/locally-created directories, but doesn't necessarily have to be. One should be able to specify which get checked first if you are not going to default to the existing behaviour where ., /Library/Recipes, and ~/Library/Recipes (which I would not include in the map) get searched first.

Version (please complete the following information):

  • OS version: 12.7, 13.6, 14.0
  • AutoPkg Version: 3.0.0 RC2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta Only for AutoPkg beta releases
Projects
None yet
Development

No branches or pull requests

2 participants