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

Dependency handling #266

Merged
merged 5 commits into from
Dec 10, 2020
Merged

Dependency handling #266

merged 5 commits into from
Dec 10, 2020

Conversation

awvwgk
Copy link
Member

@awvwgk awvwgk commented Dec 2, 2020

Take two on the dependency handling (see #251 for a recursive implementation).

  • create a dependency tree data type with serde functionality
  • allow translation from and to TOML of dependency tree
  • implement iterative fetching of each dependency level
  • use dependency tree in build_model
  • update functionality for fpm-update subcommand
  • build_model should use the dependency tree exclusively

Related #121
Fixes #265

Proposed command line interface for fpm-update

Name
    fpm-update(1) - manage project dependencies

Synopsis
    fpm update [--fetch-only] [--verbose] [--clean] [name(s)]

Description
    Manage and update project dependencies. If no dependency names are
    provided all the dependencies are updated automatically.

Options
  --clean       Ignore an existing package cache file
  --fetch-only  Only fetch dependencies, do not update existing projects
  --verbose     Show additional printout

Examples
 1. Initialize all project dependencies

    fpm update --fetch-only

 2. Update a list of dependencies

    fpm update --verbose dep1 dep2

Dependency management strategy

  1. dependencies are handled iteratively
  2. current project is added as first project to the dependency tree
  3. all nodes in the dependency tree visited and their dependencies are added to the tree
  4. repeat step 3 until all dependencies in the tree are visited
  5. create a cache of the dependency tree (build/cache.toml)

@awvwgk awvwgk marked this pull request as draft December 2, 2020 20:19
@awvwgk awvwgk mentioned this pull request Dec 2, 2020
@awvwgk
Copy link
Member Author

awvwgk commented Dec 5, 2020

I getting toward a working version here, one issue I noted is that git tags are not reliable and we have to treat them like branch names for now. One can actually force push and delete a tag with git, making it impossible to tell for fpm whether or not a dependency is fetched correctly without retrieving upstram. Therefore, I moved the TOML-Fortran pinning from tag to rev.

Right now the version is fully functional, while doing still a bit of redundant work for the fpm-build model, effectively walking the dependency tree twice, but the depth first approach of fpm-build will always find the already fetched dependencies from the dependency tree initialization doing no harm. I'll clean this up soon, but open the PR for feedback already.

Cleaned up and ready for review.

@awvwgk awvwgk marked this pull request as ready for review December 5, 2020 19:40
Copy link
Member

@LKedward LKedward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @awvwgk, this is a significant improvement. Works as expected and the implementation looks robust. 👍

My only comment is that it would be good to include fpm update in the various general fpm help texts:

help_list_nodash=[character(len=80) :: &

help_list_dash = [character(len=80) :: &

help_fpm=[character(len=80) :: &

@awvwgk
Copy link
Member Author

awvwgk commented Dec 6, 2020

Seems like I always overlook parts of the command line documentation, I have to make a checklist for creating new commands to make sure I get it added to all the right places for the next time. Thanks for the reminder.

@awvwgk
Copy link
Member Author

awvwgk commented Dec 8, 2020

I would like to move at least one of new commands (fpm-install / fpm-update) forward to focus again on the fpm-dist command. Let me know if there is anything blocking this PR in particular.

@LKedward
Copy link
Member

LKedward commented Dec 8, 2020

Let me know if there is anything blocking this PR in particular.

I'm happy for this PR to move forward; it would be good to get a second review if possible.

@awvwgk awvwgk linked an issue Dec 9, 2020 that may be closed by this pull request
@LKedward
Copy link
Member

Since this PR will close multiple issues and allow work to move forward elsewhere I think this can be merged if there are no further comments. @awvwgk are you happy to merge when you're ready?

@awvwgk
Copy link
Member Author

awvwgk commented Dec 10, 2020

Sounds good, I will rebase and merge this branch later today. If there are problems coming up later we can still handle those separately.

- create a dependency tree data type with serde functionality
- allow translation from and to TOML of dependency tree
- implement iterative fetching of each dependency level
- test round trips for dependency cache
- allow removing the cache from the command line
- update dependencies in fpm-update (rudimentary implementation only)
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.

Failure to build jsonff github dependencies are never updated
2 participants