Created
September 19, 2023 19:08
-
-
Save Shareed2k/f0bdab37f8cb93e320a4e09990b9bb71 to your computer and use it in GitHub Desktop.
remove glibs for android compilation
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
| diff --git a/lib/inventory/metadata/metadata_linux.go b/lib/inventory/metadata/metadata_linux.go | |
| index 9ef14d8ef4..a7b25d4304 100644 | |
| --- a/lib/inventory/metadata/metadata_linux.go | |
| +++ b/lib/inventory/metadata/metadata_linux.go | |
| @@ -19,44 +19,20 @@ limitations under the License. | |
| package metadata | |
| -// #include <gnu/libc-version.h> | |
| -import "C" | |
| - | |
| import ( | |
| - "fmt" | |
| - "strings" | |
| + "runtime" | |
| + | |
| + log "github.com/sirupsen/logrus" | |
| ) | |
| -// fetchOSVersion combines the content of '/etc/os-release' to be e.g. | |
| -// "ubuntu 22.04". | |
| +// fetchOSVersion returns "" if not on linux and not on darwin. | |
| func (c *fetchConfig) fetchOSVersion() string { | |
| - filename := "/etc/os-release" | |
| - out, err := c.read(filename) | |
| - if err != nil { | |
| - return "" | |
| - } | |
| - | |
| - id := "linux" | |
| - versionID := "(unknown)" | |
| - for _, line := range strings.Split(strings.TrimSpace(out), "\n") { | |
| - key, value, found := strings.Cut(line, "=") | |
| - if !found { | |
| - continue | |
| - } | |
| - | |
| - switch key { | |
| - case "ID": | |
| - id = strings.Trim(value, `"`) | |
| - case "VERSION_ID": | |
| - versionID = strings.Trim(value, `"`) | |
| - } | |
| - } | |
| - | |
| - return fmt.Sprintf("%s %s", id, versionID) | |
| + log.Warningf("fetchOSVersion is not implemented for %s", runtime.GOOS) | |
| + return "" | |
| } | |
| -// fetchGlibcVersion returns the glibc version string as returned by | |
| -// gnu_get_libc_version. | |
| +// fetchGlibcVersion returns "" if not on linux and not on darwin. | |
| func (c *fetchConfig) fetchGlibcVersion() string { | |
| - return C.GoString(C.gnu_get_libc_version()) | |
| + log.Warningf("fetchGlibcVersion is not implemented for %s", runtime.GOOS) | |
| + return "" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment