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

Perform an initial checkout if library is missing #720

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

jfrimmel
Copy link
Contributor

@jfrimmel jfrimmel commented Jan 8, 2025

As mentioned in #603, it is tempting to check in the fusesoc.conf-file into a version control system. This way all the necessary libraries are written down explicitly and changes are tracked as well. Note, that this is not the intended workflow, but it almost works with fusesoc version 2.4.2, except for one usecase:
in a clean checkout of a repository, there is the fusesoc.conf, but crucially not the fusesoc_library. In this case, almost all fusesoc-commands will fail with an error like this:

$ ls fusesoc_libraries fusesoc.conf
ls: cannot access 'fusesoc_libraries': No such file or directory
fusesoc.conf
$ cat fusesoc.conf
[library.vlog_tb_utils]
location = fusesoc_libraries/vlog_tb_utils
sync-uri = https://github.com/fusesoc/vlog_tb_utils
sync-type = git
auto-sync = true

$ fusesoc library update
WARNING: Failed to register library 'fusesoc_libraries/vlog_tb_utils is not a directory'

When looking into the code, the error can be traced to a FIXME, which exactly describes the initialization of missing libraries that this commit tries to add.

All it does is to move the check for a non-existing directory downwards after there is the correct provider. If the path doesn't exist, it tries to initialize the library using said provider, failing with the old error output as before this commit. This way, missing libraries get initialized gracefully and the usecase described above is supported.

The new testcase is simple: it creates an empty library directory, which gets updated. Since the core directory does not exist, an initial checkout should be performed.

Fixes #603.

As mentioned in olofk#603, it is tempting to check in the `fusesoc.conf`-file
into a version control system. This way all the necessary libraries are
written down explicitly and changes are tracked as well. Note, that this
is not the intended workflow, but it _almost_ works with fusesoc version
2.4.2, except for one usecase:
in a clean checkout of a repository, there is the `fusesoc.conf`, but
crucially not the `fusesoc_library`. In this case, almost all `fusesoc`-
commands will fail with an error like this:
```shell
$ ls fusesoc_libraries fusesoc.conf
ls: cannot access 'fusesoc_libraries': No such file or directory
fusesoc.conf
$ cat fusesoc.conf
[library.vlog_tb_utils]
location = fusesoc_libraries/vlog_tb_utils
sync-uri = https://github.com/fusesoc/vlog_tb_utils
sync-type = git
auto-sync = true

$ fusesoc library update
WARNING: Failed to register library 'fusesoc_libraries/vlog_tb_utils is not a directory'
```
When looking into the code, the error can be traced to a FIXME, which
exactly describes the initialization of missing libraries that this com-
mit tries to add.

All it does is to move th check for a non-existing directory downwards
after there is the correct provider. If the path doesn't exist, it tries
to initialize the library using said provider, failing with the old
error output as before this commit. This way, missing libraries get
initialized gracefully and the usecase described above is supported.

The new testcase is simple: it creates an empty library directory, which
gets updated. Since the core directory does not exist, an initial check-
out should be performed.
@olofk olofk merged commit b604f53 into olofk:main Jan 16, 2025
12 checks passed
@olofk
Copy link
Owner

olofk commented Jan 16, 2025

A very welcome addition. I must admit I don't follow the logic in the code but that's mainly because it has been a long time since I last looked at it. Your description of the issues makes it clear that you have thought about this so I trust your judgement.

Thanks for your contributions. Picked and pushed!

jfrimmel added a commit to jfrimmel/fusesoc that referenced this pull request Jan 17, 2025
The new test `test_library_update_with_initialize` introduced in olofk#720
did use the `fusesoc_libraries`-directory in the repository root and, in
contrast to other tests in that module, did not delete it afterwards.
This causes a leftover library in the repository root after running the
testsuite. This is unpleasant and a bug in the test.

This commit fixes it by cloning into the temporary directory, which was
already created for just this use-case.
olofk pushed a commit that referenced this pull request Feb 10, 2025
The new test `test_library_update_with_initialize` introduced in #720
did use the `fusesoc_libraries`-directory in the repository root and, in
contrast to other tests in that module, did not delete it afterwards.
This causes a leftover library in the repository root after running the
testsuite. This is unpleasant and a bug in the test.

This commit fixes it by cloning into the temporary directory, which was
already created for just this use-case.
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.

How to use fusesoc.conf with RCS?
2 participants