-
Notifications
You must be signed in to change notification settings - Fork 132
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
Update bindings to libvirt 8 #212
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Te current c-for-go project needs enhancement in order to accomodate generating bindings from the latest libvirt source. This situation can be addressed by using a private fork (at least, until any required changes can be merged upstream). This commit streamlines the build process for c-for-go to allow building a private version to the bin/ directory. This allows go-libvirt to operate without contaminating the GOPATH with a different version.
This is useful in case it is desirable to validate the output generated by c-for-go. Use .gitignore file instead to ensure it does not get committed.
sam-github
approved these changes
Feb 27, 2024
sam-github
reviewed
Feb 27, 2024
trapgate
reviewed
Feb 27, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the gen-consts script can be simplified somewhat, and install-c-for-go.sh
can then be dropped.
Here's my suggested version of gen-consts.sh
:
#!/bin/bash
#
# This runs the first code generator used by go-libvirt: c-for-go. This script
# is run from the 'go generate ./...' command, and only needs to be run when
# changing to a different version of libvirt.
# Set TOP to the root of this repo, and SCRIPTS to the absolute path to the
# scripts/ directory.
TOP="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -z "${LIBVIRT_SOURCE}" ]; then
echo "Set LIBVIRT_SOURCE to the root of the libvirt sources you want to use first."
exit 1
fi
if [ -z "$GOBIN" ]; then
export GOBIN=$TOP/bin
fi
# Make sure c-for-go is installed
echo "Attempting to install c-for-go..."
if ! go install github.com/xlab/[email protected] ; then
echo "failed to install c-for-go."
exit 1
fi
# Make sure goyacc is installed (needed for the lvgen/ generator)
echo "Attempting to install goyacc..."
if ! go install golang.org/x/tools/cmd/[email protected]; then
echo "failed to install goyacc. Please install it manually from https://golang.org/x/tools/cmd/goyacc"
exit 1
fi
# Ensure fresh output is in libvirt/
rm -rf libvirt/
# Temporarily symlink the libvirt sources to a subdirectory because c-for-go
# lacks a mechanism for us to pass it a search path for header files.
LVDIR=lv_source
ln -sF ${LIBVIRT_SOURCE} ${LVDIR}
if ! c-for-go -nostamp -nocgo -ccincl libvirt.yml; then
echo "c-for-go failed"
exit 1
fi
mv libvirt/const.go ${SCRIPTS}/../const.gen.go
rm ${LVDIR}
You can drop the |
mpontillo
force-pushed
the
libvirt-8-updates
branch
from
February 28, 2024 00:18
30b8126
to
831aa70
Compare
* add GOBIN to the PATH to ensure the expected tools are used * remove obsolete scripts/install-c-for-go.sh * selectively remove unused generated files * fix shellcheck warnings
mpontillo
force-pushed
the
libvirt-8-updates
branch
from
February 28, 2024 17:29
831aa70
to
606a97f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now that our upstream changes have landed in
c-for-go
,go-libvirt
's libvirt bindings can be updated to support libvirtv8.0.0
.Note that we are roughly following the Ubuntu LTS release cycle with regard to the
libvirt
version supported; I plan to update to test withv10.0.0
next.