-
Notifications
You must be signed in to change notification settings - Fork 651
feat: add libguestfs and supermin #17624
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
Draft
christopherco
wants to merge
3
commits into
4.0
Choose a base branch
from
chrco/add-libguestfs
base: 4.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
base/comps/supermin/0001-Recognize-Azure-Linux-as-an-rpm-dnf-distro.patch
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| From: Azure Linux <azurelinux@microsoft.com> | ||
| Date: Thu, 4 Jun 2026 00:00:00 +0000 | ||
| Subject: [PATCH] Recognize Azure Linux as an rpm/dnf distro | ||
|
|
||
| Azure Linux sets ID=azurelinux (with ID_LIKE=fedora) in | ||
| /etc/os-release and does not ship an /etc/redhat-release or | ||
| /etc/fedora-release marker file. supermin's os-release parser only | ||
| inspects the ID field, so fedora_detect() fails to recognize Azure | ||
| Linux and supermin aborts with "could not detect package manager used | ||
| by this system or distro". | ||
|
|
||
| Add "azurelinux" to the list of recognized rpm/dnf distro IDs so that | ||
| supermin (and libguestfs, which uses supermin to build its appliance) | ||
| works on Azure Linux. | ||
|
|
||
| This should be submitted upstream: | ||
| https://github.com/libguestfs/supermin | ||
| --- | ||
| src/ph_rpm.ml | 2 +- | ||
| 1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
|
||
| diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml | ||
| index 5061d32..db82819 100644 | ||
| --- a/src/ph_rpm.ml | ||
| +++ b/src/ph_rpm.ml | ||
| @@ -32,7 +32,7 @@ let stringset_of_list pkgs = | ||
| let fedora_detect () = | ||
| Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && | ||
| (Config.yumdownloader <> "no" || Config.dnf <> "no") && | ||
| - (List.mem (Os_release.get_id ()) [ "fedora"; "rhel"; "centos"; "openEuler"; "anolis"; "KylinSecOS" ] || | ||
| + (List.mem (Os_release.get_id ()) [ "azurelinux"; "fedora"; "rhel"; "centos"; "openEuler"; "anolis"; "KylinSecOS" ] || | ||
| try | ||
| (stat "/etc/redhat-release").st_kind = S_REG || | ||
| (stat "/etc/fedora-release").st_kind = S_REG || | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [components.supermin] | ||
|
|
||
| # supermin's package-manager auto-detection (src/ph_rpm.ml) only inspects the | ||
| # os-release ID field against a hard-coded allow-list and does not consider | ||
| # ID_LIKE. Azure Linux sets ID=azurelinux (ID_LIKE=fedora) and ships no | ||
| # /etc/redhat-release marker, so without this patch supermin aborts with | ||
| # "could not detect package manager used by this system or distro" — which | ||
| # also breaks the libguestfs appliance build. The patch adds "azurelinux" to | ||
| # the recognized rpm/dnf distro list. Should be submitted upstream: | ||
| # https://github.com/libguestfs/supermin | ||
| [[components.supermin.overlays]] | ||
| description = "Teach supermin to recognize Azure Linux (ID=azurelinux) as an rpm/dnf distro so the package-manager detection used by --build/--prepare and the libguestfs appliance works." | ||
| type = "patch-add" | ||
| source = "0001-Recognize-Azure-Linux-as-an-rpm-dnf-distro.patch" |
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Managed by azldev component update. Do not edit manually. | ||
| version = 1 | ||
| import-commit = '18dc2aa8b85ed23a60567fd0295f16ebd462db32' | ||
| upstream-commit = '18dc2aa8b85ed23a60567fd0295f16ebd462db32' | ||
| input-fingerprint = 'sha256:131350ed3666e40f286e94bd9189590bbb032db4a8d8e8d452d7e4eabc4a4c5f' | ||
| resolution-input-hash = 'sha256:466421704711c4fd3c71f0b2ed715a0e61d49e3e26f3a2637fee755795849c8e' |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Managed by azldev component update. Do not edit manually. | ||
| version = 1 | ||
| import-commit = 'dbb5a2fe0e36ccacdf586f2c846094f20d7d5a88' | ||
| upstream-commit = 'dbb5a2fe0e36ccacdf586f2c846094f20d7d5a88' | ||
| input-fingerprint = 'sha256:279d005ea057bc3934bc8d22924f310986829fd2b28f62b4dc3cc0473d838b81' | ||
| resolution-input-hash = 'sha256:466421704711c4fd3c71f0b2ed715a0e61d49e3e26f3a2637fee755795849c8e' |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| Libguestfs is a set of tools and a library for accessing and modifying | ||
| guest disk images. For more information see the home page: | ||
|
|
||
| http://libguestfs.org/ | ||
|
|
||
| For discussion, development, patches, etc. please use the mailing | ||
| list: | ||
|
|
||
| http://www.redhat.com/mailman/listinfo/libguestfs | ||
|
|
||
| This package comes with a lot of help and examples to get you started. | ||
|
|
||
| The first place to start are the manual pages. Type: | ||
|
|
||
| man guestfs | ||
| man guestfs-faq | ||
| man guestfs-release-notes | ||
| man guestfish | ||
| man virt-cat # and other virt-* tools | ||
|
|
||
| If you install the libguestfs-devel package, then in the | ||
| /usr/share/doc/libguestfs-devel/ directory you will find other | ||
| documentation including: | ||
|
|
||
| - BUGS: list of open bugs in this version | ||
|
|
||
| - ChangeLog.gz: the detailed list of changes in this version | ||
|
|
||
| - HACKING: how to extend libguestfs | ||
|
|
||
| - TODO: ideas for extending libguestfs | ||
|
|
||
| - *.c: example C programs using the API | ||
|
|
||
| - *.xml.gz: example virt-inspector output (compressed) | ||
|
|
||
| - virt-inspector.rng: virt-inspector RelaxNG schema |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/bin/bash - | ||
|
|
||
| set -e | ||
|
|
||
| # Maintainer script to copy patches from the git repo to the current | ||
| # directory. It's normally only used downstream (ie. in RHEL). Use | ||
| # it like this: | ||
| # ./copy-patches.sh | ||
|
|
||
| rhel_version=9.0.0 | ||
|
|
||
| # Check we're in the right directory. | ||
| if [ ! -f libguestfs.spec ]; then | ||
| echo "$0: run this from the directory containing 'libguestfs.spec'" | ||
| exit 1 | ||
| fi | ||
|
|
||
| git_checkout=$HOME/d/libguestfs-rhel-$rhel_version | ||
| if [ ! -d $git_checkout ]; then | ||
| echo "$0: $git_checkout does not exist" | ||
| echo "This script is only for use by the maintainer when preparing a" | ||
| echo "libguestfs release on RHEL." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Get the base version of libguestfs. | ||
| version=`grep '^Version:' libguestfs.spec | awk '{print $2}'` | ||
| tag="v$version" | ||
|
|
||
| # Remove any existing patches. | ||
| git rm -f [0-9]*.patch ||: | ||
| rm -f [0-9]*.patch | ||
|
|
||
| # Get the patches. | ||
| (cd $git_checkout; rm -f [0-9]*.patch; git format-patch -N --submodule=diff $tag) | ||
| mv $git_checkout/[0-9]*.patch . | ||
|
|
||
| # Remove any not to be applied. | ||
| rm -f *NOT-FOR-RPM*.patch | ||
|
|
||
| # Add the patches. | ||
| git add [0-9]*.patch | ||
|
|
||
| # Print out the patch lines. | ||
| echo | ||
| echo "--- Copy the following text into libguestfs.spec file" | ||
| echo | ||
|
|
||
| echo "# Patches." | ||
| for f in [0-9]*.patch; do | ||
| n=`echo $f | awk -F- '{print $1}'` | ||
| echo "Patch$n: $f" | ||
| done | ||
|
|
||
| echo | ||
| echo "--- End of text" |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Guestfish colour prompts. See PROMPT in guestfish(1). | ||
| GUESTFISH_PS1='\[\e[1;32m\]><fs>\[\e[0;31m\] ' | ||
| GUESTFISH_OUTPUT='\e[0m' | ||
| GUESTFISH_RESTORE="$GUESTFISH_OUTPUT" | ||
| GUESTFISH_INIT='\e[1;34m' | ||
| export GUESTFISH_PS1 GUESTFISH_OUTPUT GUESTFISH_RESTORE GUESTFISH_INIT |
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Is the code in question just detecting a Fedora-like distro? Would looking at ID_LIKE be a viable approach rather than adding yet another distro to the list?
Uh oh!
There was an error while loading. Please reload this page.
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.
Good callout. Right now, the supermin
os_release.mlparser only extractsIDtoday, so there's noID_LIKEaccessor yet.https://github.com/libguestfs/supermin/blob/master/src/os_release.ml#L30-L32
https://github.com/libguestfs/supermin/blob/master/src/ph_rpm.ml#L35
Adding
ID_LIKEproperly means extending the parser + new accessor + reworkingfedora_detect()to match on theID_LIKEfield, which is the kind of change that should be for upstream discussion.For now, I propose we keep this minimal list-add as a downstream patch to unblock libguestfs on AZL4 so we can run static vm image testing through
azldevin the AZL4 dev environment, and I can also raise the ID_LIKE generalization in the upstream discussion for supermin as a real architectural fix.