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

Feature: RTI verify installed via CLI #2191

Open
elgeeko1 opened this issue Feb 12, 2024 · 6 comments
Open

Feature: RTI verify installed via CLI #2191

elgeeko1 opened this issue Feb 12, 2024 · 6 comments
Labels
c Related to C target enhancement Enhancement of existing feature federated good first issue Good for newcomers

Comments

@elgeeko1
Copy link
Collaborator

User story: As a Lingua Franca developer and user, I would like to know that the C RTI is installed and executable, such as a --version or --is-present command that exits with return code 0 if the RTI binary is installed and runnable, so that I can verify development environments I provision.

Background: Docker, Ansible, Multipass, VMWare, CodePods, etc., are used to build and distribute development environments. lfc and lingo both support a --version command that prints the version of the application and exits with return code 0. This allows a baseline verification that the tools have been installed and can load without missing dependencies. The C RTI, however, has no such argument, and instead only grep-ing the output of RTI with no arguments can be used to infer the binary is installed and runnable. This solution is brittle.

Instead, either a --version, --status, --is-present or similar would allow for a primitive verification that it has been compiled and installed correctly.

@erlingrj erlingrj added enhancement Enhancement of existing feature c Related to C target federated good first issue Good for newcomers labels Feb 13, 2024
@erlingrj
Copy link
Collaborator

Agreed. RTI should support rti --version where it prints out version, commit-id and date, just like lfc. We haven't discussed how we should version the RTI yet. I think the most elegant way of achieving a --version option is to have CMake, at compile-time, check the git history and find the most recent tag (which should correspond to a release) and use this as the version see this blog: https://embeddedartistry.com/blog/2016/12/21/giving-your-firmware-build-a-version/

@lhstrh
Copy link
Member

lhstrh commented Feb 13, 2024

Related conversation lf-lang/reactor-c#348 (comment)

@elgeeko1
Copy link
Collaborator Author

The latest tag may not always correspond with the latest release (a developer can push any arbitrary tag), but I did find out how to get the latest release tag for downloading and installing lingo:

export lingo_version=$(git ls-remote --refs --sort="version:refname" --tags https://github.com/lf-lang/lingo | cut -d/ -f3- | tail -n1)
git clone --single-branch --depth 1 --branch ${lingo_version} https://github.com/lf-lang/lingo
cargo install --path ./lingo
rm -rf /var/cache/lf-lang

@lhstrh
Copy link
Member

lhstrh commented Feb 13, 2024

It's a nice idea to use tags to determine what the build version is. That's less work than maintaining a version number manually, but it will not allow us to distinguish between some random (nightly/snapshot) build and the actual latest release...

@elgeeko1
Copy link
Collaborator Author

The git ls-remote command above returns a sorted list of all tags (--tags) associated with a release (`--sort="version:refname") which should return the tag associated with the latest release.

@lhstrh
Copy link
Member

lhstrh commented Feb 13, 2024

Yes, that makes sense, but by the time there are commits on the branch since that tag, there is no way of knowing that it's actually not the release version but something else. We could compare the current commit against the commit of the tag and change the version number if its not the same. Semantic versioning allows for additions to the version number that help explain its origin. The current RTI code, however, doesn't use semver but some binary encoding...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c Related to C target enhancement Enhancement of existing feature federated good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants